{"version":3,"sources":["../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/global-this.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/fails.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/descriptors.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/function-bind-native.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/function-call.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-property-is-enumerable.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/create-property-descriptor.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/function-uncurry-this.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/classof-raw.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/indexed-object.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-null-or-undefined.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/require-object-coercible.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-indexed-object.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-callable.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-object.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/get-built-in.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-is-prototype-of.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/environment-user-agent.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/environment-v8-version.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/symbol-constructor-detection.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/use-symbol-as-uid.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-symbol.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/try-to-string.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/a-callable.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/get-method.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/ordinary-to-primitive.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-pure.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/define-global-property.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/shared-store.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/shared.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-object.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/has-own-property.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/uid.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/well-known-symbol.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-primitive.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-property-key.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/document-create-element.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/ie8-dom-define.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-get-own-property-descriptor.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/v8-prototype-define-bug.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/an-object.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-define-property.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/create-non-enumerable-property.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/function-name.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/inspect-source.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/weak-map-basic-detection.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/shared-key.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/hidden-keys.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/internal-state.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/make-built-in.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/define-built-in.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/math-trunc.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-integer-or-infinity.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-absolute-index.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-length.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/length-of-array-like.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/array-includes.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-keys-internal.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/enum-bug-keys.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-get-own-property-names.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-get-own-property-symbols.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/own-keys.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/copy-constructor-properties.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/is-forced.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/export.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/delete-property-or-throw.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-string-tag-support.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/classof.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/to-string.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/array-slice.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/array-sort.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/array-method-is-strict.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/environment-ff-version.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/environment-is-ie-or-edge.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/environment-webkit-version.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/modules/es.array.sort.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/array-from-constructor-and-list.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/get-built-in-prototype-method.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-keys.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-define-properties.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/html.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/object-create.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/add-to-unscopables.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/modules/es.array.to-sorted.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/internals/entry-unbind.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/es/array/to-sorted.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/stable/array/to-sorted.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/modules/esnext.array.to-sorted.js","../../../node_modules/.pnpm/core-js@3.45.1/node_modules/core-js/actual/array/to-sorted.js","../src/main.ts","../src/tokenizers/tokenizers.js","../src/tokenizers/utils/generic.js","../src/tokenizers/utils/core.js","../src/tokenizers/utils/hub.js","../src/tokenizers/utils/maths.js","../src/tokenizers/utils/tensor.js","../src/tokenizers/utils/data-structures.js","../../../node_modules/.pnpm/@huggingface+jinja@0.2.2/node_modules/@huggingface/jinja/dist/index.js","../src/tokenizers/models/whisper/common_whisper.js","../src/prepatch.ts","../src/TokenizerLoader.ts"],"sourcesContent":["'use strict';\nvar check = function (it) {\n  return it && it.Math === Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n  // eslint-disable-next-line es/no-global-this -- safe\n  check(typeof globalThis == 'object' && globalThis) ||\n  check(typeof window == 'object' && window) ||\n  // eslint-disable-next-line no-restricted-globals -- safe\n  check(typeof self == 'object' && self) ||\n  check(typeof global == 'object' && global) ||\n  check(typeof this == 'object' && this) ||\n  // eslint-disable-next-line no-new-func -- fallback\n  (function () { return this; })() || Function('return this')();\n","'use strict';\nmodule.exports = function (exec) {\n  try {\n    return !!exec();\n  } catch (error) {\n    return true;\n  }\n};\n","'use strict';\nvar fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n  // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;\n});\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n  // eslint-disable-next-line es/no-function-prototype-bind -- safe\n  var test = (function () { /* empty */ }).bind();\n  // eslint-disable-next-line no-prototype-builtins -- safe\n  return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n","'use strict';\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n  return call.apply(call, arguments);\n};\n","'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n  var descriptor = getOwnPropertyDescriptor(this, V);\n  return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n","'use strict';\nmodule.exports = function (bitmap, value) {\n  return {\n    enumerable: !(bitmap & 1),\n    configurable: !(bitmap & 2),\n    writable: !(bitmap & 4),\n    value: value\n  };\n};\n","'use strict';\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar call = FunctionPrototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nvar uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {\n  return function () {\n    return call.apply(fn, arguments);\n  };\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n  return stringSlice(toString(it), 8, -1);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n  // eslint-disable-next-line no-prototype-builtins -- safe\n  return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n  return classof(it) === 'String' ? split(it, '') : $Object(it);\n} : $Object;\n","'use strict';\n// we can't use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n  return it === null || it === undefined;\n};\n","'use strict';\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\nvar $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n  if (isNullOrUndefined(it)) throw new $TypeError(\"Can't call method on \" + it);\n  return it;\n};\n","'use strict';\n// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n  return IndexedObject(requireObjectCoercible(it));\n};\n","'use strict';\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\nvar documentAll = typeof document == 'object' && document.all;\n\n// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\n// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing\nmodule.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {\n  return typeof argument == 'function' || argument === documentAll;\n} : function (argument) {\n  return typeof argument == 'function';\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n  return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (argument) {\n  return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n  return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\nvar navigator = globalThis.navigator;\nvar userAgent = navigator && navigator.userAgent;\n\nmodule.exports = userAgent ? String(userAgent) : '';\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar userAgent = require('../internals/environment-user-agent');\n\nvar process = globalThis.process;\nvar Deno = globalThis.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n  match = v8.split('.');\n  // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n  // but their correct versions are not interesting for us\n  version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n  match = userAgent.match(/Edge\\/(\\d+)/);\n  if (!match || match[1] >= 74) {\n    match = userAgent.match(/Chrome\\/(\\d+)/);\n    if (match) version = +match[1];\n  }\n}\n\nmodule.exports = version;\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/environment-v8-version');\nvar fails = require('../internals/fails');\nvar globalThis = require('../internals/global-this');\n\nvar $String = globalThis.String;\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n  var symbol = Symbol('symbol detection');\n  // Chrome 38 Symbol has incorrect toString conversion\n  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n  // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,\n  // of course, fail.\n  return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||\n    // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n    !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nmodule.exports = NATIVE_SYMBOL &&\n  !Symbol.sham &&\n  typeof Symbol.iterator == 'symbol';\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n  return typeof it == 'symbol';\n} : function (it) {\n  var $Symbol = getBuiltIn('Symbol');\n  return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n","'use strict';\nvar $String = String;\n\nmodule.exports = function (argument) {\n  try {\n    return $String(argument);\n  } catch (error) {\n    return 'Object';\n  }\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n  if (isCallable(argument)) return argument;\n  throw new $TypeError(tryToString(argument) + ' is not a function');\n};\n","'use strict';\nvar aCallable = require('../internals/a-callable');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n  var func = V[P];\n  return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n  var fn, val;\n  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n  if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n  throw new $TypeError(\"Can't convert object to primitive value\");\n};\n","'use strict';\nmodule.exports = false;\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n  try {\n    defineProperty(globalThis, key, { value: value, configurable: true, writable: true });\n  } catch (error) {\n    globalThis[key] = value;\n  } return value;\n};\n","'use strict';\nvar IS_PURE = require('../internals/is-pure');\nvar globalThis = require('../internals/global-this');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});\n\n(store.versions || (store.versions = [])).push({\n  version: '3.45.1',\n  mode: IS_PURE ? 'pure' : 'global',\n  copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',\n  license: 'https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE',\n  source: 'https://github.com/zloirock/core-js'\n});\n","'use strict';\nvar store = require('../internals/shared-store');\n\nmodule.exports = function (key, value) {\n  return store[key] || (store[key] = value || {});\n};\n","'use strict';\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n  return $Object(requireObjectCoercible(argument));\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n  return hasOwnProperty(toObject(it), key);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.1.toString);\n\nmodule.exports = function (key) {\n  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar Symbol = globalThis.Symbol;\nvar WellKnownSymbolsStore = shared('wks');\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n  if (!hasOwn(WellKnownSymbolsStore, name)) {\n    WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)\n      ? Symbol[name]\n      : createWellKnownSymbol('Symbol.' + name);\n  } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n  if (!isObject(input) || isSymbol(input)) return input;\n  var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n  var result;\n  if (exoticToPrim) {\n    if (pref === undefined) pref = 'default';\n    result = call(exoticToPrim, input, pref);\n    if (!isObject(result) || isSymbol(result)) return result;\n    throw new $TypeError(\"Can't convert object to primitive value\");\n  }\n  if (pref === undefined) pref = 'number';\n  return ordinaryToPrimitive(input, pref);\n};\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n  var key = toPrimitive(argument, 'string');\n  return isSymbol(key) ? key : key + '';\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isObject = require('../internals/is-object');\n\nvar document = globalThis.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n  return EXISTS ? document.createElement(it) : {};\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n  // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n  return Object.defineProperty(createElement('div'), 'a', {\n    get: function () { return 7; }\n  }).a !== 7;\n});\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n  O = toIndexedObject(O);\n  P = toPropertyKey(P);\n  if (IE8_DOM_DEFINE) try {\n    return $getOwnPropertyDescriptor(O, P);\n  } catch (error) { /* empty */ }\n  if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n  // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n  return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n    value: 42,\n    writable: false\n  }).prototype !== 42;\n});\n","'use strict';\nvar isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n  if (isObject(argument)) return argument;\n  throw new $TypeError($String(argument) + ' is not an object');\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n  anObject(O);\n  P = toPropertyKey(P);\n  anObject(Attributes);\n  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n    var current = $getOwnPropertyDescriptor(O, P);\n    if (current && current[WRITABLE]) {\n      O[P] = Attributes.value;\n      Attributes = {\n        configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n        enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n        writable: false\n      };\n    }\n  } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n  anObject(O);\n  P = toPropertyKey(P);\n  anObject(Attributes);\n  if (IE8_DOM_DEFINE) try {\n    return $defineProperty(O, P, Attributes);\n  } catch (error) { /* empty */ }\n  if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');\n  if ('value' in Attributes) O[P] = Attributes.value;\n  return O;\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n  return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n  object[key] = value;\n  return object;\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n  EXISTS: EXISTS,\n  PROPER: PROPER,\n  CONFIGURABLE: CONFIGURABLE\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n  store.inspectSource = function (it) {\n    return functionToString(it);\n  };\n}\n\nmodule.exports = store.inspectSource;\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isCallable = require('../internals/is-callable');\n\nvar WeakMap = globalThis.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n","'use strict';\nvar shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n  return keys[key] || (keys[key] = uid(key));\n};\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');\nvar globalThis = require('../internals/global-this');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = globalThis.TypeError;\nvar WeakMap = globalThis.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n  return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n  return function (it) {\n    var state;\n    if (!isObject(it) || (state = get(it)).type !== TYPE) {\n      throw new TypeError('Incompatible receiver, ' + TYPE + ' required');\n    } return state;\n  };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n  var store = shared.state || (shared.state = new WeakMap());\n  /* eslint-disable no-self-assign -- prototype methods protection */\n  store.get = store.get;\n  store.has = store.has;\n  store.set = store.set;\n  /* eslint-enable no-self-assign -- prototype methods protection */\n  set = function (it, metadata) {\n    if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n    metadata.facade = it;\n    store.set(it, metadata);\n    return metadata;\n  };\n  get = function (it) {\n    return store.get(it) || {};\n  };\n  has = function (it) {\n    return store.has(it);\n  };\n} else {\n  var STATE = sharedKey('state');\n  hiddenKeys[STATE] = true;\n  set = function (it, metadata) {\n    if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n    metadata.facade = it;\n    createNonEnumerableProperty(it, STATE, metadata);\n    return metadata;\n  };\n  get = function (it) {\n    return hasOwn(it, STATE) ? it[STATE] : {};\n  };\n  has = function (it) {\n    return hasOwn(it, STATE);\n  };\n}\n\nmodule.exports = {\n  set: set,\n  get: get,\n  has: has,\n  enforce: enforce,\n  getterFor: getterFor\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar $String = String;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\nvar stringSlice = uncurryThis(''.slice);\nvar replace = uncurryThis(''.replace);\nvar join = uncurryThis([].join);\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n  return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split('String');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n  if (stringSlice($String(name), 0, 7) === 'Symbol(') {\n    name = '[' + replace($String(name), /^Symbol\\(([^)]*)\\).*$/, '$1') + ']';\n  }\n  if (options && options.getter) name = 'get ' + name;\n  if (options && options.setter) name = 'set ' + name;\n  if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n    if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });\n    else value.name = name;\n  }\n  if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {\n    defineProperty(value, 'length', { value: options.arity });\n  }\n  try {\n    if (options && hasOwn(options, 'constructor') && options.constructor) {\n      if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });\n    // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n    } else if (value.prototype) value.prototype = undefined;\n  } catch (error) { /* empty */ }\n  var state = enforceInternalState(value);\n  if (!hasOwn(state, 'source')) {\n    state.source = join(TEMPLATE, typeof name == 'string' ? name : '');\n  } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n  return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, 'toString');\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar definePropertyModule = require('../internals/object-define-property');\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nmodule.exports = function (O, key, value, options) {\n  if (!options) options = {};\n  var simple = options.enumerable;\n  var name = options.name !== undefined ? options.name : key;\n  if (isCallable(value)) makeBuiltIn(value, name, options);\n  if (options.global) {\n    if (simple) O[key] = value;\n    else defineGlobalProperty(key, value);\n  } else {\n    try {\n      if (!options.unsafe) delete O[key];\n      else if (O[key]) simple = true;\n    } catch (error) { /* empty */ }\n    if (simple) O[key] = value;\n    else definePropertyModule.f(O, key, {\n      value: value,\n      enumerable: false,\n      configurable: !options.nonConfigurable,\n      writable: !options.nonWritable\n    });\n  } return O;\n};\n","'use strict';\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n  var n = +x;\n  return (n > 0 ? floor : ceil)(n);\n};\n","'use strict';\nvar trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n  var number = +argument;\n  // eslint-disable-next-line no-self-compare -- NaN check\n  return number !== number || number === 0 ? 0 : trunc(number);\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n  var integer = toIntegerOrInfinity(index);\n  return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n  var len = toIntegerOrInfinity(argument);\n  return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","'use strict';\nvar toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n  return toLength(obj.length);\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n  return function ($this, el, fromIndex) {\n    var O = toIndexedObject($this);\n    var length = lengthOfArrayLike(O);\n    if (length === 0) return !IS_INCLUDES && -1;\n    var index = toAbsoluteIndex(fromIndex, length);\n    var value;\n    // Array#includes uses SameValueZero equality algorithm\n    // eslint-disable-next-line no-self-compare -- NaN check\n    if (IS_INCLUDES && el !== el) while (length > index) {\n      value = O[index++];\n      // eslint-disable-next-line no-self-compare -- NaN check\n      if (value !== value) return true;\n    // Array#indexOf ignores holes, Array#includes - not\n    } else for (;length > index; index++) {\n      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n    } return !IS_INCLUDES && -1;\n  };\n};\n\nmodule.exports = {\n  // `Array.prototype.includes` method\n  // https://tc39.es/ecma262/#sec-array.prototype.includes\n  includes: createMethod(true),\n  // `Array.prototype.indexOf` method\n  // https://tc39.es/ecma262/#sec-array.prototype.indexof\n  indexOf: createMethod(false)\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n  var O = toIndexedObject(object);\n  var i = 0;\n  var result = [];\n  var key;\n  for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n  // Don't enum bug & hidden keys\n  while (names.length > i) if (hasOwn(O, key = names[i++])) {\n    ~indexOf(result, key) || push(result, key);\n  }\n  return result;\n};\n","'use strict';\n// IE8- don't enum bug keys\nmodule.exports = [\n  'constructor',\n  'hasOwnProperty',\n  'isPrototypeOf',\n  'propertyIsEnumerable',\n  'toLocaleString',\n  'toString',\n  'valueOf'\n];\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n  return internalObjectKeys(O, hiddenKeys);\n};\n","'use strict';\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n  var keys = getOwnPropertyNamesModule.f(anObject(it));\n  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n  return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","'use strict';\nvar hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n  var keys = ownKeys(source);\n  var defineProperty = definePropertyModule.f;\n  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n  for (var i = 0; i < keys.length; i++) {\n    var key = keys[i];\n    if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n      defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n    }\n  }\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n  var value = data[normalize(feature)];\n  return value === POLYFILL ? true\n    : value === NATIVE ? false\n    : isCallable(detection) ? fails(detection)\n    : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n  return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n  options.target         - name of the target object\n  options.global         - target is the global object\n  options.stat           - export as static methods of target\n  options.proto          - export as prototype methods of target\n  options.real           - real prototype method for the `pure` version\n  options.forced         - export even if the native feature is available\n  options.bind           - bind methods to the target, required for the `pure` version\n  options.wrap           - wrap constructors to preventing global pollution, required for the `pure` version\n  options.unsafe         - use the simple assignment of property instead of delete + defineProperty\n  options.sham           - add a flag to not completely full polyfills\n  options.enumerable     - export as enumerable property\n  options.dontCallGetSet - prevent calling a getter on target\n  options.name           - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n  var TARGET = options.target;\n  var GLOBAL = options.global;\n  var STATIC = options.stat;\n  var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n  if (GLOBAL) {\n    target = globalThis;\n  } else if (STATIC) {\n    target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});\n  } else {\n    target = globalThis[TARGET] && globalThis[TARGET].prototype;\n  }\n  if (target) for (key in source) {\n    sourceProperty = source[key];\n    if (options.dontCallGetSet) {\n      descriptor = getOwnPropertyDescriptor(target, key);\n      targetProperty = descriptor && descriptor.value;\n    } else targetProperty = target[key];\n    FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n    // contained in target\n    if (!FORCED && targetProperty !== undefined) {\n      if (typeof sourceProperty == typeof targetProperty) continue;\n      copyConstructorProperties(sourceProperty, targetProperty);\n    }\n    // add a flag to not completely full polyfills\n    if (options.sham || (targetProperty && targetProperty.sham)) {\n      createNonEnumerableProperty(sourceProperty, 'sham', true);\n    }\n    defineBuiltIn(target, key, sourceProperty, options);\n  }\n};\n","'use strict';\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (O, P) {\n  if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar isCallable = require('../internals/is-callable');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Object = Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n  try {\n    return it[key];\n  } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n  var O, tag, result;\n  return it === undefined ? 'Undefined' : it === null ? 'Null'\n    // @@toStringTag case\n    : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag\n    // builtinTag case\n    : CORRECT_ARGUMENTS ? classofRaw(O)\n    // ES3 arguments fallback\n    : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;\n};\n","'use strict';\nvar classof = require('../internals/classof');\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n  if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');\n  return $String(argument);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis([].slice);\n","'use strict';\nvar arraySlice = require('../internals/array-slice');\n\nvar floor = Math.floor;\n\nvar sort = function (array, comparefn) {\n  var length = array.length;\n\n  if (length < 8) {\n    // insertion sort\n    var i = 1;\n    var element, j;\n\n    while (i < length) {\n      j = i;\n      element = array[i];\n      while (j && comparefn(array[j - 1], element) > 0) {\n        array[j] = array[--j];\n      }\n      if (j !== i++) array[j] = element;\n    }\n  } else {\n    // merge sort\n    var middle = floor(length / 2);\n    var left = sort(arraySlice(array, 0, middle), comparefn);\n    var right = sort(arraySlice(array, middle), comparefn);\n    var llength = left.length;\n    var rlength = right.length;\n    var lindex = 0;\n    var rindex = 0;\n\n    while (lindex < llength || rindex < rlength) {\n      array[lindex + rindex] = (lindex < llength && rindex < rlength)\n        ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]\n        : lindex < llength ? left[lindex++] : right[rindex++];\n    }\n  }\n\n  return array;\n};\n\nmodule.exports = sort;\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n  var method = [][METHOD_NAME];\n  return !!method && fails(function () {\n    // eslint-disable-next-line no-useless-call -- required for testing\n    method.call(null, argument || function () { return 1; }, 1);\n  });\n};\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nvar firefox = userAgent.match(/firefox\\/(\\d+)/i);\n\nmodule.exports = !!firefox && +firefox[1];\n","'use strict';\nvar UA = require('../internals/environment-user-agent');\n\nmodule.exports = /MSIE|Trident/.test(UA);\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nvar webkit = userAgent.match(/AppleWebKit\\/(\\d+)\\./);\n\nmodule.exports = !!webkit && +webkit[1];\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar deletePropertyOrThrow = require('../internals/delete-property-or-throw');\nvar toString = require('../internals/to-string');\nvar fails = require('../internals/fails');\nvar internalSort = require('../internals/array-sort');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar FF = require('../internals/environment-ff-version');\nvar IE_OR_EDGE = require('../internals/environment-is-ie-or-edge');\nvar V8 = require('../internals/environment-v8-version');\nvar WEBKIT = require('../internals/environment-webkit-version');\n\nvar test = [];\nvar nativeSort = uncurryThis(test.sort);\nvar push = uncurryThis(test.push);\n\n// IE8-\nvar FAILS_ON_UNDEFINED = fails(function () {\n  test.sort(undefined);\n});\n// V8 bug\nvar FAILS_ON_NULL = fails(function () {\n  test.sort(null);\n});\n// Old WebKit\nvar STRICT_METHOD = arrayMethodIsStrict('sort');\n\nvar STABLE_SORT = !fails(function () {\n  // feature detection can be too slow, so check engines versions\n  if (V8) return V8 < 70;\n  if (FF && FF > 3) return;\n  if (IE_OR_EDGE) return true;\n  if (WEBKIT) return WEBKIT < 603;\n\n  var result = '';\n  var code, chr, value, index;\n\n  // generate an array with more 512 elements (Chakra and old V8 fails only in this case)\n  for (code = 65; code < 76; code++) {\n    chr = String.fromCharCode(code);\n\n    switch (code) {\n      case 66: case 69: case 70: case 72: value = 3; break;\n      case 68: case 71: value = 4; break;\n      default: value = 2;\n    }\n\n    for (index = 0; index < 47; index++) {\n      test.push({ k: chr + index, v: value });\n    }\n  }\n\n  test.sort(function (a, b) { return b.v - a.v; });\n\n  for (index = 0; index < test.length; index++) {\n    chr = test[index].k.charAt(0);\n    if (result.charAt(result.length - 1) !== chr) result += chr;\n  }\n\n  return result !== 'DGBEFHACIJK';\n});\n\nvar FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;\n\nvar getSortCompare = function (comparefn) {\n  return function (x, y) {\n    if (y === undefined) return -1;\n    if (x === undefined) return 1;\n    if (comparefn !== undefined) return +comparefn(x, y) || 0;\n    return toString(x) > toString(y) ? 1 : -1;\n  };\n};\n\n// `Array.prototype.sort` method\n// https://tc39.es/ecma262/#sec-array.prototype.sort\n$({ target: 'Array', proto: true, forced: FORCED }, {\n  sort: function sort(comparefn) {\n    if (comparefn !== undefined) aCallable(comparefn);\n\n    var array = toObject(this);\n\n    if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);\n\n    var items = [];\n    var arrayLength = lengthOfArrayLike(array);\n    var itemsLength, index;\n\n    for (index = 0; index < arrayLength; index++) {\n      if (index in array) push(items, array[index]);\n    }\n\n    internalSort(items, getSortCompare(comparefn));\n\n    itemsLength = lengthOfArrayLike(items);\n    index = 0;\n\n    while (index < itemsLength) array[index] = items[index++];\n    while (index < arrayLength) deletePropertyOrThrow(array, index++);\n\n    return array;\n  }\n});\n","'use strict';\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\nmodule.exports = function (Constructor, list, $length) {\n  var index = 0;\n  var length = arguments.length > 2 ? $length : lengthOfArrayLike(list);\n  var result = new Constructor(length);\n  while (length > index) result[index] = list[index++];\n  return result;\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\nmodule.exports = function (CONSTRUCTOR, METHOD) {\n  var Constructor = globalThis[CONSTRUCTOR];\n  var Prototype = Constructor && Constructor.prototype;\n  return Prototype && Prototype[METHOD];\n};\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n  return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n  anObject(O);\n  var props = toIndexedObject(Properties);\n  var keys = objectKeys(Properties);\n  var length = keys.length;\n  var index = 0;\n  var key;\n  while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n  return O;\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","'use strict';\n/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n  return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n  activeXDocument.write(scriptTag(''));\n  activeXDocument.close();\n  var temp = activeXDocument.parentWindow.Object;\n  // eslint-disable-next-line no-useless-assignment -- avoid memory leak\n  activeXDocument = null;\n  return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n  // Thrash, waste and sodomy: IE GC bug\n  var iframe = documentCreateElement('iframe');\n  var JS = 'java' + SCRIPT + ':';\n  var iframeDocument;\n  iframe.style.display = 'none';\n  html.appendChild(iframe);\n  // https://github.com/zloirock/core-js/issues/475\n  iframe.src = String(JS);\n  iframeDocument = iframe.contentWindow.document;\n  iframeDocument.open();\n  iframeDocument.write(scriptTag('document.F=Object'));\n  iframeDocument.close();\n  return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n  try {\n    activeXDocument = new ActiveXObject('htmlfile');\n  } catch (error) { /* ignore */ }\n  NullProtoObject = typeof document != 'undefined'\n    ? document.domain && activeXDocument\n      ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n      : NullProtoObjectViaIFrame()\n    : NullProtoObjectViaActiveX(activeXDocument); // WSH\n  var length = enumBugKeys.length;\n  while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n  return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n  var result;\n  if (O !== null) {\n    EmptyConstructor[PROTOTYPE] = anObject(O);\n    result = new EmptyConstructor();\n    EmptyConstructor[PROTOTYPE] = null;\n    // add \"__proto__\" for Object.getPrototypeOf polyfill\n    result[IE_PROTO] = O;\n  } else result = NullProtoObject();\n  return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] === undefined) {\n  defineProperty(ArrayPrototype, UNSCOPABLES, {\n    configurable: true,\n    value: create(null)\n  });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n  ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');\nvar getBuiltInPrototypeMethod = require('../internals/get-built-in-prototype-method');\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\nvar $Array = Array;\nvar sort = uncurryThis(getBuiltInPrototypeMethod('Array', 'sort'));\n\n// `Array.prototype.toSorted` method\n// https://tc39.es/ecma262/#sec-array.prototype.tosorted\n$({ target: 'Array', proto: true }, {\n  toSorted: function toSorted(compareFn) {\n    if (compareFn !== undefined) aCallable(compareFn);\n    var O = toIndexedObject(this);\n    var A = arrayFromConstructorAndList($Array, O);\n    return sort(A, compareFn);\n  }\n});\n\naddToUnscopables('toSorted');\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = function (CONSTRUCTOR, METHOD) {\n  return uncurryThis(globalThis[CONSTRUCTOR].prototype[METHOD]);\n};\n","'use strict';\nrequire('../../modules/es.array.sort');\nrequire('../../modules/es.array.to-sorted');\nvar entryUnbind = require('../../internals/entry-unbind');\n\nmodule.exports = entryUnbind('Array', 'toSorted');\n","'use strict';\nvar parent = require('../../es/array/to-sorted');\n\nmodule.exports = parent;\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.array.to-sorted');\n","'use strict';\nvar parent = require('../../stable/array/to-sorted');\n// TODO: Remove from `core-js@4`\nrequire('../../modules/esnext.array.to-sorted');\n\nmodule.exports = parent;\n","// polyfill for Array.toSorted\r\nimport \"core-js/actual/array/to-sorted\";\r\n\r\nimport \"./prepatch\";\r\nexport * from \"./TokenizerLoader\";\r\nexport * as tokenizers from \"./tokenizers/tokenizers\";\r\nexport * from \"./types\";\r\n","/**\r\n * @file Tokenizers are used to prepare textual inputs for a model.\r\n *\r\n * **Example:** Create an `AutoTokenizer` and use it to tokenize a sentence.\r\n * This will automatically detect the tokenizer type based on the tokenizer class defined in `tokenizer.json`.\r\n * ```javascript\r\n * import { AutoTokenizer } from '@huggingface/transformers';\r\n *\r\n * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased');\r\n * const { input_ids } = await tokenizer('I love transformers!');\r\n * // Tensor {\r\n * //   data: BigInt64Array(6) [101n, 1045n, 2293n, 19081n, 999n, 102n],\r\n * //   dims: [1, 6],\r\n * //   type: 'int64',\r\n * //   size: 6,\r\n * // }\r\n * ```\r\n *\r\n * @module tokenizers\r\n */\r\nimport { Callable } from \"./utils/generic.js\";\r\n\r\nimport {\r\n  reverseDictionary,\r\n  escapeRegExp,\r\n  isIntegralNumber,\r\n  mergeArrays,\r\n  len,\r\n} from \"./utils/core.js\";\r\n\r\nimport { getModelJSON } from \"./utils/hub.js\";\r\n\r\nimport { max, min, round } from \"./utils/maths.js\";\r\nimport { Tensor } from \"./utils/tensor.js\";\r\n\r\nimport {\r\n  PriorityQueue,\r\n  TokenLattice,\r\n  CharTrie,\r\n  DictionarySplitter,\r\n  LRUCache,\r\n} from \"./utils/data-structures.js\";\r\n\r\nimport { Template } from \"@huggingface/jinja\";\r\n\r\nimport { WHISPER_LANGUAGE_MAPPING } from \"./models/whisper/common_whisper.js\";\r\n\r\n/**\r\n * @typedef {Object} TokenizerProperties Additional tokenizer-specific properties.\r\n * @property {boolean} [legacy=false] Whether or not the `legacy` behavior of the tokenizer should be used.\r\n * @typedef {import('./utils/hub.js').PretrainedOptions & TokenizerProperties} PretrainedTokenizerOptions\r\n */\r\n\r\n/**\r\n * Loads a tokenizer from the specified path.\r\n * @param {string} pretrained_model_name_or_path The path to the tokenizer directory.\r\n * @param {PretrainedTokenizerOptions} options Additional options for loading the tokenizer.\r\n * @returns {Promise<any[]>} A promise that resolves with information about the loaded tokenizer.\r\n */\r\nasync function loadTokenizer(pretrained_model_name_or_path, options) {\r\n  const info = await Promise.all([\r\n    getModelJSON(\r\n      pretrained_model_name_or_path,\r\n      \"tokenizer.json\",\r\n      true,\r\n      options\r\n    ),\r\n    getModelJSON(\r\n      pretrained_model_name_or_path,\r\n      \"tokenizer_config.json\",\r\n      true,\r\n      options\r\n    ),\r\n  ]);\r\n\r\n  // Override legacy option if `options.legacy` is not null\r\n  if (options.legacy !== null) {\r\n    info[1].legacy = options.legacy;\r\n  }\r\n  return info;\r\n}\r\n\r\n/**\r\n * Helper function to split a string on a regex, but keep the delimiters.\r\n * This is required, because the JavaScript `.split()` method does not keep the delimiters,\r\n * and wrapping in a capturing group causes issues with existing capturing groups (due to nesting).\r\n * @param {string} text The text to split.\r\n * @param {RegExp} regex The regex to split on.\r\n * @returns {string[]} The split string.\r\n */\r\nfunction regexSplit(text, regex) {\r\n  const result = [];\r\n  let prev = 0;\r\n  for (const match of text.matchAll(regex)) {\r\n    const fullMatch = match[0];\r\n    if (prev < match.index) {\r\n      result.push(text.slice(prev, match.index));\r\n    }\r\n    if (fullMatch.length > 0) {\r\n      result.push(fullMatch);\r\n    }\r\n    prev = match.index + fullMatch.length;\r\n  }\r\n  if (prev < text.length) {\r\n    result.push(text.slice(prev));\r\n  }\r\n  return result;\r\n}\r\n\r\n/**\r\n * Helper method to construct a pattern from a config object.\r\n * @param {Object} pattern The pattern object.\r\n * @param {boolean} invert Whether to invert the pattern.\r\n * @returns {RegExp|null} The compiled pattern.\r\n */\r\nfunction createPattern(pattern, invert = true) {\r\n  if (pattern.Regex !== undefined) {\r\n    // In certain cases, the pattern may contain unnecessary escape sequences (e.g., \\# or \\& or \\~).\r\n    // i.e., valid in Python (where the patterns are exported from) but invalid in JavaScript (where the patterns are parsed).\r\n    // This isn't an issue when creating the regex w/o the 'u' flag, but it is when the 'u' flag is used.\r\n    // For this reason, it is necessary to remove these backslashes before creating the regex.\r\n    // See https://stackoverflow.com/a/63007777/13989043 for more information\r\n    let regex = pattern.Regex.replace(/\\\\([#&~])/g, \"$1\"); // TODO: add more characters to this list if necessary\r\n\r\n    // We also handle special cases where the regex contains invalid (non-JS compatible) syntax.\r\n    for (const [key, value] of PROBLEMATIC_REGEX_MAP) {\r\n      regex = regex.replaceAll(key, value);\r\n    }\r\n\r\n    return new RegExp(regex, \"gu\");\r\n  } else if (pattern.String !== undefined) {\r\n    const escaped = escapeRegExp(pattern.String);\r\n    // NOTE: if invert is true, we wrap the pattern in a group so that it is kept when performing .split()\r\n    return new RegExp(invert ? escaped : `(${escaped})`, \"gu\");\r\n  } else {\r\n    console.warn(\"Unknown pattern type:\", pattern);\r\n    return null;\r\n  }\r\n}\r\n\r\n/**\r\n * Helper function to convert an Object to a Map\r\n * @param {Object} obj The object to convert.\r\n * @returns {Map<string, any>} The map.\r\n */\r\nfunction objectToMap(obj) {\r\n  return new Map(Object.entries(obj));\r\n}\r\n\r\n/**\r\n * Helper function to convert a tensor to a list before decoding.\r\n * @param {Tensor} tensor The tensor to convert.\r\n * @returns {number[]} The tensor as a list.\r\n */\r\nfunction prepareTensorForDecode(tensor) {\r\n  const dims = tensor.dims;\r\n  switch (dims.length) {\r\n    case 1:\r\n      return tensor.tolist();\r\n    case 2:\r\n      if (dims[0] !== 1) {\r\n        throw new Error(\r\n          \"Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.\"\r\n        );\r\n      }\r\n      return tensor.tolist()[0];\r\n    default:\r\n      throw new Error(\r\n        `Expected tensor to have 1-2 dimensions, got ${dims.length}.`\r\n      );\r\n  }\r\n}\r\n\r\n/**\r\n * Clean up a list of simple English tokenization artifacts like spaces before punctuations and abbreviated forms\r\n * @param {string} text The text to clean up.\r\n * @returns {string} The cleaned up text.\r\n */\r\nfunction clean_up_tokenization(text) {\r\n  // Clean up a list of simple English tokenization artifacts\r\n  // like spaces before punctuations and abbreviated forms\r\n  return text\r\n    .replace(/ \\./g, \".\")\r\n    .replace(/ \\?/g, \"?\")\r\n    .replace(/ \\!/g, \"!\")\r\n    .replace(/ ,/g, \",\")\r\n    .replace(/ \\' /g, \"'\")\r\n    .replace(/ n\\'t/g, \"n't\")\r\n    .replace(/ \\'m/g, \"'m\")\r\n    .replace(/ \\'s/g, \"'s\")\r\n    .replace(/ \\'ve/g, \"'ve\")\r\n    .replace(/ \\'re/g, \"'re\");\r\n}\r\n\r\n/**\r\n * Helper function to remove accents from a string.\r\n * @param {string} text The text to remove accents from.\r\n * @returns {string} The text with accents removed.\r\n */\r\nfunction remove_accents(text) {\r\n  return text.replace(/\\p{M}/gu, \"\");\r\n}\r\n\r\n/**\r\n * Helper function to lowercase a string and remove accents.\r\n * @param {string} text The text to lowercase and remove accents from.\r\n * @returns {string} The lowercased text with accents removed.\r\n */\r\nfunction lowercase_and_remove_accent(text) {\r\n  return remove_accents(text.toLowerCase());\r\n}\r\n\r\n/**\r\n * Checks whether the given Unicode codepoint represents a CJK (Chinese, Japanese, or Korean) character.\r\n *\r\n * A \"chinese character\" is defined as anything in the CJK Unicode block:\r\n * https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_(Unicode_block)\r\n *\r\n * Note that the CJK Unicode block is NOT all Japanese and Korean characters, despite its name.\r\n * The modern Korean Hangul alphabet is a different block, as is Japanese Hiragana and Katakana.\r\n * Those alphabets are used to write space-separated words, so they are not treated specially\r\n * and are handled like all other languages.\r\n *\r\n * @param {number|bigint} cp The Unicode codepoint to check.\r\n * @returns {boolean} True if the codepoint represents a CJK character, false otherwise.\r\n */\r\nexport function is_chinese_char(cp) {\r\n  return (\r\n    (cp >= 0x4e00 && cp <= 0x9fff) ||\r\n    (cp >= 0x3400 && cp <= 0x4dbf) ||\r\n    (cp >= 0x20000 && cp <= 0x2a6df) ||\r\n    (cp >= 0x2a700 && cp <= 0x2b73f) ||\r\n    (cp >= 0x2b740 && cp <= 0x2b81f) ||\r\n    (cp >= 0x2b820 && cp <= 0x2ceaf) ||\r\n    (cp >= 0xf900 && cp <= 0xfaff) ||\r\n    (cp >= 0x2f800 && cp <= 0x2fa1f)\r\n  );\r\n}\r\n\r\n/**\r\n * Helper function to fuse consecutive unknown tokens.\r\n * @param {string[]} arr The list of input tokens\r\n * @param {Map<string, any>} tokens_to_ids The mapping from tokens to token ids.\r\n * @param {number} unk_token_id The value to fuse on.\r\n * @private\r\n */\r\nfunction fuse_unk(arr, tokens_to_ids, unk_token_id) {\r\n  const fused = [];\r\n  let i = 0;\r\n  while (i < arr.length) {\r\n    fused.push(arr[i]);\r\n    if ((tokens_to_ids.get(arr[i]) ?? unk_token_id) !== unk_token_id) {\r\n      ++i;\r\n      continue;\r\n    }\r\n\r\n    while (\r\n      ++i < arr.length &&\r\n      (tokens_to_ids.get(arr[i]) ?? unk_token_id) === unk_token_id\r\n    ) {\r\n      if (tokens_to_ids.get(fused.at(-1)) !== unk_token_id) {\r\n        fused[fused.length - 1] += arr[i];\r\n      }\r\n    }\r\n  }\r\n\r\n  return fused;\r\n}\r\n\r\n/**\r\n * Split a string on whitespace.\r\n * @param {string} text The text to split.\r\n * @returns {string[]} The split string.\r\n */\r\nfunction whitespace_split(text) {\r\n  return text.match(/\\S+/g) || [];\r\n}\r\n\r\nconst PUNCTUATION_REGEX =\r\n  \"\\\\p{P}\\\\u0021-\\\\u002F\\\\u003A-\\\\u0040\\\\u005B-\\\\u0060\\\\u007B-\\\\u007E\";\r\nconst PUNCTUATION_ONLY_REGEX = new RegExp(`^[${PUNCTUATION_REGEX}]+$`, \"gu\");\r\nconst BLOOM_SPLIT_CHARS = \".,!?\\u2026\\u3002\\uff0c\\u3001\\u0964\\u06d4\\u060c\";\r\n\r\n// A mapping of regex patterns to their equivalent (but possibly longer) JS-compatible versions.\r\nconst PROBLEMATIC_REGEX_MAP = new Map([\r\n  // This uses the case insensitive group modifier, which is not supported in JavaScript.\r\n  // When parsing the regex, an \"Invalid group\" error is thrown.\r\n  [\r\n    \"(?i:'s|'t|'re|'ve|'m|'ll|'d)\",\r\n    \"(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))\",\r\n  ],\r\n\r\n  // Used to override the default (invalid) regex of the bloom pretokenizer.\r\n  // For more information, see https://github.com/huggingface/transformers.js/issues/94\r\n  [` ?[^(\\\\s|[${BLOOM_SPLIT_CHARS}])]+`, ` ?[^\\\\s${BLOOM_SPLIT_CHARS}]+`],\r\n]);\r\n\r\n/**\r\n * Represent a token added by the user on top of the existing Model vocabulary.\r\n * AddedToken can be configured to specify the behavior they should have in various situations like:\r\n *   - Whether they should only match single words\r\n *   - Whether to include any whitespace on its left or right\r\n */\r\nclass AddedToken {\r\n  /**\r\n   * Creates a new instance of AddedToken.\r\n   * @param {Object} config Added token configuration object.\r\n   * @param {string} config.content The content of the added token.\r\n   * @param {number} config.id The id of the added token.\r\n   * @param {boolean} [config.single_word=false] Whether this token must be a single word or can break words.\r\n   * @param {boolean} [config.lstrip=false] Whether this token should strip whitespaces on its left.\r\n   * @param {boolean} [config.rstrip=false] Whether this token should strip whitespaces on its right.\r\n   * @param {boolean} [config.normalized=false] Whether this token should be normalized.\r\n   * @param {boolean} [config.special=false] Whether this token is special.\r\n   */\r\n  constructor(config) {\r\n    this.content = config.content;\r\n    this.id = config.id;\r\n    this.single_word = config.single_word ?? false;\r\n    this.lstrip = config.lstrip ?? false;\r\n    this.rstrip = config.rstrip ?? false;\r\n    this.special = config.special ?? false;\r\n    this.normalized = config.normalized ?? null;\r\n  }\r\n}\r\n\r\n/**\r\n * Abstract base class for tokenizer models.\r\n *\r\n * @extends Callable\r\n */\r\nexport class TokenizerModel extends Callable {\r\n  /**\r\n   * Creates a new instance of TokenizerModel.\r\n   * @param {Object} config The configuration object for the TokenizerModel.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n\r\n    /** @type {string[]} */\r\n    this.vocab = [];\r\n\r\n    /**\r\n     * A mapping of tokens to ids.\r\n     * @type {Map<string, number>}\r\n     */\r\n    this.tokens_to_ids = new Map();\r\n\r\n    this.unk_token_id = undefined;\r\n    this.unk_token = undefined;\r\n    this.end_of_word_suffix = undefined;\r\n\r\n    /** @type {boolean} Whether to fuse unknown tokens when encoding. Defaults to false. */\r\n    this.fuse_unk = this.config.fuse_unk ?? false;\r\n  }\r\n\r\n  /**\r\n   * Instantiates a new TokenizerModel instance based on the configuration object provided.\r\n   * @param {Object} config The configuration object for the TokenizerModel.\r\n   * @param {...*} args Optional arguments to pass to the specific TokenizerModel constructor.\r\n   * @returns {TokenizerModel} A new instance of a TokenizerModel.\r\n   * @throws Will throw an error if the TokenizerModel type in the config is not recognized.\r\n   */\r\n  static fromConfig(config, ...args) {\r\n    switch (config.type) {\r\n      case \"WordPiece\":\r\n        return new WordPieceTokenizer(config);\r\n      case \"Unigram\":\r\n        // @ts-ignore\r\n        return new Unigram(config, ...args);\r\n      case \"BPE\":\r\n        return new BPE(config);\r\n\r\n      default:\r\n        // Some older tokenizers, like `google-t5/t5-small`, `openai-community/gpt2`, and `distilbert/distilbert-base-uncased`, do not have a `type` field.\r\n        // In this case, we can infer the tokenizer type based on the structure of the `vocab` field and other properties.\r\n        if (config.vocab) {\r\n          if (Array.isArray(config.vocab)) {\r\n            // config.vocab is of type `[string, number][]`\r\n            // @ts-ignore\r\n            return new Unigram(config, ...args);\r\n          } else if (\r\n            Object.hasOwn(config, \"continuing_subword_prefix\") &&\r\n            Object.hasOwn(config, \"unk_token\")\r\n          ) {\r\n            if (Object.hasOwn(config, \"merges\")) {\r\n              return new BPE(config);\r\n            } else {\r\n              return new WordPieceTokenizer(config);\r\n            }\r\n          } else {\r\n            // @ts-ignore\r\n            return new LegacyTokenizerModel(config, ...args);\r\n          }\r\n        }\r\n        throw new Error(`Unknown TokenizerModel type: ${config.type}`);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Internal function to call the TokenizerModel instance.\r\n   * @param {string[]} tokens The tokens to encode.\r\n   * @returns {string[]} The encoded tokens.\r\n   */\r\n  _call(tokens) {\r\n    tokens = this.encode(tokens);\r\n    if (this.fuse_unk) {\r\n      // Fuse unknown tokens\r\n      tokens = fuse_unk(tokens, this.tokens_to_ids, this.unk_token_id);\r\n    }\r\n    return tokens;\r\n  }\r\n\r\n  /**\r\n   * Encodes a list of tokens into a list of token IDs.\r\n   * @param {string[]} tokens The tokens to encode.\r\n   * @returns {string[]} The encoded tokens.\r\n   * @throws Will throw an error if not implemented in a subclass.\r\n   */\r\n  encode(tokens) {\r\n    throw Error(\"encode should be implemented in subclass.\");\r\n  }\r\n\r\n  /**\r\n   * Converts a list of tokens into a list of token IDs.\r\n   * @param {string[]} tokens The tokens to convert.\r\n   * @returns {number[]} The converted token IDs.\r\n   */\r\n  convert_tokens_to_ids(tokens) {\r\n    return tokens.map((t) => this.tokens_to_ids.get(t) ?? this.unk_token_id);\r\n  }\r\n\r\n  /**\r\n   * Converts a list of token IDs into a list of tokens.\r\n   * @param {number[]|bigint[]} ids The token IDs to convert.\r\n   * @returns {string[]} The converted tokens.\r\n   */\r\n  convert_ids_to_tokens(ids) {\r\n    return ids.map((i) => this.vocab[i] ?? this.unk_token);\r\n  }\r\n}\r\n\r\n/**\r\n * A subclass of TokenizerModel that uses WordPiece encoding to encode tokens.\r\n * @extends TokenizerModel\r\n */\r\nclass WordPieceTokenizer extends TokenizerModel {\r\n  /**\r\n   * @param {Object} config The configuration object.\r\n   * @param {Object} config.vocab A mapping of tokens to ids.\r\n   * @param {string} config.unk_token The unknown token string.\r\n   * @param {string} config.continuing_subword_prefix The prefix to use for continuing subwords.\r\n   * @param {number} [config.max_input_chars_per_word=100] The maximum number of characters per word.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    /**\r\n     * A mapping of tokens to ids.\r\n     * @type {Map<string, number>}\r\n     */\r\n    this.tokens_to_ids = objectToMap(config.vocab);\r\n\r\n    /**\r\n     * The id of the unknown token.\r\n     * @type {number}\r\n     */\r\n    this.unk_token_id = this.tokens_to_ids.get(config.unk_token);\r\n\r\n    /**\r\n     * The unknown token string.\r\n     * @type {string}\r\n     */\r\n    this.unk_token = config.unk_token;\r\n\r\n    /**\r\n     * The maximum number of characters allowed per word.\r\n     * @type {number}\r\n     */\r\n    this.max_input_chars_per_word = config.max_input_chars_per_word ?? 100;\r\n\r\n    /**\r\n     * An array of tokens.\r\n     * @type {string[]}\r\n     */\r\n    this.vocab = new Array(this.tokens_to_ids.size);\r\n    for (const [key, value] of this.tokens_to_ids) {\r\n      this.vocab[value] = key;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Encodes an array of tokens using WordPiece encoding.\r\n   * @param {string[]} tokens The tokens to encode.\r\n   * @returns {string[]} An array of encoded tokens.\r\n   */\r\n  encode(tokens) {\r\n    const outputTokens = [];\r\n    for (const token of tokens) {\r\n      const chars = [...token];\r\n      if (chars.length > this.max_input_chars_per_word) {\r\n        outputTokens.push(this.unk_token);\r\n        continue;\r\n      }\r\n\r\n      let isUnknown = false;\r\n      let start = 0;\r\n      const subTokens = [];\r\n\r\n      while (start < chars.length) {\r\n        let end = chars.length;\r\n        let currentSubstring = null;\r\n        while (start < end) {\r\n          let substr = chars.slice(start, end).join(\"\");\r\n\r\n          if (start > 0) {\r\n            substr = this.config.continuing_subword_prefix + substr;\r\n          }\r\n          if (this.tokens_to_ids.has(substr)) {\r\n            currentSubstring = substr;\r\n            break;\r\n          }\r\n\r\n          --end;\r\n        }\r\n        if (currentSubstring === null) {\r\n          isUnknown = true;\r\n          break;\r\n        }\r\n        subTokens.push(currentSubstring);\r\n        start = end;\r\n      }\r\n      if (isUnknown) {\r\n        outputTokens.push(this.unk_token);\r\n      } else {\r\n        outputTokens.push(...subTokens);\r\n      }\r\n    }\r\n\r\n    return outputTokens;\r\n  }\r\n}\r\n\r\n/**\r\n * Class representing a Unigram tokenizer model.\r\n * @extends TokenizerModel\r\n */\r\nclass Unigram extends TokenizerModel {\r\n  /**\r\n   * Create a new Unigram tokenizer model.\r\n   * @param {Object} config The configuration object for the Unigram model.\r\n   * @param {number} config.unk_id The ID of the unknown token\r\n   * @param {[string, number][]} config.vocab A 2D array representing a mapping of tokens to scores.\r\n   * @param {Object} moreConfig Additional configuration object for the Unigram model.\r\n   */\r\n  constructor(config, moreConfig) {\r\n    super(config);\r\n\r\n    const vocabSize = config.vocab.length;\r\n    this.vocab = new Array(vocabSize);\r\n    /** @type {number[]} */\r\n    this.scores = new Array(vocabSize);\r\n    for (let i = 0; i < vocabSize; ++i) {\r\n      [this.vocab[i], this.scores[i]] = config.vocab[i];\r\n    }\r\n\r\n    this.unk_token_id = config.unk_id;\r\n    this.unk_token = this.vocab[config.unk_id];\r\n\r\n    this.tokens_to_ids = new Map(this.vocab.map((x, i) => [x, i]));\r\n    this.bos_token = \" \"; // beginning of a sentence token\r\n\r\n    this.bos_token_id = this.tokens_to_ids.get(this.bos_token); // NOTE: may be undefined\r\n    this.eos_token = moreConfig.eos_token;\r\n\r\n    this.eos_token_id = this.tokens_to_ids.get(this.eos_token);\r\n    this.unk_token = this.vocab[this.unk_token_id];\r\n\r\n    this.minScore = min(this.scores)[0];\r\n\r\n    this.unk_score = this.minScore - 10.0;\r\n    this.scores[this.unk_token_id] = this.unk_score;\r\n\r\n    this.trie = new CharTrie();\r\n    this.trie.extend(this.vocab);\r\n\r\n    // NOTE: `fuse_unk` is hardcoded to true for Unigram models\r\n    // See: https://github.com/huggingface/tokenizers/blob/b58227c7f1ccf8b73ee2268354336da56d91e492/tokenizers/src/models/unigram/model.rs#L119\r\n    this.fuse_unk = true;\r\n  }\r\n\r\n  /**\r\n   * Populates lattice nodes.\r\n   * @param {TokenLattice} lattice The token lattice to populate with nodes.\r\n   */\r\n  populateNodes(lattice) {\r\n    const chars = lattice.chars;\r\n    const mblen = 1;\r\n    let beginPos = 0;\r\n    while (beginPos < chars.length) {\r\n      let hasSingleNode = false;\r\n\r\n      const tokens = [];\r\n      const sliced = chars.slice(beginPos).join(\"\");\r\n      const prefixedTokens = this.trie.commonPrefixSearch(sliced);\r\n      for (const token of prefixedTokens) {\r\n        tokens.push(token);\r\n        const tokenId = this.tokens_to_ids.get(token);\r\n        const tokenScore = this.scores[tokenId];\r\n        const n = len(token);\r\n        lattice.insert(beginPos, n, tokenScore, tokenId);\r\n        if (!hasSingleNode && n === mblen) {\r\n          hasSingleNode = true;\r\n        }\r\n      }\r\n      if (!hasSingleNode) {\r\n        lattice.insert(beginPos, mblen, this.unk_score, this.unk_token_id);\r\n      }\r\n      beginPos += mblen;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Encodes an array of tokens into an array of subtokens using the unigram model.\r\n   *\r\n   * @param {string} normalized The normalized string.\r\n   * @returns {string[]} An array of subtokens obtained by encoding the input tokens using the unigram model.\r\n   */\r\n  tokenize(normalized) {\r\n    const lattice = new TokenLattice(\r\n      normalized,\r\n      this.bos_token_id,\r\n      this.eos_token_id\r\n    );\r\n    this.populateNodes(lattice);\r\n    return lattice.tokens();\r\n  }\r\n\r\n  /**\r\n   * Encodes an array of tokens using Unigram encoding.\r\n   * @param {string[]} tokens The tokens to encode.\r\n   * @returns {string[]} An array of encoded tokens.\r\n   */\r\n  encode(tokens) {\r\n    const toReturn = [];\r\n    for (const token of tokens) {\r\n      const tokenized = this.tokenize(token);\r\n      toReturn.push(...tokenized);\r\n    }\r\n    return toReturn;\r\n  }\r\n}\r\n\r\n/**\r\n * Returns list of utf-8 byte and a mapping to unicode strings.\r\n * Specifically avoids mapping to whitespace/control characters the BPE code barfs on.\r\n * @returns {Object} Object with utf-8 byte keys and unicode string values.\r\n */\r\nconst BYTES_TO_UNICODE = (() => {\r\n  // Returns list of utf-8 byte and a mapping to unicode strings.\r\n  // We specifically avoids mapping to whitespace/control characters\r\n  // the bpe code barfs on.\r\n\r\n  const bs = [\r\n    ...Array.from(\r\n      { length: \"~\".charCodeAt(0) - \"!\".charCodeAt(0) + 1 },\r\n      (_, i) => i + \"!\".charCodeAt(0)\r\n    ),\r\n    ...Array.from(\r\n      { length: \"¬\".charCodeAt(0) - \"¡\".charCodeAt(0) + 1 },\r\n      (_, i) => i + \"¡\".charCodeAt(0)\r\n    ),\r\n    ...Array.from(\r\n      { length: \"ÿ\".charCodeAt(0) - \"®\".charCodeAt(0) + 1 },\r\n      (_, i) => i + \"®\".charCodeAt(0)\r\n    ),\r\n  ];\r\n  const cs = bs.slice();\r\n  let n = 0;\r\n  for (let b = 0; b < 256; ++b) {\r\n    if (!bs.includes(b)) {\r\n      bs.push(b);\r\n      cs.push(256 + n);\r\n      n += 1;\r\n    }\r\n  }\r\n  const ccs = cs.map((n) => String.fromCharCode(n));\r\n  return Object.fromEntries(bs.map((b, i) => [b, ccs[i]]));\r\n})();\r\n\r\nconst UNICODE_TO_BYTES = reverseDictionary(BYTES_TO_UNICODE);\r\n\r\n/**\r\n * @typedef {Object} BPENode\r\n * @property {string} token The token associated with the node\r\n * @property {number} bias A positional bias for the node.\r\n * @property {number} [score] The score of the node.\r\n * @property {BPENode} [prev] The previous node in the linked list.\r\n * @property {BPENode} [next] The next node in the linked list.\r\n */\r\n\r\n/**\r\n * BPE class for encoding text into Byte-Pair-Encoding (BPE) tokens.\r\n * @extends TokenizerModel\r\n */\r\nclass BPE extends TokenizerModel {\r\n  /**\r\n   * Create a BPE instance.\r\n   * @param {Object} config The configuration object for BPE.\r\n   * @param {Object} config.vocab A mapping of tokens to ids.\r\n   * @param {string[]|[string, string][]} config.merges An array of BPE merges as strings.\r\n   * @param {string} config.unk_token The unknown token used for out of vocabulary words.\r\n   * @param {string} config.end_of_word_suffix The suffix to place at the end of each word.\r\n   * @param {string} [config.continuing_subword_suffix] The suffix to insert between words.\r\n   * @param {boolean} [config.byte_fallback=false] Whether to use spm byte-fallback trick (defaults to False)\r\n   * @param {boolean} [config.ignore_merges=false] Whether or not to match tokens with the vocab before using merges.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    /** @type {Map<string, number>} */\r\n    this.tokens_to_ids = objectToMap(config.vocab);\r\n\r\n    this.unk_token_id = this.tokens_to_ids.get(config.unk_token);\r\n    this.unk_token = config.unk_token;\r\n\r\n    this.vocab = new Array(this.tokens_to_ids.size);\r\n    for (const [key, value] of this.tokens_to_ids) {\r\n      this.vocab[value] = key;\r\n    }\r\n\r\n    // Tokenizers >= 0.20.0 serializes BPE merges as a [string, string][] instead of a string[],\r\n    // which resolves the ambiguity for merges containing spaces.\r\n    const use_new_merge_format = Array.isArray(config.merges[0]);\r\n\r\n    /** @type {[string, string][]} */\r\n    this.merges = use_new_merge_format\r\n      ? /** @type {[string, string][]} */ (config.merges)\r\n      : /** @type {string[]} */ (config.merges).map(\r\n          (x) => /** @type {[string, string]} */ (x.split(\" \", 2))\r\n        );\r\n    this.bpe_ranks = new Map(this.merges.map((x, i) => [JSON.stringify(x), i]));\r\n\r\n    this.end_of_word_suffix = config.end_of_word_suffix;\r\n\r\n    // NOTE: `continuing_subword_suffix` is custom (to support `BlenderbotSmallTokenizer`)\r\n    this.continuing_subword_suffix = config.continuing_subword_suffix ?? null;\r\n\r\n    this.byte_fallback = this.config.byte_fallback ?? false;\r\n\r\n    if (this.byte_fallback) {\r\n      this.text_encoder = new TextEncoder();\r\n    }\r\n\r\n    this.ignore_merges = this.config.ignore_merges ?? false;\r\n\r\n    /**\r\n     * The maximum length we should cache in a model.\r\n     * Strings that are too long have minimal chances to cache hit anyway\r\n     */\r\n    this.max_length_to_cache = 256;\r\n\r\n    /**\r\n     * The default capacity for a `BPE`'s internal cache.\r\n     */\r\n    this.cache_capacity = 10000;\r\n    this.cache = new LRUCache(this.cache_capacity);\r\n  }\r\n\r\n  /**\r\n   * Clears the cache.\r\n   */\r\n  clear_cache() {\r\n    this.cache.clear();\r\n  }\r\n\r\n  /**\r\n   * Apply Byte-Pair-Encoding (BPE) to a given token. Efficient heap-based priority\r\n   * queue implementation adapted from https://github.com/belladoreai/llama-tokenizer-js.\r\n   * @param {string} token The token to encode.\r\n   * @returns {string[]} The BPE encoded tokens.\r\n   */\r\n  bpe(token) {\r\n    if (token.length === 0) {\r\n      return [];\r\n    }\r\n\r\n    const cached = this.cache.get(token);\r\n    if (cached !== undefined) {\r\n      return cached;\r\n    }\r\n\r\n    const word = Array.from(token);\r\n    if (this.end_of_word_suffix) {\r\n      word[word.length - 1] += this.end_of_word_suffix;\r\n    }\r\n\r\n    let result = [];\r\n    if (word.length > 1) {\r\n      // Create a priority queue to store the nodes that will be merged.\r\n      // The comparator function compares the scores of the nodes.\r\n      const queue = new PriorityQueue((a, b) => a.score < b.score);\r\n\r\n      // Construct a doubly-linked list of nodes that will be inserted into the priority queue,\r\n      // starting with the individual characters. We also populate each node with a positional\r\n      // bias to break ties in the priority queue.\r\n      let startingNode = {\r\n        token: word[0],\r\n        bias: 0,\r\n        prev: null,\r\n        next: null,\r\n      };\r\n\r\n      let previousNode = startingNode;\r\n      for (let i = 1; i < word.length; ++i) {\r\n        const currentNode = {\r\n          bias: i / word.length, // Add fractional component to break ties\r\n          token: word[i],\r\n          prev: previousNode,\r\n          next: null,\r\n        };\r\n        previousNode.next = currentNode;\r\n        this._add_node(queue, previousNode);\r\n        previousNode = currentNode;\r\n      }\r\n\r\n      while (!queue.isEmpty()) {\r\n        // Get the next node with the highest priority\r\n        const node = queue.pop();\r\n\r\n        // Check that this merge is still possible\r\n        if (node.deleted || !node.next || node.next.deleted) continue;\r\n\r\n        // Here, we mark the current node (left side of the merge) and the next node (right side of the merge) as deleted.\r\n        // This is because they will both be replaced by a new node representing the merge result.\r\n        node.deleted = true;\r\n        node.next.deleted = true;\r\n\r\n        // Next, we fix the node that comes before the current node (i.e., left side of the merge).\r\n        if (node.prev) {\r\n          // Make a shallow copy of the previous node\r\n          const newPreviousNode = { ...node.prev };\r\n\r\n          // Mark the old previous node as deleted. This avoids erroneous merges later,\r\n          // because there may still be references to this node in the priority queue.\r\n          node.prev.deleted = true;\r\n          node.prev = newPreviousNode;\r\n\r\n          // Update the reference of the previous node, by pointing its previous node to this new previous node.\r\n          if (newPreviousNode.prev) {\r\n            newPreviousNode.prev.next = newPreviousNode;\r\n          } else {\r\n            // If the previous of the previous node does not exist, it means that\r\n            // `newPreviousNode` must be the new `startingNode`.\r\n            startingNode = newPreviousNode;\r\n          }\r\n        }\r\n\r\n        // Create a new node which represents the result of the merge.\r\n        const merged = {\r\n          token: node.token + node.next.token,\r\n          bias: node.bias,\r\n          prev: node.prev,\r\n          next: node.next.next,\r\n        };\r\n\r\n        // We now consider where we can add the new merged node to the priority queue:\r\n        // 1. prev <-> merged\r\n        if (merged.prev) {\r\n          merged.prev.next = merged;\r\n          this._add_node(queue, merged.prev);\r\n        } else {\r\n          // If `merged.prev` does not exist, then `merged` must be the new `startingNode`.\r\n          startingNode = merged;\r\n        }\r\n\r\n        // 2. merged <-> next\r\n        if (merged.next) {\r\n          merged.next.prev = merged;\r\n          this._add_node(queue, merged);\r\n        }\r\n      }\r\n\r\n      // Traverse the linked list, starting from the `startingNode`, and collect the tokens.\r\n      for (\r\n        let currentNode = startingNode;\r\n        currentNode !== null;\r\n        currentNode = currentNode.next\r\n      ) {\r\n        result.push(currentNode.token);\r\n      }\r\n    } else {\r\n      result = word;\r\n    }\r\n\r\n    // Possibly append suffix\r\n    if (this.continuing_subword_suffix) {\r\n      // Do not append suffix to the last token\r\n      for (let i = 0; i < result.length - 1; ++i) {\r\n        result[i] += this.continuing_subword_suffix;\r\n      }\r\n    }\r\n\r\n    if (token.length < this.max_length_to_cache) {\r\n      // Save the result to the cache\r\n      this.cache.put(token, result);\r\n    }\r\n\r\n    return result;\r\n  }\r\n\r\n  /**\r\n   * Helper function to add a node to the priority queue.\r\n   * @param {PriorityQueue} queue\r\n   * @param {BPENode} node\r\n   * @private\r\n   */\r\n  _add_node(queue, node) {\r\n    // `score` is a measure of the merge priority: lower means higher priority\r\n    // We use the BPE rank as a measure of priority (i.e., the local of the merge in the merges list)\r\n    // We also add a fractional component to the score to break ties (with the earlier character having higher priority)\r\n    const rank = this.bpe_ranks.get(\r\n      JSON.stringify([node.token, node.next.token])\r\n    );\r\n    if (rank !== undefined) {\r\n      node.score = rank + node.bias;\r\n      queue.push(node);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Encodes the input sequence of tokens using the BPE algorithm and returns the resulting subword tokens.\r\n   * @param {string[]} tokens The input sequence of tokens to encode.\r\n   * @returns {string[]} The resulting subword tokens after applying the BPE algorithm to the input sequence of tokens.\r\n   */\r\n  encode(tokens) {\r\n    const outputTokens = [];\r\n\r\n    for (const token of tokens) {\r\n      if (this.ignore_merges && this.tokens_to_ids.has(token)) {\r\n        outputTokens.push(token);\r\n        continue;\r\n      }\r\n      const bpe_token_list = this.bpe(token);\r\n\r\n      for (const t of bpe_token_list) {\r\n        if (this.tokens_to_ids.has(t)) {\r\n          outputTokens.push(t);\r\n        } else if (this.byte_fallback) {\r\n          const byteTokens = Array.from(this.text_encoder.encode(t)).map(\r\n            (x) => `<0x${x.toString(16).toUpperCase().padStart(2, \"0\")}>`\r\n          );\r\n          if (byteTokens.every((x) => this.tokens_to_ids.has(x))) {\r\n            // Ensure the byte tokens are actually in the vocabulary, otherwise\r\n            // we fall back to the unknown token. For more information, see\r\n            // https://github.com/huggingface/transformers/issues/28096.\r\n            outputTokens.push(...byteTokens);\r\n          } else {\r\n            outputTokens.push(this.unk_token);\r\n          }\r\n        } else {\r\n          outputTokens.push(this.unk_token);\r\n        }\r\n      }\r\n    }\r\n\r\n    return outputTokens;\r\n  }\r\n}\r\n\r\n/**\r\n * Legacy tokenizer class for tokenizers with only a vocabulary.\r\n */\r\nclass LegacyTokenizerModel extends TokenizerModel {\r\n  /**\r\n   * Create a LegacyTokenizerModel instance.\r\n   * @param {Object} config The configuration object for LegacyTokenizerModel.\r\n   * @param {Object} config.vocab A (possibly nested) mapping of tokens to ids.\r\n   * @param {Object} moreConfig Additional configuration object for the LegacyTokenizerModel model.\r\n   */\r\n  constructor(config, moreConfig) {\r\n    super(config);\r\n\r\n    /**@type {Map<string, number>} */\r\n    this.tokens_to_ids = objectToMap(\r\n      moreConfig.target_lang\r\n        ? config.vocab[moreConfig.target_lang]\r\n        : config.vocab\r\n    );\r\n\r\n    this.bos_token = moreConfig.bos_token;\r\n    this.bos_token_id = this.tokens_to_ids.get(this.bos_token);\r\n\r\n    this.eos_token = moreConfig.eos_token;\r\n    this.eos_token_id = this.tokens_to_ids.get(this.eos_token);\r\n\r\n    this.pad_token = moreConfig.pad_token;\r\n    this.pad_token_id = this.tokens_to_ids.get(this.pad_token);\r\n\r\n    this.unk_token = moreConfig.unk_token;\r\n    this.unk_token_id = this.tokens_to_ids.get(this.unk_token);\r\n\r\n    this.vocab = new Array(this.tokens_to_ids.size);\r\n    for (const [key, value] of this.tokens_to_ids) {\r\n      this.vocab[value] = key;\r\n    }\r\n  }\r\n\r\n  encode(tokens) {\r\n    return tokens;\r\n  }\r\n}\r\n\r\n/**\r\n * A base class for text normalization.\r\n * @abstract\r\n */\r\nclass Normalizer extends Callable {\r\n  /**\r\n   * @param {Object} config The configuration object for the normalizer.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n  }\r\n\r\n  /**\r\n   * Factory method for creating normalizers from config objects.\r\n   * @static\r\n   * @param {Object} config The configuration object for the normalizer.\r\n   * @returns {Normalizer} A Normalizer object.\r\n   * @throws {Error} If an unknown Normalizer type is specified in the config.\r\n   */\r\n  static fromConfig(config) {\r\n    if (config === null) return null;\r\n    switch (config.type) {\r\n      case \"BertNormalizer\":\r\n        return new BertNormalizer(config);\r\n      case \"Precompiled\":\r\n        return new Precompiled(config);\r\n      case \"Sequence\":\r\n        return new NormalizerSequence(config);\r\n      case \"Replace\":\r\n        return new Replace(config);\r\n      case \"NFC\":\r\n        return new NFC(config);\r\n      case \"NFD\":\r\n        return new NFD(config);\r\n      case \"NFKC\":\r\n        return new NFKC(config);\r\n      case \"NFKD\":\r\n        return new NFKD(config);\r\n      case \"Strip\":\r\n        return new StripNormalizer(config);\r\n      case \"StripAccents\":\r\n        return new StripAccents(config);\r\n      case \"Lowercase\":\r\n        return new Lowercase(config);\r\n      case \"Prepend\":\r\n        return new Prepend(config);\r\n      default:\r\n        throw new Error(`Unknown Normalizer type: ${config.type}`);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Normalize the input text.\r\n   * @abstract\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   * @throws {Error} If this method is not implemented in a subclass.\r\n   */\r\n  normalize(text) {\r\n    throw Error(\"normalize should be implemented in subclass.\");\r\n  }\r\n\r\n  /**\r\n   * Alias for {@link Normalizer#normalize}.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  _call(text) {\r\n    return this.normalize(text);\r\n  }\r\n}\r\n\r\n/**\r\n * Replace normalizer that replaces occurrences of a pattern with a given string or regular expression.\r\n * @extends Normalizer\r\n */\r\nclass Replace extends Normalizer {\r\n  /**\r\n   * Normalize the input text by replacing the pattern with the content.\r\n   * @param {string} text The input text to be normalized.\r\n   * @returns {string} The normalized text after replacing the pattern with the content.\r\n   */\r\n  normalize(text) {\r\n    const pattern = createPattern(this.config.pattern);\r\n    return pattern === null\r\n      ? text\r\n      : text.replaceAll(pattern, this.config.content);\r\n  }\r\n}\r\n\r\n/**\r\n * A normalizer that applies Unicode normalization to the input text.\r\n * @extends Normalizer\r\n * @abstract\r\n */\r\nclass UnicodeNormalizer extends Normalizer {\r\n  /**\r\n   * @type {string} The Unicode normalization form to apply.\r\n   * Should be one of: 'NFC', 'NFD', 'NFKC', or 'NFKD'.\r\n   */\r\n  form = undefined;\r\n\r\n  /**\r\n   * Normalize the input text by applying Unicode normalization.\r\n   * @param {string} text The input text to be normalized.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    text = text.normalize(this.form);\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A normalizer that applies Unicode normalization form C (NFC) to the input text.\r\n * Canonical Decomposition, followed by Canonical Composition.\r\n * @extends UnicodeNormalizer\r\n */\r\nclass NFC extends UnicodeNormalizer {\r\n  form = \"NFC\";\r\n}\r\n\r\n/**\r\n * A normalizer that applies Unicode normalization form D (NFD) to the input text.\r\n * Canonical Decomposition.\r\n * @extends UnicodeNormalizer\r\n */\r\nclass NFD extends UnicodeNormalizer {\r\n  form = \"NFD\";\r\n}\r\n\r\n/**\r\n * A normalizer that applies Unicode normalization form KC (NFKC) to the input text.\r\n * Compatibility Decomposition, followed by Canonical Composition.\r\n * @extends UnicodeNormalizer\r\n */\r\nclass NFKC extends UnicodeNormalizer {\r\n  form = \"NFKC\";\r\n}\r\n\r\n/**\r\n * A normalizer that applies Unicode normalization form KD (NFKD) to the input text.\r\n * Compatibility Decomposition.\r\n * @extends UnicodeNormalizer\r\n */\r\nclass NFKD extends UnicodeNormalizer {\r\n  form = \"NFKD\";\r\n}\r\n\r\n/**\r\n * A normalizer that strips leading and/or trailing whitespace from the input text.\r\n */\r\nclass StripNormalizer extends Normalizer {\r\n  /**\r\n   * Strip leading and/or trailing whitespace from the input text.\r\n   * @param {string} text The input text.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    if (this.config.strip_left && this.config.strip_right) {\r\n      // Fast path to avoid an extra trim call\r\n      text = text.trim();\r\n    } else {\r\n      if (this.config.strip_left) {\r\n        text = text.trimStart();\r\n      }\r\n      if (this.config.strip_right) {\r\n        text = text.trimEnd();\r\n      }\r\n    }\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * StripAccents normalizer removes all accents from the text.\r\n * @extends Normalizer\r\n */\r\nclass StripAccents extends Normalizer {\r\n  /**\r\n   * Remove all accents from the text.\r\n   * @param {string} text The input text.\r\n   * @returns {string} The normalized text without accents.\r\n   */\r\n  normalize(text) {\r\n    text = remove_accents(text);\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A Normalizer that lowercases the input string.\r\n * @extends Normalizer\r\n */\r\nclass Lowercase extends Normalizer {\r\n  /**\r\n   * Lowercases the input string.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    text = text.toLowerCase();\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A Normalizer that prepends a string to the input string.\r\n * @extends Normalizer\r\n */\r\nclass Prepend extends Normalizer {\r\n  /**\r\n   * Prepends the input string.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    text = this.config.prepend + text;\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A Normalizer that applies a sequence of Normalizers.\r\n * @extends Normalizer\r\n */\r\nclass NormalizerSequence extends Normalizer {\r\n  /**\r\n   * Create a new instance of NormalizerSequence.\r\n   * @param {Object} config The configuration object.\r\n   * @param {Object[]} config.normalizers An array of Normalizer configuration objects.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    this.normalizers = config.normalizers.map((x) => Normalizer.fromConfig(x));\r\n  }\r\n  /**\r\n   * Apply a sequence of Normalizers to the input text.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    return this.normalizers.reduce((t, normalizer) => {\r\n      return normalizer.normalize(t);\r\n    }, text);\r\n  }\r\n}\r\n\r\n/**\r\n * A class representing a normalizer used in BERT tokenization.\r\n * @extends Normalizer\r\n */\r\nclass BertNormalizer extends Normalizer {\r\n  /**\r\n   * Adds whitespace around any CJK (Chinese, Japanese, or Korean) character in the input text.\r\n   *\r\n   * @param {string} text The input text to tokenize.\r\n   * @returns {string} The tokenized text with whitespace added around CJK characters.\r\n   */\r\n  _tokenize_chinese_chars(text) {\r\n    /* Adds whitespace around any CJK character. */\r\n    const output = [];\r\n    for (let i = 0; i < text.length; ++i) {\r\n      const char = text[i];\r\n      const cp = char.charCodeAt(0);\r\n      if (is_chinese_char(cp)) {\r\n        output.push(\" \");\r\n        output.push(char);\r\n        output.push(\" \");\r\n      } else {\r\n        output.push(char);\r\n      }\r\n    }\r\n    return output.join(\"\");\r\n  }\r\n\r\n  /**\r\n   * Strips accents from the given text.\r\n   * @param {string} text The text to strip accents from.\r\n   * @returns {string} The text with accents removed.\r\n   */\r\n  stripAccents(text) {\r\n    // \"Mark, Nonspacing\" (Mn)\r\n    return text.normalize(\"NFD\").replace(/\\p{Mn}/gu, \"\");\r\n  }\r\n\r\n  /**\r\n   * Checks whether `char` is a control character.\r\n   * @param {string} char The character to check.\r\n   * @returns {boolean} Whether `char` is a control character.\r\n   * @private\r\n   */\r\n  _is_control(char) {\r\n    switch (char) {\r\n      case \"\\t\":\r\n      case \"\\n\":\r\n      case \"\\r\":\r\n        // These are technically control characters but we count them as whitespace characters.\r\n        return false;\r\n\r\n      default:\r\n        // Check if unicode category starts with C:\r\n        // Cc - Control\r\n        // Cf - Format\r\n        // Co - Private Use\r\n        // Cs - Surrogate\r\n        return /^\\p{Cc}|\\p{Cf}|\\p{Co}|\\p{Cs}$/u.test(char);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Performs invalid character removal and whitespace cleanup on text.\r\n   * @param {string} text The text to clean.\r\n   * @returns {string} The cleaned text.\r\n   * @private\r\n   */\r\n  _clean_text(text) {\r\n    const output = [];\r\n    for (const char of text) {\r\n      const cp = char.charCodeAt(0);\r\n      if (cp === 0 || cp === 0xfffd || this._is_control(char)) {\r\n        continue;\r\n      }\r\n      if (/^\\s$/.test(char)) {\r\n        // is whitespace\r\n        output.push(\" \");\r\n      } else {\r\n        output.push(char);\r\n      }\r\n    }\r\n    return output.join(\"\");\r\n  }\r\n  /**\r\n   * Normalizes the given text based on the configuration.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    if (this.config.clean_text) {\r\n      text = this._clean_text(text);\r\n    }\r\n\r\n    if (this.config.handle_chinese_chars) {\r\n      text = this._tokenize_chinese_chars(text);\r\n    }\r\n\r\n    if (this.config.lowercase) {\r\n      text = text.toLowerCase();\r\n\r\n      if (this.config.strip_accents !== false) {\r\n        text = this.stripAccents(text);\r\n      }\r\n    } else if (this.config.strip_accents) {\r\n      text = this.stripAccents(text);\r\n    }\r\n\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A callable class representing a pre-tokenizer used in tokenization. Subclasses\r\n * should implement the `pre_tokenize_text` method to define the specific pre-tokenization logic.\r\n * @extends Callable\r\n */\r\nclass PreTokenizer extends Callable {\r\n  /**\r\n   * Factory method that returns an instance of a subclass of `PreTokenizer` based on the provided configuration.\r\n   *\r\n   * @static\r\n   * @param {Object} config A configuration object for the pre-tokenizer.\r\n   * @returns {PreTokenizer} An instance of a subclass of `PreTokenizer`.\r\n   * @throws {Error} If the provided configuration object does not correspond to any known pre-tokenizer.\r\n   */\r\n  static fromConfig(config) {\r\n    if (config === null) return null;\r\n\r\n    switch (config.type) {\r\n      case \"BertPreTokenizer\":\r\n        return new BertPreTokenizer(config);\r\n      case \"Sequence\":\r\n        return new PreTokenizerSequence(config);\r\n      case \"Whitespace\":\r\n        return new WhitespacePreTokenizer(config);\r\n      case \"WhitespaceSplit\":\r\n        return new WhitespaceSplit(config);\r\n      case \"Metaspace\":\r\n        return new MetaspacePreTokenizer(config);\r\n\r\n      case \"ByteLevel\":\r\n        return new ByteLevelPreTokenizer(config);\r\n      case \"Split\":\r\n        return new SplitPreTokenizer(config);\r\n      case \"Punctuation\":\r\n        return new PunctuationPreTokenizer(config);\r\n      case \"Digits\":\r\n        return new DigitsPreTokenizer(config);\r\n      case \"Replace\":\r\n        return new ReplacePreTokenizer(config);\r\n      default:\r\n        throw new Error(`Unknown PreTokenizer type: ${config.type}`);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Method that should be implemented by subclasses to define the specific pre-tokenization logic.\r\n   *\r\n   * @abstract\r\n   * @param {string} text The text to pre-tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} The pre-tokenized text.\r\n   * @throws {Error} If the method is not implemented in the subclass.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    throw Error(\"pre_tokenize_text should be implemented in subclass.\");\r\n  }\r\n\r\n  /**\r\n   * Tokenizes the given text into pre-tokens.\r\n   * @param {string|string[]} text The text or array of texts to pre-tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of pre-tokens.\r\n   */\r\n  pre_tokenize(text, options) {\r\n    return (\r\n      Array.isArray(text)\r\n        ? text.map((x) => this.pre_tokenize_text(x, options))\r\n        : this.pre_tokenize_text(text, options)\r\n    ).flat();\r\n  }\r\n\r\n  /**\r\n   * Alias for {@link PreTokenizer#pre_tokenize}.\r\n   * @param {string|string[]} text The text or array of texts to pre-tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of pre-tokens.\r\n   */\r\n  _call(text, options) {\r\n    return this.pre_tokenize(text, options);\r\n  }\r\n}\r\n\r\n/**\r\n * @extends PreTokenizer\r\n */\r\nclass BertPreTokenizer extends PreTokenizer {\r\n  /**\r\n   * A PreTokenizer that splits text into wordpieces using a basic tokenization scheme\r\n   * similar to that used in the original implementation of BERT.\r\n   *\r\n   * @param {Object} config The configuration object.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    // Construct a pattern which matches the rust implementation:\r\n    // https://github.com/huggingface/tokenizers/blob/b4fcc9ce6e4ad5806e82826f816acfdfdc4fcc67/tokenizers/src/pre_tokenizers/bert.rs#L11\r\n    // Equivalent to removing whitespace and splitting on punctuation (both \\p{P} and other ascii characters)\r\n    this.pattern = new RegExp(\r\n      `[^\\\\s${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]`,\r\n      \"gu\"\r\n    );\r\n  }\r\n  /**\r\n   * Tokenizes a single text using the BERT pre-tokenization scheme.\r\n   *\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    return text.trim().match(this.pattern) || [];\r\n  }\r\n}\r\n\r\n/**\r\n * A pre-tokenizer that splits text into Byte-Pair-Encoding (BPE) subwords.\r\n * @extends PreTokenizer\r\n */\r\nclass ByteLevelPreTokenizer extends PreTokenizer {\r\n  /**\r\n   * Creates a new instance of the `ByteLevelPreTokenizer` class.\r\n   * @param {Object} config The configuration object.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n\r\n    /**\r\n     * @type {boolean} Whether to add a leading space to the first word.\r\n     * This allows to treat the leading word just as any other word.\r\n     */\r\n    this.add_prefix_space = this.config.add_prefix_space;\r\n\r\n    /**\r\n     * @type {boolean} Whether the post processing step should trim offsets\r\n     * to avoid including whitespaces.\r\n     * @todo Use this in the pretokenization step.\r\n     */\r\n    this.trim_offsets = this.config.trim_offsets;\r\n\r\n    /**\r\n     * @type {boolean} Whether to use the standard GPT2 regex for whitespace splitting.\r\n     * Set it to False if you want to use your own splitting. Defaults to true.\r\n     */\r\n    this.use_regex = this.config.use_regex ?? true;\r\n    this.pattern =\r\n      /'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+/gu;\r\n\r\n    this.byte_encoder = BYTES_TO_UNICODE;\r\n    this.text_encoder = new TextEncoder();\r\n  }\r\n\r\n  /**\r\n   * Tokenizes a single piece of text using byte-level tokenization.\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    // Add a leading space if the option is enabled\r\n    if (this.add_prefix_space && !text.startsWith(\" \")) {\r\n      text = \" \" + text;\r\n    }\r\n\r\n    // Split on whitespace and punctuation\r\n    const tokens = this.use_regex ? text.match(this.pattern) || [] : [text];\r\n\r\n    // Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)\r\n    return tokens.map((token) =>\r\n      Array.from(\r\n        this.text_encoder.encode(token),\r\n        (byte) => this.byte_encoder[byte]\r\n      ).join(\"\")\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * @typedef {'removed'|'isolated'|'mergedWithPrevious'|'mergedWithNext'|'contiguous'} SplitDelimiterBehavior\r\n */\r\n\r\n/**\r\n * Splits text using a given pattern.\r\n * @extends PreTokenizer\r\n */\r\nclass SplitPreTokenizer extends PreTokenizer {\r\n  /**\r\n   * @param {Object} config The configuration options for the pre-tokenizer.\r\n   * @param {Object} config.pattern The pattern used to split the text. Can be a string or a regex object.\r\n   * @param {string|undefined} config.pattern.String The string to use for splitting. Only defined if the pattern is a string.\r\n   * @param {string|undefined} config.pattern.Regex The regex to use for splitting. Only defined if the pattern is a regex.\r\n   * @param {SplitDelimiterBehavior} config.behavior The behavior to use when splitting.\r\n   * @param {boolean} config.invert Whether to split (invert=false) or match (invert=true) the pattern.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n    // TODO support all behaviours (config.behavior)\r\n\r\n    this.pattern = createPattern(this.config.pattern, this.config.invert);\r\n  }\r\n\r\n  /**\r\n   * Tokenizes text by splitting it using the given pattern.\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    if (this.pattern === null) {\r\n      return [];\r\n    }\r\n\r\n    if (this.config.invert) {\r\n      return text.match(this.pattern) || [];\r\n    } else if (this.config.behavior?.toLowerCase() === \"removed\") {\r\n      return text.split(this.pattern).filter((x) => x);\r\n    } else {\r\n      return regexSplit(text, this.pattern);\r\n    }\r\n  }\r\n}\r\n\r\n/**\r\n * Splits text based on punctuation.\r\n * @extends PreTokenizer\r\n */\r\nclass PunctuationPreTokenizer extends PreTokenizer {\r\n  /**\r\n   * @param {Object} config The configuration options for the pre-tokenizer.\r\n   * @param {SplitDelimiterBehavior} config.behavior The behavior to use when splitting.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n    this.pattern = new RegExp(\r\n      `[^${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]+`,\r\n      \"gu\"\r\n    );\r\n  }\r\n\r\n  /**\r\n   * Tokenizes text by splitting it using the given pattern.\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    return text.match(this.pattern) || [];\r\n  }\r\n}\r\n\r\n/**\r\n * Splits text based on digits.\r\n * @extends PreTokenizer\r\n */\r\nclass DigitsPreTokenizer extends PreTokenizer {\r\n  /**\r\n   * @param {Object} config The configuration options for the pre-tokenizer.\r\n   * @param {boolean} config.individual_digits Whether to split on individual digits.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n\r\n    // Construct a pattern which matches the rust implementation:\r\n    const digit_pattern = `[^\\\\d]+|\\\\d${\r\n      this.config.individual_digits ? \"\" : \"+\"\r\n    }`;\r\n    this.pattern = new RegExp(digit_pattern, \"gu\");\r\n  }\r\n\r\n  /**\r\n   * Tokenizes text by splitting it using the given pattern.\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    return text.match(this.pattern) || [];\r\n  }\r\n}\r\n\r\n/**\r\n * @typedef {Object} PostProcessedOutput\r\n * @property {string[]} tokens List of token produced by the post-processor.\r\n * @property {number[]} [token_type_ids] List of token type ids produced by the post-processor.\r\n */\r\n\r\n/**\r\n * @typedef {Object} EncodingSingle\r\n * @property {number[]} input_ids List of token ids to be fed to a model.\r\n * @property {number[]} attention_mask List of token type ids to be fed to a model\r\n * @property {number[]} [token_type_ids] List of indices specifying which tokens should be attended to by the model\r\n */\r\n\r\n/**\r\n * @extends Callable\r\n */\r\nclass PostProcessor extends Callable {\r\n  /**\r\n   * @param {Object} config The configuration for the post-processor.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n  }\r\n\r\n  /**\r\n   * Factory method to create a PostProcessor object from a configuration object.\r\n   *\r\n   * @param {Object} config Configuration object representing a PostProcessor.\r\n   * @returns {PostProcessor} A PostProcessor object created from the given configuration.\r\n   * @throws {Error} If an unknown PostProcessor type is encountered.\r\n   */\r\n  static fromConfig(config) {\r\n    if (config === null) return null;\r\n    switch (config.type) {\r\n      case \"TemplateProcessing\":\r\n        return new TemplateProcessing(config);\r\n\r\n      case \"ByteLevel\":\r\n        return new ByteLevelPostProcessor(config);\r\n\r\n      case \"RobertaProcessing\":\r\n        return new RobertaProcessing(config);\r\n      case \"BertProcessing\":\r\n        return new BertProcessing(config);\r\n\r\n      case \"Sequence\":\r\n        return new PostProcessorSequence(config);\r\n      default:\r\n        throw new Error(`Unknown PostProcessor type: ${config.type}`);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Method to be implemented in subclass to apply post-processing on the given tokens.\r\n   *\r\n   * @param {Array} tokens The input tokens to be post-processed.\r\n   * @param {...*} args Additional arguments required by the post-processing logic.\r\n   * @returns {PostProcessedOutput} The post-processed tokens.\r\n   * @throws {Error} If the method is not implemented in subclass.\r\n   */\r\n  post_process(tokens, ...args) {\r\n    throw Error(\"post_process should be implemented in subclass.\");\r\n  }\r\n\r\n  /**\r\n   * Alias for {@link PostProcessor#post_process}.\r\n   * @param {Array} tokens The text or array of texts to post-process.\r\n   * @param {...*} args Additional arguments required by the post-processing logic.\r\n   * @returns {PostProcessedOutput} The post-processed tokens.\r\n   */\r\n  _call(tokens, ...args) {\r\n    return this.post_process(tokens, ...args);\r\n  }\r\n}\r\n\r\n/**\r\n * A post-processor that adds special tokens to the beginning and end of the input.\r\n */\r\nclass BertProcessing extends PostProcessor {\r\n  /**\r\n   * @param {Object} config The configuration for the post-processor.\r\n   * @param {string[]} config.cls The special tokens to add to the beginning of the input.\r\n   * @param {string[]} config.sep The special tokens to add to the end of the input.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    // TODO use all of config: add_prefix_space, trim_offsets\r\n\r\n    this.cls = config.cls[0];\r\n    this.sep = config.sep[0];\r\n  }\r\n\r\n  /**\r\n   * Adds the special tokens to the beginning and end of the input.\r\n   * @param {string[]} tokens The input tokens.\r\n   * @param {string[]} [tokens_pair=null] An optional second set of input tokens.\r\n   * @returns {PostProcessedOutput} The post-processed tokens with the special tokens added to the beginning and end.\r\n   */\r\n  post_process(tokens, tokens_pair = null, { add_special_tokens = true } = {}) {\r\n    if (add_special_tokens) {\r\n      tokens = mergeArrays([this.cls], tokens, [this.sep]);\r\n    }\r\n\r\n    let token_type_ids = new Array(tokens.length).fill(0);\r\n    if (tokens_pair !== null) {\r\n      // NOTE: It is intended to add 2 EOS tokens after the first set of tokens\r\n      // https://github.com/huggingface/tokenizers/issues/983\r\n      const middle =\r\n        add_special_tokens && this instanceof RobertaProcessing\r\n          ? [this.sep]\r\n          : [];\r\n      const after = add_special_tokens ? [this.sep] : [];\r\n\r\n      tokens = mergeArrays(tokens, middle, tokens_pair, after);\r\n      token_type_ids = mergeArrays(\r\n        token_type_ids,\r\n        new Array(tokens_pair.length + middle.length + after.length).fill(1)\r\n      );\r\n    }\r\n    return { tokens, token_type_ids };\r\n  }\r\n}\r\nclass RobertaProcessing extends BertProcessing {} // NOTE: extends BertProcessing\r\n\r\n/**\r\n * Post processor that replaces special tokens in a template with actual tokens.\r\n * @extends PostProcessor\r\n */\r\nclass TemplateProcessing extends PostProcessor {\r\n  /**\r\n   * Creates a new instance of `TemplateProcessing`.\r\n   * @param {Object} config The configuration options for the post processor.\r\n   * @param {Array} config.single The template for a single sequence of tokens.\r\n   * @param {Array} config.pair The template for a pair of sequences of tokens.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.single = config.single;\r\n    this.pair = config.pair;\r\n  }\r\n\r\n  /**\r\n   * Replaces special tokens in the template with actual tokens.\r\n   * @param {string[]} tokens The list of tokens for the first sequence.\r\n   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).\r\n   * @returns {PostProcessedOutput} An object containing the list of tokens with the special tokens replaced with actual tokens.\r\n   */\r\n  post_process(tokens, tokens_pair = null, { add_special_tokens = true } = {}) {\r\n    const type = tokens_pair === null ? this.single : this.pair;\r\n\r\n    let processedTokens = [];\r\n    let types = [];\r\n    for (const item of type) {\r\n      if (\"SpecialToken\" in item) {\r\n        if (add_special_tokens) {\r\n          processedTokens.push(item.SpecialToken.id);\r\n          types.push(item.SpecialToken.type_id);\r\n        }\r\n      } else if (\"Sequence\" in item) {\r\n        if (item.Sequence.id === \"A\") {\r\n          processedTokens = mergeArrays(processedTokens, tokens);\r\n          types = mergeArrays(\r\n            types,\r\n            new Array(tokens.length).fill(item.Sequence.type_id)\r\n          );\r\n        } else if (item.Sequence.id === \"B\") {\r\n          processedTokens = mergeArrays(processedTokens, tokens_pair);\r\n          types = mergeArrays(\r\n            types,\r\n            new Array(tokens_pair.length).fill(item.Sequence.type_id)\r\n          );\r\n        }\r\n      }\r\n    }\r\n    return { tokens: processedTokens, token_type_ids: types };\r\n  }\r\n}\r\n\r\n/**\r\n * A PostProcessor that returns the given tokens as is.\r\n * @extends PostProcessor\r\n */\r\nclass ByteLevelPostProcessor extends PostProcessor {\r\n  /**\r\n   * Post process the given tokens.\r\n   * @param {string[]} tokens The list of tokens for the first sequence.\r\n   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).\r\n   * @returns {PostProcessedOutput} An object containing the post-processed tokens.\r\n   */\r\n  post_process(tokens, tokens_pair = null) {\r\n    if (tokens_pair) {\r\n      tokens = mergeArrays(tokens, tokens_pair);\r\n    }\r\n    return { tokens };\r\n  }\r\n}\r\n\r\n/**\r\n * A post-processor that applies multiple post-processors in sequence.\r\n */\r\nclass PostProcessorSequence extends PostProcessor {\r\n  /**\r\n   * Creates a new instance of PostProcessorSequence.\r\n   * @param {Object} config The configuration object.\r\n   * @param {Object[]} config.processors The list of post-processors to apply.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.processors = config.processors.map((x) => PostProcessor.fromConfig(x));\r\n  }\r\n\r\n  /**\r\n   * Post process the given tokens.\r\n   * @param {string[]} tokens The list of tokens for the first sequence.\r\n   * @param {string[]} [tokens_pair=null] The list of tokens for the second sequence (optional).\r\n   * @returns {PostProcessedOutput} An object containing the post-processed tokens.\r\n   */\r\n  post_process(tokens, tokens_pair = null, options = {}) {\r\n    let token_type_ids;\r\n    for (const processor of this.processors) {\r\n      if (processor instanceof ByteLevelPostProcessor) {\r\n        // Special case where we need to pass the tokens_pair to the post-processor\r\n        const output = processor.post_process(tokens);\r\n        tokens = output.tokens;\r\n        if (tokens_pair) {\r\n          const pair_output = processor.post_process(tokens_pair);\r\n          tokens_pair = pair_output.tokens;\r\n        }\r\n      } else {\r\n        const output = processor.post_process(tokens, tokens_pair, options);\r\n        tokens = output.tokens;\r\n        token_type_ids = output.token_type_ids;\r\n      }\r\n    }\r\n    return { tokens, token_type_ids };\r\n  }\r\n}\r\n\r\n/**\r\n * The base class for token decoders.\r\n * @extends Callable\r\n */\r\nclass Decoder extends Callable {\r\n  /**\r\n   * Creates an instance of `Decoder`.\r\n   *\r\n   * @param {Object} config The configuration object.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n\r\n    /** @type {AddedToken[]} */\r\n    this.added_tokens = [];\r\n    this.end_of_word_suffix = null;\r\n    this.trim_offsets = config.trim_offsets;\r\n  }\r\n\r\n  /**\r\n   * Creates a decoder instance based on the provided configuration.\r\n   *\r\n   * @param {Object} config The configuration object.\r\n   * @returns {Decoder} A decoder instance.\r\n   * @throws {Error} If an unknown decoder type is provided.\r\n   */\r\n  static fromConfig(config) {\r\n    if (config === null) return null;\r\n    switch (config.type) {\r\n      case \"WordPiece\":\r\n        return new WordPieceDecoder(config);\r\n      case \"Metaspace\":\r\n        return new MetaspaceDecoder(config);\r\n      case \"ByteLevel\":\r\n        return new ByteLevelDecoder(config);\r\n\r\n      case \"Replace\":\r\n        return new ReplaceDecoder(config);\r\n      case \"ByteFallback\":\r\n        return new ByteFallback(config);\r\n      case \"Fuse\":\r\n        return new FuseDecoder(config);\r\n      case \"Strip\":\r\n        return new StripDecoder(config);\r\n\r\n      case \"Sequence\":\r\n        return new DecoderSequence(config);\r\n\r\n      case \"CTC\":\r\n        return new CTCDecoder(config);\r\n      case \"BPEDecoder\":\r\n        return new BPEDecoder(config);\r\n      default:\r\n        throw new Error(`Unknown Decoder type: ${config.type}`);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Calls the `decode` method.\r\n   *\r\n   * @param {string[]} tokens The list of tokens.\r\n   * @returns {string} The decoded string.\r\n   */\r\n  _call(tokens) {\r\n    return this.decode(tokens);\r\n  }\r\n\r\n  /**\r\n   * Decodes a list of tokens.\r\n   * @param {string[]} tokens The list of tokens.\r\n   * @returns {string} The decoded string.\r\n   */\r\n  decode(tokens) {\r\n    return this.decode_chain(tokens).join(\"\");\r\n  }\r\n\r\n  /**\r\n   * Apply the decoder to a list of tokens.\r\n   *\r\n   * @param {string[]} tokens The list of tokens.\r\n   * @returns {string[]} The decoded list of tokens.\r\n   * @throws {Error} If the `decode_chain` method is not implemented in the subclass.\r\n   */\r\n  decode_chain(tokens) {\r\n    throw Error(\"`decode_chain` should be implemented in subclass.\");\r\n  }\r\n}\r\n\r\nclass ReplaceDecoder extends Decoder {\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    const pattern = createPattern(this.config.pattern);\r\n    return pattern === null\r\n      ? tokens\r\n      : tokens.map((token) => token.replaceAll(pattern, this.config.content));\r\n  }\r\n}\r\n\r\nclass ByteFallback extends Decoder {\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.text_decoder = new TextDecoder();\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    const new_tokens = [];\r\n    let previous_byte_tokens = [];\r\n\r\n    for (const token of tokens) {\r\n      let bytes = null;\r\n      if (\r\n        token.length === 6 &&\r\n        token.startsWith(\"<0x\") &&\r\n        token.endsWith(\">\")\r\n      ) {\r\n        const byte = parseInt(token.slice(3, 5), 16);\r\n        if (!isNaN(byte)) {\r\n          bytes = byte;\r\n        }\r\n      }\r\n      if (bytes !== null) {\r\n        previous_byte_tokens.push(bytes);\r\n      } else {\r\n        if (previous_byte_tokens.length > 0) {\r\n          const string = this.text_decoder.decode(\r\n            Uint8Array.from(previous_byte_tokens)\r\n          );\r\n          new_tokens.push(string);\r\n          previous_byte_tokens = [];\r\n        }\r\n        new_tokens.push(token);\r\n      }\r\n    }\r\n    if (previous_byte_tokens.length > 0) {\r\n      const string = this.text_decoder.decode(\r\n        Uint8Array.from(previous_byte_tokens)\r\n      );\r\n      new_tokens.push(string);\r\n      previous_byte_tokens = [];\r\n    }\r\n\r\n    return new_tokens;\r\n  }\r\n}\r\n\r\n/**\r\n * Fuse simply fuses all tokens into one big string.\r\n * It's usually the last decoding step anyway, but this decoder\r\n * exists incase some decoders need to happen after that step\r\n */\r\nclass FuseDecoder extends Decoder {\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    return [tokens.join(\"\")];\r\n  }\r\n}\r\n\r\nclass StripDecoder extends Decoder {\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.content = this.config.content;\r\n    this.start = this.config.start;\r\n    this.stop = this.config.stop;\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    return tokens.map((token) => {\r\n      let start_cut = 0;\r\n      for (let i = 0; i < this.start; ++i) {\r\n        if (token[i] === this.content) {\r\n          start_cut = i + 1;\r\n          continue;\r\n        } else {\r\n          break;\r\n        }\r\n      }\r\n\r\n      let stop_cut = token.length;\r\n      for (let i = 0; i < this.stop; ++i) {\r\n        const index = token.length - i - 1;\r\n        if (token[index] === this.content) {\r\n          stop_cut = index;\r\n          continue;\r\n        } else {\r\n          break;\r\n        }\r\n      }\r\n\r\n      return token.slice(start_cut, stop_cut);\r\n    });\r\n  }\r\n}\r\n\r\n/**\r\n * A decoder that decodes a list of WordPiece tokens into a single string.\r\n * @extends Decoder\r\n */\r\nclass WordPieceDecoder extends Decoder {\r\n  /**\r\n   * Creates a new instance of WordPieceDecoder.\r\n   * @param {Object} config The configuration object.\r\n   * @param {string} config.prefix The prefix used for WordPiece encoding.\r\n   * @param {boolean} config.cleanup Whether to cleanup the decoded string.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    this.cleanup = config.cleanup;\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    return tokens.map((token, i) => {\r\n      if (i !== 0) {\r\n        if (token.startsWith(this.config.prefix)) {\r\n          // NOTE: .replace() is intended; only replace first occurrence\r\n          token = token.replace(this.config.prefix, \"\");\r\n        } else {\r\n          token = \" \" + token;\r\n        }\r\n      }\r\n      if (this.cleanup) {\r\n        token = clean_up_tokenization(token);\r\n      }\r\n\r\n      return token;\r\n    });\r\n  }\r\n}\r\n\r\n/**\r\n * Byte-level decoder for tokenization output. Inherits from the `Decoder` class.\r\n * @extends Decoder\r\n */\r\nclass ByteLevelDecoder extends Decoder {\r\n  /**\r\n   * Create a `ByteLevelDecoder` object.\r\n   * @param {Object} config Configuration object.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.byte_decoder = UNICODE_TO_BYTES;\r\n    this.text_decoder = new TextDecoder(\"utf-8\", {\r\n      fatal: false,\r\n      ignoreBOM: true,\r\n    });\r\n\r\n    this.end_of_word_suffix = null;\r\n  }\r\n\r\n  /**\r\n   * Convert an array of tokens to string by decoding each byte.\r\n   * @param {string[]} tokens Array of tokens to be decoded.\r\n   * @returns {string} The decoded string.\r\n   */\r\n  convert_tokens_to_string(tokens) {\r\n    const text = tokens.join(\"\");\r\n    const byteArray = new Uint8Array(\r\n      [...text].map((c) => this.byte_decoder[c])\r\n    );\r\n    const decoded_text = this.text_decoder.decode(byteArray);\r\n    return decoded_text;\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    // TODO move to base class (like HF)\r\n    // tokens === filtered_tokens\r\n\r\n    // To avoid mixing byte-level and unicode for byte-level BPT\r\n    // we need to build string separately for added tokens and byte-level tokens\r\n    // cf. https://github.com/huggingface/transformers/issues/1133\r\n    const sub_texts = [];\r\n    let current_sub_text = [];\r\n    for (const token of tokens) {\r\n      // tokens sent here are already filtered, so we don't need to do this\r\n      // if (skip_special_tokens && this.all_special_ids.includes(token)) {\r\n      //     continue;\r\n      // }\r\n\r\n      if (this.added_tokens.find((x) => x.content === token) !== undefined) {\r\n        if (current_sub_text.length > 0) {\r\n          sub_texts.push(this.convert_tokens_to_string(current_sub_text));\r\n          current_sub_text = [];\r\n        }\r\n        sub_texts.push(token);\r\n      } else {\r\n        current_sub_text.push(token);\r\n      }\r\n    }\r\n    if (current_sub_text.length > 0) {\r\n      sub_texts.push(this.convert_tokens_to_string(current_sub_text));\r\n    }\r\n\r\n    // TODO add spaces_between_special_tokens and clean_up_tokenization_spaces options\r\n\r\n    return sub_texts;\r\n  }\r\n}\r\n\r\n/**\r\n * The CTC (Connectionist Temporal Classification) decoder.\r\n * See https://github.com/huggingface/tokenizers/blob/bb38f390a61883fc2f29d659af696f428d1cda6b/tokenizers/src/decoders/ctc.rs\r\n */\r\nclass CTCDecoder extends Decoder {\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.pad_token = this.config.pad_token;\r\n    this.word_delimiter_token = this.config.word_delimiter_token;\r\n    this.cleanup = this.config.cleanup;\r\n  }\r\n  /**\r\n   * Converts a connectionist-temporal-classification (CTC) output tokens into a single string.\r\n   * @param {string[]} tokens Array of tokens to be decoded.\r\n   * @returns {string} The decoded string.\r\n   */\r\n  convert_tokens_to_string(tokens) {\r\n    if (tokens.length === 0) return \"\";\r\n\r\n    // group same tokens into non-repeating tokens in CTC style decoding\r\n    const grouped_tokens = [tokens[0]];\r\n    for (let i = 1; i < tokens.length; ++i) {\r\n      if (tokens[i] !== grouped_tokens.at(-1)) {\r\n        grouped_tokens.push(tokens[i]);\r\n      }\r\n    }\r\n\r\n    // filter self.pad_token which is used as CTC-blank token\r\n    const filtered_tokens = grouped_tokens.filter(\r\n      (token) => token !== this.pad_token\r\n    );\r\n\r\n    let text = filtered_tokens.join(\"\");\r\n    if (this.cleanup) {\r\n      // cleanup and replace delimiter token\r\n      text = clean_up_tokenization(text)\r\n        .replaceAll(this.word_delimiter_token, \" \")\r\n        .trim();\r\n    }\r\n    return text;\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    return [this.convert_tokens_to_string(tokens)];\r\n  }\r\n}\r\n\r\n/**\r\n * Apply a sequence of decoders.\r\n * @extends Decoder\r\n */\r\nclass DecoderSequence extends Decoder {\r\n  /**\r\n   * Creates a new instance of DecoderSequence.\r\n   * @param {Object} config The configuration object.\r\n   * @param {Object[]} config.decoders The list of decoders to apply.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    this.decoders = config.decoders.map((x) => Decoder.fromConfig(x));\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    // Use reduce to apply each decoder to the tokens\r\n    return this.decoders.reduce((toks, decoder) => {\r\n      return decoder.decode_chain(toks);\r\n    }, tokens);\r\n  }\r\n}\r\n\r\nclass BPEDecoder extends Decoder {\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.suffix = this.config.suffix;\r\n  }\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    return tokens.map((token, i) => {\r\n      return token.replaceAll(this.suffix, i === tokens.length - 1 ? \"\" : \" \");\r\n    });\r\n  }\r\n}\r\n\r\n// Custom decoder for VITS\r\nclass VitsDecoder extends Decoder {\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    let decoded = \"\";\r\n    for (let i = 1; i < tokens.length; i += 2) {\r\n      decoded += tokens[i];\r\n    }\r\n    return [decoded];\r\n  }\r\n}\r\n\r\n/**\r\n * This PreTokenizer replaces spaces with the given replacement character, adds a prefix space if requested,\r\n * and returns a list of tokens.\r\n * @extends PreTokenizer\r\n */\r\nclass MetaspacePreTokenizer extends PreTokenizer {\r\n  /**\r\n   * @param {Object} config The configuration object for the MetaspacePreTokenizer.\r\n   * @param {boolean} config.add_prefix_space Whether to add a prefix space to the first token.\r\n   * @param {string} config.replacement The character to replace spaces with.\r\n   * @param {string} [config.str_rep=config.replacement] An optional string representation of the replacement character.\r\n   * @param {'first'|'never'|'always'} [config.prepend_scheme='always'] The metaspace prepending scheme.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n\r\n    this.addPrefixSpace = config.add_prefix_space;\r\n    this.replacement = config.replacement;\r\n    this.strRep = config.str_rep || this.replacement;\r\n    this.prepend_scheme = config.prepend_scheme ?? \"always\";\r\n  }\r\n\r\n  /**\r\n   * This method takes a string, replaces spaces with the replacement character,\r\n   * adds a prefix space if requested, and returns a new list of tokens.\r\n   * @param {string} text The text to pre-tokenize.\r\n   * @param {Object} [options] The options for the pre-tokenization.\r\n   * @param {number} [options.section_index] The index of the section to pre-tokenize.\r\n   * @returns {string[]} A new list of pre-tokenized tokens.\r\n   */\r\n  pre_tokenize_text(text, { section_index = undefined } = {}) {\r\n    let normalized = text.replaceAll(\" \", this.strRep);\r\n\r\n    if (\r\n      // We add a prefix space if:\r\n      //  (1) The addPrefixSpace option is enabled and the normalized\r\n      //      token does not already start with the replacement character.\r\n      this.addPrefixSpace &&\r\n      !normalized.startsWith(this.replacement) &&\r\n      // and (2) either:\r\n      //  (a) prepend_scheme is 'always'\r\n      //  (b) prepend_scheme is 'first' and this is the first section\r\n      (this.prepend_scheme === \"always\" ||\r\n        (this.prepend_scheme === \"first\" && section_index === 0))\r\n    ) {\r\n      normalized = this.strRep + normalized;\r\n    }\r\n    return [normalized];\r\n  }\r\n}\r\n\r\n/**\r\n * MetaspaceDecoder class extends the Decoder class and decodes Metaspace tokenization.\r\n * @extends Decoder\r\n */\r\nclass MetaspaceDecoder extends Decoder {\r\n  /**\r\n   * Constructs a new MetaspaceDecoder object.\r\n   * @param {Object} config The configuration object for the MetaspaceDecoder.\r\n   * @param {boolean} config.add_prefix_space Whether to add a prefix space to the decoded string.\r\n   * @param {string} config.replacement The string to replace spaces with.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n\r\n    this.addPrefixSpace = config.add_prefix_space;\r\n    this.replacement = config.replacement;\r\n  }\r\n\r\n  /** @type {Decoder['decode_chain']} */\r\n  decode_chain(tokens) {\r\n    const result = [];\r\n    for (let i = 0; i < tokens.length; ++i) {\r\n      let normalized = tokens[i].replaceAll(this.replacement, \" \");\r\n      if (this.addPrefixSpace && i == 0 && normalized.startsWith(\" \")) {\r\n        normalized = normalized.substring(1);\r\n      }\r\n      result.push(normalized);\r\n    }\r\n    return result;\r\n  }\r\n}\r\n\r\n/**\r\n * A normalizer that applies a precompiled charsmap.\r\n * This is useful for applying complex normalizations in C++ and exposing them to JavaScript.\r\n * @extends Normalizer\r\n * @param {Object} config The configuration object for the Precompiled normalizer.\r\n * @param {Object} config.precompiled_charsmap The precompiled charsmap object.\r\n */\r\nclass Precompiled extends Normalizer {\r\n  /**\r\n   * Create a new instance of Precompiled normalizer.\r\n   * @param {Object} config The configuration object.\r\n   * @param {any} config.precompiled_charsmap Precompiled chars mapping.\r\n   */\r\n  constructor(config) {\r\n    super(config);\r\n    this.charsmap = config.precompiled_charsmap;\r\n  }\r\n\r\n  /**\r\n   * Normalizes the given text by applying the precompiled charsmap.\r\n   * @param {string} text The text to normalize.\r\n   * @returns {string} The normalized text.\r\n   */\r\n  normalize(text) {\r\n    // As stated in the sentencepiece normalization docs (https://github.com/google/sentencepiece/blob/master/doc/normalization.md#use-pre-defined-normalization-rule),\r\n    // there are 5 pre-defined normalization rules:\r\n    //  1. nmt_nfkc: NFKC normalization with some additional normalization around spaces. (default)\r\n    //  2. nfkc: original NFKC normalization.\r\n    //  3. nmt_nfkc_cf: nmt_nfkc + Unicode case folding (mostly lower casing)\r\n    //  4. nfkc_cf: nfkc + Unicode case folding.\r\n    //  5. identity: no normalization\r\n    //\r\n    // For now, we only implement the default (nmt_nfkc).\r\n    // See https://raw.githubusercontent.com/google/sentencepiece/master/data/nmt_nfkc.tsv for the full list of rules.\r\n    // TODO: detect when a different `this.charsmap` is used.\r\n\r\n    text = text.replace(\r\n      /[\\u0001-\\u0008\\u000B\\u000E-\\u001F\\u007F\\u008F\\u009F]/gm,\r\n      \"\"\r\n    ); // Remove control characters\r\n    text = text.replace(\r\n      /[\\u0009\\u000A\\u000C\\u000D\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u2581\\u3000\\uFEFF\\uFFFD]/gm,\r\n      \"\\u0020\"\r\n    ); // Replace certain characters with a space\r\n\r\n    if (text.includes(\"\\uFF5E\")) {\r\n      // To match the sentencepiece implementation 100%, we must handle a very strange edge-case.\r\n      // For some reason, the \"Fullwidth Tilde\" character (\\uFF5E) should not be converted to the standard Tilde character (\\u007E).\r\n      // However, NFKC normalization does do this conversion. As a result, we split the string on the Fullwidth Tilde character,\r\n      // perform NFKC normalization on each substring, and then join them back together with the Fullwidth Tilde character.\r\n      const parts = text.split(\"\\uFF5E\");\r\n      text = parts.map((part) => part.normalize(\"NFKC\")).join(\"\\uFF5E\");\r\n    } else {\r\n      text = text.normalize(\"NFKC\");\r\n    }\r\n\r\n    return text;\r\n  }\r\n}\r\n\r\n/**\r\n * A pre-tokenizer that applies a sequence of pre-tokenizers to the input text.\r\n * @extends PreTokenizer\r\n */\r\nclass PreTokenizerSequence extends PreTokenizer {\r\n  /**\r\n   * Creates an instance of PreTokenizerSequence.\r\n   * @param {Object} config The configuration object for the pre-tokenizer sequence.\r\n   * @param {Object[]} config.pretokenizers An array of pre-tokenizer configurations.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.tokenizers = config.pretokenizers.map((x) =>\r\n      PreTokenizer.fromConfig(x)\r\n    );\r\n  }\r\n\r\n  /**\r\n   * Applies each pre-tokenizer in the sequence to the input text in turn.\r\n   * @param {string} text The text to pre-tokenize.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} The pre-tokenized text.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    // Use reduce to apply each tokenizer to the text\r\n    return this.tokenizers.reduce(\r\n      (preTokenizedText, tokenizer) => {\r\n        return tokenizer.pre_tokenize(preTokenizedText, options);\r\n      },\r\n      [text]\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * Splits on word boundaries (using the following regular expression: `\\w+|[^\\w\\s]+`).\r\n */\r\nclass WhitespacePreTokenizer extends PreTokenizer {\r\n  /**\r\n   * Creates an instance of WhitespacePreTokenizer.\r\n   * @param {Object} config The configuration object for the pre-tokenizer.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n  }\r\n  /**\r\n   * Pre-tokenizes the input text by splitting it on word boundaries.\r\n   * @param {string} text The text to be pre-tokenized.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens produced by splitting the input text on whitespace.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    return text.match(/\\w+|[^\\w\\s]+/g) || [];\r\n  }\r\n}\r\n\r\n/**\r\n * Splits a string of text by whitespace characters into individual tokens.\r\n * @extends PreTokenizer\r\n */\r\nclass WhitespaceSplit extends PreTokenizer {\r\n  /**\r\n   * Creates an instance of WhitespaceSplit.\r\n   * @param {Object} config The configuration object for the pre-tokenizer.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n  }\r\n  /**\r\n   * Pre-tokenizes the input text by splitting it on whitespace characters.\r\n   * @param {string} text The text to be pre-tokenized.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens produced by splitting the input text on whitespace.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    return whitespace_split(text);\r\n  }\r\n}\r\n\r\n// NOTE: `ReplacePreTokenizer` is custom (to support `BlenderbotSmallTokenizer`)\r\nclass ReplacePreTokenizer extends PreTokenizer {\r\n  /**\r\n   * @param {Object} config The configuration options for the pre-tokenizer.\r\n   * @param {Object} config.pattern The pattern used to split the text. Can be a string or a regex object.\r\n   * @param {string} config.content What to replace the pattern with.\r\n   */\r\n  constructor(config) {\r\n    super();\r\n    this.config = config;\r\n    this.pattern = createPattern(this.config.pattern);\r\n    this.content = this.config.content;\r\n  }\r\n\r\n  /**\r\n   * Pre-tokenizes the input text by replacing certain characters.\r\n   * @param {string} text The text to be pre-tokenized.\r\n   * @param {Object} [options] Additional options for the pre-tokenization logic.\r\n   * @returns {string[]} An array of tokens produced by replacing certain characters.\r\n   */\r\n  pre_tokenize_text(text, options) {\r\n    if (this.pattern === null) {\r\n      return [text];\r\n    }\r\n    return [text.replaceAll(this.pattern, this.config.content)];\r\n  }\r\n}\r\n\r\nconst SPECIAL_TOKEN_ATTRIBUTES = [\r\n  \"bos_token\",\r\n  \"eos_token\",\r\n  \"unk_token\",\r\n  \"sep_token\",\r\n  \"pad_token\",\r\n  \"cls_token\",\r\n  \"mask_token\",\r\n  // additional_special_tokens (TODO)\r\n];\r\n\r\n/**\r\n *\r\n * Helper function for padding values of an object, which are each arrays.\r\n * NOTE: No additional checks are made here for validity of arguments.\r\n * @param {Record<string, any[]>} item The input object.\r\n * @param {number} length The length to pad to.\r\n * @param {(key: string) => any} value_fn Determine the value to fill the array, based on its key.\r\n * @param {string} side Which side to pad the array.\r\n * @private\r\n */\r\nfunction padHelper(item, length, value_fn, side) {\r\n  for (const key of Object.keys(item)) {\r\n    const diff = length - item[key].length;\r\n    const value = value_fn(key);\r\n\r\n    const padData = new Array(diff).fill(value);\r\n    item[key] =\r\n      side === \"right\"\r\n        ? mergeArrays(item[key], padData)\r\n        : mergeArrays(padData, item[key]);\r\n  }\r\n}\r\n\r\n/**\r\n * Helper function for truncating values of an object, which are each arrays.\r\n * NOTE: No additional checks are made here for validity of arguments.\r\n * @param {Record<string, any[]>} item The input object.\r\n * @param {number} length The length to truncate to.\r\n * @private\r\n */\r\nfunction truncateHelper(item, length) {\r\n  // Setting .length to a lower value truncates the array in-place:\r\n  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length\r\n  for (const key of Object.keys(item)) {\r\n    item[key].length = length;\r\n  }\r\n}\r\n\r\n/**\r\n * @typedef {Object} Message\r\n * @property {string} role The role of the message (e.g., \"user\" or \"assistant\" or \"system\").\r\n * @property {string} content The content of the message.\r\n */\r\n\r\nexport class PreTrainedTokenizer extends Callable {\r\n  return_token_type_ids = false;\r\n\r\n  padding_side = \"right\";\r\n  /**\r\n   * Create a new PreTrainedTokenizer instance.\r\n   * @param {Object} tokenizerJSON The JSON of the tokenizer.\r\n   * @param {Object} tokenizerConfig The config of the tokenizer.\r\n   */\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super();\r\n\r\n    this.config = tokenizerConfig;\r\n\r\n    // Construct parts of the tokenizer from the JSON\r\n    /**\r\n     * @type {Normalizer | null}\r\n     */\r\n    this.normalizer = Normalizer.fromConfig(tokenizerJSON.normalizer);\r\n    this.pre_tokenizer = PreTokenizer.fromConfig(tokenizerJSON.pre_tokenizer);\r\n    this.model = TokenizerModel.fromConfig(\r\n      tokenizerJSON.model,\r\n      tokenizerConfig\r\n    );\r\n    this.post_processor = PostProcessor.fromConfig(\r\n      tokenizerJSON.post_processor\r\n    );\r\n    this.decoder = Decoder.fromConfig(tokenizerJSON.decoder);\r\n\r\n    // Add added_tokens to model\r\n    this.special_tokens = [];\r\n    this.all_special_ids = [];\r\n\r\n    /** @type {AddedToken[]} */\r\n    this.added_tokens = [];\r\n    for (const addedToken of tokenizerJSON.added_tokens) {\r\n      const token = new AddedToken(addedToken);\r\n      this.added_tokens.push(token);\r\n\r\n      this.model.tokens_to_ids.set(token.content, token.id);\r\n      this.model.vocab[token.id] = token.content;\r\n\r\n      if (token.special) {\r\n        this.special_tokens.push(token.content);\r\n        this.all_special_ids.push(token.id);\r\n      }\r\n    }\r\n\r\n    // Update additional_special_tokens\r\n    this.additional_special_tokens =\r\n      tokenizerConfig.additional_special_tokens ?? [];\r\n    this.special_tokens.push(...this.additional_special_tokens);\r\n    this.special_tokens = [...new Set(this.special_tokens)]; // Remove duplicates\r\n\r\n    if (this.decoder) {\r\n      // Slight hack, but it prevents code duplication:\r\n      this.decoder.added_tokens = this.added_tokens;\r\n\r\n      // Another slight hack to add `end_of_word_suffix` (if present) to the decoder\r\n      // This is needed for cases where BPE model and ByteLevel decoder are used\r\n      // For more information, see https://github.com/huggingface/transformers.js/issues/74\r\n      // TODO: save this to the decoder when exporting?\r\n      this.decoder.end_of_word_suffix = this.model.end_of_word_suffix;\r\n    }\r\n\r\n    this.added_tokens_splitter = new DictionarySplitter(\r\n      this.added_tokens.map((x) => x.content)\r\n    );\r\n\r\n    /** @type {Map<string, AddedToken>} */\r\n    this.added_tokens_map = new Map(\r\n      this.added_tokens.map((x) => [x.content, x])\r\n    );\r\n\r\n    // Set mask token if present (otherwise will be undefined, which is fine)\r\n    this.mask_token = this.getToken(\"mask_token\");\r\n    this.mask_token_id = this.model.tokens_to_ids.get(this.mask_token);\r\n\r\n    this.pad_token = this.getToken(\"pad_token\", \"eos_token\");\r\n    this.pad_token_id = this.model.tokens_to_ids.get(this.pad_token);\r\n\r\n    this.sep_token = this.getToken(\"sep_token\");\r\n    this.sep_token_id = this.model.tokens_to_ids.get(this.sep_token);\r\n\r\n    this.unk_token = this.getToken(\"unk_token\");\r\n    this.unk_token_id = this.model.tokens_to_ids.get(this.unk_token);\r\n\r\n    this.bos_token = this.getToken(\"bos_token\");\r\n    this.bos_token_id = this.model.tokens_to_ids.get(this.bos_token);\r\n\r\n    this.eos_token = this.getToken(\"eos_token\");\r\n    this.eos_token_id = this.model.tokens_to_ids.get(this.eos_token);\r\n\r\n    this.model_max_length = tokenizerConfig.model_max_length;\r\n\r\n    /** @type {boolean} Whether or not to strip the text when tokenizing (removing excess spaces before and after the string). */\r\n    this.remove_space = tokenizerConfig.remove_space;\r\n\r\n    this.clean_up_tokenization_spaces =\r\n      tokenizerConfig.clean_up_tokenization_spaces ?? true;\r\n    this.do_lowercase_and_remove_accent =\r\n      tokenizerConfig.do_lowercase_and_remove_accent ?? false;\r\n\r\n    if (tokenizerConfig.padding_side) {\r\n      this.padding_side = tokenizerConfig.padding_side;\r\n    }\r\n\r\n    this.add_bos_token = tokenizerConfig.add_bos_token;\r\n    this.add_eos_token = tokenizerConfig.add_eos_token;\r\n\r\n    this.legacy = false;\r\n\r\n    this.chat_template = tokenizerConfig.chat_template ?? null;\r\n    if (Array.isArray(this.chat_template)) {\r\n      // Chat templates are stored as lists of dicts with fixed key names,\r\n      // we reconstruct that into a single dict while loading them.\r\n      const chat_template = Object.create(null);\r\n      for (const { name, template } of this.chat_template) {\r\n        if (typeof name !== \"string\" || typeof template !== \"string\") {\r\n          throw new Error(\r\n            'Chat template must be a list of objects with \"name\" and \"template\" properties'\r\n          );\r\n        }\r\n        chat_template[name] = template;\r\n      }\r\n      this.chat_template = chat_template;\r\n    }\r\n    this._compiled_template_cache = new Map();\r\n  }\r\n\r\n  /**\r\n   * Returns the value of the first matching key in the tokenizer config object.\r\n   * @param {...string} keys One or more keys to search for in the tokenizer config object.\r\n   * @returns {string|null} The value associated with the first matching key, or null if no match is found.\r\n   * @throws {Error} If an object is found for a matching key and its __type property is not \"AddedToken\".\r\n   * @private\r\n   */\r\n  getToken(...keys) {\r\n    for (const key of keys) {\r\n      const item = this.config[key];\r\n\r\n      if (!item) continue;\r\n\r\n      if (typeof item === \"object\") {\r\n        if (item.__type === \"AddedToken\") {\r\n          return item.content;\r\n        } else {\r\n          throw Error(`Unknown token: ${item}`);\r\n        }\r\n      } else {\r\n        return item;\r\n      }\r\n    }\r\n    return null;\r\n  }\r\n\r\n  /**\r\n   * Loads a pre-trained tokenizer from the given `pretrained_model_name_or_path`.\r\n   *\r\n   * @param {string} pretrained_model_name_or_path The path to the pre-trained tokenizer.\r\n   * @param {PretrainedTokenizerOptions} options Additional options for loading the tokenizer.\r\n   *\r\n   * @throws {Error} Throws an error if the tokenizer.json or tokenizer_config.json files are not found in the `pretrained_model_name_or_path`.\r\n   * @returns {Promise<PreTrainedTokenizer>} A new instance of the `PreTrainedTokenizer` class.\r\n   */\r\n  static async from_pretrained(\r\n    pretrained_model_name_or_path,\r\n    {\r\n      progress_callback = null,\r\n      config = null,\r\n      cache_dir = null,\r\n      local_files_only = false,\r\n      revision = \"main\",\r\n      legacy = null,\r\n    } = {}\r\n  ) {\r\n    const info = await loadTokenizer(pretrained_model_name_or_path, {\r\n      progress_callback,\r\n      config,\r\n      cache_dir,\r\n      local_files_only,\r\n      revision,\r\n      legacy,\r\n    });\r\n\r\n    // @ts-ignore\r\n    return new this(...info);\r\n  }\r\n\r\n  /**\r\n   * @typedef {number[]|number[][]|Tensor} BatchEncodingItem\r\n   *\r\n   * @typedef {Object} BatchEncoding Holds the output of the tokenizer's call function.\r\n   * @property {BatchEncodingItem} input_ids List of token ids to be fed to a model.\r\n   * @property {BatchEncodingItem} attention_mask List of indices specifying which tokens should be attended to by the model.\r\n   * @property {BatchEncodingItem} [token_type_ids] List of token type ids to be fed to a model.\r\n   */\r\n\r\n  /**\r\n   * Encode/tokenize the given text(s).\r\n   * @param {string|string[]} text The text to tokenize.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string|string[]} [options.text_pair=null] Optional second sequence to be encoded. If set, must be the same type as text.\r\n   * @param {boolean|'max_length'} [options.padding=false] Whether to pad the input sequences.\r\n   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.\r\n   * @param {boolean} [options.truncation=null] Whether to truncate the input sequences.\r\n   * @param {number} [options.max_length=null] Maximum length of the returned list and optionally padding length.\r\n   * @param {boolean} [options.return_tensor=false] Whether to return the results as Tensors or arrays.\r\n   * @param {boolean} [options.return_token_type_ids=null] Whether to return the token type ids.\r\n   * @returns {BatchEncoding} Object to be passed to the model.\r\n   */\r\n  _call(\r\n    // Required positional arguments\r\n    text,\r\n\r\n    // Optional keyword arguments\r\n    {\r\n      text_pair = null,\r\n      add_special_tokens = true,\r\n      padding = false,\r\n      truncation = null,\r\n      max_length = null,\r\n      return_tensor = false,\r\n      return_token_type_ids = null,\r\n    } = {}\r\n  ) {\r\n    const isBatched = Array.isArray(text);\r\n\r\n    /** @type {EncodingSingle[]} */\r\n    let encodedTokens;\r\n\r\n    if (isBatched) {\r\n      if (text.length === 0) {\r\n        throw Error(\"text array must be non-empty\");\r\n      }\r\n\r\n      if (text_pair !== null) {\r\n        if (!Array.isArray(text_pair)) {\r\n          throw Error(\"text_pair must also be an array\");\r\n        } else if (text.length !== text_pair.length) {\r\n          throw Error(\"text and text_pair must have the same length\");\r\n        }\r\n\r\n        encodedTokens = text.map((t, i) =>\r\n          this._encode_plus(t, {\r\n            text_pair: text_pair[i],\r\n            add_special_tokens,\r\n            return_token_type_ids,\r\n          })\r\n        );\r\n      } else {\r\n        encodedTokens = text.map((x) =>\r\n          this._encode_plus(x, { add_special_tokens, return_token_type_ids })\r\n        );\r\n      }\r\n    } else {\r\n      if (text === null || text === undefined) {\r\n        throw Error(\"text may not be null or undefined\");\r\n      }\r\n\r\n      if (Array.isArray(text_pair)) {\r\n        throw Error(\r\n          \"When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).\"\r\n        );\r\n      }\r\n\r\n      // For single input, we just wrap in an array, and then unwrap later.\r\n      encodedTokens = [\r\n        this._encode_plus(text, {\r\n          text_pair,\r\n          add_special_tokens,\r\n          return_token_type_ids,\r\n        }),\r\n      ];\r\n    }\r\n    // At this point, `encodedTokens` is batched, of shape [batch_size, tokens].\r\n    // However, array may be jagged. So, we may need pad to max_length.\r\n    if (max_length === null) {\r\n      max_length = this.model_max_length;\r\n    } else if (truncation === null) {\r\n      if (padding === true) {\r\n        console.warn(\r\n          \"`max_length` is ignored when `padding: true` and there is no truncation strategy. \" +\r\n            \"To pad to max length, use `padding: 'max_length'`.\"\r\n        );\r\n        max_length = this.model_max_length;\r\n      } else if (padding === false) {\r\n        console.warn(\r\n          \"Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation: true` to explicitly truncate examples to max length.\"\r\n        );\r\n        truncation = true;\r\n      }\r\n    }\r\n\r\n    // padding: 'max_length' doesn't require any additional calculation\r\n    // but padding: true has to calculate max_length from the sequences\r\n    if (padding === true) {\r\n      max_length = Math.min(\r\n        max(encodedTokens.map((x) => x.input_ids.length))[0],\r\n        max_length ?? Infinity\r\n      );\r\n    }\r\n\r\n    // Ensure it is less than model max length\r\n    max_length = Math.min(max_length, this.model_max_length ?? Infinity);\r\n\r\n    if (padding || truncation) {\r\n      // Perform padding and/or truncation\r\n      for (let i = 0; i < encodedTokens.length; ++i) {\r\n        if (encodedTokens[i].input_ids.length === max_length) {\r\n          continue;\r\n        } else if (encodedTokens[i].input_ids.length > max_length) {\r\n          // possibly truncate\r\n          if (truncation) {\r\n            truncateHelper(encodedTokens[i], max_length);\r\n          }\r\n        } else {\r\n          // t.length < max_length\r\n          // possibly pad\r\n          if (padding) {\r\n            padHelper(\r\n              encodedTokens[i],\r\n              max_length,\r\n              (key) => (key === \"input_ids\" ? this.pad_token_id : 0),\r\n              this.padding_side\r\n            );\r\n          }\r\n        }\r\n      }\r\n    }\r\n\r\n    const result = {};\r\n\r\n    if (return_tensor) {\r\n      if (!(padding && truncation)) {\r\n        // Not, guaranteed that all items have same length, so\r\n        // we perform additional check\r\n\r\n        if (\r\n          encodedTokens.some((x) => {\r\n            for (const key of Object.keys(x)) {\r\n              if (x[key].length !== encodedTokens[0][key]?.length) {\r\n                return true;\r\n              }\r\n            }\r\n            return false;\r\n          })\r\n        ) {\r\n          throw Error(\r\n            \"Unable to create tensor, you should probably activate truncation and/or padding \" +\r\n              \"with 'padding=true' and 'truncation=true' to have batched tensors with the same length.\"\r\n          );\r\n        }\r\n      }\r\n\r\n      // Now we actually convert to tensor\r\n      // NOTE: In the same way as the python library, we return a batched tensor, regardless of\r\n      // whether we have a single input or multiple inputs.\r\n      const dims = [encodedTokens.length, encodedTokens[0].input_ids.length];\r\n\r\n      for (const key of Object.keys(encodedTokens[0])) {\r\n        result[key] = new Tensor(\r\n          \"int64\",\r\n          BigInt64Array.from(encodedTokens.flatMap((x) => x[key]).map(BigInt)),\r\n          dims\r\n        );\r\n      }\r\n    } else {\r\n      for (const key of Object.keys(encodedTokens[0])) {\r\n        result[key] = encodedTokens.map((x) => x[key]);\r\n      }\r\n\r\n      // If not returning a tensor, we match the input type\r\n      if (!isBatched) {\r\n        // Input was not batched, so we unwrap\r\n        for (const key of Object.keys(result)) {\r\n          result[key] = result[key][0];\r\n        }\r\n      }\r\n    }\r\n\r\n    return /** @type {BatchEncoding} */ (result);\r\n  }\r\n\r\n  /**\r\n   * Encodes a single text using the preprocessor pipeline of the tokenizer.\r\n   *\r\n   * @param {string|null} text The text to encode.\r\n   * @returns {string[]|null} The encoded tokens.\r\n   */\r\n  _encode_text(text) {\r\n    if (text === null) return null;\r\n\r\n    // Actual function which does encoding, for a single text\r\n    // First, we take care of special tokens. Needed to avoid issues arising from\r\n    // normalization and/or pretokenization (which may not preserve special tokens)\r\n    const sections = this.added_tokens_splitter.split(text);\r\n\r\n    // Process left/right stripping of added tokens\r\n    for (let i = 0; i < sections.length; ++i) {\r\n      const addedToken = this.added_tokens_map.get(sections[i]);\r\n      if (addedToken) {\r\n        if (addedToken.lstrip && i > 0) {\r\n          sections[i - 1] = sections[i - 1].trimEnd();\r\n        }\r\n        if (addedToken.rstrip && i < sections.length - 1) {\r\n          sections[i + 1] = sections[i + 1].trimStart();\r\n        }\r\n      }\r\n    }\r\n\r\n    const tokens = sections.flatMap((x, section_index) => {\r\n      if (x.length === 0) return [];\r\n      if (this.added_tokens_map.has(x)) return [x]; // Return added tokens unchanged\r\n\r\n      if (this.remove_space === true) {\r\n        x = x.trim().split(/\\s+/).join(\" \");\r\n      }\r\n      if (this.do_lowercase_and_remove_accent) {\r\n        x = lowercase_and_remove_accent(x);\r\n      }\r\n\r\n      if (this.normalizer !== null) {\r\n        x = this.normalizer(x);\r\n      }\r\n\r\n      // If, after normalization, this section is empty (e.g., trimming whitespace),\r\n      // we return an empty array\r\n      if (x.length === 0) {\r\n        return [];\r\n      }\r\n\r\n      const sectionTokens =\r\n        this.pre_tokenizer !== null\r\n          ? this.pre_tokenizer(x, {\r\n              section_index,\r\n            })\r\n          : [x];\r\n\r\n      const tokens = this.model(sectionTokens);\r\n\r\n      return tokens;\r\n    });\r\n\r\n    return tokens;\r\n  }\r\n\r\n  /**\r\n   * Encodes a single text or a pair of texts using the model's tokenizer.\r\n   *\r\n   * @param {string} text The text to encode.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.text_pair=null] The optional second text to encode.\r\n   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.\r\n   * @param {boolean} [options.return_token_type_ids=null] Whether to return token_type_ids.\r\n   * @returns {EncodingSingle} An object containing the encoded text.\r\n   * @private\r\n   */\r\n  _encode_plus(\r\n    text,\r\n    {\r\n      text_pair = null,\r\n      add_special_tokens = true,\r\n      return_token_type_ids = null,\r\n    } = {}\r\n  ) {\r\n    const { tokens, token_type_ids } = this._tokenize_helper(text, {\r\n      pair: text_pair,\r\n      add_special_tokens,\r\n    });\r\n\r\n    const input_ids = this.model.convert_tokens_to_ids(tokens);\r\n\r\n    const result = {\r\n      input_ids,\r\n      attention_mask: new Array(input_ids.length).fill(1),\r\n    };\r\n    if (\r\n      (return_token_type_ids ?? this.return_token_type_ids) &&\r\n      token_type_ids\r\n    ) {\r\n      result.token_type_ids = token_type_ids;\r\n    }\r\n    return result;\r\n  }\r\n\r\n  /**\r\n   * Internal helper function to tokenize a text, and optionally a pair of texts.\r\n   * @param {string} text The text to tokenize.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.pair=null] The optional second text to tokenize.\r\n   * @param {boolean} [options.add_special_tokens=false] Whether or not to add the special tokens associated with the corresponding model.\r\n   * @returns {{tokens: string[], token_type_ids?: number[]}} An object containing the tokens and optionally the token type IDs.\r\n   */\r\n  _tokenize_helper(text, { pair = null, add_special_tokens = false } = {}) {\r\n    const tokens = this._encode_text(text);\r\n    const tokens2 = this._encode_text(pair);\r\n\r\n    return this.post_processor\r\n      ? this.post_processor(tokens, tokens2, { add_special_tokens })\r\n      : { tokens: mergeArrays(tokens ?? [], tokens2 ?? []) };\r\n  }\r\n\r\n  /**\r\n   * Converts a string into a sequence of tokens.\r\n   * @param {string} text The sequence to be encoded.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.pair] A second sequence to be encoded with the first.\r\n   * @param {boolean} [options.add_special_tokens=false] Whether or not to add the special tokens associated with the corresponding model.\r\n   * @returns {string[]} The list of tokens.\r\n   */\r\n  tokenize(text, { pair = null, add_special_tokens = false } = {}) {\r\n    return this._tokenize_helper(text, { pair, add_special_tokens }).tokens;\r\n  }\r\n\r\n  /**\r\n   * Encodes a single text or a pair of texts using the model's tokenizer.\r\n   *\r\n   * @param {string} text The text to encode.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.text_pair=null] The optional second text to encode.\r\n   * @param {boolean} [options.add_special_tokens=true] Whether or not to add the special tokens associated with the corresponding model.\r\n   * @param {boolean} [options.return_token_type_ids=null] Whether to return token_type_ids.\r\n   * @returns {number[]} An array of token IDs representing the encoded text(s).\r\n   */\r\n  encode(\r\n    text,\r\n    {\r\n      text_pair = null,\r\n      add_special_tokens = true,\r\n      return_token_type_ids = null,\r\n    } = {}\r\n  ) {\r\n    return this._encode_plus(text, {\r\n      text_pair,\r\n      add_special_tokens,\r\n      return_token_type_ids,\r\n    }).input_ids;\r\n  }\r\n\r\n  /**\r\n   * Decode a batch of tokenized sequences.\r\n   * @param {number[][]|Tensor} batch List/Tensor of tokenized input sequences.\r\n   * @param {Object} decode_args (Optional) Object with decoding arguments.\r\n   * @returns {string[]} List of decoded sequences.\r\n   */\r\n  batch_decode(batch, decode_args = {}) {\r\n    if (batch instanceof Tensor) {\r\n      batch = batch.tolist();\r\n    }\r\n    return batch.map((x) => this.decode(x, decode_args));\r\n  }\r\n\r\n  /**\r\n   * Decodes a sequence of token IDs back to a string.\r\n   *\r\n   * @param {number[]|bigint[]|Tensor} token_ids List/Tensor of token IDs to decode.\r\n   * @param {Object} [decode_args={}]\r\n   * @param {boolean} [decode_args.skip_special_tokens=false] If true, special tokens are removed from the output string.\r\n   * @param {boolean} [decode_args.clean_up_tokenization_spaces=true] If true, spaces before punctuations and abbreviated forms are removed.\r\n   *\r\n   * @returns {string} The decoded string.\r\n   * @throws {Error} If `token_ids` is not a non-empty array of integers.\r\n   */\r\n  decode(token_ids, decode_args = {}) {\r\n    if (token_ids instanceof Tensor) {\r\n      token_ids = prepareTensorForDecode(token_ids);\r\n    }\r\n\r\n    if (\r\n      !Array.isArray(token_ids) ||\r\n      token_ids.length === 0 ||\r\n      !isIntegralNumber(token_ids[0])\r\n    ) {\r\n      throw Error(\"token_ids must be a non-empty array of integers.\");\r\n    }\r\n\r\n    return this.decode_single(token_ids, decode_args);\r\n  }\r\n\r\n  /**\r\n   * Decode a single list of token ids to a string.\r\n   * @param {number[]|bigint[]} token_ids List of token ids to decode\r\n   * @param {Object} decode_args Optional arguments for decoding\r\n   * @param {boolean} [decode_args.skip_special_tokens=false] Whether to skip special tokens during decoding\r\n   * @param {boolean} [decode_args.clean_up_tokenization_spaces=null] Whether to clean up tokenization spaces during decoding.\r\n   * If null, the value is set to `this.decoder.cleanup` if it exists, falling back to `this.clean_up_tokenization_spaces` if it exists, falling back to `true`.\r\n   * @returns {string} The decoded string\r\n   */\r\n  decode_single(\r\n    token_ids,\r\n    { skip_special_tokens = false, clean_up_tokenization_spaces = null }\r\n  ) {\r\n    let tokens = this.model.convert_ids_to_tokens(token_ids);\r\n    if (skip_special_tokens) {\r\n      tokens = tokens.filter((x) => !this.special_tokens.includes(x));\r\n    }\r\n\r\n    // If `this.decoder` is null, we just join tokens with a space:\r\n    // https://github.com/huggingface/tokenizers/blob/8edec536a737cb04494b454805be16c020abb14f/tokenizers/src/tokenizer/mod.rs#L835\r\n    /** @type {string} */\r\n    let decoded = this.decoder ? this.decoder(tokens) : tokens.join(\" \");\r\n\r\n    // Slight hack, but prevents having to pass `skip_special_tokens` to\r\n    // each call to `decode`, which would lead to code duplication.\r\n    if (this.decoder && this.decoder.end_of_word_suffix) {\r\n      decoded = decoded.replaceAll(this.decoder.end_of_word_suffix, \" \");\r\n      if (skip_special_tokens) {\r\n        decoded = decoded.trim();\r\n      }\r\n    }\r\n\r\n    if (clean_up_tokenization_spaces ?? this.clean_up_tokenization_spaces) {\r\n      decoded = clean_up_tokenization(decoded);\r\n    }\r\n\r\n    return decoded;\r\n  }\r\n\r\n  /**\r\n   * Retrieve the chat template string used for tokenizing chat messages. This template is used\r\n   * internally by the `apply_chat_template` method and can also be used externally to retrieve the model's chat\r\n   * template for better generation tracking.\r\n   *\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.chat_template=null]\r\n   * A Jinja template or the name of a template to use for this conversion.\r\n   * It is usually not necessary to pass anything to this argument,\r\n   * as the model's template will be used by default.\r\n   * @param {Object[]} [options.tools=null]\r\n   * A list of tools (callable functions) that will be accessible to the model. If the template does not\r\n   * support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema,\r\n   * giving the name, description and argument types for the tool. See our\r\n   * [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use)\r\n   * for more information.\r\n   * @returns {string} The chat template string.\r\n   */\r\n  get_chat_template({ chat_template = null, tools = null } = {}) {\r\n    // First, handle the cases when the model has a dict of multiple templates\r\n    if (this.chat_template && typeof this.chat_template === \"object\") {\r\n      const template_dict = this.chat_template;\r\n\r\n      if (\r\n        chat_template !== null &&\r\n        Object.hasOwn(template_dict, chat_template)\r\n      ) {\r\n        // The user can pass the name of a template to the chat template argument instead of an entire template\r\n        chat_template = template_dict[chat_template];\r\n      } else if (chat_template === null) {\r\n        if (tools !== null && \"tool_use\" in template_dict) {\r\n          chat_template = template_dict[\"tool_use\"];\r\n        } else if (\"default\" in template_dict) {\r\n          chat_template = template_dict[\"default\"];\r\n        } else {\r\n          throw Error(\r\n            `This model has multiple chat templates with no default specified! Please either pass a chat ` +\r\n              `template or the name of the template you wish to use to the 'chat_template' argument. Available ` +\r\n              `template names are ${Object.keys(template_dict).sort()}.`\r\n          );\r\n        }\r\n      }\r\n    } else if (chat_template === null) {\r\n      // These are the cases when the model has a single template\r\n      // priority: `chat_template` argument > `tokenizer.chat_template`\r\n      if (this.chat_template) {\r\n        chat_template = this.chat_template;\r\n      } else {\r\n        throw Error(\r\n          \"Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template \" +\r\n            \"argument was passed! For information about writing templates and setting the \" +\r\n            \"tokenizer.chat_template attribute, please see the documentation at \" +\r\n            \"https://huggingface.co/docs/transformers/main/en/chat_templating\"\r\n        );\r\n      }\r\n    }\r\n    return chat_template;\r\n  }\r\n\r\n  /**\r\n   * Converts a list of message objects with `\"role\"` and `\"content\"` keys to a list of token\r\n   * ids. This method is intended for use with chat models, and will read the tokenizer's chat_template attribute to\r\n   * determine the format and control tokens to use when converting.\r\n   *\r\n   * See [here](https://huggingface.co/docs/transformers/chat_templating) for more information.\r\n   *\r\n   * **Example:** Applying a chat template to a conversation.\r\n   *\r\n   * ```javascript\r\n   * import { AutoTokenizer } from \"@huggingface/transformers\";\r\n   *\r\n   * const tokenizer = await AutoTokenizer.from_pretrained(\"Xenova/mistral-tokenizer-v1\");\r\n   *\r\n   * const chat = [\r\n   *   { \"role\": \"user\", \"content\": \"Hello, how are you?\" },\r\n   *   { \"role\": \"assistant\", \"content\": \"I'm doing great. How can I help you today?\" },\r\n   *   { \"role\": \"user\", \"content\": \"I'd like to show off how chat templating works!\" },\r\n   * ]\r\n   *\r\n   * const text = tokenizer.apply_chat_template(chat, { tokenize: false });\r\n   * // \"<s>[INST] Hello, how are you? [/INST]I'm doing great. How can I help you today?</s> [INST] I'd like to show off how chat templating works! [/INST]\"\r\n   *\r\n   * const input_ids = tokenizer.apply_chat_template(chat, { tokenize: true, return_tensor: false });\r\n   * // [1, 733, 16289, 28793, 22557, 28725, 910, 460, 368, 28804, 733, 28748, 16289, 28793, 28737, 28742, 28719, 2548, 1598, 28723, 1602, 541, 315, 1316, 368, 3154, 28804, 2, 28705, 733, 16289, 28793, 315, 28742, 28715, 737, 298, 1347, 805, 910, 10706, 5752, 1077, 3791, 28808, 733, 28748, 16289, 28793]\r\n   * ```\r\n   *\r\n   * @param {Message[]} conversation A list of message objects with `\"role\"` and `\"content\"` keys,\r\n   * representing the chat history so far.\r\n   * @param {Object} options An optional object containing the following properties:\r\n   * @param {string} [options.chat_template=null] A Jinja template to use for this conversion. If\r\n   * this is not passed, the model's chat template will be used instead.\r\n   * @param {Object[]} [options.tools=null]\r\n   * A list of tools (callable functions) that will be accessible to the model. If the template does not\r\n   * support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema,\r\n   * giving the name, description and argument types for the tool. See our\r\n   * [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use)\r\n   * for more information.\r\n   * @param {Record<string, string>[]} [options.documents=null]\r\n   * A list of dicts representing documents that will be accessible to the model if it is performing RAG\r\n   * (retrieval-augmented generation). If the template does not support RAG, this argument will have no\r\n   * effect. We recommend that each document should be a dict containing \"title\" and \"text\" keys. Please\r\n   * see the RAG section of the [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#arguments-for-RAG)\r\n   * for examples of passing documents with chat templates.\r\n   * @param {boolean} [options.add_generation_prompt=false] Whether to end the prompt with the token(s) that indicate\r\n   * the start of an assistant message. This is useful when you want to generate a response from the model.\r\n   * Note that this argument will be passed to the chat template, and so it must be supported in the\r\n   * template for this argument to have any effect.\r\n   * @param {boolean} [options.tokenize=true] Whether to tokenize the output. If false, the output will be a string.\r\n   * @param {boolean} [options.padding=false] Whether to pad sequences to the maximum length. Has no effect if tokenize is false.\r\n   * @param {boolean} [options.truncation=false] Whether to truncate sequences to the maximum length. Has no effect if tokenize is false.\r\n   * @param {number} [options.max_length=null] Maximum length (in tokens) to use for padding or truncation. Has no effect if tokenize is false.\r\n   * If not specified, the tokenizer's `max_length` attribute will be used as a default.\r\n   * @param {boolean} [options.return_tensor=false] Whether to return the output as a Tensor or an Array. Has no effect if tokenize is false.\r\n   * @param {boolean} [options.return_dict=true] Whether to return a dictionary with named outputs. Has no effect if tokenize is false.\r\n   * @param {Object} [options.tokenizer_kwargs={}] Additional options to pass to the tokenizer.\r\n   * @returns {string | Tensor | number[]| number[][]|BatchEncoding} The tokenized output.\r\n   */\r\n  apply_chat_template(\r\n    conversation,\r\n    {\r\n      tools = null,\r\n      documents = null,\r\n      chat_template = null,\r\n      add_generation_prompt = false,\r\n      tokenize = true,\r\n      padding = false,\r\n      truncation = false,\r\n      max_length = null,\r\n      return_tensor = false,\r\n      return_dict = false,\r\n      tokenizer_kwargs = {},\r\n      ...kwargs\r\n    } = {}\r\n  ) {\r\n    chat_template = this.get_chat_template({ chat_template, tools });\r\n\r\n    if (typeof chat_template !== \"string\") {\r\n      throw Error(\r\n        `chat_template must be a string, but got ${typeof chat_template}`\r\n      );\r\n    }\r\n\r\n    // Compilation function uses a cache to avoid recompiling the same template\r\n    let compiledTemplate = this._compiled_template_cache.get(chat_template);\r\n    if (compiledTemplate === undefined) {\r\n      compiledTemplate = new Template(chat_template);\r\n      this._compiled_template_cache.set(chat_template, compiledTemplate);\r\n    }\r\n\r\n    const special_tokens_map = Object.create(null);\r\n    for (const key of SPECIAL_TOKEN_ATTRIBUTES) {\r\n      const value = this.getToken(key);\r\n      if (value) {\r\n        special_tokens_map[key] = value;\r\n      }\r\n    }\r\n\r\n    const rendered = compiledTemplate.render({\r\n      messages: conversation,\r\n      add_generation_prompt,\r\n      tools,\r\n      documents,\r\n      ...special_tokens_map,\r\n      ...kwargs,\r\n    });\r\n\r\n    if (tokenize) {\r\n      const out = this._call(rendered, {\r\n        add_special_tokens: false,\r\n        padding,\r\n        truncation,\r\n        max_length,\r\n        return_tensor,\r\n        ...tokenizer_kwargs,\r\n      });\r\n      return return_dict ? out : out.input_ids;\r\n    }\r\n\r\n    return rendered;\r\n  }\r\n}\r\n\r\n/**\r\n * BertTokenizer is a class used to tokenize text for BERT models.\r\n * @extends PreTrainedTokenizer\r\n */\r\nexport class BertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\n/**\r\n * Albert tokenizer\r\n * @extends PreTrainedTokenizer\r\n */\r\nexport class AlbertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class MobileBertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class SqueezeBertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class DebertaTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class DebertaV2Tokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class HerbertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class ConvBertTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class RoFormerTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\nexport class DistilBertTokenizer extends PreTrainedTokenizer {}\r\nexport class CamembertTokenizer extends PreTrainedTokenizer {}\r\nexport class XLMTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n    console.warn(\r\n      'WARNING: `XLMTokenizer` is not yet supported by Hugging Face\\'s \"fast\" tokenizers library. Therefore, you may experience slightly inaccurate results.'\r\n    );\r\n  }\r\n}\r\nexport class ElectraTokenizer extends PreTrainedTokenizer {\r\n  return_token_type_ids = true;\r\n}\r\n\r\nexport class T5Tokenizer extends PreTrainedTokenizer {}\r\nexport class GPT2Tokenizer extends PreTrainedTokenizer {}\r\nexport class BartTokenizer extends PreTrainedTokenizer {}\r\nexport class MBartTokenizer extends PreTrainedTokenizer {\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    this.languageRegex = /^[a-z]{2}_[A-Z]{2}$/;\r\n    this.language_codes = this.special_tokens.filter((x) =>\r\n      this.languageRegex.test(x)\r\n    );\r\n    this.lang_to_token = (x) => x; // Identity function\r\n  }\r\n\r\n  /**\r\n   * Helper function to build translation inputs for an `MBartTokenizer`.\r\n   * @param {string|string[]} raw_inputs The text to tokenize.\r\n   * @param {Object} tokenizer_options Options to be sent to the tokenizer\r\n   * @param {Object} generate_kwargs Generation options.\r\n   * @returns {Object} Object to be passed to the model.\r\n   */\r\n  _build_translation_inputs(raw_inputs, tokenizer_options, generate_kwargs) {\r\n    return _build_translation_inputs(\r\n      this,\r\n      raw_inputs,\r\n      tokenizer_options,\r\n      generate_kwargs\r\n    );\r\n  }\r\n}\r\nexport class MBart50Tokenizer extends MBartTokenizer {} // NOTE: extends MBartTokenizer\r\n\r\nexport class RobertaTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class BloomTokenizer extends PreTrainedTokenizer {}\r\n\r\nconst SPIECE_UNDERLINE = \"▁\";\r\n\r\nexport class LlamaTokenizer extends PreTrainedTokenizer {\r\n  padding_side = \"left\";\r\n\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    this.legacy = tokenizerConfig.legacy ?? true;\r\n    if (!this.legacy) {\r\n      // See https://github.com/huggingface/transformers/pull/24565 for more information\r\n      this.normalizer = null;\r\n      this.pre_tokenizer = new MetaspacePreTokenizer({\r\n        replacement: SPIECE_UNDERLINE,\r\n        add_prefix_space: true,\r\n        prepend_scheme: \"first\",\r\n      });\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Helper function to handle legacy encoding of SPM tokenizers.\r\n   * Adapted from https://github.com/huggingface/transformers/blob/e6dcf8abd6f65bb4b6dfc1831b20d9ba49ce00e2/src/transformers/models/t5/tokenization_t5.py#L374-L387\r\n   * @param {string} text The text to encode.\r\n   * @returns {string[]} The encoded tokens.\r\n   */\r\n  _encode_text(text) {\r\n    if (text === null) return null;\r\n\r\n    if (this.legacy || text.length === 0) {\r\n      return super._encode_text(text);\r\n    }\r\n\r\n    let tokens = super._encode_text(\r\n      SPIECE_UNDERLINE + text.replaceAll(SPIECE_UNDERLINE, \" \")\r\n    );\r\n    if (\r\n      tokens.length > 1 &&\r\n      tokens[0] === SPIECE_UNDERLINE &&\r\n      this.special_tokens.includes(tokens[1])\r\n    ) {\r\n      tokens = tokens.slice(1);\r\n    }\r\n    return tokens;\r\n  }\r\n}\r\nexport class CodeLlamaTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class XLMRobertaTokenizer extends PreTrainedTokenizer {}\r\nexport class MPNetTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class FalconTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class GPTNeoXTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class EsmTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class Qwen2Tokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class GemmaTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class Grok1Tokenizer extends PreTrainedTokenizer {}\r\n\r\n/**\r\n * Helper function to build translation inputs for an `NllbTokenizer` or `M2M100Tokenizer`.\r\n * @param {PreTrainedTokenizer} self The tokenizer instance.\r\n * @param {string|string[]} raw_inputs The text to tokenize.\r\n * @param {Object} tokenizer_options Options to be sent to the tokenizer\r\n * @param {Object} generate_kwargs Generation options.\r\n * @returns {Object} Object to be passed to the model.\r\n * @private\r\n */\r\nfunction _build_translation_inputs(\r\n  self,\r\n  raw_inputs,\r\n  tokenizer_options,\r\n  generate_kwargs\r\n) {\r\n  if (!(\"language_codes\" in self) || !Array.isArray(self.language_codes)) {\r\n    throw new Error(\r\n      \"Tokenizer must have `language_codes` attribute set and it should be an array of language ids.\"\r\n    );\r\n  }\r\n  if (!(\"languageRegex\" in self) || !(self.languageRegex instanceof RegExp)) {\r\n    throw new Error(\r\n      \"Tokenizer must have `languageRegex` attribute set and it should be a regular expression.\"\r\n    );\r\n  }\r\n  if (!(\"lang_to_token\" in self) || typeof self.lang_to_token !== \"function\") {\r\n    throw new Error(\r\n      \"Tokenizer must have `lang_to_token` attribute set and it should be a function.\"\r\n    );\r\n  }\r\n  const src_lang_token = generate_kwargs.src_lang;\r\n  const tgt_lang_token = generate_kwargs.tgt_lang;\r\n\r\n  // Check that the target language is valid:\r\n  if (!self.language_codes.includes(tgt_lang_token)) {\r\n    throw new Error(\r\n      `Target language code \"${tgt_lang_token}\" is not valid. Must be one of: {${self.language_codes.join(\r\n        \", \"\r\n      )}}`\r\n    );\r\n  }\r\n\r\n  // Allow `src_lang` to be optional. If not set, we'll use the tokenizer's default.\r\n  if (src_lang_token !== undefined) {\r\n    // Check that the source language is valid:\r\n    if (!self.language_codes.includes(src_lang_token)) {\r\n      throw new Error(\r\n        `Source language code \"${src_lang_token}\" is not valid. Must be one of: {${self.language_codes.join(\r\n          \", \"\r\n        )}}`\r\n      );\r\n    }\r\n\r\n    // In the same way as the Python library, we override the post-processor\r\n    // to force the source language to be first:\r\n    for (const item of self.post_processor.config.single) {\r\n      if (\r\n        \"SpecialToken\" in item &&\r\n        self.languageRegex.test(item.SpecialToken.id)\r\n      ) {\r\n        item.SpecialToken.id = self.lang_to_token(src_lang_token);\r\n        break;\r\n      }\r\n    }\r\n    // TODO: Do the same for pair?\r\n  }\r\n\r\n  // Override the `forced_bos_token_id` to force the correct language\r\n  generate_kwargs.forced_bos_token_id = self.model.convert_tokens_to_ids([\r\n    self.lang_to_token(tgt_lang_token),\r\n  ])[0];\r\n\r\n  return self._call(raw_inputs, tokenizer_options);\r\n}\r\n\r\n/**\r\n * The NllbTokenizer class is used to tokenize text for NLLB (\"No Language Left Behind\") models.\r\n *\r\n * No Language Left Behind (NLLB) is a first-of-its-kind, AI breakthrough project\r\n * that open-sources models capable of delivering high-quality translations directly\r\n * between any pair of 200+ languages — including low-resource languages like Asturian,\r\n * Luganda, Urdu and more. It aims to help people communicate with anyone, anywhere,\r\n * regardless of their language preferences. For more information, check out their\r\n * [paper](https://huggingface.co/papers/2207.04672).\r\n *\r\n * For a list of supported languages (along with their language codes),\r\n * @see {@link https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200}\r\n */\r\nexport class NllbTokenizer extends PreTrainedTokenizer {\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    this.languageRegex = /^[a-z]{3}_[A-Z][a-z]{3}$/;\r\n    this.language_codes = this.special_tokens.filter((x) =>\r\n      this.languageRegex.test(x)\r\n    );\r\n    this.lang_to_token = (x) => x; // Identity function\r\n  }\r\n\r\n  /**\r\n   * Helper function to build translation inputs for an `NllbTokenizer`.\r\n   * @param {string|string[]} raw_inputs The text to tokenize.\r\n   * @param {Object} tokenizer_options Options to be sent to the tokenizer\r\n   * @param {Object} generate_kwargs Generation options.\r\n   * @returns {Object} Object to be passed to the model.\r\n   */\r\n  _build_translation_inputs(raw_inputs, tokenizer_options, generate_kwargs) {\r\n    return _build_translation_inputs(\r\n      this,\r\n      raw_inputs,\r\n      tokenizer_options,\r\n      generate_kwargs\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * The M2M100Tokenizer class is used to tokenize text for M2M100 (\"Many-to-Many\") models.\r\n *\r\n * M2M100 is a multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many\r\n * multilingual translation. It was introduced in this [paper](https://huggingface.co/papers/2010.11125)\r\n * and first released in [this](https://github.com/pytorch/fairseq/tree/master/examples/m2m_100) repository.\r\n *\r\n * For a list of supported languages (along with their language codes),\r\n * @see {@link https://huggingface.co/facebook/m2m100_418M#languages-covered}\r\n */\r\nexport class M2M100Tokenizer extends PreTrainedTokenizer {\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    this.languageRegex = /^__[a-z]{2,3}__$/;\r\n    this.language_codes = this.special_tokens\r\n      .filter((x) => this.languageRegex.test(x))\r\n      .map((x) => x.slice(2, -2));\r\n    this.lang_to_token = (x) => `__${x}__`;\r\n  }\r\n\r\n  /**\r\n   * Helper function to build translation inputs for an `M2M100Tokenizer`.\r\n   * @param {string|string[]} raw_inputs The text to tokenize.\r\n   * @param {Object} tokenizer_options Options to be sent to the tokenizer\r\n   * @param {Object} generate_kwargs Generation options.\r\n   * @returns {Object} Object to be passed to the model.\r\n   */\r\n  _build_translation_inputs(raw_inputs, tokenizer_options, generate_kwargs) {\r\n    return _build_translation_inputs(\r\n      this,\r\n      raw_inputs,\r\n      tokenizer_options,\r\n      generate_kwargs\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * WhisperTokenizer tokenizer\r\n * @extends PreTrainedTokenizer\r\n */\r\nexport class WhisperTokenizer extends PreTrainedTokenizer {\r\n  get timestamp_begin() {\r\n    return this.model.convert_tokens_to_ids([\"<|notimestamps|>\"])[0] + 1;\r\n  }\r\n\r\n  /**\r\n   * Decodes automatic speech recognition (ASR) sequences.\r\n   * @param {Array<{tokens: bigint[], token_timestamps?: number[], stride: number[]}>} sequences The sequences to decode.\r\n   * @param {Record<string, any>} options The options to use for decoding.\r\n   * @returns {Array<string|{chunks?: undefined|Array<{language: string|null, timestamp: Array<number|null>, text: string}>}>} The decoded sequences.\r\n   */\r\n  _decode_asr(\r\n    sequences,\r\n    {\r\n      return_timestamps = false,\r\n      return_language = false,\r\n      time_precision = null,\r\n      force_full_sequences = true,\r\n    } = {}\r\n  ) {\r\n    // Set force_full_sequences=false if you want streaming\r\n    // TODO add support for `return_language`\r\n\r\n    // Internal method meant to only be used by asr pipeline.\r\n    // Handles all the little quirks specific to whisper to handle\r\n    // the various options not allowed in other seq2seq models\r\n\r\n    // =========== Overview ============\r\n    // - iterate over all outputs\r\n    // - all tokens within output\r\n    // - Each token can be\r\n    //   - language token\r\n    //   - special token\r\n    //   - timestamp token\r\n    //   - text token\r\n    // - We accumulate the text tokens.\r\n    // - We split on end timestamps\r\n    // - Lots of complexity comes from stride and timestamps\r\n\r\n    if (time_precision === null) {\r\n      throw Error(\"Must specify time_precision\");\r\n    }\r\n    let last_language = null;\r\n\r\n    const returnWordTimestamps = return_timestamps === \"word\";\r\n\r\n    function new_chunk() {\r\n      return { language: last_language, timestamp: [null, null], text: \"\" };\r\n    }\r\n\r\n    // Welcome to the state machine!\r\n    const chunks = [];\r\n    let chunk = new_chunk();\r\n    let time_offset = 0.0;\r\n    const timestamp_begin = this.timestamp_begin;\r\n    // Whisper timestamp tokens start from 0.00 and go to timestamp 30.00 in 0.02 increments.\r\n    // We can calculate the last time stamp token as timestamp_begin plus the number of tokens\r\n    // tokens from 0.00 to 30.00 which is 1500.\r\n    const total_timestamp_tokens = 1500; // (30.00 - 0.00) / 0.02\r\n    const timestamp_end = timestamp_begin + total_timestamp_tokens;\r\n\r\n    let previous_tokens = [];\r\n    let previous_token_timestamps = [];\r\n\r\n    let skip = false;\r\n    let right_stride_start = null;\r\n\r\n    const all_special_ids = new Set(this.all_special_ids);\r\n\r\n    for (const output of sequences) {\r\n      // NOTE: python version has batches, so it uses [0]\r\n      const token_ids = output.tokens;\r\n      const token_timestamps = returnWordTimestamps\r\n        ? output.token_timestamps\r\n        : null;\r\n\r\n      // These keep track of timestamps within strides, which need\r\n      // to be skipped and resolve all tokens in a single chunk.\r\n      let last_timestamp = null;\r\n      let first_timestamp = timestamp_begin;\r\n\r\n      if (\"stride\" in output) {\r\n        const [chunk_len, stride_left, stride_right] = output.stride;\r\n\r\n        // Offset the timings to account for the other `model_outputs`.\r\n        time_offset -= stride_left;\r\n        right_stride_start = chunk_len - stride_right;\r\n\r\n        // Keeping track of timestamps within strides\r\n        // We're going to NOT split on those, and delay until we're\r\n        // out of BOTH stride. Otherwise lots of issues occur and\r\n        // corner cases\r\n        if (stride_left) {\r\n          first_timestamp = stride_left / time_precision + timestamp_begin;\r\n        }\r\n\r\n        if (stride_right) {\r\n          for (let i = token_ids.length - 1; i >= 0; --i) {\r\n            const token = Number(token_ids[i]);\r\n            if (token >= timestamp_begin) {\r\n              // There can be several token in the right stride\r\n              // But the last one is ALWAYS going to be skipped\r\n              if (\r\n                last_timestamp !== null &&\r\n                (token - timestamp_begin) * time_precision < right_stride_start\r\n              ) {\r\n                break;\r\n              }\r\n              last_timestamp = token;\r\n            }\r\n          }\r\n        }\r\n      }\r\n\r\n      let current_tokens = [];\r\n      let current_token_timestamps = [];\r\n\r\n      // - all tokens within output\r\n      for (let i = 0; i < token_ids.length; ++i) {\r\n        const token = Number(token_ids[i]);\r\n        // 4 possible states for each token\r\n        // - 1/ Language code\r\n        // - 2/ all other special tokens (which we ignore)\r\n        // - 3/ Timestamp\r\n        // - 4/ Regular text\r\n\r\n        if (all_special_ids.has(token)) {\r\n          const text = this.decode([token]);\r\n          const language = WHISPER_LANGUAGE_MAPPING.get(text.slice(2, -2));\r\n\r\n          if (language !== undefined) {\r\n            // 1/ Indeed some language\r\n            // TODO Handle when language is different from the previous\r\n            // one, and we cannot use timestamped tokens to create chunks\r\n            if (\r\n              last_language !== null &&\r\n              language !== last_language &&\r\n              !return_timestamps\r\n            ) {\r\n              previous_tokens.push(current_tokens);\r\n              const resolved_tokens =\r\n                this.findLongestCommonSequence(previous_tokens)[0];\r\n              const resolved_text = this.decode(resolved_tokens);\r\n              chunk.text = resolved_text;\r\n              chunks.push(chunk);\r\n\r\n              // Flush all our temporary context\r\n              previous_tokens = [];\r\n              current_tokens = [];\r\n              chunk = new_chunk();\r\n            }\r\n\r\n            last_language = chunk.language = language;\r\n          } else {\r\n            // 2/ This is a regular special token, ignoring it\r\n          }\r\n        } else if (token >= timestamp_begin && token <= timestamp_end) {\r\n          // 3/ Timestamp token\r\n          const time = (token - timestamp_begin) * time_precision + time_offset;\r\n          const rounded_time = round(time, 2);\r\n\r\n          if (last_timestamp !== null && token >= last_timestamp) {\r\n            // Whisper outputted a timestamp token, but it falls within\r\n            // our stride, so we're going to skip it for the time being\r\n            // and resolve this later\r\n            // Skip is necessary because timestamp tokens always come\r\n            // by pair, so we need to skip the next one too (which would mark the start of another chunk).\r\n            skip = true;\r\n          } else if (\r\n            skip ||\r\n            (previous_tokens.length > 0 && token < first_timestamp)\r\n          ) {\r\n            skip = false;\r\n          } else if (chunk.timestamp[0] === null) {\r\n            chunk.timestamp[0] = rounded_time;\r\n          } else {\r\n            // This is the end of the timestamp chunk\r\n            if (rounded_time === chunk.timestamp[0]) {\r\n              // This is a bug in timestamp token output\r\n              // where we're taking the duplicate token\r\n              // as a stop where it should be a start.\r\n              // This is an issue in the underlying model output\r\n              // Let's just skip it so it becomes de-factor a start agin\r\n            } else {\r\n              chunk.timestamp[1] = rounded_time;\r\n\r\n              // Handling merges\r\n              previous_tokens.push(current_tokens);\r\n\r\n              if (returnWordTimestamps) {\r\n                previous_token_timestamps.push(current_token_timestamps);\r\n              }\r\n              const [resolved_tokens, resolved_token_timestamps] =\r\n                this.findLongestCommonSequence(\r\n                  previous_tokens,\r\n                  previous_token_timestamps\r\n                );\r\n\r\n              const resolved_text = this.decode(resolved_tokens);\r\n              chunk.text = resolved_text;\r\n\r\n              if (returnWordTimestamps) {\r\n                chunk.words = this.collateWordTimestamps(\r\n                  resolved_tokens,\r\n                  resolved_token_timestamps,\r\n                  last_language\r\n                );\r\n              }\r\n\r\n              chunks.push(chunk);\r\n\r\n              // Flush all our temporary context\r\n              previous_tokens = [];\r\n              current_tokens = [];\r\n              previous_token_timestamps = [];\r\n              current_token_timestamps = [];\r\n              chunk = new_chunk();\r\n            }\r\n          }\r\n        } else {\r\n          // 4/ Regular token\r\n          // We just append to the list of all tokens so we can handle\r\n          // merges later and decode into text.\r\n          current_tokens.push(token);\r\n\r\n          if (returnWordTimestamps) {\r\n            let start_time = round(token_timestamps[i] + time_offset, 2);\r\n\r\n            let end_time;\r\n            if (i + 1 < token_timestamps.length) {\r\n              end_time = round(token_timestamps[i + 1] + time_offset, 2);\r\n\r\n              // Do not allow punctuation-only tokens to have a duration.\r\n              // This prevents long pauses from messing up the timestamps.\r\n              const decoded_text = this.decode([token]);\r\n              if (PUNCTUATION_ONLY_REGEX.test(decoded_text)) {\r\n                // Add `time_precision` to avoid overlapping timestamps\r\n                end_time = round(\r\n                  Math.min(start_time + time_precision, end_time),\r\n                  2\r\n                );\r\n              }\r\n            } else {\r\n              // should never happen\r\n              end_time = null;\r\n            }\r\n            current_token_timestamps.push([start_time, end_time]);\r\n          }\r\n        }\r\n      }\r\n\r\n      if (\"stride\" in output) {\r\n        const [chunk_len, stride_left, stride_right] = output.stride;\r\n        time_offset += chunk_len - stride_right;\r\n      }\r\n\r\n      // Leftover tokens\r\n      if (current_tokens.length > 0) {\r\n        previous_tokens.push(current_tokens);\r\n        if (returnWordTimestamps) {\r\n          previous_token_timestamps.push(current_token_timestamps);\r\n        }\r\n      } else if (previous_tokens.every((p) => p.length === 0)) {\r\n        // Flushing previous tokens (END)\"\r\n        chunk = new_chunk();\r\n        previous_tokens = [];\r\n        current_tokens = [];\r\n        previous_token_timestamps = [];\r\n        current_token_timestamps = [];\r\n      }\r\n    }\r\n\r\n    if (previous_tokens.length > 0) {\r\n      if (force_full_sequences && return_timestamps) {\r\n        // Last token should always be timestamps, so there shouldn't be\r\n        // leftover\r\n        throw new Error(\r\n          \"Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. \" +\r\n            \"Also make sure WhisperTimeStampLogitsProcessor was used during generation.\"\r\n        );\r\n      }\r\n\r\n      // Happens when we don't use timestamps\r\n      const [resolved_tokens, resolved_token_timestamps] =\r\n        this.findLongestCommonSequence(\r\n          previous_tokens,\r\n          previous_token_timestamps\r\n        );\r\n\r\n      // Flushing previous tokens (FINAL)\r\n      const resolved_text = this.decode(resolved_tokens);\r\n      chunk.text = resolved_text;\r\n      if (returnWordTimestamps) {\r\n        chunk.words = this.collateWordTimestamps(\r\n          resolved_tokens,\r\n          resolved_token_timestamps,\r\n          last_language\r\n        );\r\n      }\r\n      chunks.push(chunk);\r\n    }\r\n\r\n    let optional = Object.create(null);\r\n\r\n    // Preparing and cleaning up the pipeline output\r\n    const full_text = chunks.map((chunk) => chunk.text).join(\"\");\r\n    if (return_timestamps || return_language) {\r\n      for (let i = 0; i < chunks.length; ++i) {\r\n        const chunk = chunks[i];\r\n        if (!return_timestamps) {\r\n          delete chunk[\"timestamp\"];\r\n        }\r\n\r\n        if (!return_language) {\r\n          delete chunk[\"language\"];\r\n        }\r\n      }\r\n      if (returnWordTimestamps) {\r\n        const new_chunks = [];\r\n        for (const chunk of chunks) {\r\n          for (const word of chunk.words) {\r\n            new_chunks.push(word);\r\n          }\r\n        }\r\n        optional = { chunks: new_chunks };\r\n      } else {\r\n        optional = { chunks: chunks };\r\n      }\r\n    }\r\n    return [full_text, optional];\r\n  }\r\n\r\n  /**\r\n   * Finds the longest common sequence among the provided sequences.\r\n   * @param {number[][]} sequences An array of sequences of token ids to compare.\r\n   * @returns {number[][]} The longest common sequence found.\r\n   * @throws {Error} If there is a bug within the function.\r\n   * @private\r\n   */\r\n  findLongestCommonSequence(sequences, token_timestamp_sequences = null) {\r\n    // It would be much harder to do O(n) because of fault tolerance.\r\n    // We actually have a really good property which is that the total sequence\r\n    // MUST be those subsequences in order.\r\n    // If token_timestamp_sequences is provided, will split those sequences in\r\n    // exactly the same way.\r\n    let leftSequence = sequences[0];\r\n    let leftLength = leftSequence.length;\r\n    let totalSequence = [];\r\n\r\n    const use_token_timestamp_sequences =\r\n      Array.isArray(token_timestamp_sequences) &&\r\n      token_timestamp_sequences.length > 0;\r\n    let total_token_timestamp_sequence = use_token_timestamp_sequences\r\n      ? []\r\n      : null;\r\n    let left_token_timestamp_sequence = use_token_timestamp_sequences\r\n      ? token_timestamp_sequences[0]\r\n      : null;\r\n    for (let i = 1; i < sequences.length; ++i) {\r\n      const rightSequence = sequences[i];\r\n      let max = 0.0;\r\n      let maxIndices = [leftLength, leftLength, 0, 0];\r\n      // Here we're sliding matches\r\n      // [a, b, c, d]\r\n      //          [c, d, f]\r\n      // =        [c] == [d]\r\n\r\n      // [a, b, c, d]\r\n      //       [c, d, f]\r\n      // =     [c, d] == [c, d]\r\n\r\n      // [a, b, c, d]\r\n      //    [c, d, f]\r\n\r\n      // =  [b, c, d] == [c, d, f]\r\n\r\n      // [a, b, c, d]\r\n      // [c, d, f]\r\n\r\n      // [a, b, c] == [c, d, f]\r\n\r\n      // [a, b, c, d]\r\n      // [d, f]\r\n\r\n      // [a, b] == [d, f]\r\n\r\n      // [a, b, c, d]\r\n      // [f]\r\n\r\n      // [a] == [f]\r\n\r\n      const rightLength = rightSequence.length;\r\n      for (let j = 1; j < leftLength + rightLength; ++j) {\r\n        // Slightly convoluted because we don't want out of bound indices\r\n        // This will be necessary for a small conflict resolution optimization\r\n        // later\r\n        const leftStart = Math.max(0, leftLength - j);\r\n        const leftStop = Math.min(leftLength, leftLength + rightLength - j);\r\n        const left = leftSequence.slice(leftStart, leftStop);\r\n        const rightStart = Math.max(0, j - leftLength);\r\n        const rightStop = Math.min(rightLength, j);\r\n        const right = rightSequence.slice(rightStart, rightStop);\r\n        if (left.length !== right.length) {\r\n          throw new Error(\r\n            \"There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.\"\r\n          );\r\n        }\r\n\r\n        let matches;\r\n        if (use_token_timestamp_sequences) {\r\n          // Get length of longest subsequence of tokens that match\r\n          // and have timestamps that are in order\r\n          matches = left.filter(\r\n            (elem, idx) =>\r\n              elem === right[idx] &&\r\n              left_token_timestamp_sequence[leftStart + idx] <=\r\n                token_timestamp_sequences[i][rightStart + idx]\r\n          ).length;\r\n        } else {\r\n          matches = left.filter((elem, idx) => elem === right[idx]).length;\r\n        }\r\n\r\n        // epsilon to favor long perfect matches\r\n        const eps = j / 10000.0;\r\n        const matching = matches / j + eps;\r\n        if (matches > 1 && matching > max) {\r\n          max = matching;\r\n          maxIndices = [leftStart, leftStop, rightStart, rightStop];\r\n        }\r\n      }\r\n      const [leftStart, leftStop, rightStart, rightStop] = maxIndices;\r\n      const leftMid = Math.floor((leftStop + leftStart) / 2);\r\n      const rightMid = Math.floor((rightStop + rightStart) / 2);\r\n      totalSequence.push(...leftSequence.slice(0, leftMid));\r\n      leftSequence = rightSequence.slice(rightMid);\r\n      leftLength = leftSequence.length;\r\n\r\n      if (use_token_timestamp_sequences) {\r\n        total_token_timestamp_sequence.push(\r\n          ...left_token_timestamp_sequence.slice(0, leftMid)\r\n        );\r\n        left_token_timestamp_sequence =\r\n          token_timestamp_sequences[i].slice(rightMid);\r\n      }\r\n    }\r\n    totalSequence.push(...leftSequence);\r\n\r\n    if (use_token_timestamp_sequences) {\r\n      total_token_timestamp_sequence.push(...left_token_timestamp_sequence);\r\n      return [totalSequence, total_token_timestamp_sequence];\r\n    } else {\r\n      return [totalSequence, []];\r\n    }\r\n  }\r\n\r\n  /** @private */\r\n  collateWordTimestamps(tokens, token_timestamps, language) {\r\n    const [words, _, token_indices] = this.combineTokensIntoWords(\r\n      tokens,\r\n      language\r\n    );\r\n\r\n    const timings = [];\r\n    for (let i = 0; i < words.length; ++i) {\r\n      const indices = token_indices[i];\r\n      timings.push({\r\n        text: words[i],\r\n        timestamp: [\r\n          token_timestamps[indices.at(0)][0],\r\n          token_timestamps[indices.at(-1)][1],\r\n        ],\r\n      });\r\n    }\r\n    return timings;\r\n  }\r\n\r\n  /**\r\n   * Groups tokens by word. Returns a tuple containing a list of strings with the words,\r\n   * and a list of `token_id` sequences with the tokens making up each word.\r\n   * @param {number[]} tokens\r\n   * @param {string} [language]\r\n   * @param {string} prepend_punctionations\r\n   * @param {string} append_punctuations\r\n   *\r\n   * @private\r\n   */\r\n  combineTokensIntoWords(\r\n    tokens,\r\n    language,\r\n    prepend_punctionations = \"\\\"'“¡¿([{-\",\r\n    append_punctuations = \"\\\"'.。,，!！?？:：”)]}、\"\r\n  ) {\r\n    language = language ?? \"english\";\r\n\r\n    let words, word_tokens, token_indices;\r\n\r\n    if ([\"chinese\", \"japanese\", \"thai\", \"lao\", \"myanmar\"].includes(language)) {\r\n      // These languages don't typically use spaces.\r\n      [words, word_tokens, token_indices] = this.splitTokensOnUnicode(tokens);\r\n    } else {\r\n      [words, word_tokens, token_indices] = this.splitTokensOnSpaces(tokens);\r\n    }\r\n\r\n    return this.mergePunctuations(\r\n      words,\r\n      word_tokens,\r\n      token_indices,\r\n      prepend_punctionations,\r\n      append_punctuations\r\n    );\r\n  }\r\n\r\n  /** @type {PreTrainedTokenizer['decode']} */\r\n  decode(token_ids, decode_args) {\r\n    let text;\r\n    // @ts-ignore\r\n    if (decode_args?.decode_with_timestamps) {\r\n      if (token_ids instanceof Tensor) {\r\n        token_ids = prepareTensorForDecode(token_ids);\r\n      }\r\n      text = this.decodeWithTimestamps(token_ids, decode_args);\r\n    } else {\r\n      text = super.decode(token_ids, decode_args);\r\n    }\r\n    // TODO: implement offsets\r\n    // if (decode_args.output_offsets) {\r\n    //     let offsets = this.computeOffsets\r\n    // }\r\n    return text;\r\n  }\r\n\r\n  /**\r\n   * @param {number[]|bigint[]} token_ids List of token IDs to decode.\r\n   * @param {Object} decode_args Optional arguments for decoding\r\n   * @private\r\n   */\r\n  decodeWithTimestamps(token_ids, decode_args) {\r\n    const time_precision = decode_args?.time_precision ?? 0.02;\r\n\r\n    const timestamp_begin = Array.from(this.all_special_ids).at(-1) + 1;\r\n    /**@type {Array} */\r\n    let outputs = [[]];\r\n    for (let token of token_ids) {\r\n      token = Number(token);\r\n      if (token >= timestamp_begin) {\r\n        const timestamp = ((token - timestamp_begin) * time_precision).toFixed(\r\n          2\r\n        );\r\n        outputs.push(`<|${timestamp}|>`);\r\n        outputs.push([]);\r\n      } else {\r\n        outputs[outputs.length - 1].push(token);\r\n      }\r\n    }\r\n    outputs = outputs.map((s) =>\r\n      typeof s === \"string\" ? s : super.decode(s, decode_args)\r\n    );\r\n\r\n    return outputs.join(\"\");\r\n  }\r\n\r\n  /**\r\n   * Combine tokens into words by splitting at any position where the tokens are decoded as valid unicode points.\r\n   * @param {number[]} tokens\r\n   * @returns {*}\r\n   * @private\r\n   */\r\n  splitTokensOnUnicode(tokens) {\r\n    const decoded_full = this.decode(tokens, {\r\n      // @ts-ignore\r\n      decode_with_timestamps: true,\r\n    });\r\n    const replacement_char = \"\\uFFFD\";\r\n\r\n    const words = [];\r\n    const word_tokens = [];\r\n    const token_indices = [];\r\n    let current_tokens = [];\r\n    let current_indices = [];\r\n    let unicode_offset = 0;\r\n\r\n    for (let token_idx = 0; token_idx < tokens.length; ++token_idx) {\r\n      const token = tokens[token_idx];\r\n\r\n      current_tokens.push(token);\r\n      current_indices.push(token_idx);\r\n\r\n      const decoded = this.decode(current_tokens, {\r\n        // @ts-ignore\r\n        decode_with_timestamps: true,\r\n      });\r\n\r\n      if (\r\n        !decoded.includes(replacement_char) ||\r\n        decoded_full[unicode_offset + decoded.indexOf(replacement_char)] ===\r\n          replacement_char\r\n      ) {\r\n        words.push(decoded);\r\n        word_tokens.push(current_tokens);\r\n        token_indices.push(current_indices);\r\n        current_tokens = [];\r\n        current_indices = [];\r\n        unicode_offset += decoded.length;\r\n      }\r\n    }\r\n\r\n    return [words, word_tokens, token_indices];\r\n  }\r\n\r\n  /**\r\n   * Combine tokens into words by splitting at whitespace and punctuation tokens.\r\n   * @param {number[]} tokens\r\n   * @private\r\n   */\r\n  splitTokensOnSpaces(tokens) {\r\n    const [subwords, subword_tokens_list, subword_indices_list] =\r\n      this.splitTokensOnUnicode(tokens);\r\n\r\n    const words = [];\r\n    const word_tokens = [];\r\n    const token_indices = [];\r\n\r\n    const punctuationRegex = new RegExp(`^[${PUNCTUATION_REGEX}]$`, \"gu\");\r\n\r\n    for (let i = 0; i < subwords.length; ++i) {\r\n      const subword = subwords[i];\r\n      const subword_tokens = subword_tokens_list[i];\r\n      const subword_indices = subword_indices_list[i];\r\n\r\n      // @ts-ignore\r\n      const special =\r\n        subword_tokens[0] >= this.model.tokens_to_ids.get(\"<|endoftext|>\");\r\n      const with_space = subword.startsWith(\" \");\r\n      const trimmed = subword.trim();\r\n      const punctuation = punctuationRegex.test(trimmed);\r\n\r\n      if (special || with_space || punctuation || words.length === 0) {\r\n        words.push(subword);\r\n        word_tokens.push(subword_tokens);\r\n        token_indices.push(subword_indices);\r\n      } else {\r\n        const ix = words.length - 1;\r\n        words[ix] += subword;\r\n        word_tokens[ix].push(...subword_tokens);\r\n        token_indices[ix].push(...subword_indices);\r\n      }\r\n    }\r\n\r\n    return [words, word_tokens, token_indices];\r\n  }\r\n\r\n  /**\r\n   * Merges punctuation tokens with neighboring words.\r\n   * @param {string[]} words\r\n   * @param {number[][]} tokens\r\n   * @param {number[][]} indices\r\n   * @param {string} prepended\r\n   * @param {string} appended\r\n   * @private\r\n   */\r\n  mergePunctuations(words, tokens, indices, prepended, appended) {\r\n    const newWords = structuredClone(words);\r\n    const newTokens = structuredClone(tokens);\r\n    const newIndices = structuredClone(indices);\r\n\r\n    // prepend punctuations\r\n    let i = newWords.length - 2;\r\n    let j = newWords.length - 1;\r\n\r\n    while (i >= 0) {\r\n      if (\r\n        newWords[i].startsWith(\" \") &&\r\n        prepended.includes(newWords[i].trim())\r\n      ) {\r\n        newWords[j] = newWords[i] + newWords[j];\r\n        newTokens[j] = mergeArrays(newTokens[i], newTokens[j]);\r\n        newIndices[j] = mergeArrays(newIndices[i], newIndices[j]);\r\n        newWords[i] = \"\";\r\n        newTokens[i] = [];\r\n        newIndices[i] = [];\r\n      } else {\r\n        j = i;\r\n      }\r\n      --i;\r\n    }\r\n\r\n    // append punctuations\r\n    i = 0;\r\n    j = 1;\r\n    while (j < newWords.length) {\r\n      if (!newWords[i].endsWith(\" \") && appended.includes(newWords[j])) {\r\n        newWords[i] += newWords[j];\r\n        newTokens[i] = mergeArrays(newTokens[i], newTokens[j]);\r\n        newIndices[i] = mergeArrays(newIndices[i], newIndices[j]);\r\n        newWords[j] = \"\";\r\n        newTokens[j] = [];\r\n        newIndices[j] = [];\r\n      } else {\r\n        i = j;\r\n      }\r\n      ++j;\r\n    }\r\n\r\n    return [\r\n      newWords.filter((x) => x),\r\n      newTokens.filter((x) => x.length > 0),\r\n      newIndices.filter((x) => x.length > 0),\r\n    ];\r\n  }\r\n}\r\nexport class CodeGenTokenizer extends PreTrainedTokenizer {}\r\nexport class CLIPTokenizer extends PreTrainedTokenizer {}\r\nexport class SiglipTokenizer extends PreTrainedTokenizer {}\r\n\r\n/**\r\n * @todo This model is not yet supported by Hugging Face's \"fast\" tokenizers library (https://github.com/huggingface/tokenizers).\r\n * Therefore, this implementation (which is based on fast tokenizers) may produce slightly inaccurate results.\r\n */\r\nexport class MarianTokenizer extends PreTrainedTokenizer {\r\n  /**\r\n   * Create a new MarianTokenizer instance.\r\n   * @param {Object} tokenizerJSON The JSON of the tokenizer.\r\n   * @param {Object} tokenizerConfig The config of the tokenizer.\r\n   */\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    this.languageRegex = /^(>>\\w+<<)\\s*/g;\r\n\r\n    this.supported_language_codes = this.model.vocab.filter((x) =>\r\n      this.languageRegex.test(x)\r\n    );\r\n\r\n    console.warn(\r\n      'WARNING: `MarianTokenizer` is not yet supported by Hugging Face\\'s \"fast\" tokenizers library. Therefore, you may experience slightly inaccurate results.'\r\n    );\r\n  }\r\n\r\n  /**\r\n   * Encodes a single text. Overriding this method is necessary since the language codes\r\n   * must be removed before encoding with sentencepiece model.\r\n   * @see https://github.com/huggingface/transformers/blob/12d51db243a00726a548a43cc333390ebae731e3/src/transformers/models/marian/tokenization_marian.py#L204-L213\r\n   *\r\n   * @param {string|null} text The text to encode.\r\n   * @returns {Array} The encoded tokens.\r\n   */\r\n  _encode_text(text) {\r\n    if (text === null) return null;\r\n\r\n    // Check if text starts with language code:\r\n    const [matchInfo, ...remainder] = text.trim().split(this.languageRegex);\r\n\r\n    if (remainder.length === 0) {\r\n      // No language code, encode normally\r\n      return super._encode_text(matchInfo);\r\n    } else if (remainder.length === 2) {\r\n      // Text starts with language code, so we do not encode it with sentencepiece.\r\n      const [language, text] = remainder;\r\n\r\n      if (!this.supported_language_codes.includes(language)) {\r\n        console.warn(\r\n          `Unsupported language code \"${language}\" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(\r\n            this.supported_language_codes\r\n          )}`\r\n        );\r\n      }\r\n      return mergeArrays([language], super._encode_text(text));\r\n    }\r\n  }\r\n}\r\n\r\nexport class Wav2Vec2CTCTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class BlenderbotTokenizer extends PreTrainedTokenizer {}\r\nexport class BlenderbotSmallTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class SpeechT5Tokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class NougatTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class VitsTokenizer extends PreTrainedTokenizer {\r\n  constructor(tokenizerJSON, tokenizerConfig) {\r\n    super(tokenizerJSON, tokenizerConfig);\r\n\r\n    // Custom decoder function\r\n    this.decoder = new VitsDecoder({});\r\n  }\r\n}\r\n\r\nexport class CohereTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class MgpstrTokenizer extends PreTrainedTokenizer {}\r\n\r\nexport class Ernie4_5_Tokenizer extends PreTrainedTokenizer {}\r\n\r\n/**\r\n * Helper class which is used to instantiate pretrained tokenizers with the `from_pretrained` function.\r\n * The chosen tokenizer class is determined by the type specified in the tokenizer config.\r\n *\r\n * @example\r\n * const tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased');\r\n */\r\nexport class AutoTokenizer {\r\n  static TOKENIZER_CLASS_MAPPING = {\r\n    T5Tokenizer,\r\n    DistilBertTokenizer,\r\n    CamembertTokenizer,\r\n    DebertaTokenizer,\r\n    DebertaV2Tokenizer,\r\n    BertTokenizer,\r\n    HerbertTokenizer,\r\n    ConvBertTokenizer,\r\n    RoFormerTokenizer,\r\n    XLMTokenizer,\r\n    ElectraTokenizer,\r\n    MobileBertTokenizer,\r\n    SqueezeBertTokenizer,\r\n    AlbertTokenizer,\r\n    GPT2Tokenizer,\r\n    BartTokenizer,\r\n    MBartTokenizer,\r\n    MBart50Tokenizer,\r\n    RobertaTokenizer,\r\n    WhisperTokenizer,\r\n    CodeGenTokenizer,\r\n    CLIPTokenizer,\r\n    SiglipTokenizer,\r\n    MarianTokenizer,\r\n    BloomTokenizer,\r\n    NllbTokenizer,\r\n    M2M100Tokenizer,\r\n    LlamaTokenizer,\r\n    CodeLlamaTokenizer,\r\n    XLMRobertaTokenizer,\r\n    MPNetTokenizer,\r\n    FalconTokenizer,\r\n    GPTNeoXTokenizer,\r\n    EsmTokenizer,\r\n    Wav2Vec2CTCTokenizer,\r\n    BlenderbotTokenizer,\r\n    BlenderbotSmallTokenizer,\r\n    SpeechT5Tokenizer,\r\n    NougatTokenizer,\r\n    VitsTokenizer,\r\n    Qwen2Tokenizer,\r\n    GemmaTokenizer,\r\n    Grok1Tokenizer,\r\n    CohereTokenizer,\r\n    MgpstrTokenizer,\r\n    Ernie4_5_Tokenizer,\r\n\r\n    // Base case:\r\n    PreTrainedTokenizer,\r\n  };\r\n\r\n  /**\r\n   * Instantiate one of the tokenizer classes of the library from a pretrained model.\r\n   *\r\n   * The tokenizer class to instantiate is selected based on the `tokenizer_class` property of the config object\r\n   * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)\r\n   *\r\n   * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:\r\n   * - A string, the *model id* of a pretrained tokenizer hosted inside a model repo on huggingface.co.\r\n   *   Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a\r\n   *   user or organization name, like `dbmdz/bert-base-german-cased`.\r\n   * - A path to a *directory* containing tokenizer files, e.g., `./my_model_directory/`.\r\n   * @param {PretrainedTokenizerOptions} options Additional options for loading the tokenizer.\r\n   *\r\n   * @returns {Promise<PreTrainedTokenizer>} A new instance of the PreTrainedTokenizer class.\r\n   */\r\n  static async from_pretrained(\r\n    pretrained_model_name_or_path,\r\n    {\r\n      progress_callback = null,\r\n      config = null,\r\n      cache_dir = null,\r\n      local_files_only = false,\r\n      revision = \"main\",\r\n      legacy = null,\r\n    } = {}\r\n  ) {\r\n    const [tokenizerJSON, tokenizerConfig] = await loadTokenizer(\r\n      pretrained_model_name_or_path,\r\n      {\r\n        progress_callback,\r\n        config,\r\n        cache_dir,\r\n        local_files_only,\r\n        revision,\r\n        legacy,\r\n      }\r\n    );\r\n\r\n    // Some tokenizers are saved with the \"Fast\" suffix, so we remove that if present.\r\n    const tokenizerName =\r\n      tokenizerConfig.tokenizer_class?.replace(/Fast$/, \"\") ??\r\n      \"PreTrainedTokenizer\";\r\n\r\n    let cls = this.TOKENIZER_CLASS_MAPPING[tokenizerName];\r\n    if (!cls) {\r\n      console.warn(\r\n        `Unknown tokenizer class \"${tokenizerName}\", attempting to construct from base class.`\r\n      );\r\n      cls = PreTrainedTokenizer;\r\n    }\r\n    return new cls(tokenizerJSON, tokenizerConfig);\r\n  }\r\n}\r\n","/**\r\n * A base class for creating callable objects.\r\n * See [here](https://stackoverflow.com/q/76073890) for more information.\r\n *\r\n * @type {new () => {(...args: any[]): any, _call(...args: any[]): any}}\r\n */\r\nexport const Callable = /** @type {any} */ (\r\n  class {\r\n    /**\r\n     * Creates a new instance of the Callable class.\r\n     */\r\n    constructor() {\r\n      /**\r\n       * Creates a closure that delegates to a private method '_call' with the given arguments.\r\n       * @type {any}\r\n       * @param {...any} args Zero or more arguments to pass to the '_call' method.\r\n       * @returns {*} The result of calling the '_call' method.\r\n       */\r\n      let closure = function (...args) {\r\n        return closure._call(...args);\r\n      };\r\n      return Object.setPrototypeOf(closure, new.target.prototype);\r\n    }\r\n\r\n    /**\r\n     * This method should be implemented in subclasses to provide the\r\n     * functionality of the callable object.\r\n     *\r\n     * @param {any[]} args\r\n     * @throws {Error} If the subclass does not implement the `_call` method.\r\n     */\r\n    _call(...args) {\r\n      throw Error(\"Must implement _call method in subclass\");\r\n    }\r\n  }\r\n);\r\n","/**\r\n * @file Core utility functions/classes for Transformers.js.\r\n *\r\n * These are only used internally, meaning an end-user shouldn't\r\n * need to access anything here.\r\n *\r\n * @module utils/core\r\n */\r\n\r\n/**\r\n * Helper function to dispatch progress callbacks.\r\n *\r\n * @param {Function} progress_callback The progress callback function to dispatch.\r\n * @param {any} data The data to pass to the progress callback function.\r\n * @returns {void}\r\n * @private\r\n */\r\nexport function dispatchCallback(progress_callback, data) {\r\n  if (progress_callback) progress_callback(data);\r\n}\r\n\r\n/**\r\n * Reverses the keys and values of an object.\r\n *\r\n * @param {Object} data The object to reverse.\r\n * @returns {Object} The reversed object.\r\n * @see https://ultimatecourses.com/blog/reverse-object-keys-and-values-in-javascript\r\n */\r\nexport function reverseDictionary(data) {\r\n  // https://ultimatecourses.com/blog/reverse-object-keys-and-values-in-javascript\r\n  return Object.fromEntries(\r\n    Object.entries(data).map(([key, value]) => [value, key])\r\n  );\r\n}\r\n\r\n/**\r\n * Escapes regular expression special characters from a string by replacing them with their escaped counterparts.\r\n *\r\n * @param {string} string The string to escape.\r\n * @returns {string} The escaped string.\r\n */\r\nexport function escapeRegExp(string) {\r\n  return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"); // $& means the whole matched string\r\n}\r\n\r\n/**\r\n * Check if a value is a typed array.\r\n * @param {*} val The value to check.\r\n * @returns {boolean} True if the value is a `TypedArray`, false otherwise.\r\n *\r\n * Adapted from https://stackoverflow.com/a/71091338/13989043\r\n */\r\nexport function isTypedArray(val) {\r\n  return val?.prototype?.__proto__?.constructor?.name === \"TypedArray\";\r\n}\r\n\r\n/**\r\n * Check if a value is an integer.\r\n * @param {*} x The value to check.\r\n * @returns {boolean} True if the value is a string, false otherwise.\r\n */\r\nexport function isIntegralNumber(x) {\r\n  return Number.isInteger(x) || typeof x === \"bigint\";\r\n}\r\n\r\n/**\r\n * Calculates the dimensions of a nested array.\r\n *\r\n * @param {any[]} arr The nested array to calculate dimensions for.\r\n * @returns {number[]} An array containing the dimensions of the input array.\r\n */\r\nexport function calculateDimensions(arr) {\r\n  const dimensions = [];\r\n  let current = arr;\r\n  while (Array.isArray(current)) {\r\n    dimensions.push(current.length);\r\n    current = current[0];\r\n  }\r\n  return dimensions;\r\n}\r\n\r\n/**\r\n * Replicate python's .pop() method for objects.\r\n * @param {Object} obj The object to pop from.\r\n * @param {string} key The key to pop.\r\n * @param {*} defaultValue The default value to return if the key does not exist.\r\n * @returns {*} The value of the popped key.\r\n * @throws {Error} If the key does not exist and no default value is provided.\r\n */\r\nexport function pop(obj, key, defaultValue = undefined) {\r\n  const value = obj[key];\r\n  if (value !== undefined) {\r\n    delete obj[key];\r\n    return value;\r\n  }\r\n  if (defaultValue === undefined) {\r\n    throw Error(`Key ${key} does not exist in object.`);\r\n  }\r\n  return defaultValue;\r\n}\r\n\r\n/**\r\n * Efficiently merge arrays, creating a new copy.\r\n * Adapted from https://stackoverflow.com/a/6768642/13989043\r\n * @param  {Array[]} arrs Arrays to merge.\r\n * @returns {Array} The merged array.\r\n */\r\nexport function mergeArrays(...arrs) {\r\n  return Array.prototype.concat.apply([], arrs);\r\n}\r\n\r\n/**\r\n * Compute the Cartesian product of given arrays\r\n * @param {...Array} a Arrays to compute the product\r\n * @returns {Array} Returns the computed Cartesian product as an array\r\n * @private\r\n */\r\nexport function product(...a) {\r\n  // Cartesian product of items\r\n  // Adapted from https://stackoverflow.com/a/43053803\r\n  return a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e])));\r\n}\r\n\r\n/**\r\n * Calculates the index offset for a given index and window size.\r\n * @param {number} i The index.\r\n * @param {number} w The window size.\r\n * @returns {number} The index offset.\r\n */\r\nexport function calculateReflectOffset(i, w) {\r\n  return Math.abs(((i + w) % (2 * w)) - w);\r\n}\r\n\r\n/**\r\n *\r\n * @param {Object} o\r\n * @param {string[]} props\r\n * @returns {Object}\r\n */\r\nexport function pick(o, props) {\r\n  return Object.assign(\r\n    {},\r\n    ...props.map((prop) => {\r\n      if (o[prop] !== undefined) {\r\n        return { [prop]: o[prop] };\r\n      }\r\n    })\r\n  );\r\n}\r\n\r\n/**\r\n * Calculate the length of a string, taking multi-byte characters into account.\r\n * This mimics the behavior of Python's `len` function.\r\n * @param {string} s The string to calculate the length of.\r\n * @returns {number} The length of the string.\r\n */\r\nexport function len(s) {\r\n  let length = 0;\r\n  for (const c of s) ++length;\r\n  return length;\r\n}\r\n","/**\r\n * @typedef {Object} PretrainedOptions Options for loading a pretrained model.\r\n * @property {boolean?} [quantized=true] Whether to load the 8-bit quantized version of the model (only applicable when loading model files).\r\n * @property {function} [progress_callback=null] If specified, this function will be called during model construction, to provide the user with progress updates.\r\n * @property {Object} [config=null] Configuration for the model to use instead of an automatically loaded configuration. Configuration can be automatically loaded when:\r\n * - The model is a model provided by the library (loaded with the *model id* string of a pretrained model).\r\n * - The model is loaded by supplying a local directory as `pretrained_model_name_or_path` and a configuration JSON file named *config.json* is found in the directory.\r\n * @property {string} [cache_dir=null] Path to a directory in which a downloaded pretrained model configuration should be cached if the standard cache should not be used.\r\n * @property {boolean} [local_files_only=false] Whether or not to only look at local files (e.g., not try downloading the model).\r\n * @property {string} [revision='main'] The specific model version to use. It can be a branch name, a tag name, or a commit id,\r\n * since we use a git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any identifier allowed by git.\r\n * NOTE: This setting is ignored for local requests.\r\n * @property {string} [model_file_name=null] If specified, load the model with this name (excluding the .onnx suffix). Currently only valid for encoder- or decoder-only models.\r\n */\r\n\r\n/**\r\n *\r\n * Retrieves a file from either a remote URL using the Fetch API or from the local file system using the FileSystem API.\r\n * If the filesystem is available and `env.useCache = true`, the file will be downloaded and cached.\r\n *\r\n * @param {string} path_or_repo_id This can be either:\r\n * - a string, the *model id* of a model repo on huggingface.co.\r\n * - a path to a *directory* potentially containing the file.\r\n * @param {string} filename The name of the file to locate in `path_or_repo`.\r\n * @param {boolean} [fatal=true] Whether to throw an error if the file is not found.\r\n * @param {PretrainedOptions} [options] An object containing optional parameters.\r\n *\r\n * @throws Will throw an error if the file is not found and `fatal` is true.\r\n * @returns {Promise} A Promise that resolves with the file content as a buffer.\r\n */\r\nexport async function getModelFile(\r\n  path_or_repo_id,\r\n  filename,\r\n  fatal = true,\r\n  options = {}\r\n) {\r\n  if (path_or_repo_id.startsWith(\"http\")) {\r\n    return fetch(path_or_repo_id + filename).then((response) => {\r\n      if (!response.ok) {\r\n        if (fatal) {\r\n          throw new Error(`File not found at ${path_or_repo_id}${filename}`);\r\n        } else {\r\n          return null;\r\n        }\r\n      }\r\n      return response.arrayBuffer();\r\n    });\r\n  } else {\r\n    throw new Error(\r\n      \"Filesystem not supported, please implement your own file reading logic.\"\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * Fetches a JSON file from a given path and file name.\r\n *\r\n * @param {string} modelPath The path to the directory containing the file.\r\n * @param {string} fileName The name of the file to fetch.\r\n * @param {boolean} [fatal=true] Whether to throw an error if the file is not found.\r\n * @param {PretrainedOptions} [options] An object containing optional parameters.\r\n * @returns {Promise<Object>} The JSON data parsed into a JavaScript object.\r\n * @throws Will throw an error if the file is not found and `fatal` is true.\r\n */\r\nexport async function getModelJSON(\r\n  modelPath,\r\n  fileName,\r\n  fatal = true,\r\n  options = {}\r\n) {\r\n  let buffer = await getModelFile(modelPath, fileName, fatal, options);\r\n  if (buffer === null) {\r\n    // Return empty object\r\n    return {};\r\n  }\r\n\r\n  let decoder = new TextDecoder(\"utf-8\");\r\n  let jsonData = decoder.decode(buffer);\r\n\r\n  return JSON.parse(jsonData);\r\n}\r\n","/**\r\n * @file Helper module for mathematical processing.\r\n *\r\n * These functions and classes are only used internally,\r\n * meaning an end-user shouldn't need to access anything here.\r\n *\r\n * @module utils/maths\r\n */\r\n\r\n/**\r\n * @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array} TypedArray\r\n * @typedef {BigInt64Array | BigUint64Array} BigTypedArray\r\n * @typedef {TypedArray | BigTypedArray} AnyTypedArray\r\n */\r\n\r\n/**\r\n * @param {TypedArray} input\r\n */\r\nexport function interpolate_data(\r\n  input,\r\n  [in_channels, in_height, in_width],\r\n  [out_height, out_width],\r\n  mode = \"bilinear\",\r\n  align_corners = false\r\n) {\r\n  // TODO use mode and align_corners\r\n\r\n  // Output image dimensions\r\n  const x_scale = out_width / in_width;\r\n  const y_scale = out_height / in_height;\r\n\r\n  // Output image\r\n  // @ts-ignore\r\n  const out_img = new input.constructor(out_height * out_width * in_channels);\r\n\r\n  // Pre-calculate strides\r\n  const inStride = in_height * in_width;\r\n  const outStride = out_height * out_width;\r\n\r\n  for (let i = 0; i < out_height; ++i) {\r\n    for (let j = 0; j < out_width; ++j) {\r\n      // Calculate output offset\r\n      const outOffset = i * out_width + j;\r\n\r\n      // Calculate input pixel coordinates\r\n      const x = (j + 0.5) / x_scale - 0.5;\r\n      const y = (i + 0.5) / y_scale - 0.5;\r\n\r\n      // Calculate the four nearest input pixels\r\n      // We also check if the input pixel coordinates are within the image bounds\r\n      let x1 = Math.floor(x);\r\n      let y1 = Math.floor(y);\r\n      const x2 = Math.min(x1 + 1, in_width - 1);\r\n      const y2 = Math.min(y1 + 1, in_height - 1);\r\n\r\n      x1 = Math.max(x1, 0);\r\n      y1 = Math.max(y1, 0);\r\n\r\n      // Calculate the fractional distances between the input pixel and the four nearest pixels\r\n      const s = x - x1;\r\n      const t = y - y1;\r\n\r\n      // Perform bilinear interpolation\r\n      const w1 = (1 - s) * (1 - t);\r\n      const w2 = s * (1 - t);\r\n      const w3 = (1 - s) * t;\r\n      const w4 = s * t;\r\n\r\n      // Calculate the four nearest input pixel indices\r\n      const yStride = y1 * in_width;\r\n      const xStride = y2 * in_width;\r\n      const idx1 = yStride + x1;\r\n      const idx2 = yStride + x2;\r\n      const idx3 = xStride + x1;\r\n      const idx4 = xStride + x2;\r\n\r\n      for (let k = 0; k < in_channels; ++k) {\r\n        // Calculate channel offset\r\n        const cOffset = k * inStride;\r\n\r\n        out_img[k * outStride + outOffset] =\r\n          w1 * input[cOffset + idx1] +\r\n          w2 * input[cOffset + idx2] +\r\n          w3 * input[cOffset + idx3] +\r\n          w4 * input[cOffset + idx4];\r\n      }\r\n    }\r\n  }\r\n\r\n  return out_img;\r\n}\r\n\r\n/**\r\n * Helper method to permute a `AnyTypedArray` directly\r\n * @template {AnyTypedArray} T\r\n * @param {T} array\r\n * @param {number[]} dims\r\n * @param {number[]} axes\r\n * @returns {[T, number[]]} The permuted array and the new shape.\r\n */\r\nexport function permute_data(array, dims, axes) {\r\n  // Calculate the new shape of the permuted array\r\n  // and the stride of the original array\r\n  const shape = new Array(axes.length);\r\n  const stride = new Array(axes.length);\r\n\r\n  for (let i = axes.length - 1, s = 1; i >= 0; --i) {\r\n    stride[i] = s;\r\n    shape[i] = dims[axes[i]];\r\n    s *= shape[i];\r\n  }\r\n\r\n  // Precompute inverse mapping of stride\r\n  const invStride = axes.map((_, i) => stride[axes.indexOf(i)]);\r\n\r\n  // Create the permuted array with the new shape\r\n  // @ts-ignore\r\n  const permutedData = new array.constructor(array.length);\r\n\r\n  // Permute the original array to the new array\r\n  for (let i = 0; i < array.length; ++i) {\r\n    let newIndex = 0;\r\n    for (let j = dims.length - 1, k = i; j >= 0; --j) {\r\n      newIndex += (k % dims[j]) * invStride[j];\r\n      k = Math.floor(k / dims[j]);\r\n    }\r\n    permutedData[newIndex] = array[i];\r\n  }\r\n\r\n  return [permutedData, shape];\r\n}\r\n\r\n/**\r\n * Compute the softmax of an array of numbers.\r\n * @template {TypedArray|number[]} T\r\n * @param {T} arr The array of numbers to compute the softmax of.\r\n * @returns {T} The softmax array.\r\n */\r\nexport function softmax(arr) {\r\n  // Compute the maximum value in the array\r\n  const maxVal = max(arr)[0];\r\n\r\n  // Compute the exponentials of the array values\r\n  const exps = arr.map((x) => Math.exp(x - maxVal));\r\n\r\n  // Compute the sum of the exponentials\r\n  // @ts-ignore\r\n  const sumExps = exps.reduce((acc, val) => acc + val, 0);\r\n\r\n  // Compute the softmax values\r\n  const softmaxArr = exps.map((x) => x / sumExps);\r\n\r\n  return /** @type {T} */ (softmaxArr);\r\n}\r\n\r\n/**\r\n * Calculates the logarithm of the softmax function for the input array.\r\n * @template {TypedArray|number[]} T\r\n * @param {T} arr The input array to calculate the log_softmax function for.\r\n * @returns {T} The resulting log_softmax array.\r\n */\r\nexport function log_softmax(arr) {\r\n  // Compute the maximum value in the array\r\n  const maxVal = max(arr)[0];\r\n\r\n  // Compute the sum of the exponentials\r\n  let sumExps = 0;\r\n  for (let i = 0; i < arr.length; ++i) {\r\n    sumExps += Math.exp(arr[i] - maxVal);\r\n  }\r\n\r\n  // Compute the log of the sum\r\n  const logSum = Math.log(sumExps);\r\n\r\n  // Compute the softmax values\r\n  const logSoftmaxArr = arr.map((x) => x - maxVal - logSum);\r\n\r\n  return /** @type {T} */ (logSoftmaxArr);\r\n}\r\n\r\n/**\r\n * Calculates the dot product of two arrays.\r\n * @param {number[]} arr1 The first array.\r\n * @param {number[]} arr2 The second array.\r\n * @returns {number} The dot product of arr1 and arr2.\r\n */\r\nexport function dot(arr1, arr2) {\r\n  let result = 0;\r\n  for (let i = 0; i < arr1.length; ++i) {\r\n    result += arr1[i] * arr2[i];\r\n  }\r\n  return result;\r\n}\r\n\r\n/**\r\n * Computes the cosine similarity between two arrays.\r\n *\r\n * @param {number[]} arr1 The first array.\r\n * @param {number[]} arr2 The second array.\r\n * @returns {number} The cosine similarity between the two arrays.\r\n */\r\nexport function cos_sim(arr1, arr2) {\r\n  // Calculate dot product of the two arrays\r\n  const dotProduct = dot(arr1, arr2);\r\n\r\n  // Calculate the magnitude of the first array\r\n  const magnitudeA = magnitude(arr1);\r\n\r\n  // Calculate the magnitude of the second array\r\n  const magnitudeB = magnitude(arr2);\r\n\r\n  // Calculate the cosine similarity\r\n  const cosineSimilarity = dotProduct / (magnitudeA * magnitudeB);\r\n\r\n  return cosineSimilarity;\r\n}\r\n\r\n/**\r\n * Calculates the magnitude of a given array.\r\n * @param {number[]} arr The array to calculate the magnitude of.\r\n * @returns {number} The magnitude of the array.\r\n */\r\nexport function magnitude(arr) {\r\n  return Math.sqrt(arr.reduce((acc, val) => acc + val * val, 0));\r\n}\r\n\r\n/**\r\n * Returns the value and index of the minimum element in an array.\r\n * @param {number[]|TypedArray} arr array of numbers.\r\n * @returns {[number, number]} the value and index of the minimum element, of the form: [valueOfMin, indexOfMin]\r\n * @throws {Error} If array is empty.\r\n */\r\nexport function min(arr) {\r\n  if (arr.length === 0) throw Error(\"Array must not be empty\");\r\n  let min = arr[0];\r\n  let indexOfMin = 0;\r\n  for (let i = 1; i < arr.length; ++i) {\r\n    if (arr[i] < min) {\r\n      min = arr[i];\r\n      indexOfMin = i;\r\n    }\r\n  }\r\n  return [min, indexOfMin];\r\n}\r\n\r\n/**\r\n * Returns the value and index of the maximum element in an array.\r\n * @param {number[]|AnyTypedArray} arr array of numbers.\r\n * @returns {[number, number]} the value and index of the maximum element, of the form: [valueOfMax, indexOfMax]\r\n * @throws {Error} If array is empty.\r\n */\r\nexport function max(arr) {\r\n  if (arr.length === 0) throw Error(\"Array must not be empty\");\r\n  let max = arr[0];\r\n  let indexOfMax = 0;\r\n  for (let i = 1; i < arr.length; ++i) {\r\n    if (arr[i] > max) {\r\n      max = arr[i];\r\n      indexOfMax = i;\r\n    }\r\n  }\r\n  return [Number(max), indexOfMax];\r\n}\r\n\r\nfunction isPowerOfTwo(number) {\r\n  // Check if the number is greater than 0 and has only one bit set to 1\r\n  return number > 0 && (number & (number - 1)) === 0;\r\n}\r\n\r\n/**\r\n * Implementation of Radix-4 FFT.\r\n *\r\n * P2FFT class provides functionality for performing Fast Fourier Transform on arrays\r\n * which are a power of two in length.\r\n * Code adapted from https://www.npmjs.com/package/fft.js\r\n */\r\nclass P2FFT {\r\n  /**\r\n   * @param {number} size The size of the input array. Must be a power of two larger than 1.\r\n   * @throws {Error} FFT size must be a power of two larger than 1.\r\n   */\r\n  constructor(size) {\r\n    this.size = size | 0; // convert to a 32-bit signed integer\r\n    if (this.size <= 1 || !isPowerOfTwo(this.size))\r\n      throw new Error(\"FFT size must be a power of two larger than 1\");\r\n\r\n    this._csize = size << 1;\r\n\r\n    this.table = new Float64Array(this.size * 2);\r\n    for (let i = 0; i < this.table.length; i += 2) {\r\n      const angle = (Math.PI * i) / this.size;\r\n      this.table[i] = Math.cos(angle);\r\n      this.table[i + 1] = -Math.sin(angle);\r\n    }\r\n\r\n    // Find size's power of two\r\n    let power = 0;\r\n    for (let t = 1; this.size > t; t <<= 1) ++power;\r\n\r\n    // Calculate initial step's width:\r\n    //   * If we are full radix-4, it is 2x smaller to give inital len=8\r\n    //   * Otherwise it is the same as `power` to give len=4\r\n    this._width = power % 2 === 0 ? power - 1 : power;\r\n\r\n    // Pre-compute bit-reversal patterns\r\n    this._bitrev = new Int32Array(1 << this._width);\r\n    for (let j = 0; j < this._bitrev.length; ++j) {\r\n      this._bitrev[j] = 0;\r\n      for (let shift = 0; shift < this._width; shift += 2) {\r\n        const revShift = this._width - shift - 2;\r\n        this._bitrev[j] |= ((j >>> shift) & 3) << revShift;\r\n      }\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Create a complex number array with size `2 * size`\r\n   *\r\n   * @returns {Float64Array} A complex number array with size `2 * size`\r\n   */\r\n  createComplexArray() {\r\n    return new Float64Array(this._csize);\r\n  }\r\n\r\n  /**\r\n   * Converts a complex number representation stored in a Float64Array to an array of real numbers.\r\n   *\r\n   * @param {Float64Array} complex The complex number representation to be converted.\r\n   * @param {number[]} [storage] An optional array to store the result in.\r\n   * @returns {number[]} An array of real numbers representing the input complex number representation.\r\n   */\r\n  fromComplexArray(complex, storage) {\r\n    const res = storage || new Array(complex.length >>> 1);\r\n    for (let i = 0; i < complex.length; i += 2) res[i >>> 1] = complex[i];\r\n    return res;\r\n  }\r\n\r\n  /**\r\n   * Convert a real-valued input array to a complex-valued output array.\r\n   * @param {Float64Array} input The real-valued input array.\r\n   * @param {Float64Array} [storage] Optional buffer to store the output array.\r\n   * @returns {Float64Array} The complex-valued output array.\r\n   */\r\n  toComplexArray(input, storage) {\r\n    const res = storage || this.createComplexArray();\r\n    for (let i = 0; i < res.length; i += 2) {\r\n      res[i] = input[i >>> 1];\r\n      res[i + 1] = 0;\r\n    }\r\n    return res;\r\n  }\r\n\r\n  /**\r\n   * Performs a Fast Fourier Transform (FFT) on the given input data and stores the result in the output buffer.\r\n   *\r\n   * @param {Float64Array} out The output buffer to store the result.\r\n   * @param {Float64Array} data The input data to transform.\r\n   *\r\n   * @throws {Error} Input and output buffers must be different.\r\n   *\r\n   * @returns {void}\r\n   */\r\n  transform(out, data) {\r\n    if (out === data)\r\n      throw new Error(\"Input and output buffers must be different\");\r\n\r\n    this._transform4(out, data, 1 /* DONE */);\r\n  }\r\n\r\n  /**\r\n   * Performs a real-valued forward FFT on the given input buffer and stores the result in the given output buffer.\r\n   * The input buffer must contain real values only, while the output buffer will contain complex values. The input and\r\n   * output buffers must be different.\r\n   *\r\n   * @param {Float64Array} out The output buffer.\r\n   * @param {Float64Array} data The input buffer containing real values.\r\n   *\r\n   * @throws {Error} If the input and output buffers are the same.\r\n   */\r\n  realTransform(out, data) {\r\n    if (out === data)\r\n      throw new Error(\"Input and output buffers must be different\");\r\n\r\n    this._realTransform4(out, data, 1 /* DONE */);\r\n  }\r\n\r\n  /**\r\n   * Performs an inverse FFT transformation on the given `data` array, and stores the result in `out`.\r\n   * The `out` array must be a different buffer than the `data` array. The `out` array will contain the\r\n   * result of the transformation. The `data` array will not be modified.\r\n   *\r\n   * @param {Float64Array} out The output buffer for the transformed data.\r\n   * @param {Float64Array} data The input data to transform.\r\n   * @throws {Error} If `out` and `data` refer to the same buffer.\r\n   * @returns {void}\r\n   */\r\n  inverseTransform(out, data) {\r\n    if (out === data)\r\n      throw new Error(\"Input and output buffers must be different\");\r\n\r\n    this._transform4(out, data, -1 /* DONE */);\r\n    for (let i = 0; i < out.length; ++i) out[i] /= this.size;\r\n  }\r\n\r\n  /**\r\n   * Performs a radix-4 implementation of a discrete Fourier transform on a given set of data.\r\n   *\r\n   * @param {Float64Array} out The output buffer for the transformed data.\r\n   * @param {Float64Array} data The input buffer of data to be transformed.\r\n   * @param {number} inv A scaling factor to apply to the transform.\r\n   * @returns {void}\r\n   */\r\n  _transform4(out, data, inv) {\r\n    // radix-4 implementation\r\n\r\n    const size = this._csize;\r\n\r\n    // Initial step (permute and transform)\r\n    const width = this._width;\r\n    let step = 1 << width;\r\n    let len = (size / step) << 1;\r\n\r\n    let outOff;\r\n    let t;\r\n    const bitrev = this._bitrev;\r\n    if (len === 4) {\r\n      for (outOff = 0, t = 0; outOff < size; outOff += len, ++t) {\r\n        const off = bitrev[t];\r\n        this._singleTransform2(data, out, outOff, off, step);\r\n      }\r\n    } else {\r\n      // len === 8\r\n      for (outOff = 0, t = 0; outOff < size; outOff += len, ++t) {\r\n        const off = bitrev[t];\r\n        this._singleTransform4(data, out, outOff, off, step, inv);\r\n      }\r\n    }\r\n\r\n    // Loop through steps in decreasing order\r\n    const table = this.table;\r\n    for (step >>= 2; step >= 2; step >>= 2) {\r\n      len = (size / step) << 1;\r\n      const quarterLen = len >>> 2;\r\n\r\n      // Loop through offsets in the data\r\n      for (outOff = 0; outOff < size; outOff += len) {\r\n        // Full case\r\n        const limit = outOff + quarterLen - 1;\r\n        for (let i = outOff, k = 0; i < limit; i += 2, k += step) {\r\n          const A = i;\r\n          const B = A + quarterLen;\r\n          const C = B + quarterLen;\r\n          const D = C + quarterLen;\r\n\r\n          // Original values\r\n          const Ar = out[A];\r\n          const Ai = out[A + 1];\r\n          const Br = out[B];\r\n          const Bi = out[B + 1];\r\n          const Cr = out[C];\r\n          const Ci = out[C + 1];\r\n          const Dr = out[D];\r\n          const Di = out[D + 1];\r\n\r\n          const tableBr = table[k];\r\n          const tableBi = inv * table[k + 1];\r\n          const MBr = Br * tableBr - Bi * tableBi;\r\n          const MBi = Br * tableBi + Bi * tableBr;\r\n\r\n          const tableCr = table[2 * k];\r\n          const tableCi = inv * table[2 * k + 1];\r\n          const MCr = Cr * tableCr - Ci * tableCi;\r\n          const MCi = Cr * tableCi + Ci * tableCr;\r\n\r\n          const tableDr = table[3 * k];\r\n          const tableDi = inv * table[3 * k + 1];\r\n          const MDr = Dr * tableDr - Di * tableDi;\r\n          const MDi = Dr * tableDi + Di * tableDr;\r\n\r\n          // Pre-Final values\r\n          const T0r = Ar + MCr;\r\n          const T0i = Ai + MCi;\r\n          const T1r = Ar - MCr;\r\n          const T1i = Ai - MCi;\r\n          const T2r = MBr + MDr;\r\n          const T2i = MBi + MDi;\r\n          const T3r = inv * (MBr - MDr);\r\n          const T3i = inv * (MBi - MDi);\r\n\r\n          // Final values\r\n          out[A] = T0r + T2r;\r\n          out[A + 1] = T0i + T2i;\r\n          out[B] = T1r + T3i;\r\n          out[B + 1] = T1i - T3r;\r\n          out[C] = T0r - T2r;\r\n          out[C + 1] = T0i - T2i;\r\n          out[D] = T1r - T3i;\r\n          out[D + 1] = T1i + T3r;\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Performs a radix-2 implementation of a discrete Fourier transform on a given set of data.\r\n   *\r\n   * @param {Float64Array} data The input buffer of data to be transformed.\r\n   * @param {Float64Array} out The output buffer for the transformed data.\r\n   * @param {number} outOff The offset at which to write the output data.\r\n   * @param {number} off The offset at which to begin reading the input data.\r\n   * @param {number} step The step size for indexing the input data.\r\n   * @returns {void}\r\n   */\r\n  _singleTransform2(data, out, outOff, off, step) {\r\n    // radix-2 implementation\r\n    // NOTE: Only called for len=4\r\n\r\n    const evenR = data[off];\r\n    const evenI = data[off + 1];\r\n    const oddR = data[off + step];\r\n    const oddI = data[off + step + 1];\r\n\r\n    out[outOff] = evenR + oddR;\r\n    out[outOff + 1] = evenI + oddI;\r\n    out[outOff + 2] = evenR - oddR;\r\n    out[outOff + 3] = evenI - oddI;\r\n  }\r\n\r\n  /**\r\n   * Performs radix-4 transformation on input data of length 8\r\n   *\r\n   * @param {Float64Array} data Input data array of length 8\r\n   * @param {Float64Array} out Output data array of length 8\r\n   * @param {number} outOff Index of output array to start writing from\r\n   * @param {number} off Index of input array to start reading from\r\n   * @param {number} step Step size between elements in input array\r\n   * @param {number} inv Scaling factor for inverse transform\r\n   *\r\n   * @returns {void}\r\n   */\r\n  _singleTransform4(data, out, outOff, off, step, inv) {\r\n    // radix-4\r\n    // NOTE: Only called for len=8\r\n    const step2 = step * 2;\r\n    const step3 = step * 3;\r\n\r\n    // Original values\r\n    const Ar = data[off];\r\n    const Ai = data[off + 1];\r\n    const Br = data[off + step];\r\n    const Bi = data[off + step + 1];\r\n    const Cr = data[off + step2];\r\n    const Ci = data[off + step2 + 1];\r\n    const Dr = data[off + step3];\r\n    const Di = data[off + step3 + 1];\r\n\r\n    // Pre-Final values\r\n    const T0r = Ar + Cr;\r\n    const T0i = Ai + Ci;\r\n    const T1r = Ar - Cr;\r\n    const T1i = Ai - Ci;\r\n    const T2r = Br + Dr;\r\n    const T2i = Bi + Di;\r\n    const T3r = inv * (Br - Dr);\r\n    const T3i = inv * (Bi - Di);\r\n\r\n    // Final values\r\n    out[outOff] = T0r + T2r;\r\n    out[outOff + 1] = T0i + T2i;\r\n    out[outOff + 2] = T1r + T3i;\r\n    out[outOff + 3] = T1i - T3r;\r\n    out[outOff + 4] = T0r - T2r;\r\n    out[outOff + 5] = T0i - T2i;\r\n    out[outOff + 6] = T1r - T3i;\r\n    out[outOff + 7] = T1i + T3r;\r\n  }\r\n\r\n  /**\r\n   * Real input radix-4 implementation\r\n   * @param {Float64Array} out Output array for the transformed data\r\n   * @param {Float64Array} data Input array of real data to be transformed\r\n   * @param {number} inv The scale factor used to normalize the inverse transform\r\n   */\r\n  _realTransform4(out, data, inv) {\r\n    // Real input radix-4 implementation\r\n    const size = this._csize;\r\n\r\n    // Initial step (permute and transform)\r\n    const width = this._width;\r\n    let step = 1 << width;\r\n    let len = (size / step) << 1;\r\n\r\n    let outOff;\r\n    let t;\r\n    const bitrev = this._bitrev;\r\n    if (len === 4) {\r\n      for (outOff = 0, t = 0; outOff < size; outOff += len, ++t) {\r\n        const off = bitrev[t];\r\n        this._singleRealTransform2(data, out, outOff, off >>> 1, step >>> 1);\r\n      }\r\n    } else {\r\n      // len === 8\r\n      for (outOff = 0, t = 0; outOff < size; outOff += len, ++t) {\r\n        const off = bitrev[t];\r\n        this._singleRealTransform4(\r\n          data,\r\n          out,\r\n          outOff,\r\n          off >>> 1,\r\n          step >>> 1,\r\n          inv\r\n        );\r\n      }\r\n    }\r\n\r\n    // Loop through steps in decreasing order\r\n    const table = this.table;\r\n    for (step >>= 2; step >= 2; step >>= 2) {\r\n      len = (size / step) << 1;\r\n      const halfLen = len >>> 1;\r\n      const quarterLen = halfLen >>> 1;\r\n      const hquarterLen = quarterLen >>> 1;\r\n\r\n      // Loop through offsets in the data\r\n      for (outOff = 0; outOff < size; outOff += len) {\r\n        for (let i = 0, k = 0; i <= hquarterLen; i += 2, k += step) {\r\n          const A = outOff + i;\r\n          const B = A + quarterLen;\r\n          const C = B + quarterLen;\r\n          const D = C + quarterLen;\r\n\r\n          // Original values\r\n          const Ar = out[A];\r\n          const Ai = out[A + 1];\r\n          const Br = out[B];\r\n          const Bi = out[B + 1];\r\n          const Cr = out[C];\r\n          const Ci = out[C + 1];\r\n          const Dr = out[D];\r\n          const Di = out[D + 1];\r\n\r\n          // Middle values\r\n          const MAr = Ar;\r\n          const MAi = Ai;\r\n\r\n          const tableBr = table[k];\r\n          const tableBi = inv * table[k + 1];\r\n          const MBr = Br * tableBr - Bi * tableBi;\r\n          const MBi = Br * tableBi + Bi * tableBr;\r\n\r\n          const tableCr = table[2 * k];\r\n          const tableCi = inv * table[2 * k + 1];\r\n          const MCr = Cr * tableCr - Ci * tableCi;\r\n          const MCi = Cr * tableCi + Ci * tableCr;\r\n\r\n          const tableDr = table[3 * k];\r\n          const tableDi = inv * table[3 * k + 1];\r\n          const MDr = Dr * tableDr - Di * tableDi;\r\n          const MDi = Dr * tableDi + Di * tableDr;\r\n\r\n          // Pre-Final values\r\n          const T0r = MAr + MCr;\r\n          const T0i = MAi + MCi;\r\n          const T1r = MAr - MCr;\r\n          const T1i = MAi - MCi;\r\n          const T2r = MBr + MDr;\r\n          const T2i = MBi + MDi;\r\n          const T3r = inv * (MBr - MDr);\r\n          const T3i = inv * (MBi - MDi);\r\n\r\n          // Final values\r\n          out[A] = T0r + T2r;\r\n          out[A + 1] = T0i + T2i;\r\n          out[B] = T1r + T3i;\r\n          out[B + 1] = T1i - T3r;\r\n\r\n          // Output final middle point\r\n          if (i === 0) {\r\n            out[C] = T0r - T2r;\r\n            out[C + 1] = T0i - T2i;\r\n            continue;\r\n          }\r\n\r\n          // Do not overwrite ourselves\r\n          if (i === hquarterLen) continue;\r\n\r\n          const SA = outOff + quarterLen - i;\r\n          const SB = outOff + halfLen - i;\r\n\r\n          out[SA] = T1r - inv * T3i;\r\n          out[SA + 1] = -T1i - inv * T3r;\r\n          out[SB] = T0r - inv * T2r;\r\n          out[SB + 1] = -T0i + inv * T2i;\r\n        }\r\n      }\r\n    }\r\n\r\n    // Complete the spectrum by adding its mirrored negative frequency components.\r\n    const half = size >>> 1;\r\n    for (let i = 2; i < half; i += 2) {\r\n      out[size - i] = out[i];\r\n      out[size - i + 1] = -out[i + 1];\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Performs a single real input radix-2 transformation on the provided data\r\n   *\r\n   * @param {Float64Array} data The input data array\r\n   * @param {Float64Array} out The output data array\r\n   * @param {number} outOff The output offset\r\n   * @param {number} off The input offset\r\n   * @param {number} step The step\r\n   *\r\n   * @returns {void}\r\n   */\r\n  _singleRealTransform2(data, out, outOff, off, step) {\r\n    // radix-2 implementation\r\n    // NOTE: Only called for len=4\r\n\r\n    const evenR = data[off];\r\n    const oddR = data[off + step];\r\n\r\n    out[outOff] = evenR + oddR;\r\n    out[outOff + 1] = 0;\r\n    out[outOff + 2] = evenR - oddR;\r\n    out[outOff + 3] = 0;\r\n  }\r\n\r\n  /**\r\n   * Computes a single real-valued transform using radix-4 algorithm.\r\n   * This method is only called for len=8.\r\n   *\r\n   * @param {Float64Array} data The input data array.\r\n   * @param {Float64Array} out The output data array.\r\n   * @param {number} outOff The offset into the output array.\r\n   * @param {number} off The offset into the input array.\r\n   * @param {number} step The step size for the input array.\r\n   * @param {number} inv The value of inverse.\r\n   */\r\n  _singleRealTransform4(data, out, outOff, off, step, inv) {\r\n    // radix-4\r\n    // NOTE: Only called for len=8\r\n    const step2 = step * 2;\r\n    const step3 = step * 3;\r\n\r\n    // Original values\r\n    const Ar = data[off];\r\n    const Br = data[off + step];\r\n    const Cr = data[off + step2];\r\n    const Dr = data[off + step3];\r\n\r\n    // Pre-Final values\r\n    const T0r = Ar + Cr;\r\n    const T1r = Ar - Cr;\r\n    const T2r = Br + Dr;\r\n    const T3r = inv * (Br - Dr);\r\n\r\n    // Final values\r\n    out[outOff] = T0r + T2r;\r\n    out[outOff + 1] = 0;\r\n    out[outOff + 2] = T1r;\r\n    out[outOff + 3] = -T3r;\r\n    out[outOff + 4] = T0r - T2r;\r\n    out[outOff + 5] = 0;\r\n    out[outOff + 6] = T1r;\r\n    out[outOff + 7] = T3r;\r\n  }\r\n}\r\n\r\n/**\r\n * NP2FFT class provides functionality for performing Fast Fourier Transform on arrays\r\n * which are not a power of two in length. In such cases, the chirp-z transform is used.\r\n *\r\n * For more information, see: https://math.stackexchange.com/questions/77118/non-power-of-2-ffts/77156#77156\r\n */\r\nclass NP2FFT {\r\n  /**\r\n   * Constructs a new NP2FFT object.\r\n   * @param {number} fft_length The length of the FFT\r\n   */\r\n  constructor(fft_length) {\r\n    // Helper variables\r\n    const a = 2 * (fft_length - 1);\r\n    const b = 2 * (2 * fft_length - 1);\r\n    const nextP2 = 2 ** Math.ceil(Math.log2(b));\r\n    this.bufferSize = nextP2;\r\n    this._a = a;\r\n\r\n    // Define buffers\r\n    // Compute chirp for transform\r\n    const chirp = new Float64Array(b);\r\n    const ichirp = new Float64Array(nextP2);\r\n    this._chirpBuffer = new Float64Array(nextP2);\r\n    this._buffer1 = new Float64Array(nextP2);\r\n    this._buffer2 = new Float64Array(nextP2);\r\n    this._outBuffer1 = new Float64Array(nextP2);\r\n    this._outBuffer2 = new Float64Array(nextP2);\r\n\r\n    // Compute complex exponentiation\r\n    const theta = (-2 * Math.PI) / fft_length;\r\n    const baseR = Math.cos(theta);\r\n    const baseI = Math.sin(theta);\r\n\r\n    // Precompute helper for chirp-z transform\r\n    for (let i = 0; i < b >> 1; ++i) {\r\n      // Compute complex power:\r\n      const e = (i + 1 - fft_length) ** 2 / 2.0;\r\n\r\n      // Compute the modulus and argument of the result\r\n      const result_mod = Math.sqrt(baseR ** 2 + baseI ** 2) ** e;\r\n      const result_arg = e * Math.atan2(baseI, baseR);\r\n\r\n      // Convert the result back to rectangular form\r\n      // and assign to chirp and ichirp\r\n      const i2 = 2 * i;\r\n      chirp[i2] = result_mod * Math.cos(result_arg);\r\n      chirp[i2 + 1] = result_mod * Math.sin(result_arg);\r\n\r\n      // conjugate\r\n      ichirp[i2] = chirp[i2];\r\n      ichirp[i2 + 1] = -chirp[i2 + 1];\r\n    }\r\n    this._slicedChirpBuffer = chirp.subarray(a, b);\r\n\r\n    // create object to perform Fast Fourier Transforms\r\n    // with `nextP2` complex numbers\r\n    this._f = new P2FFT(nextP2 >> 1);\r\n    this._f.transform(this._chirpBuffer, ichirp);\r\n  }\r\n\r\n  _transform(output, input, real) {\r\n    const ib1 = this._buffer1;\r\n    const ib2 = this._buffer2;\r\n    const ob2 = this._outBuffer1;\r\n    const ob3 = this._outBuffer2;\r\n    const cb = this._chirpBuffer;\r\n    const sb = this._slicedChirpBuffer;\r\n    const a = this._a;\r\n\r\n    if (real) {\r\n      // Real multiplication\r\n      for (let j = 0; j < sb.length; j += 2) {\r\n        const j2 = j + 1;\r\n        const j3 = j >> 1;\r\n\r\n        const a_real = input[j3];\r\n        ib1[j] = a_real * sb[j];\r\n        ib1[j2] = a_real * sb[j2];\r\n      }\r\n    } else {\r\n      // Complex multiplication\r\n      for (let j = 0; j < sb.length; j += 2) {\r\n        const j2 = j + 1;\r\n        ib1[j] = input[j] * sb[j] - input[j2] * sb[j2];\r\n        ib1[j2] = input[j] * sb[j2] + input[j2] * sb[j];\r\n      }\r\n    }\r\n    this._f.transform(ob2, ib1);\r\n\r\n    for (let j = 0; j < cb.length; j += 2) {\r\n      const j2 = j + 1;\r\n\r\n      ib2[j] = ob2[j] * cb[j] - ob2[j2] * cb[j2];\r\n      ib2[j2] = ob2[j] * cb[j2] + ob2[j2] * cb[j];\r\n    }\r\n    this._f.inverseTransform(ob3, ib2);\r\n\r\n    for (let j = 0; j < ob3.length; j += 2) {\r\n      const a_real = ob3[j + a];\r\n      const a_imag = ob3[j + a + 1];\r\n      const b_real = sb[j];\r\n      const b_imag = sb[j + 1];\r\n\r\n      output[j] = a_real * b_real - a_imag * b_imag;\r\n      output[j + 1] = a_real * b_imag + a_imag * b_real;\r\n    }\r\n  }\r\n\r\n  transform(output, input) {\r\n    this._transform(output, input, false);\r\n  }\r\n\r\n  realTransform(output, input) {\r\n    this._transform(output, input, true);\r\n  }\r\n}\r\n\r\nexport class FFT {\r\n  constructor(fft_length) {\r\n    this.fft_length = fft_length;\r\n    this.isPowerOfTwo = isPowerOfTwo(fft_length);\r\n    if (this.isPowerOfTwo) {\r\n      this.fft = new P2FFT(fft_length);\r\n      this.outputBufferSize = 2 * fft_length;\r\n    } else {\r\n      this.fft = new NP2FFT(fft_length);\r\n      this.outputBufferSize = this.fft.bufferSize;\r\n    }\r\n  }\r\n\r\n  realTransform(out, input) {\r\n    this.fft.realTransform(out, input);\r\n  }\r\n\r\n  transform(out, input) {\r\n    this.fft.transform(out, input);\r\n  }\r\n}\r\n\r\n/**\r\n * Performs median filter on the provided data. Padding is done by mirroring the data.\r\n * @param {AnyTypedArray} data The input array\r\n * @param {number} windowSize The window size\r\n */\r\nexport function medianFilter(data, windowSize) {\r\n  if (windowSize % 2 === 0 || windowSize <= 0) {\r\n    throw new Error(\"Window size must be a positive odd number\");\r\n  }\r\n\r\n  // @ts-ignore\r\n  const outputArray = new data.constructor(data.length);\r\n\r\n  // @ts-ignore\r\n  const buffer = new data.constructor(windowSize); // Reusable array for storing values\r\n\r\n  const halfWindowSize = Math.floor(windowSize / 2);\r\n\r\n  for (let i = 0; i < data.length; ++i) {\r\n    let valuesIndex = 0;\r\n\r\n    for (let j = -halfWindowSize; j <= halfWindowSize; ++j) {\r\n      let index = i + j;\r\n      if (index < 0) {\r\n        index = Math.abs(index);\r\n      } else if (index >= data.length) {\r\n        index = 2 * (data.length - 1) - index;\r\n      }\r\n\r\n      buffer[valuesIndex++] = data[index];\r\n    }\r\n\r\n    buffer.sort();\r\n    outputArray[i] = buffer[halfWindowSize];\r\n  }\r\n\r\n  return outputArray;\r\n}\r\n\r\n/**\r\n * Helper function to round a number to a given number of decimals\r\n * @param {number} num The number to round\r\n * @param {number} decimals The number of decimals\r\n * @returns {number} The rounded number\r\n */\r\nexport function round(num, decimals) {\r\n  const pow = Math.pow(10, decimals);\r\n  return Math.round(num * pow) / pow;\r\n}\r\n\r\n/**\r\n * Helper function to round a number to the nearest integer, with ties rounded to the nearest even number.\r\n * Also known as \"bankers' rounding\". This is the default rounding mode in python. For example:\r\n * 1.5 rounds to 2 and 2.5 rounds to 2.\r\n *\r\n * @param {number} x The number to round\r\n * @returns {number} The rounded number\r\n */\r\nexport function bankers_round(x) {\r\n  const r = Math.round(x);\r\n  const br = Math.abs(x) % 1 === 0.5 ? (r % 2 === 0 ? r : r - 1) : r;\r\n  return br;\r\n}\r\n\r\n/**\r\n * Measures similarity between two temporal sequences (e.g., input audio and output tokens\r\n * to generate token-level timestamps).\r\n * @param {number[][]} matrix\r\n * @returns {number[][]}\r\n */\r\nexport function dynamic_time_warping(matrix) {\r\n  const output_length = matrix.length;\r\n  const input_length = matrix[0].length;\r\n\r\n  const outputShape = [output_length + 1, input_length + 1];\r\n\r\n  const cost = Array.from({ length: outputShape[0] }, () =>\r\n    Array(outputShape[1]).fill(Infinity)\r\n  );\r\n  cost[0][0] = 0;\r\n\r\n  const trace = Array.from({ length: outputShape[0] }, () =>\r\n    Array(outputShape[1]).fill(-1)\r\n  );\r\n\r\n  for (let j = 1; j < outputShape[1]; ++j) {\r\n    for (let i = 1; i < outputShape[0]; ++i) {\r\n      const c0 = cost[i - 1][j - 1];\r\n      const c1 = cost[i - 1][j];\r\n      const c2 = cost[i][j - 1];\r\n\r\n      let c, t;\r\n      if (c0 < c1 && c0 < c2) {\r\n        c = c0;\r\n        t = 0;\r\n      } else if (c1 < c0 && c1 < c2) {\r\n        c = c1;\r\n        t = 1;\r\n      } else {\r\n        c = c2;\r\n        t = 2;\r\n      }\r\n      cost[i][j] = matrix[i - 1][j - 1] + c;\r\n      trace[i][j] = t;\r\n    }\r\n  }\r\n\r\n  for (let i = 0; i < outputShape[1]; ++i) {\r\n    // trace[0, :] = 2\r\n    trace[0][i] = 2;\r\n  }\r\n  for (let i = 0; i < outputShape[0]; ++i) {\r\n    // trace[:, 0] = 1\r\n    trace[i][0] = 1;\r\n  }\r\n\r\n  // backtrace\r\n  let i = output_length;\r\n  let j = input_length;\r\n  let text_indices = [];\r\n  let time_indices = [];\r\n  while (i > 0 || j > 0) {\r\n    text_indices.push(i - 1);\r\n    time_indices.push(j - 1);\r\n\r\n    switch (trace[i][j]) {\r\n      case 0:\r\n        --i;\r\n        --j;\r\n        break;\r\n      case 1:\r\n        --i;\r\n        break;\r\n      case 2:\r\n        --j;\r\n        break;\r\n      default:\r\n        throw new Error(\r\n          `Internal error in dynamic time warping. Unexpected trace[${i}, ${j}]. Please file a bug report.`\r\n        );\r\n    }\r\n  }\r\n\r\n  text_indices.reverse();\r\n  time_indices.reverse();\r\n\r\n  return [text_indices, time_indices];\r\n}\r\n","export class TensorError extends Error {\r\n  constructor(message) {\r\n    super(message);\r\n  }\r\n}\r\n\r\nexport class Tensor {\r\n  /**\r\n   * Create a new Tensor or copy an existing Tensor.\r\n   *\r\n   * *JUST PLACEHOLDER\r\n   */\r\n  constructor(...args) {\r\n    throw new TensorError(\r\n      `You seem to be creating a tensor object. Unfortunately, the '@lenml/tokenizers' library does not support returning any ONNX-related object instances. Please try setting 'return_tensor=false' to avoid this error`\r\n    );\r\n  }\r\n}\r\n","/**\r\n * @file Custom data structures.\r\n *\r\n * These are only used internally, meaning an end-user shouldn't\r\n * need to access anything here.\r\n *\r\n * @module utils/data-structures\r\n */\r\n\r\n/**\r\n * Efficient Heap-based Implementation of a Priority Queue.\r\n * It uses an array-based binary heap, where the root is at index `0`, and the\r\n * children of node `i` are located at indices `2i + 1` and `2i + 2`, respectively.\r\n *\r\n * Adapted from the following sources:\r\n * - https://stackoverflow.com/a/42919752/13989043 (original)\r\n * - https://github.com/belladoreai/llama-tokenizer-js (minor improvements)\r\n */\r\nexport class PriorityQueue {\r\n  /**\r\n   * Create a new PriorityQueue.\r\n   * @param {function(any, any): boolean} comparator Comparator function to determine priority. Defaults to a MaxHeap.\r\n   */\r\n  constructor(comparator = (a, b) => a > b, maxSize = Infinity) {\r\n    this._heap = [];\r\n    this._comparator = comparator;\r\n    this._maxSize = maxSize;\r\n  }\r\n\r\n  /**\r\n   * The size of the queue\r\n   */\r\n  get size() {\r\n    return this._heap.length;\r\n  }\r\n\r\n  /**\r\n   * Check if the queue is empty.\r\n   * @returns {boolean} `true` if the queue is empty, `false` otherwise.\r\n   */\r\n  isEmpty() {\r\n    return this.size === 0;\r\n  }\r\n\r\n  /**\r\n   * Return the element with the highest priority in the queue.\r\n   * @returns {any} The highest priority element in the queue.\r\n   */\r\n  peek() {\r\n    return this._heap[0];\r\n  }\r\n\r\n  /**\r\n   * Add one or more elements to the queue.\r\n   * @param  {...any} values The values to push into the queue.\r\n   * @returns {number} The new size of the queue.\r\n   */\r\n  push(...values) {\r\n    return this.extend(values);\r\n  }\r\n\r\n  /**\r\n   * Add multiple elements to the queue.\r\n   * @param {any[]} values The values to push into the queue.\r\n   * @returns {number} The new size of the queue.\r\n   */\r\n  extend(values) {\r\n    for (const value of values) {\r\n      if (this.size < this._maxSize) {\r\n        this._heap.push(value);\r\n        this._siftUp();\r\n      } else {\r\n        // Get index of value with the lowest priority\r\n        const smallest = this._smallest();\r\n\r\n        // If the new value has higher priority than the smallest value in the heap\r\n        // then replace the smallest value with the new value and update the heap\r\n        if (this._comparator(value, this._heap[smallest])) {\r\n          this._heap[smallest] = value;\r\n          this._siftUpFrom(smallest);\r\n        }\r\n      }\r\n    }\r\n    return this.size;\r\n  }\r\n\r\n  /**\r\n   * Remove and return the element with the highest priority in the queue.\r\n   * @returns {any} The element with the highest priority in the queue.\r\n   */\r\n  pop() {\r\n    const poppedValue = this.peek();\r\n    const bottom = this.size - 1;\r\n    if (bottom > 0) {\r\n      this._swap(0, bottom);\r\n    }\r\n    this._heap.pop();\r\n    this._siftDown();\r\n    return poppedValue;\r\n  }\r\n\r\n  /**\r\n   * Replace the element with the highest priority in the queue with a new value.\r\n   * @param {*} value The new value.\r\n   * @returns {*} The replaced value.\r\n   */\r\n  replace(value) {\r\n    const replacedValue = this.peek();\r\n    this._heap[0] = value;\r\n    this._siftDown();\r\n    return replacedValue;\r\n  }\r\n\r\n  /**\r\n   * Compute the index for the parent of the node at index `i`.\r\n   * @param {number} i The index of the node to get the parent of.\r\n   * @returns {number} The index of the parent node.\r\n   * @private\r\n   */\r\n  _parent(i) {\r\n    return ((i + 1) >>> 1) - 1;\r\n  }\r\n\r\n  /**\r\n   * Compute the index for the left child of the node at index `i`.\r\n   * @param {number} i The index of the node to get the left child of.\r\n   * @returns {number} The index of the left child.\r\n   * @private\r\n   */\r\n  _left(i) {\r\n    return (i << 1) + 1;\r\n  }\r\n\r\n  /**\r\n   * Compute the index for the right child of the node at index `i`.\r\n   * @param {number} i The index of the node to get the right child of.\r\n   * @returns {number} The index of the right child.\r\n   * @private\r\n   */\r\n  _right(i) {\r\n    return (i + 1) << 1;\r\n  }\r\n\r\n  /**\r\n   * Check if the element at index `i` is greater than the element at index `j`.\r\n   * @param {number} i The index of the first element to compare.\r\n   * @param {number} j The index of the second element to compare.\r\n   * @returns {boolean} `true` if the element at index `i` is greater than the element at index `j`, `false` otherwise.\r\n   * @private\r\n   */\r\n  _greater(i, j) {\r\n    return this._comparator(this._heap[i], this._heap[j]);\r\n  }\r\n\r\n  /**\r\n   * Swap the elements at indices `i` and `j`.\r\n   * @param {number} i The index of the first element to swap.\r\n   * @param {number} j The index of the second element to swap.\r\n   * @private\r\n   */\r\n  _swap(i, j) {\r\n    const temp = this._heap[i];\r\n    this._heap[i] = this._heap[j];\r\n    this._heap[j] = temp;\r\n  }\r\n\r\n  /**\r\n   * Maintain the heap property by updating positions in the heap,\r\n   * starting at the last element and moving up the heap.\r\n   * @private\r\n   */\r\n  _siftUp() {\r\n    this._siftUpFrom(this.size - 1);\r\n  }\r\n\r\n  /**\r\n   * Helper function to sift up from a given node.\r\n   * @param {number} node The index of the node to start sifting up from.\r\n   */\r\n  _siftUpFrom(node) {\r\n    while (node > 0 && this._greater(node, this._parent(node))) {\r\n      this._swap(node, this._parent(node));\r\n      node = this._parent(node);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Maintain the heap property by updating positions in the heap,\r\n   * starting at the first element and moving down the heap.\r\n   * @private\r\n   */\r\n  _siftDown() {\r\n    let node = 0;\r\n    while (\r\n      (this._left(node) < this.size && this._greater(this._left(node), node)) ||\r\n      (this._right(node) < this.size && this._greater(this._right(node), node))\r\n    ) {\r\n      const maxChild =\r\n        this._right(node) < this.size &&\r\n        this._greater(this._right(node), this._left(node))\r\n          ? this._right(node)\r\n          : this._left(node);\r\n      this._swap(node, maxChild);\r\n      node = maxChild;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Get the index of the smallest element in the heap. Since we use an array-based heap,\r\n   * the index can be computed without needing to traverse the heap.\r\n   * @private\r\n   */\r\n  _smallest() {\r\n    return 2 ** Math.floor(Math.log2(this.size)) - 1;\r\n  }\r\n}\r\n\r\n/**\r\n * A trie structure to efficiently store and search for strings.\r\n */\r\nexport class CharTrie {\r\n  constructor() {\r\n    this.root = CharTrieNode.default();\r\n  }\r\n\r\n  /**\r\n   * Adds one or more `texts` to the trie.\r\n   * @param {string[]} texts The strings to add to the trie.\r\n   */\r\n  extend(texts) {\r\n    for (const text of texts) {\r\n      this.push(text);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Adds text to the trie.\r\n   * @param {string} text The string to add to the trie.\r\n   */\r\n  push(text) {\r\n    let node = this.root;\r\n    for (const ch of text) {\r\n      let child = node.children.get(ch);\r\n      if (child === undefined) {\r\n        child = CharTrieNode.default();\r\n        node.children.set(ch, child);\r\n      }\r\n      node = child;\r\n    }\r\n    node.isLeaf = true;\r\n  }\r\n\r\n  /**\r\n   * Searches the trie for all strings with a common prefix of `text`.\r\n   * @param {string} text The common prefix to search for.\r\n   * @yields {string} Each string in the trie that has `text` as a prefix.\r\n   */\r\n  *commonPrefixSearch(text) {\r\n    let node = this.root;\r\n    if (node === undefined) return;\r\n\r\n    let prefix = \"\";\r\n    for (const ch of text) {\r\n      prefix += ch;\r\n      node = node.children.get(ch);\r\n      if (node === undefined) return;\r\n      if (node.isLeaf) {\r\n        yield prefix;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/**\r\n * Represents a node in a character trie.\r\n */\r\nclass CharTrieNode {\r\n  /**\r\n   * Create a new CharTrieNode.\r\n   * @param {boolean} isLeaf Whether the node is a leaf node or not.\r\n   * @param {Map<string, CharTrieNode>} children A map containing the node's children, where the key is a character and the value is a `CharTrieNode`.\r\n   */\r\n  constructor(isLeaf, children) {\r\n    this.isLeaf = isLeaf;\r\n    this.children = children;\r\n  }\r\n\r\n  /**\r\n   * Returns a new `CharTrieNode` instance with default values.\r\n   * @returns {CharTrieNode} A new `CharTrieNode` instance with `isLeaf` set to `false` and an empty `children` map.\r\n   */\r\n  static default() {\r\n    return new CharTrieNode(false, new Map());\r\n  }\r\n}\r\n\r\n/**\r\n * A lattice data structure to be used for tokenization.\r\n */\r\nexport class TokenLattice {\r\n  /**\r\n   * Creates a new TokenLattice instance.\r\n   *\r\n   * @param {string} sentence The input sentence to be tokenized.\r\n   * @param {number} bosTokenId The beginning-of-sequence token ID.\r\n   * @param {number} eosTokenId The end-of-sequence token ID.\r\n   */\r\n  constructor(sentence, bosTokenId, eosTokenId) {\r\n    this.chars = Array.from(sentence);\r\n    this.len = this.chars.length;\r\n    this.bosTokenId = bosTokenId;\r\n    this.eosTokenId = eosTokenId;\r\n    this.nodes = [];\r\n    this.beginNodes = Array.from({ length: this.len + 1 }, () => []);\r\n    this.endNodes = Array.from({ length: this.len + 1 }, () => []);\r\n\r\n    const bos = new TokenLatticeNode(this.bosTokenId, 0, 0, 0, 0.0);\r\n    const eos = new TokenLatticeNode(this.eosTokenId, 1, this.len, 0, 0.0);\r\n    this.nodes.push(bos.clone());\r\n    this.nodes.push(eos.clone());\r\n    this.beginNodes[this.len].push(eos);\r\n    this.endNodes[0].push(bos);\r\n  }\r\n\r\n  /**\r\n   * Inserts a new token node into the token lattice.\r\n   *\r\n   * @param {number} pos The starting position of the token.\r\n   * @param {number} length The length of the token.\r\n   * @param {number} score The score of the token.\r\n   * @param {number} tokenId The token ID of the token.\r\n   */\r\n  insert(pos, length, score, tokenId) {\r\n    const nodeId = this.nodes.length;\r\n    const node = new TokenLatticeNode(tokenId, nodeId, pos, length, score);\r\n    this.beginNodes[pos].push(node);\r\n    this.endNodes[pos + length].push(node);\r\n    this.nodes.push(node);\r\n  }\r\n\r\n  /**\r\n   * Implements the Viterbi algorithm to compute the most likely sequence of tokens.\r\n   *\r\n   * @returns {TokenLatticeNode[]} The most likely sequence of tokens.\r\n   */\r\n  viterbi() {\r\n    const len = this.len;\r\n    let pos = 0;\r\n    while (pos <= len) {\r\n      if (this.beginNodes[pos].length == 0) {\r\n        return [];\r\n      }\r\n      for (let rnode of this.beginNodes[pos]) {\r\n        rnode.prev = null;\r\n        let bestScore = 0.0;\r\n        let bestNode = null;\r\n        for (let lnode of this.endNodes[pos]) {\r\n          const score = lnode.backtraceScore + rnode.score;\r\n          if (bestNode === null || score > bestScore) {\r\n            bestNode = lnode.clone();\r\n            bestScore = score;\r\n          }\r\n        }\r\n\r\n        if (bestNode !== null) {\r\n          rnode.prev = bestNode;\r\n          rnode.backtraceScore = bestScore;\r\n        } else {\r\n          return [];\r\n        }\r\n      }\r\n      ++pos;\r\n    }\r\n\r\n    const results = [];\r\n    const root = this.beginNodes[len][0];\r\n    const prev = root.prev;\r\n    if (prev === null) {\r\n      return [];\r\n    }\r\n\r\n    let node = prev.clone();\r\n    while (node.prev !== null) {\r\n      results.push(node.clone());\r\n      const n = node.clone();\r\n      node = n.prev.clone();\r\n    }\r\n\r\n    results.reverse();\r\n    return results;\r\n  }\r\n\r\n  /**\r\n   * @param {TokenLatticeNode} node\r\n   * @returns {string} The array of nodes representing the most likely sequence of tokens.\r\n   */\r\n  piece(node) {\r\n    return this.chars.slice(node.pos, node.pos + node.length).join(\"\");\r\n  }\r\n\r\n  /**\r\n   * @returns {string[]} The most likely sequence of tokens.\r\n   */\r\n  tokens() {\r\n    const nodes = this.viterbi();\r\n    return nodes.map((x) => this.piece(x));\r\n  }\r\n\r\n  /**\r\n   * @returns {number[]} The most likely sequence of token ids.\r\n   */\r\n  tokenIds() {\r\n    const nodes = this.viterbi();\r\n    return nodes.map((x) => x.tokenId);\r\n  }\r\n}\r\nclass TokenLatticeNode {\r\n  /**\r\n   * Represents a node in a token lattice for a given sentence.\r\n   * @param {number} tokenId The ID of the token associated with this node.\r\n   * @param {number} nodeId The ID of this node.\r\n   * @param {number} pos The starting position of the token in the sentence.\r\n   * @param {number} length The length of the token.\r\n   * @param {number} score The score associated with the token.\r\n   */\r\n  constructor(tokenId, nodeId, pos, length, score) {\r\n    this.tokenId = tokenId;\r\n    this.nodeId = nodeId;\r\n    this.pos = pos;\r\n    this.length = length;\r\n    this.score = score;\r\n    this.prev = null;\r\n    this.backtraceScore = 0.0;\r\n  }\r\n\r\n  /**\r\n   * Returns a clone of this node.\r\n   * @returns {TokenLatticeNode} A clone of this node.\r\n   */\r\n  clone() {\r\n    const n = new TokenLatticeNode(\r\n      this.tokenId,\r\n      this.nodeId,\r\n      this.pos,\r\n      this.length,\r\n      this.score\r\n    );\r\n    n.prev = this.prev;\r\n    n.backtraceScore = this.backtraceScore;\r\n    return n;\r\n  }\r\n}\r\n\r\n/**\r\n * A data structure which uses a trie to split a string into tokens based on a dictionary.\r\n * It can also use a regular expression to preprocess the input text before splitting.\r\n *\r\n * NOTE: To ensure multi-byte characters are handled correctly, we operate at byte-level instead of character-level.\r\n */\r\nexport class DictionarySplitter {\r\n  /**\r\n   * @param {string[]} dictionary The dictionary of words to use for splitting.\r\n   */\r\n  constructor(dictionary) {\r\n    this.trie = this._buildTrie(dictionary);\r\n  }\r\n\r\n  /**\r\n   * Builds a trie from the given dictionary.\r\n   * @param {string[]} dictionary The dictionary of words to build the trie from.\r\n   * @returns {Object} The root node of the trie.\r\n   * @private\r\n   */\r\n  _buildTrie(dictionary) {\r\n    const trie = Object.create(null);\r\n    for (const word of dictionary) {\r\n      let node = trie;\r\n      for (let i = 0; i < word.length; ++i) {\r\n        node = node[word[i]] ??= Object.create(null);\r\n      }\r\n      node.end = word;\r\n    }\r\n    return trie;\r\n  }\r\n\r\n  /**\r\n   * Splits the input text into tokens based on the dictionary.\r\n   * @param {string} text The input text to split.\r\n   * @returns {string[]} An array of tokens.\r\n   */\r\n  split(text) {\r\n    const result = [];\r\n    const n = text.length;\r\n    let start = 0;\r\n    let i = 0;\r\n\r\n    while (i < n) {\r\n      let node = this.trie;\r\n      let match = null;\r\n      let j = i;\r\n\r\n      while (j < n && (node = node[text[j]])) {\r\n        if (node.end) {\r\n          // Always keep the last (i.e., longest) match.\r\n          match = node.end;\r\n        }\r\n        ++j;\r\n      }\r\n\r\n      if (match) {\r\n        if (i > start) {\r\n          result.push(text.slice(start, i));\r\n        }\r\n        result.push(match);\r\n        i += match.length;\r\n        start = i;\r\n      } else {\r\n        ++i;\r\n      }\r\n    }\r\n    if (start < n) {\r\n      result.push(text.slice(start));\r\n    }\r\n    return result;\r\n  }\r\n}\r\n\r\n/**\r\n * A simple Least Recently Used (LRU) cache implementation in JavaScript.\r\n * This cache stores key-value pairs and evicts the least recently used item\r\n * when the capacity is exceeded.\r\n */\r\nexport class LRUCache {\r\n  /**\r\n   * Creates an LRUCache instance.\r\n   * @param {number} capacity The maximum number of items the cache can hold.\r\n   */\r\n  constructor(capacity) {\r\n    this.capacity = capacity;\r\n    this.cache = new Map();\r\n  }\r\n\r\n  /**\r\n   * Retrieves the value associated with the given key and marks the key as recently used.\r\n   * @param {any} key The key to retrieve.\r\n   * @returns {any} The value associated with the key, or undefined if the key does not exist.\r\n   */\r\n  get(key) {\r\n    if (!this.cache.has(key)) return undefined;\r\n    const value = this.cache.get(key);\r\n    this.cache.delete(key);\r\n    this.cache.set(key, value);\r\n    return value;\r\n  }\r\n\r\n  /**\r\n   * Inserts or updates the key-value pair in the cache.\r\n   * If the key already exists, it is updated and marked as recently used.\r\n   * If the cache exceeds its capacity, the least recently used item is evicted.\r\n   * @param {any} key The key to add or update.\r\n   * @param {any} value The value to associate with the key.\r\n   */\r\n  put(key, value) {\r\n    if (this.cache.has(key)) {\r\n      this.cache.delete(key);\r\n    }\r\n    this.cache.set(key, value);\r\n    if (this.cache.size > this.capacity) {\r\n      this.cache.delete(this.cache.keys().next().value);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Clears the cache.\r\n   */\r\n  clear() {\r\n    this.cache.clear();\r\n  }\r\n}\r\n","// src/lexer.ts\nvar TOKEN_TYPES = Object.freeze({\n  Text: \"Text\",\n  // The text between Jinja statements or expressions\n  NumericLiteral: \"NumericLiteral\",\n  // e.g., 123\n  BooleanLiteral: \"BooleanLiteral\",\n  // true or false\n  StringLiteral: \"StringLiteral\",\n  // 'string'\n  Identifier: \"Identifier\",\n  // Variables, functions, etc.\n  Equals: \"Equals\",\n  // =\n  OpenParen: \"OpenParen\",\n  // (\n  CloseParen: \"CloseParen\",\n  // )\n  OpenStatement: \"OpenStatement\",\n  // {%\n  CloseStatement: \"CloseStatement\",\n  // %}\n  OpenExpression: \"OpenExpression\",\n  // {{\n  CloseExpression: \"CloseExpression\",\n  // }}\n  OpenSquareBracket: \"OpenSquareBracket\",\n  // [\n  CloseSquareBracket: \"CloseSquareBracket\",\n  // ]\n  OpenCurlyBracket: \"OpenCurlyBracket\",\n  // {\n  CloseCurlyBracket: \"CloseCurlyBracket\",\n  // }\n  Comma: \"Comma\",\n  // ,\n  Dot: \"Dot\",\n  // .\n  Colon: \"Colon\",\n  // :\n  Pipe: \"Pipe\",\n  // |\n  CallOperator: \"CallOperator\",\n  // ()\n  AdditiveBinaryOperator: \"AdditiveBinaryOperator\",\n  // + -\n  MultiplicativeBinaryOperator: \"MultiplicativeBinaryOperator\",\n  // * / %\n  ComparisonBinaryOperator: \"ComparisonBinaryOperator\",\n  // < > <= >= == !=\n  UnaryOperator: \"UnaryOperator\",\n  // ! - +\n  // Keywords\n  Set: \"Set\",\n  If: \"If\",\n  For: \"For\",\n  In: \"In\",\n  Is: \"Is\",\n  NotIn: \"NotIn\",\n  Else: \"Else\",\n  EndIf: \"EndIf\",\n  ElseIf: \"ElseIf\",\n  EndFor: \"EndFor\",\n  And: \"And\",\n  Or: \"Or\",\n  Not: \"UnaryOperator\"\n});\nvar KEYWORDS = Object.freeze({\n  set: TOKEN_TYPES.Set,\n  for: TOKEN_TYPES.For,\n  in: TOKEN_TYPES.In,\n  is: TOKEN_TYPES.Is,\n  if: TOKEN_TYPES.If,\n  else: TOKEN_TYPES.Else,\n  endif: TOKEN_TYPES.EndIf,\n  elif: TOKEN_TYPES.ElseIf,\n  endfor: TOKEN_TYPES.EndFor,\n  and: TOKEN_TYPES.And,\n  or: TOKEN_TYPES.Or,\n  not: TOKEN_TYPES.Not,\n  \"not in\": TOKEN_TYPES.NotIn,\n  // Literals\n  true: TOKEN_TYPES.BooleanLiteral,\n  false: TOKEN_TYPES.BooleanLiteral\n});\nvar Token = class {\n  /**\n   * Constructs a new Token.\n   * @param {string} value The raw value as seen inside the source code.\n   * @param {TokenType} type The type of token.\n   */\n  constructor(value, type) {\n    this.value = value;\n    this.type = type;\n  }\n};\nfunction isWord(char) {\n  return /\\w/.test(char);\n}\nfunction isInteger(char) {\n  return /[0-9]/.test(char);\n}\nvar ORDERED_MAPPING_TABLE = [\n  // Control sequences\n  [\"{%\", TOKEN_TYPES.OpenStatement],\n  [\"%}\", TOKEN_TYPES.CloseStatement],\n  [\"{{\", TOKEN_TYPES.OpenExpression],\n  [\"}}\", TOKEN_TYPES.CloseExpression],\n  // Single character tokens\n  [\"(\", TOKEN_TYPES.OpenParen],\n  [\")\", TOKEN_TYPES.CloseParen],\n  [\"{\", TOKEN_TYPES.OpenCurlyBracket],\n  [\"}\", TOKEN_TYPES.CloseCurlyBracket],\n  [\"[\", TOKEN_TYPES.OpenSquareBracket],\n  [\"]\", TOKEN_TYPES.CloseSquareBracket],\n  [\",\", TOKEN_TYPES.Comma],\n  [\".\", TOKEN_TYPES.Dot],\n  [\":\", TOKEN_TYPES.Colon],\n  [\"|\", TOKEN_TYPES.Pipe],\n  // Comparison operators\n  [\"<=\", TOKEN_TYPES.ComparisonBinaryOperator],\n  [\">=\", TOKEN_TYPES.ComparisonBinaryOperator],\n  [\"==\", TOKEN_TYPES.ComparisonBinaryOperator],\n  [\"!=\", TOKEN_TYPES.ComparisonBinaryOperator],\n  [\"<\", TOKEN_TYPES.ComparisonBinaryOperator],\n  [\">\", TOKEN_TYPES.ComparisonBinaryOperator],\n  // Arithmetic operators\n  [\"+\", TOKEN_TYPES.AdditiveBinaryOperator],\n  [\"-\", TOKEN_TYPES.AdditiveBinaryOperator],\n  [\"*\", TOKEN_TYPES.MultiplicativeBinaryOperator],\n  [\"/\", TOKEN_TYPES.MultiplicativeBinaryOperator],\n  [\"%\", TOKEN_TYPES.MultiplicativeBinaryOperator],\n  // Assignment operator\n  [\"=\", TOKEN_TYPES.Equals]\n];\nvar ESCAPE_CHARACTERS = /* @__PURE__ */ new Map([\n  [\"n\", \"\\n\"],\n  // New line\n  [\"t\", \"\t\"],\n  // Horizontal tab\n  [\"r\", \"\\r\"],\n  // Carriage return\n  [\"b\", \"\\b\"],\n  // Backspace\n  [\"f\", \"\\f\"],\n  // Form feed\n  [\"v\", \"\\v\"],\n  // Vertical tab\n  [\"'\", \"'\"],\n  // Single quote\n  ['\"', '\"'],\n  // Double quote\n  [\"\\\\\", \"\\\\\"]\n  // Backslash\n]);\nfunction preprocess(template, options = {}) {\n  if (template.endsWith(\"\\n\")) {\n    template = template.slice(0, -1);\n  }\n  template = template.replace(/{#.*?#}/gs, \"{##}\");\n  if (options.lstrip_blocks) {\n    template = template.replace(/^[ \\t]*({[#%])/gm, \"$1\");\n  }\n  if (options.trim_blocks) {\n    template = template.replace(/([#%]})\\n/g, \"$1\");\n  }\n  return template.replace(/{##}/g, \"\").replace(/-%}\\s*/g, \"%}\").replace(/\\s*{%-/g, \"{%\").replace(/-}}\\s*/g, \"}}\").replace(/\\s*{{-/g, \"{{\");\n}\nfunction tokenize(source, options = {}) {\n  const tokens = [];\n  const src = preprocess(source, options);\n  let cursorPosition = 0;\n  const consumeWhile = (predicate) => {\n    let str = \"\";\n    while (predicate(src[cursorPosition])) {\n      if (src[cursorPosition] === \"\\\\\") {\n        ++cursorPosition;\n        if (cursorPosition >= src.length)\n          throw new SyntaxError(\"Unexpected end of input\");\n        const escaped = src[cursorPosition++];\n        const unescaped = ESCAPE_CHARACTERS.get(escaped);\n        if (unescaped === void 0) {\n          throw new SyntaxError(`Unexpected escaped character: ${escaped}`);\n        }\n        str += unescaped;\n        continue;\n      }\n      str += src[cursorPosition++];\n      if (cursorPosition >= src.length)\n        throw new SyntaxError(\"Unexpected end of input\");\n    }\n    return str;\n  };\n  main:\n    while (cursorPosition < src.length) {\n      const lastTokenType = tokens.at(-1)?.type;\n      if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {\n        let text = \"\";\n        while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression\n        !(src[cursorPosition] === \"{\" && (src[cursorPosition + 1] === \"%\" || src[cursorPosition + 1] === \"{\"))) {\n          text += src[cursorPosition++];\n        }\n        if (text.length > 0) {\n          tokens.push(new Token(text, TOKEN_TYPES.Text));\n          continue;\n        }\n      }\n      consumeWhile((char2) => /\\s/.test(char2));\n      const char = src[cursorPosition];\n      if (char === \"-\" || char === \"+\") {\n        const lastTokenType2 = tokens.at(-1)?.type;\n        if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {\n          throw new SyntaxError(`Unexpected character: ${char}`);\n        }\n        switch (lastTokenType2) {\n          case TOKEN_TYPES.Identifier:\n          case TOKEN_TYPES.NumericLiteral:\n          case TOKEN_TYPES.BooleanLiteral:\n          case TOKEN_TYPES.StringLiteral:\n          case TOKEN_TYPES.CloseParen:\n          case TOKEN_TYPES.CloseSquareBracket:\n            break;\n          default: {\n            ++cursorPosition;\n            const num = consumeWhile(isInteger);\n            tokens.push(\n              new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)\n            );\n            continue;\n          }\n        }\n      }\n      for (const [char2, token] of ORDERED_MAPPING_TABLE) {\n        const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);\n        if (slice2 === char2) {\n          tokens.push(new Token(char2, token));\n          cursorPosition += char2.length;\n          continue main;\n        }\n      }\n      if (char === \"'\" || char === '\"') {\n        ++cursorPosition;\n        const str = consumeWhile((c) => c !== char);\n        tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));\n        ++cursorPosition;\n        continue;\n      }\n      if (isInteger(char)) {\n        const num = consumeWhile(isInteger);\n        tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));\n        continue;\n      }\n      if (isWord(char)) {\n        const word = consumeWhile(isWord);\n        const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;\n        if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {\n          tokens.pop();\n          tokens.push(new Token(\"not in\", TOKEN_TYPES.NotIn));\n        } else {\n          tokens.push(new Token(word, type));\n        }\n        continue;\n      }\n      throw new SyntaxError(`Unexpected character: ${char}`);\n    }\n  return tokens;\n}\n\n// src/ast.ts\nvar Statement = class {\n  type = \"Statement\";\n};\nvar Program = class extends Statement {\n  constructor(body) {\n    super();\n    this.body = body;\n  }\n  type = \"Program\";\n};\nvar If = class extends Statement {\n  constructor(test, body, alternate) {\n    super();\n    this.test = test;\n    this.body = body;\n    this.alternate = alternate;\n  }\n  type = \"If\";\n};\nvar For = class extends Statement {\n  constructor(loopvar, iterable, body) {\n    super();\n    this.loopvar = loopvar;\n    this.iterable = iterable;\n    this.body = body;\n  }\n  type = \"For\";\n};\nvar SetStatement = class extends Statement {\n  constructor(assignee, value) {\n    super();\n    this.assignee = assignee;\n    this.value = value;\n  }\n  type = \"Set\";\n};\nvar Expression = class extends Statement {\n  type = \"Expression\";\n};\nvar MemberExpression = class extends Expression {\n  constructor(object, property, computed) {\n    super();\n    this.object = object;\n    this.property = property;\n    this.computed = computed;\n  }\n  type = \"MemberExpression\";\n};\nvar CallExpression = class extends Expression {\n  constructor(callee, args) {\n    super();\n    this.callee = callee;\n    this.args = args;\n  }\n  type = \"CallExpression\";\n};\nvar Identifier = class extends Expression {\n  /**\n   * @param {string} value The name of the identifier\n   */\n  constructor(value) {\n    super();\n    this.value = value;\n  }\n  type = \"Identifier\";\n};\nvar Literal = class extends Expression {\n  constructor(value) {\n    super();\n    this.value = value;\n  }\n  type = \"Literal\";\n};\nvar NumericLiteral = class extends Literal {\n  type = \"NumericLiteral\";\n};\nvar StringLiteral = class extends Literal {\n  type = \"StringLiteral\";\n};\nvar BooleanLiteral = class extends Literal {\n  type = \"BooleanLiteral\";\n};\nvar ArrayLiteral = class extends Literal {\n  type = \"ArrayLiteral\";\n};\nvar TupleLiteral = class extends Literal {\n  type = \"TupleLiteral\";\n};\nvar ObjectLiteral = class extends Literal {\n  type = \"ObjectLiteral\";\n};\nvar BinaryExpression = class extends Expression {\n  constructor(operator, left, right) {\n    super();\n    this.operator = operator;\n    this.left = left;\n    this.right = right;\n  }\n  type = \"BinaryExpression\";\n};\nvar FilterExpression = class extends Expression {\n  constructor(operand, filter) {\n    super();\n    this.operand = operand;\n    this.filter = filter;\n  }\n  type = \"FilterExpression\";\n};\nvar TestExpression = class extends Expression {\n  constructor(operand, negate, test) {\n    super();\n    this.operand = operand;\n    this.negate = negate;\n    this.test = test;\n  }\n  type = \"TestExpression\";\n};\nvar UnaryExpression = class extends Expression {\n  constructor(operator, argument) {\n    super();\n    this.operator = operator;\n    this.argument = argument;\n  }\n  type = \"UnaryExpression\";\n};\nvar SliceExpression = class extends Expression {\n  constructor(start = void 0, stop = void 0, step = void 0) {\n    super();\n    this.start = start;\n    this.stop = stop;\n    this.step = step;\n  }\n  type = \"SliceExpression\";\n};\nvar KeywordArgumentExpression = class extends Expression {\n  constructor(key, value) {\n    super();\n    this.key = key;\n    this.value = value;\n  }\n  type = \"KeywordArgumentExpression\";\n};\n\n// src/parser.ts\nfunction parse(tokens) {\n  const program = new Program([]);\n  let current = 0;\n  function expect(type, error) {\n    const prev = tokens[current++];\n    if (!prev || prev.type !== type) {\n      throw new Error(`Parser Error: ${error}. ${prev.type} !== ${type}.`);\n    }\n    return prev;\n  }\n  function parseAny() {\n    switch (tokens[current].type) {\n      case TOKEN_TYPES.Text:\n        return parseText();\n      case TOKEN_TYPES.OpenStatement:\n        return parseJinjaStatement();\n      case TOKEN_TYPES.OpenExpression:\n        return parseJinjaExpression();\n      default:\n        throw new SyntaxError(`Unexpected token type: ${tokens[current].type}`);\n    }\n  }\n  function not(...types) {\n    return current + types.length <= tokens.length && types.some((type, i) => type !== tokens[current + i].type);\n  }\n  function is(...types) {\n    return current + types.length <= tokens.length && types.every((type, i) => type === tokens[current + i].type);\n  }\n  function parseText() {\n    return new StringLiteral(expect(TOKEN_TYPES.Text, \"Expected text token\").value);\n  }\n  function parseJinjaStatement() {\n    expect(TOKEN_TYPES.OpenStatement, \"Expected opening statement token\");\n    let result;\n    switch (tokens[current].type) {\n      case TOKEN_TYPES.Set:\n        ++current;\n        result = parseSetStatement();\n        expect(TOKEN_TYPES.CloseStatement, \"Expected closing statement token\");\n        break;\n      case TOKEN_TYPES.If:\n        ++current;\n        result = parseIfStatement();\n        expect(TOKEN_TYPES.OpenStatement, \"Expected {% token\");\n        expect(TOKEN_TYPES.EndIf, \"Expected endif token\");\n        expect(TOKEN_TYPES.CloseStatement, \"Expected %} token\");\n        break;\n      case TOKEN_TYPES.For:\n        ++current;\n        result = parseForStatement();\n        expect(TOKEN_TYPES.OpenStatement, \"Expected {% token\");\n        expect(TOKEN_TYPES.EndFor, \"Expected endfor token\");\n        expect(TOKEN_TYPES.CloseStatement, \"Expected %} token\");\n        break;\n      default:\n        throw new SyntaxError(`Unknown statement type: ${tokens[current].type}`);\n    }\n    return result;\n  }\n  function parseJinjaExpression() {\n    expect(TOKEN_TYPES.OpenExpression, \"Expected opening expression token\");\n    const result = parseExpression();\n    expect(TOKEN_TYPES.CloseExpression, \"Expected closing expression token\");\n    return result;\n  }\n  function parseSetStatement() {\n    const left = parseExpression();\n    if (is(TOKEN_TYPES.Equals)) {\n      ++current;\n      const value = parseSetStatement();\n      return new SetStatement(left, value);\n    }\n    return left;\n  }\n  function parseIfStatement() {\n    const test = parseExpression();\n    expect(TOKEN_TYPES.CloseStatement, \"Expected closing statement token\");\n    const body = [];\n    const alternate = [];\n    while (!(tokens[current]?.type === TOKEN_TYPES.OpenStatement && (tokens[current + 1]?.type === TOKEN_TYPES.ElseIf || tokens[current + 1]?.type === TOKEN_TYPES.Else || tokens[current + 1]?.type === TOKEN_TYPES.EndIf))) {\n      body.push(parseAny());\n    }\n    if (tokens[current]?.type === TOKEN_TYPES.OpenStatement && tokens[current + 1]?.type !== TOKEN_TYPES.EndIf) {\n      ++current;\n      if (is(TOKEN_TYPES.ElseIf)) {\n        expect(TOKEN_TYPES.ElseIf, \"Expected elseif token\");\n        alternate.push(parseIfStatement());\n      } else {\n        expect(TOKEN_TYPES.Else, \"Expected else token\");\n        expect(TOKEN_TYPES.CloseStatement, \"Expected closing statement token\");\n        while (!(tokens[current]?.type === TOKEN_TYPES.OpenStatement && tokens[current + 1]?.type === TOKEN_TYPES.EndIf)) {\n          alternate.push(parseAny());\n        }\n      }\n    }\n    return new If(test, body, alternate);\n  }\n  function parseExpressionSequence(primary = false) {\n    const fn = primary ? parsePrimaryExpression : parseExpression;\n    const expressions = [fn()];\n    const isTuple = is(TOKEN_TYPES.Comma);\n    while (isTuple) {\n      ++current;\n      expressions.push(fn());\n      if (!is(TOKEN_TYPES.Comma)) {\n        break;\n      }\n    }\n    return isTuple ? new TupleLiteral(expressions) : expressions[0];\n  }\n  function parseForStatement() {\n    const loopVariable = parseExpressionSequence(true);\n    if (!(loopVariable instanceof Identifier || loopVariable instanceof TupleLiteral)) {\n      throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${loopVariable.type} instead`);\n    }\n    expect(TOKEN_TYPES.In, \"Expected `in` keyword following loop variable\");\n    const iterable = parseExpression();\n    expect(TOKEN_TYPES.CloseStatement, \"Expected closing statement token\");\n    const body = [];\n    while (not(TOKEN_TYPES.OpenStatement, TOKEN_TYPES.EndFor)) {\n      body.push(parseAny());\n    }\n    return new For(loopVariable, iterable, body);\n  }\n  function parseExpression() {\n    return parseTernaryExpression();\n  }\n  function parseTernaryExpression() {\n    const a = parseLogicalOrExpression();\n    if (is(TOKEN_TYPES.If)) {\n      ++current;\n      const predicate = parseLogicalOrExpression();\n      expect(TOKEN_TYPES.Else, \"Expected else token\");\n      const b = parseLogicalOrExpression();\n      return new If(predicate, [a], [b]);\n    }\n    return a;\n  }\n  function parseLogicalOrExpression() {\n    let left = parseLogicalAndExpression();\n    while (is(TOKEN_TYPES.Or)) {\n      const operator = tokens[current];\n      ++current;\n      const right = parseLogicalAndExpression();\n      left = new BinaryExpression(operator, left, right);\n    }\n    return left;\n  }\n  function parseLogicalAndExpression() {\n    let left = parseLogicalNegationExpression();\n    while (is(TOKEN_TYPES.And)) {\n      const operator = tokens[current];\n      ++current;\n      const right = parseLogicalNegationExpression();\n      left = new BinaryExpression(operator, left, right);\n    }\n    return left;\n  }\n  function parseLogicalNegationExpression() {\n    let right;\n    while (is(TOKEN_TYPES.Not)) {\n      const operator = tokens[current];\n      ++current;\n      const arg = parseLogicalNegationExpression();\n      right = new UnaryExpression(operator, arg);\n    }\n    return right ?? parseComparisonExpression();\n  }\n  function parseComparisonExpression() {\n    let left = parseAdditiveExpression();\n    while (is(TOKEN_TYPES.ComparisonBinaryOperator) || is(TOKEN_TYPES.In) || is(TOKEN_TYPES.NotIn)) {\n      const operator = tokens[current];\n      ++current;\n      const right = parseAdditiveExpression();\n      left = new BinaryExpression(operator, left, right);\n    }\n    return left;\n  }\n  function parseAdditiveExpression() {\n    let left = parseMultiplicativeExpression();\n    while (is(TOKEN_TYPES.AdditiveBinaryOperator)) {\n      const operator = tokens[current];\n      ++current;\n      const right = parseMultiplicativeExpression();\n      left = new BinaryExpression(operator, left, right);\n    }\n    return left;\n  }\n  function parseCallMemberExpression() {\n    const member = parseMemberExpression();\n    if (is(TOKEN_TYPES.OpenParen)) {\n      return parseCallExpression(member);\n    }\n    return member;\n  }\n  function parseCallExpression(callee) {\n    let callExpression = new CallExpression(callee, parseArgs());\n    if (is(TOKEN_TYPES.OpenParen)) {\n      callExpression = parseCallExpression(callExpression);\n    }\n    return callExpression;\n  }\n  function parseArgs() {\n    expect(TOKEN_TYPES.OpenParen, \"Expected opening parenthesis for arguments list\");\n    const args = parseArgumentsList();\n    expect(TOKEN_TYPES.CloseParen, \"Expected closing parenthesis for arguments list\");\n    return args;\n  }\n  function parseArgumentsList() {\n    const args = [];\n    while (!is(TOKEN_TYPES.CloseParen)) {\n      let argument = parseExpression();\n      if (is(TOKEN_TYPES.Equals)) {\n        ++current;\n        if (!(argument instanceof Identifier)) {\n          throw new SyntaxError(`Expected identifier for keyword argument`);\n        }\n        const value = parseExpression();\n        argument = new KeywordArgumentExpression(argument, value);\n      }\n      args.push(argument);\n      if (is(TOKEN_TYPES.Comma)) {\n        ++current;\n      }\n    }\n    return args;\n  }\n  function parseMemberExpressionArgumentsList() {\n    const slices = [];\n    let isSlice = false;\n    while (!is(TOKEN_TYPES.CloseSquareBracket)) {\n      if (is(TOKEN_TYPES.Colon)) {\n        slices.push(void 0);\n        ++current;\n        isSlice = true;\n      } else {\n        slices.push(parseExpression());\n        if (is(TOKEN_TYPES.Colon)) {\n          ++current;\n          isSlice = true;\n        }\n      }\n    }\n    if (slices.length === 0) {\n      throw new SyntaxError(`Expected at least one argument for member/slice expression`);\n    }\n    if (isSlice) {\n      if (slices.length > 3) {\n        throw new SyntaxError(`Expected 0-3 arguments for slice expression`);\n      }\n      return new SliceExpression(...slices);\n    }\n    return slices[0];\n  }\n  function parseMemberExpression() {\n    let object = parsePrimaryExpression();\n    while (is(TOKEN_TYPES.Dot) || is(TOKEN_TYPES.OpenSquareBracket)) {\n      const operator = tokens[current];\n      ++current;\n      let property;\n      const computed = operator.type !== TOKEN_TYPES.Dot;\n      if (computed) {\n        property = parseMemberExpressionArgumentsList();\n        expect(TOKEN_TYPES.CloseSquareBracket, \"Expected closing square bracket\");\n      } else {\n        property = parsePrimaryExpression();\n        if (property.type !== \"Identifier\") {\n          throw new SyntaxError(`Expected identifier following dot operator`);\n        }\n      }\n      object = new MemberExpression(object, property, computed);\n    }\n    return object;\n  }\n  function parseMultiplicativeExpression() {\n    let left = parseTestExpression();\n    while (is(TOKEN_TYPES.MultiplicativeBinaryOperator)) {\n      const operator = tokens[current];\n      ++current;\n      const right = parseTestExpression();\n      left = new BinaryExpression(operator, left, right);\n    }\n    return left;\n  }\n  function parseTestExpression() {\n    let operand = parseFilterExpression();\n    while (is(TOKEN_TYPES.Is)) {\n      ++current;\n      const negate = is(TOKEN_TYPES.Not);\n      if (negate) {\n        ++current;\n      }\n      let filter = parsePrimaryExpression();\n      if (filter instanceof BooleanLiteral) {\n        filter = new Identifier(filter.value.toString());\n      }\n      if (!(filter instanceof Identifier)) {\n        throw new SyntaxError(`Expected identifier for the test`);\n      }\n      operand = new TestExpression(operand, negate, filter);\n    }\n    return operand;\n  }\n  function parseFilterExpression() {\n    let operand = parseCallMemberExpression();\n    while (is(TOKEN_TYPES.Pipe)) {\n      ++current;\n      let filter = parsePrimaryExpression();\n      if (!(filter instanceof Identifier)) {\n        throw new SyntaxError(`Expected identifier for the filter`);\n      }\n      if (is(TOKEN_TYPES.OpenParen)) {\n        filter = parseCallExpression(filter);\n      }\n      operand = new FilterExpression(operand, filter);\n    }\n    return operand;\n  }\n  function parsePrimaryExpression() {\n    const token = tokens[current];\n    switch (token.type) {\n      case TOKEN_TYPES.NumericLiteral:\n        ++current;\n        return new NumericLiteral(Number(token.value));\n      case TOKEN_TYPES.StringLiteral:\n        ++current;\n        return new StringLiteral(token.value);\n      case TOKEN_TYPES.BooleanLiteral:\n        ++current;\n        return new BooleanLiteral(token.value === \"true\");\n      case TOKEN_TYPES.Identifier:\n        ++current;\n        return new Identifier(token.value);\n      case TOKEN_TYPES.OpenParen: {\n        ++current;\n        const expression = parseExpressionSequence();\n        if (tokens[current].type !== TOKEN_TYPES.CloseParen) {\n          throw new SyntaxError(`Expected closing parenthesis, got ${tokens[current].type} instead`);\n        }\n        ++current;\n        return expression;\n      }\n      case TOKEN_TYPES.OpenSquareBracket: {\n        ++current;\n        const values = [];\n        while (!is(TOKEN_TYPES.CloseSquareBracket)) {\n          values.push(parseExpression());\n          if (is(TOKEN_TYPES.Comma)) {\n            ++current;\n          }\n        }\n        ++current;\n        return new ArrayLiteral(values);\n      }\n      case TOKEN_TYPES.OpenCurlyBracket: {\n        ++current;\n        const values = /* @__PURE__ */ new Map();\n        while (!is(TOKEN_TYPES.CloseCurlyBracket)) {\n          const key = parseExpression();\n          expect(TOKEN_TYPES.Colon, \"Expected colon between key and value in object literal\");\n          const value = parseExpression();\n          values.set(key, value);\n          if (is(TOKEN_TYPES.Comma)) {\n            ++current;\n          }\n        }\n        ++current;\n        return new ObjectLiteral(values);\n      }\n      default:\n        throw new SyntaxError(`Unexpected token: ${token.type}`);\n    }\n  }\n  while (current < tokens.length) {\n    program.body.push(parseAny());\n  }\n  return program;\n}\n\n// src/utils.ts\nfunction range(start, stop, step = 1) {\n  if (stop === void 0) {\n    stop = start;\n    start = 0;\n  }\n  const result = [];\n  for (let i = start; i < stop; i += step) {\n    result.push(i);\n  }\n  return result;\n}\nfunction slice(array, start, stop, step = 1) {\n  const direction = Math.sign(step);\n  if (direction >= 0) {\n    start = (start ??= 0) < 0 ? Math.max(array.length + start, 0) : Math.min(start, array.length);\n    stop = (stop ??= array.length) < 0 ? Math.max(array.length + stop, 0) : Math.min(stop, array.length);\n  } else {\n    start = (start ??= array.length - 1) < 0 ? Math.max(array.length + start, -1) : Math.min(start, array.length - 1);\n    stop = (stop ??= -1) < -1 ? Math.max(array.length + stop, -1) : Math.min(stop, array.length - 1);\n  }\n  const result = [];\n  for (let i = start; direction * i < direction * stop; i += step) {\n    result.push(array[i]);\n  }\n  return result;\n}\nfunction titleCase(value) {\n  return value.replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\n// src/runtime.ts\nvar RuntimeValue = class {\n  type = \"RuntimeValue\";\n  value;\n  /**\n   * A collection of built-in functions for this type.\n   */\n  builtins = /* @__PURE__ */ new Map();\n  /**\n   * Creates a new RuntimeValue.\n   */\n  constructor(value = void 0) {\n    this.value = value;\n  }\n  /**\n   * Determines truthiness or falsiness of the runtime value.\n   * This function should be overridden by subclasses if it has custom truthiness criteria.\n   * @returns {BooleanValue} BooleanValue(true) if the value is truthy, BooleanValue(false) otherwise.\n   */\n  __bool__() {\n    return new BooleanValue(!!this.value);\n  }\n};\nvar NumericValue = class extends RuntimeValue {\n  type = \"NumericValue\";\n};\nvar StringValue = class extends RuntimeValue {\n  type = \"StringValue\";\n  builtins = /* @__PURE__ */ new Map([\n    [\n      \"upper\",\n      new FunctionValue(() => {\n        return new StringValue(this.value.toUpperCase());\n      })\n    ],\n    [\n      \"lower\",\n      new FunctionValue(() => {\n        return new StringValue(this.value.toLowerCase());\n      })\n    ],\n    [\n      \"strip\",\n      new FunctionValue(() => {\n        return new StringValue(this.value.trim());\n      })\n    ],\n    [\n      \"title\",\n      new FunctionValue(() => {\n        return new StringValue(titleCase(this.value));\n      })\n    ],\n    [\"length\", new NumericValue(this.value.length)]\n  ]);\n};\nvar BooleanValue = class extends RuntimeValue {\n  type = \"BooleanValue\";\n};\nvar ObjectValue = class extends RuntimeValue {\n  type = \"ObjectValue\";\n  /**\n   * NOTE: necessary to override since all JavaScript arrays are considered truthy,\n   * while only non-empty Python arrays are consider truthy.\n   *\n   * e.g.,\n   *  - JavaScript:  {} && 5 -> 5\n   *  - Python:      {} and 5 -> {}\n   */\n  __bool__() {\n    return new BooleanValue(this.value.size > 0);\n  }\n  builtins = /* @__PURE__ */ new Map([\n    [\n      \"get\",\n      new FunctionValue(([key, defaultValue]) => {\n        if (!(key instanceof StringValue)) {\n          throw new Error(`Object key must be a string: got ${key.type}`);\n        }\n        return this.value.get(key.value) ?? defaultValue ?? new NullValue();\n      })\n    ],\n    [\n      \"items\",\n      new FunctionValue(() => {\n        return new ArrayValue(\n          Array.from(this.value.entries()).map(([key, value]) => new ArrayValue([new StringValue(key), value]))\n        );\n      })\n    ]\n  ]);\n};\nvar ArrayValue = class extends RuntimeValue {\n  type = \"ArrayValue\";\n  builtins = /* @__PURE__ */ new Map([[\"length\", new NumericValue(this.value.length)]]);\n  /**\n   * NOTE: necessary to override since all JavaScript arrays are considered truthy,\n   * while only non-empty Python arrays are consider truthy.\n   *\n   * e.g.,\n   *  - JavaScript:  [] && 5 -> 5\n   *  - Python:      [] and 5 -> []\n   */\n  __bool__() {\n    return new BooleanValue(this.value.length > 0);\n  }\n};\nvar TupleValue = class extends ArrayValue {\n  type = \"TupleValue\";\n};\nvar FunctionValue = class extends RuntimeValue {\n  type = \"FunctionValue\";\n};\nvar NullValue = class extends RuntimeValue {\n  type = \"NullValue\";\n};\nvar UndefinedValue = class extends RuntimeValue {\n  type = \"UndefinedValue\";\n};\nvar Environment = class {\n  constructor(parent) {\n    this.parent = parent;\n  }\n  /**\n   * The variables declared in this environment.\n   */\n  variables = /* @__PURE__ */ new Map([\n    [\n      \"namespace\",\n      new FunctionValue((args) => {\n        if (args.length === 0) {\n          return new ObjectValue(/* @__PURE__ */ new Map());\n        }\n        if (args.length !== 1 || !(args[0] instanceof ObjectValue)) {\n          throw new Error(\"`namespace` expects either zero arguments or a single object argument\");\n        }\n        return args[0];\n      })\n    ]\n  ]);\n  /**\n   * The tests available in this environment.\n   */\n  tests = /* @__PURE__ */ new Map([\n    [\"boolean\", (operand) => operand.type === \"BooleanValue\"],\n    [\"callable\", (operand) => operand instanceof FunctionValue],\n    [\n      \"odd\",\n      (operand) => {\n        if (operand.type !== \"NumericValue\") {\n          throw new Error(`Cannot apply test \"odd\" to type: ${operand.type}`);\n        }\n        return operand.value % 2 !== 0;\n      }\n    ],\n    [\n      \"even\",\n      (operand) => {\n        if (operand.type !== \"NumericValue\") {\n          throw new Error(`Cannot apply test \"even\" to type: ${operand.type}`);\n        }\n        return operand.value % 2 === 0;\n      }\n    ],\n    [\"false\", (operand) => operand.type === \"BooleanValue\" && !operand.value],\n    [\"true\", (operand) => operand.type === \"BooleanValue\" && operand.value],\n    [\"number\", (operand) => operand.type === \"NumericValue\"],\n    [\"integer\", (operand) => operand.type === \"NumericValue\" && Number.isInteger(operand.value)],\n    [\"iterable\", (operand) => operand instanceof ArrayValue || operand instanceof StringValue],\n    [\n      \"lower\",\n      (operand) => {\n        const str = operand.value;\n        return operand.type === \"StringValue\" && str === str.toLowerCase();\n      }\n    ],\n    [\n      \"upper\",\n      (operand) => {\n        const str = operand.value;\n        return operand.type === \"StringValue\" && str === str.toUpperCase();\n      }\n    ],\n    [\"none\", (operand) => operand.type === \"NullValue\"],\n    [\"defined\", (operand) => operand.type !== \"UndefinedValue\"],\n    [\"undefined\", (operand) => operand.type === \"UndefinedValue\"],\n    [\"equalto\", (a, b) => a.value === b.value]\n  ]);\n  /**\n   * Set the value of a variable in the current environment.\n   */\n  set(name, value) {\n    return this.declareVariable(name, convertToRuntimeValues(value));\n  }\n  declareVariable(name, value) {\n    if (this.variables.has(name)) {\n      throw new SyntaxError(`Variable already declared: ${name}`);\n    }\n    this.variables.set(name, value);\n    return value;\n  }\n  // private assignVariable(name: string, value: AnyRuntimeValue): AnyRuntimeValue {\n  // \tconst env = this.resolve(name);\n  // \tenv.variables.set(name, value);\n  // \treturn value;\n  // }\n  /**\n   * Set variable in the current scope.\n   * See https://jinja.palletsprojects.com/en/3.0.x/templates/#assignments for more information.\n   */\n  setVariable(name, value) {\n    this.variables.set(name, value);\n    return value;\n  }\n  /**\n   * Resolve the environment in which the variable is declared.\n   * @param {string} name The name of the variable.\n   * @returns {Environment} The environment in which the variable is declared.\n   */\n  resolve(name) {\n    if (this.variables.has(name)) {\n      return this;\n    }\n    if (this.parent) {\n      return this.parent.resolve(name);\n    }\n    throw new Error(`Unknown variable: ${name}`);\n  }\n  lookupVariable(name) {\n    try {\n      return this.resolve(name).variables.get(name) ?? new UndefinedValue();\n    } catch {\n      return new UndefinedValue();\n    }\n  }\n};\nvar Interpreter = class {\n  global;\n  constructor(env) {\n    this.global = env ?? new Environment();\n  }\n  /**\n   * Run the program.\n   */\n  run(program) {\n    return this.evaluate(program, this.global);\n  }\n  /**\n   * Evaluates expressions following the binary operation type.\n   */\n  evaluateBinaryExpression(node, environment) {\n    const left = this.evaluate(node.left, environment);\n    switch (node.operator.value) {\n      case \"and\":\n        return left.__bool__().value ? this.evaluate(node.right, environment) : left;\n      case \"or\":\n        return left.__bool__().value ? left : this.evaluate(node.right, environment);\n    }\n    const right = this.evaluate(node.right, environment);\n    switch (node.operator.value) {\n      case \"==\":\n        return new BooleanValue(left.value == right.value);\n      case \"!=\":\n        return new BooleanValue(left.value != right.value);\n    }\n    if (left instanceof UndefinedValue || right instanceof UndefinedValue) {\n      throw new Error(\"Cannot perform operation on undefined values\");\n    } else if (left instanceof NullValue || right instanceof NullValue) {\n      throw new Error(\"Cannot perform operation on null values\");\n    } else if (left instanceof NumericValue && right instanceof NumericValue) {\n      switch (node.operator.value) {\n        case \"+\":\n          return new NumericValue(left.value + right.value);\n        case \"-\":\n          return new NumericValue(left.value - right.value);\n        case \"*\":\n          return new NumericValue(left.value * right.value);\n        case \"/\":\n          return new NumericValue(left.value / right.value);\n        case \"%\":\n          return new NumericValue(left.value % right.value);\n        case \"<\":\n          return new BooleanValue(left.value < right.value);\n        case \">\":\n          return new BooleanValue(left.value > right.value);\n        case \">=\":\n          return new BooleanValue(left.value >= right.value);\n        case \"<=\":\n          return new BooleanValue(left.value <= right.value);\n      }\n    } else if (left instanceof ArrayValue && right instanceof ArrayValue) {\n      switch (node.operator.value) {\n        case \"+\":\n          return new ArrayValue(left.value.concat(right.value));\n      }\n    } else if (right instanceof ArrayValue) {\n      const member = right.value.find((x) => x.value === left.value) !== void 0;\n      switch (node.operator.value) {\n        case \"in\":\n          return new BooleanValue(member);\n        case \"not in\":\n          return new BooleanValue(!member);\n      }\n    }\n    if (left instanceof StringValue || right instanceof StringValue) {\n      switch (node.operator.value) {\n        case \"+\":\n          return new StringValue(left.value.toString() + right.value.toString());\n      }\n    }\n    if (left instanceof StringValue && right instanceof StringValue) {\n      switch (node.operator.value) {\n        case \"in\":\n          return new BooleanValue(right.value.includes(left.value));\n        case \"not in\":\n          return new BooleanValue(!right.value.includes(left.value));\n      }\n    }\n    if (left instanceof StringValue && right instanceof ObjectValue) {\n      switch (node.operator.value) {\n        case \"in\":\n          return new BooleanValue(right.value.has(left.value));\n        case \"not in\":\n          return new BooleanValue(!right.value.has(left.value));\n      }\n    }\n    throw new SyntaxError(`Unknown operator \"${node.operator.value}\" between ${left.type} and ${right.type}`);\n  }\n  /**\n   * Evaluates expressions following the filter operation type.\n   */\n  evaluateFilterExpression(node, environment) {\n    const operand = this.evaluate(node.operand, environment);\n    if (node.filter.type === \"Identifier\") {\n      const filter = node.filter;\n      if (operand instanceof ArrayValue) {\n        switch (filter.value) {\n          case \"list\":\n            return operand;\n          case \"first\":\n            return operand.value[0];\n          case \"last\":\n            return operand.value[operand.value.length - 1];\n          case \"length\":\n            return new NumericValue(operand.value.length);\n          case \"reverse\":\n            return new ArrayValue(operand.value.reverse());\n          case \"sort\":\n            return new ArrayValue(\n              operand.value.sort((a, b) => {\n                if (a.type !== b.type) {\n                  throw new Error(`Cannot compare different types: ${a.type} and ${b.type}`);\n                }\n                switch (a.type) {\n                  case \"NumericValue\":\n                    return a.value - b.value;\n                  case \"StringValue\":\n                    return a.value.localeCompare(b.value);\n                  default:\n                    throw new Error(`Cannot compare type: ${a.type}`);\n                }\n              })\n            );\n          default:\n            throw new Error(`Unknown ArrayValue filter: ${filter.value}`);\n        }\n      } else if (operand instanceof StringValue) {\n        switch (filter.value) {\n          case \"length\":\n            return new NumericValue(operand.value.length);\n          case \"upper\":\n            return new StringValue(operand.value.toUpperCase());\n          case \"lower\":\n            return new StringValue(operand.value.toLowerCase());\n          case \"title\":\n            return new StringValue(titleCase(operand.value));\n          case \"capitalize\":\n            return new StringValue(operand.value.charAt(0).toUpperCase() + operand.value.slice(1));\n          case \"trim\":\n            return new StringValue(operand.value.trim());\n          default:\n            throw new Error(`Unknown StringValue filter: ${filter.value}`);\n        }\n      } else if (operand instanceof NumericValue) {\n        switch (filter.value) {\n          case \"abs\":\n            return new NumericValue(Math.abs(operand.value));\n          default:\n            throw new Error(`Unknown NumericValue filter: ${filter.value}`);\n        }\n      } else if (operand instanceof ObjectValue) {\n        switch (filter.value) {\n          case \"items\":\n            return new ArrayValue(\n              Array.from(operand.value.entries()).map(([key, value]) => new ArrayValue([new StringValue(key), value]))\n            );\n          case \"length\":\n            return new NumericValue(operand.value.size);\n          default:\n            throw new Error(`Unknown ObjectValue filter: ${filter.value}`);\n        }\n      }\n      throw new Error(`Cannot apply filter \"${filter.value}\" to type: ${operand.type}`);\n    } else if (node.filter.type === \"CallExpression\") {\n      const filter = node.filter;\n      if (filter.callee.type !== \"Identifier\") {\n        throw new Error(`Unknown filter: ${filter.callee.type}`);\n      }\n      const filterName = filter.callee.value;\n      if (operand instanceof ArrayValue) {\n        switch (filterName) {\n          case \"selectattr\": {\n            if (operand.value.some((x) => !(x instanceof ObjectValue))) {\n              throw new Error(\"`selectattr` can only be applied to array of objects\");\n            }\n            if (filter.args.some((x) => x.type !== \"StringLiteral\")) {\n              throw new Error(\"arguments of `selectattr` must be strings\");\n            }\n            const [attr, testName, value] = filter.args.map((x) => this.evaluate(x, environment));\n            let testFunction;\n            if (testName) {\n              const test = environment.tests.get(testName.value);\n              if (!test) {\n                throw new Error(`Unknown test: ${testName.value}`);\n              }\n              testFunction = test;\n            } else {\n              testFunction = (...x) => x[0].__bool__().value;\n            }\n            const filtered = operand.value.filter((item) => {\n              const a = item.value.get(attr.value);\n              if (a) {\n                return testFunction(a, value);\n              }\n              return false;\n            });\n            return new ArrayValue(filtered);\n          }\n        }\n        throw new Error(`Unknown ArrayValue filter: ${filterName}`);\n      } else {\n        throw new Error(`Cannot apply filter \"${filterName}\" to type: ${operand.type}`);\n      }\n    }\n    throw new Error(`Unknown filter: ${node.filter.type}`);\n  }\n  /**\n   * Evaluates expressions following the test operation type.\n   */\n  evaluateTestExpression(node, environment) {\n    const operand = this.evaluate(node.operand, environment);\n    const test = environment.tests.get(node.test.value);\n    if (!test) {\n      throw new Error(`Unknown test: ${node.test.value}`);\n    }\n    const result = test(operand);\n    return new BooleanValue(node.negate ? !result : result);\n  }\n  /**\n   * Evaluates expressions following the unary operation type.\n   */\n  evaluateUnaryExpression(node, environment) {\n    const argument = this.evaluate(node.argument, environment);\n    switch (node.operator.value) {\n      case \"not\":\n        return new BooleanValue(!argument.value);\n      default:\n        throw new SyntaxError(`Unknown operator: ${node.operator.value}`);\n    }\n  }\n  evalProgram(program, environment) {\n    return this.evaluateBlock(program.body, environment);\n  }\n  evaluateBlock(statements, environment) {\n    let result = \"\";\n    for (const statement of statements) {\n      const lastEvaluated = this.evaluate(statement, environment);\n      if (lastEvaluated.type !== \"NullValue\" && lastEvaluated.type !== \"UndefinedValue\") {\n        result += lastEvaluated.value;\n      }\n    }\n    return new StringValue(result);\n  }\n  evaluateIdentifier(node, environment) {\n    return environment.lookupVariable(node.value);\n  }\n  evaluateCallExpression(expr, environment) {\n    const args = [];\n    const kwargs = /* @__PURE__ */ new Map();\n    for (const argument of expr.args) {\n      if (argument.type === \"KeywordArgumentExpression\") {\n        const kwarg = argument;\n        kwargs.set(kwarg.key.value, this.evaluate(kwarg.value, environment));\n      } else {\n        args.push(this.evaluate(argument, environment));\n      }\n    }\n    if (kwargs.size > 0) {\n      args.push(new ObjectValue(kwargs));\n    }\n    const fn = this.evaluate(expr.callee, environment);\n    if (fn.type !== \"FunctionValue\") {\n      throw new Error(`Cannot call something that is not a function: got ${fn.type}`);\n    }\n    return fn.value(args, environment);\n  }\n  evaluateSliceExpression(object, expr, environment) {\n    if (!(object instanceof ArrayValue || object instanceof StringValue)) {\n      throw new Error(\"Slice object must be an array or string\");\n    }\n    const start = this.evaluate(expr.start, environment);\n    const stop = this.evaluate(expr.stop, environment);\n    const step = this.evaluate(expr.step, environment);\n    if (!(start instanceof NumericValue || start instanceof UndefinedValue)) {\n      throw new Error(\"Slice start must be numeric or undefined\");\n    }\n    if (!(stop instanceof NumericValue || stop instanceof UndefinedValue)) {\n      throw new Error(\"Slice stop must be numeric or undefined\");\n    }\n    if (!(step instanceof NumericValue || step instanceof UndefinedValue)) {\n      throw new Error(\"Slice step must be numeric or undefined\");\n    }\n    if (object instanceof ArrayValue) {\n      return new ArrayValue(slice(object.value, start.value, stop.value, step.value));\n    } else {\n      return new StringValue(slice(Array.from(object.value), start.value, stop.value, step.value).join(\"\"));\n    }\n  }\n  evaluateMemberExpression(expr, environment) {\n    const object = this.evaluate(expr.object, environment);\n    let property;\n    if (expr.computed) {\n      if (expr.property.type === \"SliceExpression\") {\n        return this.evaluateSliceExpression(object, expr.property, environment);\n      } else {\n        property = this.evaluate(expr.property, environment);\n      }\n    } else {\n      property = new StringValue(expr.property.value);\n    }\n    let value;\n    if (object instanceof ObjectValue) {\n      if (!(property instanceof StringValue)) {\n        throw new Error(`Cannot access property with non-string: got ${property.type}`);\n      }\n      value = object.value.get(property.value) ?? object.builtins.get(property.value);\n    } else if (object instanceof ArrayValue || object instanceof StringValue) {\n      if (property instanceof NumericValue) {\n        value = object.value.at(property.value);\n        if (object instanceof StringValue) {\n          value = new StringValue(object.value.at(property.value));\n        }\n      } else if (property instanceof StringValue) {\n        value = object.builtins.get(property.value);\n      } else {\n        throw new Error(`Cannot access property with non-string/non-number: got ${property.type}`);\n      }\n    } else {\n      if (!(property instanceof StringValue)) {\n        throw new Error(`Cannot access property with non-string: got ${property.type}`);\n      }\n      value = object.builtins.get(property.value);\n    }\n    return value instanceof RuntimeValue ? value : new UndefinedValue();\n  }\n  evaluateSet(node, environment) {\n    const rhs = this.evaluate(node.value, environment);\n    if (node.assignee.type === \"Identifier\") {\n      const variableName = node.assignee.value;\n      environment.setVariable(variableName, rhs);\n    } else if (node.assignee.type === \"MemberExpression\") {\n      const member = node.assignee;\n      const object = this.evaluate(member.object, environment);\n      if (!(object instanceof ObjectValue)) {\n        throw new Error(\"Cannot assign to member of non-object\");\n      }\n      if (member.property.type !== \"Identifier\") {\n        throw new Error(\"Cannot assign to member with non-identifier property\");\n      }\n      object.value.set(member.property.value, rhs);\n    } else {\n      throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(node.assignee)}`);\n    }\n    return new NullValue();\n  }\n  evaluateIf(node, environment) {\n    const test = this.evaluate(node.test, environment);\n    return this.evaluateBlock(test.__bool__().value ? node.body : node.alternate, environment);\n  }\n  evaluateFor(node, environment) {\n    const scope = new Environment(environment);\n    const iterable = this.evaluate(node.iterable, scope);\n    if (!(iterable instanceof ArrayValue)) {\n      throw new Error(`Expected iterable type in for loop: got ${iterable.type}`);\n    }\n    let result = \"\";\n    for (let i = 0; i < iterable.value.length; ++i) {\n      const loop = /* @__PURE__ */ new Map([\n        [\"index\", new NumericValue(i + 1)],\n        [\"index0\", new NumericValue(i)],\n        [\"revindex\", new NumericValue(iterable.value.length - i)],\n        [\"revindex0\", new NumericValue(iterable.value.length - i - 1)],\n        [\"first\", new BooleanValue(i === 0)],\n        [\"last\", new BooleanValue(i === iterable.value.length - 1)],\n        [\"length\", new NumericValue(iterable.value.length)],\n        [\"previtem\", i > 0 ? iterable.value[i - 1] : new UndefinedValue()],\n        [\"nextitem\", i < iterable.value.length - 1 ? iterable.value[i + 1] : new UndefinedValue()]\n      ]);\n      scope.setVariable(\"loop\", new ObjectValue(loop));\n      const current = iterable.value[i];\n      if (node.loopvar.type === \"Identifier\") {\n        scope.setVariable(node.loopvar.value, current);\n      } else if (node.loopvar.type === \"TupleLiteral\") {\n        const loopvar = node.loopvar;\n        if (current.type !== \"ArrayValue\") {\n          throw new Error(`Cannot unpack non-iterable type: ${current.type}`);\n        }\n        const c = current;\n        if (loopvar.value.length !== c.value.length) {\n          throw new Error(`Too ${loopvar.value.length > c.value.length ? \"few\" : \"many\"} items to unpack`);\n        }\n        for (let j = 0; j < loopvar.value.length; ++j) {\n          if (loopvar.value[j].type !== \"Identifier\") {\n            throw new Error(`Cannot unpack non-identifier type: ${loopvar.value[j].type}`);\n          }\n          scope.setVariable(loopvar.value[j].value, c.value[j]);\n        }\n      }\n      const evaluated = this.evaluateBlock(node.body, scope);\n      result += evaluated.value;\n    }\n    return new StringValue(result);\n  }\n  evaluate(statement, environment) {\n    if (statement === void 0)\n      return new UndefinedValue();\n    switch (statement.type) {\n      case \"Program\":\n        return this.evalProgram(statement, environment);\n      case \"Set\":\n        return this.evaluateSet(statement, environment);\n      case \"If\":\n        return this.evaluateIf(statement, environment);\n      case \"For\":\n        return this.evaluateFor(statement, environment);\n      case \"NumericLiteral\":\n        return new NumericValue(Number(statement.value));\n      case \"StringLiteral\":\n        return new StringValue(statement.value);\n      case \"BooleanLiteral\":\n        return new BooleanValue(statement.value);\n      case \"ArrayLiteral\":\n        return new ArrayValue(statement.value.map((x) => this.evaluate(x, environment)));\n      case \"TupleLiteral\":\n        return new TupleValue(statement.value.map((x) => this.evaluate(x, environment)));\n      case \"ObjectLiteral\": {\n        const mapping = /* @__PURE__ */ new Map();\n        for (const [key, value] of statement.value) {\n          const evaluatedKey = this.evaluate(key, environment);\n          if (!(evaluatedKey instanceof StringValue)) {\n            throw new Error(`Object keys must be strings: got ${evaluatedKey.type}`);\n          }\n          mapping.set(evaluatedKey.value, this.evaluate(value, environment));\n        }\n        return new ObjectValue(mapping);\n      }\n      case \"Identifier\":\n        return this.evaluateIdentifier(statement, environment);\n      case \"CallExpression\":\n        return this.evaluateCallExpression(statement, environment);\n      case \"MemberExpression\":\n        return this.evaluateMemberExpression(statement, environment);\n      case \"UnaryExpression\":\n        return this.evaluateUnaryExpression(statement, environment);\n      case \"BinaryExpression\":\n        return this.evaluateBinaryExpression(statement, environment);\n      case \"FilterExpression\":\n        return this.evaluateFilterExpression(statement, environment);\n      case \"TestExpression\":\n        return this.evaluateTestExpression(statement, environment);\n      default:\n        throw new SyntaxError(`Unknown node type: ${statement.type}`);\n    }\n  }\n};\nfunction convertToRuntimeValues(input) {\n  switch (typeof input) {\n    case \"number\":\n      return new NumericValue(input);\n    case \"string\":\n      return new StringValue(input);\n    case \"boolean\":\n      return new BooleanValue(input);\n    case \"object\":\n      if (input === null) {\n        return new NullValue();\n      } else if (Array.isArray(input)) {\n        return new ArrayValue(input.map(convertToRuntimeValues));\n      } else {\n        return new ObjectValue(\n          new Map(Object.entries(input).map(([key, value]) => [key, convertToRuntimeValues(value)]))\n        );\n      }\n    case \"function\":\n      return new FunctionValue((args, _scope) => {\n        const result = input(...args.map((x) => x.value)) ?? null;\n        return convertToRuntimeValues(result);\n      });\n    default:\n      throw new Error(`Cannot convert to runtime value: ${input}`);\n  }\n}\n\n// src/index.ts\nvar Template = class {\n  parsed;\n  /**\n   * @param {string} template The template string\n   */\n  constructor(template) {\n    const tokens = tokenize(template, {\n      lstrip_blocks: true,\n      trim_blocks: true\n    });\n    this.parsed = parse(tokens);\n  }\n  render(items) {\n    const env = new Environment();\n    env.set(\"false\", false);\n    env.set(\"true\", true);\n    env.set(\"raise_exception\", (args) => {\n      throw new Error(args);\n    });\n    env.set(\"range\", range);\n    for (const [key, value] of Object.entries(items)) {\n      env.set(key, value);\n    }\n    const interpreter = new Interpreter(env);\n    const result = interpreter.run(this.parsed);\n    return result.value;\n  }\n};\nexport {\n  Environment,\n  Interpreter,\n  Template,\n  parse,\n  tokenize\n};\n","const WHISPER_LANGUAGES = [\r\n  [\"en\", \"english\"],\r\n  [\"zh\", \"chinese\"],\r\n  [\"de\", \"german\"],\r\n  [\"es\", \"spanish\"],\r\n  [\"ru\", \"russian\"],\r\n  [\"ko\", \"korean\"],\r\n  [\"fr\", \"french\"],\r\n  [\"ja\", \"japanese\"],\r\n  [\"pt\", \"portuguese\"],\r\n  [\"tr\", \"turkish\"],\r\n  [\"pl\", \"polish\"],\r\n  [\"ca\", \"catalan\"],\r\n  [\"nl\", \"dutch\"],\r\n  [\"ar\", \"arabic\"],\r\n  [\"sv\", \"swedish\"],\r\n  [\"it\", \"italian\"],\r\n  [\"id\", \"indonesian\"],\r\n  [\"hi\", \"hindi\"],\r\n  [\"fi\", \"finnish\"],\r\n  [\"vi\", \"vietnamese\"],\r\n  [\"he\", \"hebrew\"],\r\n  [\"uk\", \"ukrainian\"],\r\n  [\"el\", \"greek\"],\r\n  [\"ms\", \"malay\"],\r\n  [\"cs\", \"czech\"],\r\n  [\"ro\", \"romanian\"],\r\n  [\"da\", \"danish\"],\r\n  [\"hu\", \"hungarian\"],\r\n  [\"ta\", \"tamil\"],\r\n  [\"no\", \"norwegian\"],\r\n  [\"th\", \"thai\"],\r\n  [\"ur\", \"urdu\"],\r\n  [\"hr\", \"croatian\"],\r\n  [\"bg\", \"bulgarian\"],\r\n  [\"lt\", \"lithuanian\"],\r\n  [\"la\", \"latin\"],\r\n  [\"mi\", \"maori\"],\r\n  [\"ml\", \"malayalam\"],\r\n  [\"cy\", \"welsh\"],\r\n  [\"sk\", \"slovak\"],\r\n  [\"te\", \"telugu\"],\r\n  [\"fa\", \"persian\"],\r\n  [\"lv\", \"latvian\"],\r\n  [\"bn\", \"bengali\"],\r\n  [\"sr\", \"serbian\"],\r\n  [\"az\", \"azerbaijani\"],\r\n  [\"sl\", \"slovenian\"],\r\n  [\"kn\", \"kannada\"],\r\n  [\"et\", \"estonian\"],\r\n  [\"mk\", \"macedonian\"],\r\n  [\"br\", \"breton\"],\r\n  [\"eu\", \"basque\"],\r\n  [\"is\", \"icelandic\"],\r\n  [\"hy\", \"armenian\"],\r\n  [\"ne\", \"nepali\"],\r\n  [\"mn\", \"mongolian\"],\r\n  [\"bs\", \"bosnian\"],\r\n  [\"kk\", \"kazakh\"],\r\n  [\"sq\", \"albanian\"],\r\n  [\"sw\", \"swahili\"],\r\n  [\"gl\", \"galician\"],\r\n  [\"mr\", \"marathi\"],\r\n  [\"pa\", \"punjabi\"],\r\n  [\"si\", \"sinhala\"],\r\n  [\"km\", \"khmer\"],\r\n  [\"sn\", \"shona\"],\r\n  [\"yo\", \"yoruba\"],\r\n  [\"so\", \"somali\"],\r\n  [\"af\", \"afrikaans\"],\r\n  [\"oc\", \"occitan\"],\r\n  [\"ka\", \"georgian\"],\r\n  [\"be\", \"belarusian\"],\r\n  [\"tg\", \"tajik\"],\r\n  [\"sd\", \"sindhi\"],\r\n  [\"gu\", \"gujarati\"],\r\n  [\"am\", \"amharic\"],\r\n  [\"yi\", \"yiddish\"],\r\n  [\"lo\", \"lao\"],\r\n  [\"uz\", \"uzbek\"],\r\n  [\"fo\", \"faroese\"],\r\n  [\"ht\", \"haitian creole\"],\r\n  [\"ps\", \"pashto\"],\r\n  [\"tk\", \"turkmen\"],\r\n  [\"nn\", \"nynorsk\"],\r\n  [\"mt\", \"maltese\"],\r\n  [\"sa\", \"sanskrit\"],\r\n  [\"lb\", \"luxembourgish\"],\r\n  [\"my\", \"myanmar\"],\r\n  [\"bo\", \"tibetan\"],\r\n  [\"tl\", \"tagalog\"],\r\n  [\"mg\", \"malagasy\"],\r\n  [\"as\", \"assamese\"],\r\n  [\"tt\", \"tatar\"],\r\n  [\"haw\", \"hawaiian\"],\r\n  [\"ln\", \"lingala\"],\r\n  [\"ha\", \"hausa\"],\r\n  [\"ba\", \"bashkir\"],\r\n  [\"jw\", \"javanese\"],\r\n  [\"su\", \"sundanese\"],\r\n];\r\n\r\n// @ts-ignore\r\nexport const WHISPER_LANGUAGE_MAPPING = new Map(WHISPER_LANGUAGES);\r\n// @ts-ignore\r\nexport const WHISPER_TO_LANGUAGE_CODE_MAPPING = new Map([\r\n  ...WHISPER_LANGUAGES.map(([k, v]) => [v, k]),\r\n  ...[\r\n    [\"burmese\", \"my\"],\r\n    [\"valencian\", \"ca\"],\r\n    [\"flemish\", \"nl\"],\r\n    [\"haitian\", \"ht\"],\r\n    [\"letzeburgesch\", \"lb\"],\r\n    [\"pushto\", \"ps\"],\r\n    [\"panjabi\", \"pa\"],\r\n    [\"moldavian\", \"ro\"],\r\n    [\"moldovan\", \"ro\"],\r\n    [\"sinhalese\", \"si\"],\r\n    [\"castilian\", \"es\"],\r\n  ],\r\n]);\r\n\r\n/**\r\n * @param {string} language The language name or code\r\n * @returns {string} The language code\r\n */\r\nexport function whisper_language_to_code(language) {\r\n  language = language.toLowerCase();\r\n\r\n  // Map to code from user-friendly name (e.g., \"english\" -> \"en\")\r\n  let language_code = WHISPER_TO_LANGUAGE_CODE_MAPPING.get(language);\r\n\r\n  if (language_code === undefined) {\r\n    // User provided something that is not a language name\r\n\r\n    if (WHISPER_LANGUAGE_MAPPING.has(language)) {\r\n      // User provided the language code directly (e.g., \"en\")\r\n      language_code = language;\r\n    } else {\r\n      // User provided something that is not a language code or name\r\n      const is_language_code = language.length === 2;\r\n      const langs = is_language_code\r\n        ? WHISPER_LANGUAGE_MAPPING.keys()\r\n        : WHISPER_LANGUAGE_MAPPING.values();\r\n\r\n      throw new Error(\r\n        `Language \"${language}\" is not supported. Must be one of: ${JSON.stringify(\r\n          langs\r\n        )}`\r\n      );\r\n    }\r\n  }\r\n  return language_code;\r\n}\r\n","import { AutoTokenizer, PreTrainedTokenizer } from \"./tokenizers/tokenizers\";\r\n\r\n// NOTE: Set this to turn off the warning of claude tokenizer\r\n// @ts-ignore\r\nAutoTokenizer.TOKENIZER_CLASS_MAPPING.ClaudeTokenizer = PreTrainedTokenizer;\r\n","import {\r\n  AutoTokenizer as _AutoTokenizer,\r\n  PreTrainedTokenizer,\r\n} from \"./tokenizers/tokenizers\";\r\nimport { NSTokenizerConfig, NSTokenizerJSON } from \"./types\";\r\n\r\ninterface ITokenizerModelJsonData {\r\n  tokenizerJSON: Partial<NSTokenizerJSON.Root>;\r\n  tokenizerConfig: Partial<NSTokenizerConfig.Root>;\r\n}\r\ninterface ITokenizerModelUrls {\r\n  tokenizerJSON: string;\r\n  tokenizerConfig: string;\r\n}\r\n\r\nexport class TokenizerLoader {\r\n  /**\r\n   * Creates a pre-trained tokenizer from the provided model data.\r\n   *\r\n   * @param {ITokenizerModelJsonData} model - The model data containing the tokenizer JSON and configuration.\r\n   * @return {PreTrainedTokenizer} pre-trained tokenizer.\r\n   * @throws {Error} If the tokenizer JSON or configuration is missing.\r\n   */\r\n  static fromPreTrained(model: ITokenizerModelJsonData): PreTrainedTokenizer {\r\n    const { tokenizerJSON, tokenizerConfig } = model;\r\n    if (!tokenizerJSON) {\r\n      throw new Error(\"tokenizerJSON is required.\");\r\n    }\r\n    if (!tokenizerConfig) {\r\n      throw new Error(\"tokenizerConfig is required.\");\r\n    }\r\n    // Some tokenizers are saved with the \"Fast\" suffix, so we remove that if present.\r\n    const tokenizerName =\r\n      tokenizerConfig.tokenizer_class?.replace(/Fast$/, \"\") ??\r\n      \"PreTrainedTokenizer\";\r\n\r\n    let cls = (_AutoTokenizer as any).TOKENIZER_CLASS_MAPPING[tokenizerName];\r\n    if (!cls) {\r\n      console.warn(\r\n        `Unknown tokenizer class \"${tokenizerName}\", attempting to construct from base class.`\r\n      );\r\n      cls = PreTrainedTokenizer;\r\n    }\r\n    return new cls(tokenizerJSON, tokenizerConfig);\r\n  }\r\n\r\n  /**\r\n   * Creates a pre-trained tokenizer from the provided model URLs.\r\n   *\r\n   * @param {ITokenizerModelUrls} model - The model URLs containing the tokenizer JSON and configuration.\r\n   * @param {Object} [options] - Optional parameters.\r\n   * @param {any} [options.fetch] - The fetch function to use for making HTTP requests. Defaults to global.fetch.\r\n   * @param {Partial<ITokenizerModelJsonData>} [options.tokenizerJSON] - Additional tokenizer JSON data to merge with the fetched data.\r\n   * @param {Partial<ITokenizerModelJsonData>} [options.tokenizerConfig] - Additional tokenizer configuration data to merge with the fetched data.\r\n   * @return {Promise<PreTrainedTokenizer>} A promise that resolves to the pre-trained tokenizer.\r\n   */\r\n  static async fromPreTrainedUrls(\r\n    model: ITokenizerModelUrls,\r\n    options?: {\r\n      fetch?: any;\r\n    } & Partial<ITokenizerModelJsonData>\r\n  ) {\r\n    const fetch =\r\n      (options?.fetch as typeof global.fetch) ??\r\n      globalThis.fetch.bind(globalThis);\r\n    const [tokenizerJSON, tokenizerConfig] = await Promise.all([\r\n      fetch(model.tokenizerJSON).then((res) => res.json()),\r\n      fetch(model.tokenizerConfig).then((res) => res.json()),\r\n    ]);\r\n    return TokenizerLoader.fromPreTrained({\r\n      tokenizerJSON: {\r\n        ...tokenizerJSON,\r\n        ...options?.tokenizerJSON,\r\n      },\r\n      tokenizerConfig: {\r\n        ...tokenizerConfig,\r\n        ...options?.tokenizerConfig,\r\n      },\r\n    });\r\n  }\r\n}\r\n"],"mappings":"gxBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,cACA,IAAIC,GAAQC,EAAA,SAAUC,EAAI,CACxB,OAAOA,GAAMA,EAAG,OAAS,MAAQA,CACnC,EAFY,SAKZH,GAAO,QAELC,GAAM,OAAO,YAAc,UAAY,UAAU,GACjDA,GAAM,OAAO,QAAU,UAAY,MAAM,GAEzCA,GAAM,OAAO,MAAQ,UAAY,IAAI,GACrCA,GAAM,OAAO,QAAU,UAAY,MAAM,GACzCA,GAAM,OAAOF,IAAQ,UAAYA,EAAI,IAEpC,UAAY,CAAE,OAAO,IAAM,GAAG,GAAK,SAAS,aAAa,EAAE,ICf9D,IAAAK,EAAAC,EAAA,CAAAC,GAAAC,KAAA,cACAA,GAAO,QAAU,SAAUC,EAAM,CAC/B,GAAI,CACF,MAAO,CAAC,CAACA,EAAK,CAChB,MAAgB,CACd,MAAO,EACT,CACF,ICPA,IAAAC,GAAAC,EAAA,CAAAC,GAAAC,KAAA,cACA,IAAIC,GAAQ,IAGZD,GAAO,QAAU,CAACC,GAAM,UAAY,CAElC,OAAO,OAAO,eAAe,CAAC,EAAG,EAAG,CAAE,IAAKC,EAAA,UAAY,CAAE,MAAO,EAAG,EAAxB,MAA0B,CAAC,EAAE,CAAC,IAAM,CACjF,CAAC,ICPD,IAAAC,GAAAC,EAAA,CAAAC,GAAAC,KAAA,cACA,IAAIC,GAAQ,IAEZD,GAAO,QAAU,CAACC,GAAM,UAAY,CAElC,IAAIC,GAAQ,UAAY,CAAc,GAAG,KA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I,CAACC,EACH,MAAM,IAAI,MAAM,4BAA4B,EAE9C,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EACJD,EAAgB,iBAAiB,QAAQ,QAAS,EAAE,GACpD,sBAEEE,EAAOC,GAAuB,wBAAwBF,CAAa,EACvE,OAAKC,IACH,QAAQ,KACN,4BAA4BD,CAAa,6CAC3C,EACAC,EAAME,GAED,IAAIF,EAAIH,EAAeC,CAAe,CAC/C,CAYA,aAAa,mBACXF,EACAO,EAGA,CACA,IAAMC,EACHD,GAAS,OACV,WAAW,MAAM,KAAK,UAAU,EAC5B,CAACN,EAAeC,CAAe,EAAI,MAAM,QAAQ,IAAI,CACzDM,EAAMR,EAAM,aAAa,EAAE,KAAMS,GAAQA,EAAI,KAAK,CAAC,EACnDD,EAAMR,EAAM,eAAe,EAAE,KAAMS,GAAQA,EAAI,KAAK,CAAC,CACvD,CAAC,EACD,OAAOV,GAAgB,eAAe,CACpC,cAAe,CACb,GAAGE,EACH,GAAGM,GAAS,aACd,EACA,gBAAiB,CACf,GAAGL,EACH,GAAGK,GAAS,eACd,CACF,CAAC,CACH,CACF,EAjE6BG,EAAAX,GAAA,mBAAtB,IAAMY,GAANZ","names":["require_global_this","__commonJSMin","exports","module","check","__name","it","require_fails","__commonJSMin","exports","module","exec","require_descriptors","__commonJSMin","exports","module","fails","__name","require_function_bind_native","__commonJSMin","exports","module","fails","test","require_function_call","__commonJSMin","exports","module","NATIVE_BIND","call","require_object_property_is_enumerable","__commonJSMin","exports","$propertyIsEnumerable","getOwnPropertyDescriptor","NASHORN_BUG","__name","V","descriptor","require_create_property_descriptor","__commonJSMin","exports","module","bitmap","value","require_function_uncurry_this","__commonJSMin","exports","module","NATIVE_BIND","FunctionPrototype","call","uncurryThisWithBind","fn","require_classof_raw","__commonJSMin","exports","module","uncurryThis","toString","stringSlice","it","require_indexed_object","__commonJSMin","exports","module","uncurryThis","fails","classof","$Object","split","it","require_is_null_or_undefined","__commonJSMin","exports","module","it","require_require_object_coercible","__commonJSMin","exports","module","isNullOrUndefined","$TypeError","it","require_to_indexed_object","__commonJSMin","exports","module","IndexedObject","requireObjectCoercible","it","require_is_callable","__commonJSMin","exports","module","documentAll","argument","require_is_object","__commonJSMin","exports","module","isCallable","it","require_get_built_in","__commonJSMin","exports","module","globalThis","isCallable","aFunction","__name","argument","namespace","method","require_object_is_prototype_of","__commonJSMin","exports","module","uncurryThis","require_environment_user_agent","__commonJSMin","exports","module","globalThis","navigator","userAgent","require_environment_v8_version","__commonJSMin","exports","module","globalThis","userAgent","process","Deno","versions","v8","match","version","require_symbol_constructor_detection","__commonJSMin","exports","module","V8_VERSION","fails","globalThis","$String","symbol","require_use_symbol_as_uid","__commonJSMin","exports","module","NATIVE_SYMBOL","require_is_symbol","__commonJSMin","exports","module","getBuiltIn","isCallable","isPrototypeOf","USE_SYMBOL_AS_UID","$Object","it","$Symbol","require_try_to_string","__commonJSMin","exports","module","$String","argument","require_a_callable","__commonJSMin","exports","module","isCallable","tryToString","$TypeError","argument","require_get_method","__commonJSMin","exports","module","aCallable","isNullOrUndefined","V","P","func","require_ordinary_to_primitive","__commonJSMin","exports","module","call","isCallable","isObject","$TypeError","input","pref","fn","val","require_is_pure","__commonJSMin","exports","module","require_define_global_property","__commonJSMin","exports","module","globalThis","defineProperty","key","value","require_shared_store","__commonJSMin","exports","module","IS_PURE","globalThis","defineGlobalProperty","SHARED","store","require_shared","__commonJSMin","exports","module","store","key","value","require_to_object","__commonJSMin","exports","module","requireObjectCoercible","$Object","argument","require_has_own_property","__commonJSMin","exports","module","uncurryThis","toObject","hasOwnProperty","__name","it","key","require_uid","__commonJSMin","exports","module","uncurryThis","id","postfix","toString","key","require_well_known_symbol","__commonJSMin","exports","module","globalThis","shared","hasOwn","uid","NATIVE_SYMBOL","USE_SYMBOL_AS_UID","Symbol","WellKnownSymbolsStore","createWellKnownSymbol","name","require_to_primitive","__commonJSMin","exports","module","call","isObject","isSymbol","getMethod","ordinaryToPrimitive","wellKnownSymbol","$TypeError","TO_PRIMITIVE","input","pref","exoticToPrim","result","require_to_property_key","__commonJSMin","exports","module","toPrimitive","isSymbol","argument","key","require_document_create_element","__commonJSMin","exports","module","globalThis","isObject","document","EXISTS","it","require_ie8_dom_define","__commonJSMin","exports","module","DESCRIPTORS","fails","createElement","__name","require_object_get_own_property_descriptor","__commonJSMin","exports","DESCRIPTORS","call","propertyIsEnumerableModule","createPropertyDescriptor","toIndexedObject","toPropertyKey","hasOwn","IE8_DOM_DEFINE","$getOwnPropertyDescriptor","__name","O","P","require_v8_prototype_define_bug","__commonJSMin","exports","module","DESCRIPTORS","fails","require_an_object","__commonJSMin","exports","module","isObject","$String","$TypeError","argument","require_object_define_property","__commonJSMin","exports","DESCRIPTORS","IE8_DOM_DEFINE","V8_PROTOTYPE_DEFINE_BUG","anObject","toPropertyKey","$TypeError","$defineProperty","$getOwnPropertyDescriptor","ENUMERABLE","CONFIGURABLE","WRITABLE","__name","O","P","Attributes","current","require_create_non_enumerable_property","__commonJSMin","exports","module","DESCRIPTORS","definePropertyModule","createPropertyDescriptor","object","key","value","require_function_name","__commonJSMin","exports","module","DESCRIPTORS","hasOwn","FunctionPrototype","getDescriptor","EXISTS","PROPER","__name","CONFIGURABLE","require_inspect_source","__commonJSMin","exports","module","uncurryThis","isCallable","store","functionToString","it","require_weak_map_basic_detection","__commonJSMin","exports","module","globalThis","isCallable","WeakMap","require_shared_key","__commonJSMin","exports","module","shared","uid","keys","key","require_hidden_keys","__commonJSMin","exports","module","require_internal_state","__commonJSMin","exports","module","NATIVE_WEAK_MAP","globalThis","isObject","createNonEnumerableProperty","hasOwn","shared","sharedKey","hiddenKeys","OBJECT_ALREADY_INITIALIZED","TypeError","WeakMap","set","get","has","enforce","__name","it","getterFor","TYPE","state","store","metadata","STATE","require_make_built_in","__commonJSMin","exports","module","uncurryThis","fails","isCallable","hasOwn","DESCRIPTORS","CONFIGURABLE_FUNCTION_NAME","inspectSource","InternalStateModule","enforceInternalState","getInternalState","$String","defineProperty","stringSlice","replace","join","CONFIGURABLE_LENGTH","TEMPLATE","makeBuiltIn","value","name","options","state","__name","require_define_built_in","__commonJSMin","exports","module","isCallable","definePropertyModule","makeBuiltIn","defineGlobalProperty","O","key","value","options","simple","name","require_math_trunc","__commonJSMin","exports","module","ceil","floor","__name","x","n","require_to_integer_or_infinity","__commonJSMin","exports","module","trunc","argument","number","require_to_absolute_index","__commonJSMin","exports","module","toIntegerOrInfinity","max","min","index","length","integer","require_to_length","__commonJSMin","exports","module","toIntegerOrInfinity","min","argument","len","require_length_of_array_like","__commonJSMin","exports","module","toLength","obj","require_array_includes","__commonJSMin","exports","module","toIndexedObject","toAbsoluteIndex","lengthOfArrayLike","createMethod","__name","IS_INCLUDES","$this","el","fromIndex","O","length","index","value","require_object_keys_internal","__commonJSMin","exports","module","uncurryThis","hasOwn","toIndexedObject","indexOf","hiddenKeys","push","object","names","O","i","result","key","require_enum_bug_keys","__commonJSMin","exports","module","require_object_get_own_property_names","__commonJSMin","exports","internalObjectKeys","enumBugKeys","hiddenKeys","__name","O","require_object_get_own_property_symbols","__commonJSMin","exports","require_own_keys","__commonJSMin","exports","module","getBuiltIn","uncurryThis","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","anObject","concat","__name","it","keys","getOwnPropertySymbols","require_copy_constructor_properties","__commonJSMin","exports","module","hasOwn","ownKeys","getOwnPropertyDescriptorModule","definePropertyModule","target","source","exceptions","keys","defineProperty","getOwnPropertyDescriptor","i","key","require_is_forced","__commonJSMin","exports","module","fails","isCallable","replacement","isForced","__name","feature","detection","value","data","normalize","POLYFILL","NATIVE","string","require_export","__commonJSMin","exports","module","globalThis","getOwnPropertyDescriptor","createNonEnumerableProperty","defineBuiltIn","defineGlobalProperty","copyConstructorProperties","isForced","options","source","TARGET","GLOBAL","STATIC","FORCED","target","key","targetProperty","sourceProperty","descriptor","require_delete_property_or_throw","__commonJSMin","exports","module","tryToString","$TypeError","O","P","require_to_string_tag_support","__commonJSMin","exports","module","wellKnownSymbol","TO_STRING_TAG","test","require_classof","__commonJSMin","exports","module","TO_STRING_TAG_SUPPORT","isCallable","classofRaw","wellKnownSymbol","TO_STRING_TAG","$Object","CORRECT_ARGUMENTS","tryGet","__name","it","key","O","tag","result","require_to_string","__commonJSMin","exports","module","classof","$String","argument","require_array_slice","__commonJSMin","exports","module","uncurryThis","require_array_sort","__commonJSMin","exports","module","arraySlice","floor","sort","__name","array","comparefn","length","i","element","j","middle","left","right","llength","rlength","lindex","rindex","require_array_method_is_strict","__commonJSMin","exports","module","fails","METHOD_NAME","argument","method","require_environment_ff_version","__commonJSMin","exports","module","userAgent","firefox","require_environment_is_ie_or_edge","__commonJSMin","exports","module","UA","require_environment_webkit_version","__commonJSMin","exports","module","userAgent","webkit","require_es_array_sort","__commonJSMin","$","uncurryThis","aCallable","toObject","lengthOfArrayLike","deletePropertyOrThrow","toString","fails","internalSort","arrayMethodIsStrict","FF","IE_OR_EDGE","V8","WEBKIT","test","nativeSort","push","FAILS_ON_UNDEFINED","FAILS_ON_NULL","STRICT_METHOD","STABLE_SORT","result","code","chr","value","index","a","b","FORCED","getSortCompare","__name","comparefn","x","y","array","items","arrayLength","itemsLength","require_array_from_constructor_and_list","__commonJSMin","exports","module","lengthOfArrayLike","Constructor","list","$length","index","length","result","require_get_built_in_prototype_method","__commonJSMin","exports","module","globalThis","CONSTRUCTOR","METHOD","Constructor","Prototype","require_object_keys","__commonJSMin","exports","module","internalObjectKeys","enumBugKeys","__name","O","require_object_define_properties","__commonJSMin","exports","DESCRIPTORS","V8_PROTOTYPE_DEFINE_BUG","definePropertyModule","anObject","toIndexedObject","objectKeys","__name","O","Properties","props","keys","length","index","key","require_html","__commonJSMin","exports","module","getBuiltIn","require_object_create","__commonJSMin","exports","module","anObject","definePropertiesModule","enumBugKeys","hiddenKeys","html","documentCreateElement","sharedKey","GT","LT","PROTOTYPE","SCRIPT","IE_PROTO","EmptyConstructor","__name","scriptTag","content","NullProtoObjectViaActiveX","activeXDocument","temp","NullProtoObjectViaIFrame","iframe","JS","iframeDocument","NullProtoObject","length","O","Properties","result","require_add_to_unscopables","__commonJSMin","exports","module","wellKnownSymbol","create","defineProperty","UNSCOPABLES","ArrayPrototype","key","require_es_array_to_sorted","__commonJSMin","$","uncurryThis","aCallable","toIndexedObject","arrayFromConstructorAndList","getBuiltInPrototypeMethod","addToUnscopables","$Array","sort","__name","compareFn","O","A","require_entry_unbind","__commonJSMin","exports","module","globalThis","uncurryThis","CONSTRUCTOR","METHOD","require_to_sorted","__commonJSMin","exports","module","entryUnbind","require_to_sorted","__commonJSMin","exports","module","parent","require_esnext_array_to_sorted","__commonJSMin","require_to_sorted","__commonJSMin","exports","module","parent","import_to_sorted","tokenizers_exports","__export","AlbertTokenizer","AutoTokenizer","BartTokenizer","BertTokenizer","BlenderbotSmallTokenizer","BlenderbotTokenizer","BloomTokenizer","CLIPTokenizer","CamembertTokenizer","CodeGenTokenizer","CodeLlamaTokenizer","CohereTokenizer","ConvBertTokenizer","DebertaTokenizer","DebertaV2Tokenizer","DistilBertTokenizer","ElectraTokenizer","Ernie4_5_Tokenizer","EsmTokenizer","FalconTokenizer","GPT2Tokenizer","GPTNeoXTokenizer","GemmaTokenizer","Grok1Tokenizer","HerbertTokenizer","LlamaTokenizer","M2M100Tokenizer","MBart50Tokenizer","MBartTokenizer","MPNetTokenizer","MarianTokenizer","MgpstrTokenizer","MobileBertTokenizer","NllbTokenizer","NougatTokenizer","PreTrainedTokenizer","Qwen2Tokenizer","RoFormerTokenizer","RobertaTokenizer","SiglipTokenizer","SpeechT5Tokenizer","SqueezeBertTokenizer","T5Tokenizer","TokenizerModel","VitsTokenizer","Wav2Vec2CTCTokenizer","WhisperTokenizer","XLMRobertaTokenizer","XLMTokenizer","is_chinese_char","_a","Callable","closure","__name","args","reverseDictionary","data","key","value","__name","escapeRegExp","string","isIntegralNumber","x","__name","mergeArrays","arrs","__name","len","length","c","__name","getModelFile","path_or_repo_id","filename","fatal","options","response","__name","getModelJSON","modelPath","fileName","buffer","jsonData","min","arr","indexOfMin","i","__name","max","indexOfMax","round","num","decimals","pow","__name","_TensorError","message","__name","TensorError","_Tensor","args","Tensor","_PriorityQueue","comparator","a","b","maxSize","values","value","smallest","poppedValue","bottom","replacedValue","i","j","temp","node","maxChild","__name","PriorityQueue","_CharTrie","CharTrieNode","texts","text","ch","child","prefix","CharTrie","_CharTrieNode","isLeaf","children","_TokenLattice","sentence","bosTokenId","eosTokenId","bos","TokenLatticeNode","eos","pos","length","score","tokenId","nodeId","len","rnode","bestScore","bestNode","lnode","results","prev","x","TokenLattice","_TokenLatticeNode","n","_DictionarySplitter","dictionary","_a","trie","word","result","start","match","DictionarySplitter","_LRUCache","capacity","key","LRUCache","TOKEN_TYPES","KEYWORDS","_a","Token","value","type","__name","isWord","char","isInteger","ORDERED_MAPPING_TABLE","ESCAPE_CHARACTERS","preprocess","template","options","tokenize","source","tokens","src","cursorPosition","consumeWhile","predicate","str","escaped","unescaped","main","lastTokenType","text","char2","lastTokenType2","num","token","c","word","Statement","__publicField","Program","body","If","test","alternate","For","loopvar","iterable","SetStatement","assignee","Expression","MemberExpression","object","property","computed","CallExpression","callee","args","Identifier","Literal","NumericLiteral","StringLiteral","BooleanLiteral","ArrayLiteral","TupleLiteral","ObjectLiteral","BinaryExpression","operator","left","right","FilterExpression","operand","filter","TestExpression","negate","UnaryExpression","argument","SliceExpression","start","stop","step","KeywordArgumentExpression","key","parse","program","current","expect","error","prev","parseAny","parseText","parseJinjaStatement","parseJinjaExpression","not","types","i","is","result","parseSetStatement","parseIfStatement","parseForStatement","parseExpression","parseExpressionSequence","primary","fn","parsePrimaryExpression","expressions","isTuple","loopVariable","parseTernaryExpression","a","parseLogicalOrExpression","b","parseLogicalAndExpression","parseLogicalNegationExpression","arg","parseComparisonExpression","parseAdditiveExpression","parseMultiplicativeExpression","parseCallMemberExpression","member","parseMemberExpression","parseCallExpression","callExpression","parseArgs","parseArgumentsList","parseMemberExpressionArgumentsList","slices","isSlice","parseTestExpression","parseFilterExpression","expression","values","range","slice","array","direction","titleCase","RuntimeValue","BooleanValue","NumericValue","StringValue","FunctionValue","ObjectValue","defaultValue","NullValue","ArrayValue","TupleValue","UndefinedValue","Environment","parent","name","convertToRuntimeValues","Interpreter","env","node","environment","x","filterName","attr","testName","testFunction","filtered","item","statements","statement","lastEvaluated","expr","kwargs","kwarg","rhs","variableName","scope","loop","j","evaluated","mapping","evaluatedKey","input","_scope","Template","items","WHISPER_LANGUAGES","WHISPER_LANGUAGE_MAPPING","WHISPER_TO_LANGUAGE_CODE_MAPPING","k","v","loadTokenizer","pretrained_model_name_or_path","options","info","getModelJSON","__name","regexSplit","text","regex","result","prev","match","fullMatch","createPattern","pattern","invert","key","value","PROBLEMATIC_REGEX_MAP","escaped","escapeRegExp","objectToMap","obj","prepareTensorForDecode","tensor","dims","clean_up_tokenization","remove_accents","lowercase_and_remove_accent","is_chinese_char","cp","fuse_unk","arr","tokens_to_ids","unk_token_id","fused","i","whitespace_split","PUNCTUATION_REGEX","PUNCTUATION_ONLY_REGEX","BLOOM_SPLIT_CHARS","_AddedToken","config","AddedToken","_TokenizerModel","Callable","args","WordPieceTokenizer","Unigram","BPE","LegacyTokenizerModel","tokens","ids","TokenizerModel","_WordPieceTokenizer","outputTokens","token","chars","isUnknown","start","subTokens","end","currentSubstring","substr","_Unigram","moreConfig","vocabSize","x","min","CharTrie","lattice","mblen","beginPos","hasSingleNode","sliced","prefixedTokens","tokenId","tokenScore","n","len","normalized","TokenLattice","toReturn","tokenized","BYTES_TO_UNICODE","bs","_","cs","b","ccs","UNICODE_TO_BYTES","reverseDictionary","_BPE","use_new_merge_format","LRUCache","cached","word","queue","PriorityQueue","a","startingNode","previousNode","currentNode","node","newPreviousNode","merged","rank","bpe_token_list","t","byteTokens","_LegacyTokenizerModel","_Normalizer","BertNormalizer","Precompiled","NormalizerSequence","Replace","NFC","NFD","NFKC","NFKD","StripNormalizer","StripAccents","Lowercase","Prepend","Normalizer","_Replace","_UnicodeNormalizer","__publicField","UnicodeNormalizer","_NFC","_NFD","_NFKC","_NFKD","_StripNormalizer","_StripAccents","_Lowercase","_Prepend","_NormalizerSequence","normalizer","_BertNormalizer","output","char","_PreTokenizer","BertPreTokenizer","PreTokenizerSequence","WhitespacePreTokenizer","WhitespaceSplit","MetaspacePreTokenizer","ByteLevelPreTokenizer","SplitPreTokenizer","PunctuationPreTokenizer","DigitsPreTokenizer","ReplacePreTokenizer","PreTokenizer","_BertPreTokenizer","_ByteLevelPreTokenizer","byte","_SplitPreTokenizer","_PunctuationPreTokenizer","_DigitsPreTokenizer","digit_pattern","_PostProcessor","TemplateProcessing","ByteLevelPostProcessor","RobertaProcessing","BertProcessing","PostProcessorSequence","PostProcessor","_BertProcessing","tokens_pair","add_special_tokens","mergeArrays","token_type_ids","middle","after","_RobertaProcessing","_TemplateProcessing","type","processedTokens","types","item","_ByteLevelPostProcessor","_PostProcessorSequence","processor","_Decoder","WordPieceDecoder","MetaspaceDecoder","ByteLevelDecoder","ReplaceDecoder","ByteFallback","FuseDecoder","StripDecoder","DecoderSequence","CTCDecoder","BPEDecoder","Decoder","_ReplaceDecoder","_ByteFallback","new_tokens","previous_byte_tokens","bytes","string","_FuseDecoder","_StripDecoder","start_cut","stop_cut","index","_WordPieceDecoder","_ByteLevelDecoder","byteArray","c","sub_texts","current_sub_text","_CTCDecoder","grouped_tokens","_DecoderSequence","toks","decoder","_BPEDecoder","_VitsDecoder","decoded","VitsDecoder","_MetaspacePreTokenizer","section_index","_MetaspaceDecoder","_Precompiled","part","_PreTokenizerSequence","preTokenizedText","tokenizer","_WhitespacePreTokenizer","_WhitespaceSplit","_ReplacePreTokenizer","SPECIAL_TOKEN_ATTRIBUTES","padHelper","length","value_fn","side","diff","padData","truncateHelper","_PreTrainedTokenizer","tokenizerJSON","tokenizerConfig","addedToken","DictionarySplitter","chat_template","name","template","keys","progress_callback","cache_dir","local_files_only","revision","legacy","text_pair","padding","truncation","max_length","return_tensor","return_token_type_ids","isBatched","encodedTokens","max","Tensor","sections","sectionTokens","input_ids","pair","tokens2","batch","decode_args","token_ids","isIntegralNumber","skip_special_tokens","clean_up_tokenization_spaces","tools","template_dict","conversation","documents","add_generation_prompt","tokenize","return_dict","tokenizer_kwargs","kwargs","compiledTemplate","Template","special_tokens_map","rendered","out","PreTrainedTokenizer","_BertTokenizer","BertTokenizer","_AlbertTokenizer","AlbertTokenizer","_MobileBertTokenizer","MobileBertTokenizer","_SqueezeBertTokenizer","SqueezeBertTokenizer","_DebertaTokenizer","DebertaTokenizer","_DebertaV2Tokenizer","DebertaV2Tokenizer","_HerbertTokenizer","HerbertTokenizer","_ConvBertTokenizer","ConvBertTokenizer","_RoFormerTokenizer","RoFormerTokenizer","_DistilBertTokenizer","DistilBertTokenizer","_CamembertTokenizer","CamembertTokenizer","_XLMTokenizer","XLMTokenizer","_ElectraTokenizer","ElectraTokenizer","_T5Tokenizer","T5Tokenizer","_GPT2Tokenizer","GPT2Tokenizer","_BartTokenizer","BartTokenizer","_MBartTokenizer","raw_inputs","tokenizer_options","generate_kwargs","_build_translation_inputs","MBartTokenizer","_MBart50Tokenizer","MBart50Tokenizer","_RobertaTokenizer","RobertaTokenizer","_BloomTokenizer","BloomTokenizer","SPIECE_UNDERLINE","_LlamaTokenizer","LlamaTokenizer","_CodeLlamaTokenizer","CodeLlamaTokenizer","_XLMRobertaTokenizer","XLMRobertaTokenizer","_MPNetTokenizer","MPNetTokenizer","_FalconTokenizer","FalconTokenizer","_GPTNeoXTokenizer","GPTNeoXTokenizer","_EsmTokenizer","EsmTokenizer","_Qwen2Tokenizer","Qwen2Tokenizer","_GemmaTokenizer","GemmaTokenizer","_Grok1Tokenizer","Grok1Tokenizer","self","src_lang_token","tgt_lang_token","_NllbTokenizer","NllbTokenizer","_M2M100Tokenizer","M2M100Tokenizer","_WhisperTokenizer","sequences","return_timestamps","return_language","time_precision","force_full_sequences","last_language","returnWordTimestamps","new_chunk","chunks","chunk","time_offset","timestamp_begin","timestamp_end","previous_tokens","previous_token_timestamps","skip","right_stride_start","all_special_ids","token_timestamps","last_timestamp","first_timestamp","chunk_len","stride_left","stride_right","current_tokens","current_token_timestamps","language","WHISPER_LANGUAGE_MAPPING","resolved_tokens","resolved_text","time","rounded_time","round","resolved_token_timestamps","start_time","end_time","decoded_text","p","optional","full_text","new_chunks","token_timestamp_sequences","leftSequence","leftLength","totalSequence","use_token_timestamp_sequences","total_token_timestamp_sequence","left_token_timestamp_sequence","rightSequence","maxIndices","rightLength","j","leftStart","leftStop","left","rightStart","rightStop","right","matches","elem","idx","eps","matching","leftMid","rightMid","words","token_indices","timings","indices","prepend_punctionations","append_punctuations","word_tokens","outputs","timestamp","s","decoded_full","replacement_char","current_indices","unicode_offset","token_idx","subwords","subword_tokens_list","subword_indices_list","punctuationRegex","subword","subword_tokens","subword_indices","special","with_space","trimmed","punctuation","ix","prepended","appended","newWords","newTokens","newIndices","WhisperTokenizer","_CodeGenTokenizer","CodeGenTokenizer","_CLIPTokenizer","CLIPTokenizer","_SiglipTokenizer","SiglipTokenizer","_MarianTokenizer","matchInfo","remainder","MarianTokenizer","_Wav2Vec2CTCTokenizer","Wav2Vec2CTCTokenizer","_BlenderbotTokenizer","BlenderbotTokenizer","_BlenderbotSmallTokenizer","BlenderbotSmallTokenizer","_SpeechT5Tokenizer","SpeechT5Tokenizer","_NougatTokenizer","NougatTokenizer","_VitsTokenizer","VitsTokenizer","_CohereTokenizer","CohereTokenizer","_MgpstrTokenizer","MgpstrTokenizer","_Ernie4_5_Tokenizer","Ernie4_5_Tokenizer","_AutoTokenizer","tokenizerName","cls","AutoTokenizer","AutoTokenizer","PreTrainedTokenizer","_TokenizerLoader","model","tokenizerJSON","tokenizerConfig","tokenizerName","cls","AutoTokenizer","PreTrainedTokenizer","options","fetch","res","__name","TokenizerLoader"]}