@generaltranslation/react-core 1.8.20 → 1.8.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs.min.cjs +1 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.esm.min.mjs +1 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.min.mjs","names":["stableStringify","u64.split","TYPE","TYPE$1","getPluralForm","stableStringify","numOptions","dateTimeOptions","currencyOptions","React","reactUse","reactUse","_useEnableI18n","_readAuthFromEnv","_useDetermineLocale","_useRegionState","readAuthFromEnv","useEnableI18n","useRegionState","reactUse"],"sources":["../src/variables/getVariableName.ts","../../core/dist/base64-r7YWJYWt.mjs","../../core/dist/isVariable-fAKEB7gF.mjs","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js","../../format/dist/IntlCache-ywLCPDGw.mjs","../../format/dist/internal.mjs","../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/error.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/types.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/date-time.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/number.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/index.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/time-data.generated.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/date-time-pattern-generator.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/parser.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/manipulator.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/index.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/printer.js","../../core/dist/internal.mjs","../src/variables/_getVariableProps.ts","../src/branches/plurals/getPluralBranch.ts","../src/rendering/getGTTag.ts","../src/rendering/renderDefaultChildren.tsx","../src/dictionaries/indexDict.ts","../src/internal/addGTIdentifier.ts","../src/errors-dir/constants.ts","../src/errors-dir/diagnostics.ts","../src/errors-dir/createErrors.ts","../src/errors-dir/internalErrors.ts","../src/utils/utils.tsx","../../format/dist/types-DY1ZTHWr.mjs","../src/internal/writeChildrenAsObjects.ts","../src/dictionaries/getDictionaryEntry.ts","../src/dictionaries/getEntryAndMetadata.ts","../src/rendering/renderTranslatedChildren.tsx","../src/rendering/getDefaultRenderSettings.ts","../src/rendering/renderSkeleton.tsx","../src/utils/cookies.ts","../src/dictionaries/isDictionaryEntry.ts","../src/dictionaries/mergeDictionaries.ts","../src/dictionaries/getSubtree.ts","../src/dictionaries/injectEntry.ts","../src/dictionaries/stripMetadataFromEntries.ts","../../core/dist/id-DEaFhGqX.mjs","../src/dictionaries/injectHashes.ts","../src/dictionaries/injectTranslations.ts","../src/dictionaries/injectFallbacks.ts","../src/dictionaries/injectAndMerge.ts","../src/dictionaries/collectUntranslatedEntries.ts","../../i18n/dist/isEncodedTranslationOptions-BOwWa_-J.mjs","../../i18n/dist/versionId-BTjLA0FZ.mjs","../../i18n/dist/mFallback-pqVm9wDk.mjs","../../i18n/dist/index.mjs","../src/variables/Derive.tsx","../src/provider/GTContext.ts","../src/variables/Num.tsx","../src/variables/Var.tsx","../src/variables/Currency.tsx","../src/variables/DateTime.tsx","../src/variables/RelativeTime.tsx","../src/rendering/renderVariable.tsx","../src/promises/dangerouslyUsable.ts","../src/utils/use.ts","../src/translation/T.tsx","../src/translation/hooks/useGT.tsx","../src/translation/hooks/useTranslations.tsx","../src/hooks/useDefaultLocale.ts","../src/hooks/useLocale.ts","../src/hooks/useVersionId.ts","../src/hooks/useRegion.ts","../src/provider/hooks/useRuntimeTranslation.ts","../src/provider/hooks/translation/useCreateInternalUseGTFunction.ts","../src/provider/hooks/translation/useCreateInternalUseTranslationsFunction.ts","../src/provider/hooks/locales/useLocaleState.ts","../src/provider/hooks/useErrorChecks.ts","../src/dictionaries/loadDictionaryHelper.ts","../src/provider/hooks/useLoadDictionary.ts","../src/utils/fetchTranslations.ts","../src/provider/hooks/useLoadTranslations.ts","../src/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.ts","../src/provider/hooks/useEnableI18n.ts","../src/provider/helpers/isSSREnabled.ts","../src/provider/hooks/locales/useDetermineLocale.ts","../src/provider/hooks/useRegionState.ts","../src/provider/GTProvider.tsx","../src/branches/plurals/Plural.tsx","../src/branches/Branch.tsx","../src/hooks/useLocales.ts","../src/hooks/useSetLocale.ts","../src/ui/LocaleSelector.tsx","../src/hooks/useLocaleSelector.ts","../src/ui/RegionSelector.tsx","../src/hooks/useGTClass.ts","../src/hooks/useRegionSelector.ts","../src/hooks/useLocaleDirection.ts","../src/translation/hooks/useMessages.ts"],"sourcesContent":["const defaultVariableNames = {\n variable: 'value',\n number: 'n',\n datetime: 'date',\n currency: 'cost',\n 'relative-time': 'time',\n} as const;\n\nexport const baseVariablePrefix = '_gt_';\n\nexport default function getVariableName(\n props: Record<string, unknown> = {},\n variableType: keyof typeof defaultVariableNames\n): string {\n if (typeof props.name === 'string') return props.name;\n const baseVariableName = defaultVariableNames[variableType] || 'value';\n const gtTag = props['data-_gt'] as { id?: number } | undefined;\n return `${baseVariablePrefix}${baseVariableName}_${gtTag?.id}`;\n}\n","//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction lowercaseFirstWord(text) {\n\treturn text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api2.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://runtime2.gtx.dev\";\n//#endregion\n//#region src/utils/isSupportedFileFormatTransform.ts\nconst SUPPORTED_TRANSFORMATIONS = {\n\tGTJSON: [\"GTJSON\"],\n\tJSON: [\"JSON\"],\n\tPO: [\"PO\"],\n\tPOT: [\"POT\", \"PO\"],\n\tYAML: [\"YAML\"],\n\tMDX: [\"MDX\"],\n\tMD: [\"MD\"],\n\tTS: [\"TS\"],\n\tJS: [\"JS\"],\n\tHTML: [\"HTML\"],\n\tTXT: [\"TXT\"],\n\tTWILIO_CONTENT_JSON: [\"TWILIO_CONTENT_JSON\"]\n};\n/**\n* This function checks if a file format transformation is supported during translation\n* @param from - The source file format.\n* @param to - The target file format.\n* @returns True if the transformation is supported, false otherwise\n*/\nfunction isSupportedFileFormatTransform(from, to) {\n\treturn SUPPORTED_TRANSFORMATIONS[from]?.includes(to) ?? false;\n}\n//#endregion\n//#region src/translate/utils/validateFileFormatTransform.ts\n/**\n* Returns a user-facing validation error when a requested file format transform\n* is missing source format context or is not currently supported.\n*/\nfunction getFileFormatTransformError(file) {\n\tif (!file.transformFormat) return void 0;\n\tconst fileLabel = file.fileName ?? file.fileId ?? \"unknown file\";\n\tif (!file.fileFormat) return `fileFormat is required when transformFormat is provided for ${fileLabel}`;\n\tif (!isSupportedFileFormatTransform(file.fileFormat, file.transformFormat)) return `Unsupported file format transform: ${file.fileFormat} -> ${file.transformFormat}`;\n}\n/**\n* Validates file format transforms before sending upload/enqueue requests.\n*/\nfunction validateFileFormatTransforms(files) {\n\tfor (const file of files) {\n\t\tconst error = getFileFormatTransformError(file);\n\t\tif (error) throw new Error(error);\n\t}\n}\n//#endregion\n//#region src/utils/base64.ts\nfunction encode(data) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(data, \"utf8\").toString(\"base64\");\n\tconst bytes = new TextEncoder().encode(data);\n\tlet binary = \"\";\n\tfor (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);\n\treturn btoa(binary);\n}\nfunction decode(base64) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(base64, \"base64\").toString(\"utf8\");\n\tconst binary = atob(base64);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn new TextDecoder().decode(bytes);\n}\n//#endregion\nexport { defaultBaseUrl as a, createDiagnosticMessage as c, libraryDefaultLocale as d, isSupportedFileFormatTransform as i, formatDiagnosticErrorDetails as l, encode as n, defaultCacheUrl as o, validateFileFormatTransforms as r, defaultRuntimeApiUrl as s, decode as t, defaultTimeout as u };\n\n//# sourceMappingURL=base64-r7YWJYWt.mjs.map","//#region src/utils/stableStringify.ts\n/**\n* Deterministic JSON stringification with sorted object keys.\n* Drop-in replacement for `fast-json-stable-stringify` for plain\n* JSON-compatible data (no toJSON, no circular references).\n*/\nfunction _stringify(node) {\n\tif (node === void 0) return void 0;\n\tif (node === null) return \"null\";\n\tif (typeof node === \"number\") return isFinite(node) ? \"\" + node : \"null\";\n\tif (typeof node !== \"object\") return JSON.stringify(node);\n\tif (Array.isArray(node)) {\n\t\tlet out = \"[\";\n\t\tfor (let i = 0; i < node.length; i++) {\n\t\t\tif (i) out += \",\";\n\t\t\tout += _stringify(node[i]) || \"null\";\n\t\t}\n\t\treturn out + \"]\";\n\t}\n\tconst keys = Object.keys(node).sort();\n\tlet out = \"\";\n\tfor (const key of keys) {\n\t\tconst value = _stringify(node[key]);\n\t\tif (!value) continue;\n\t\tif (out) out += \",\";\n\t\tout += JSON.stringify(key) + \":\" + value;\n\t}\n\treturn \"{\" + out + \"}\";\n}\nfunction stableStringify(data) {\n\treturn _stringify(data) ?? \"\";\n}\n//#endregion\n//#region src/utils/isVariable.ts\nfunction isVariable(obj) {\n\tconst variableObj = obj;\n\tif (variableObj && typeof variableObj === \"object\" && typeof variableObj.k === \"string\") {\n\t\tconst k = Object.keys(variableObj);\n\t\tif (k.length === 1) return true;\n\t\tif (k.length === 2) {\n\t\t\tif (typeof variableObj.i === \"number\") return true;\n\t\t\tif (typeof variableObj.v === \"string\") return true;\n\t\t}\n\t\tif (k.length === 3) {\n\t\t\tif (typeof variableObj.v === \"string\" && typeof variableObj.i === \"number\") return true;\n\t\t}\n\t}\n\treturn false;\n}\n//#endregion\nexport { stableStringify as n, isVariable as t };\n\n//# sourceMappingURL=isVariable-fAKEB7gF.mjs.map","/**\n * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.\n * @param a - value to test\n * @returns `true` when the value is a Uint8Array-compatible view.\n * @example\n * Check whether a value is a Uint8Array-compatible view.\n * ```ts\n * isBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function isBytes(a) {\n // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.\n // The fallback still requires a real ArrayBuffer view, so plain\n // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and\n // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.\n return (a instanceof Uint8Array ||\n (ArrayBuffer.isView(a) &&\n a.constructor.name === 'Uint8Array' &&\n 'BYTES_PER_ELEMENT' in a &&\n a.BYTES_PER_ELEMENT === 1));\n}\n/**\n * Asserts something is a non-negative integer.\n * @param n - number to validate\n * @param title - label included in thrown errors\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a non-negative integer option.\n * ```ts\n * anumber(32, 'length');\n * ```\n */\nexport function anumber(n, title = '') {\n if (typeof n !== 'number') {\n const prefix = title && `\"${title}\" `;\n throw new TypeError(`${prefix}expected number, got ${typeof n}`);\n }\n if (!Number.isSafeInteger(n) || n < 0) {\n const prefix = title && `\"${title}\" `;\n throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);\n }\n}\n/**\n * Asserts something is Uint8Array.\n * @param value - value to validate\n * @param length - optional exact length constraint\n * @param title - label included in thrown errors\n * @returns The validated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate that a value is a byte array.\n * ```ts\n * abytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function abytes(value, length, title = '') {\n const bytes = isBytes(value);\n const len = value?.length;\n const needsLen = length !== undefined;\n if (!bytes || (needsLen && len !== length)) {\n const prefix = title && `\"${title}\" `;\n const ofLen = needsLen ? ` of length ${length}` : '';\n const got = bytes ? `length=${len}` : `type=${typeof value}`;\n const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got;\n if (!bytes)\n throw new TypeError(message);\n throw new RangeError(message);\n }\n return value;\n}\n/**\n * Copies bytes into a fresh Uint8Array.\n * Buffer-style slices can alias the same backing store, so callers that need ownership should copy.\n * @param bytes - source bytes to clone\n * @returns Freshly allocated copy of `bytes`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Clone a byte array before mutating it.\n * ```ts\n * const copy = copyBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function copyBytes(bytes) {\n // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n // because callers use it at byte-validation boundaries before mutating the detached copy.\n return Uint8Array.from(abytes(bytes));\n}\n/**\n * Asserts something is a wrapped hash constructor.\n * @param h - hash constructor to validate\n * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}\n * @throws On invalid hash metadata ranges or values. {@link RangeError}\n * @throws If the hash metadata allows empty outputs or block sizes. {@link Error}\n * @example\n * Validate a callable hash wrapper.\n * ```ts\n * import { ahash } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * ahash(sha256);\n * ```\n */\nexport function ahash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new TypeError('Hash must wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass\n // validation and can produce empty outputs instead of failing fast.\n if (h.outputLen < 1)\n throw new Error('\"outputLen\" must be >= 1');\n if (h.blockLen < 1)\n throw new Error('\"blockLen\" must be >= 1');\n}\n/**\n * Asserts a hash instance has not been destroyed or finished.\n * @param instance - hash instance to validate\n * @param checkFinished - whether to reject finalized instances\n * @throws If the hash instance has already been destroyed or finalized. {@link Error}\n * @example\n * Validate that a hash instance is still usable.\n * ```ts\n * import { aexists } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aexists(hash);\n * ```\n */\nexport function aexists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\n/**\n * Asserts output is a sufficiently-sized byte array.\n * @param out - destination buffer\n * @param instance - hash instance providing output length\n * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a caller-provided digest buffer.\n * ```ts\n * import { aoutput } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aoutput(new Uint8Array(hash.outputLen), hash);\n * ```\n */\nexport function aoutput(out, instance) {\n abytes(out, undefined, 'digestInto() output');\n const min = instance.outputLen;\n if (out.length < min) {\n throw new RangeError('\"digestInto() output\" expected to be of length >=' + min);\n }\n}\n/**\n * Casts a typed array view to Uint8Array.\n * @param arr - source typed array\n * @returns Uint8Array view over the same buffer.\n * @example\n * Reinterpret a typed array as bytes.\n * ```ts\n * u8(new Uint32Array([1, 2]));\n * ```\n */\nexport function u8(arr) {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Casts a typed array view to Uint32Array.\n * `arr.byteOffset` must already be 4-byte aligned or the platform\n * Uint32Array constructor will throw.\n * @param arr - source typed array\n * @returns Uint32Array view over the same buffer.\n * @example\n * Reinterpret a byte array as 32-bit words.\n * ```ts\n * u32(new Uint8Array(8));\n * ```\n */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/**\n * Zeroizes typed arrays in place. Warning: JS provides no guarantees.\n * @param arrays - arrays to overwrite with zeros\n * @example\n * Zeroize sensitive buffers in place.\n * ```ts\n * clean(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/**\n * Creates a DataView for byte-level manipulation.\n * @param arr - source typed array\n * @returns DataView over the same buffer region.\n * @example\n * Create a DataView over an existing buffer.\n * ```ts\n * createView(new Uint8Array(4));\n * ```\n */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Rotate-right operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the right.\n * ```ts\n * rotr(0x12345678, 8);\n * ```\n */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n/**\n * Rotate-left operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the left.\n * ```ts\n * rotl(0x12345678, 8);\n * ```\n */\nexport function rotl(word, shift) {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Whether the current platform is little-endian. */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/**\n * Byte-swap operation for uint32 values.\n * @param word - source word\n * @returns Word with reversed byte order.\n * @example\n * Reverse the byte order of a 32-bit word.\n * ```ts\n * byteSwap(0x11223344);\n * ```\n */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/**\n * Conditionally byte-swaps one 32-bit word on big-endian platforms.\n * @param n - source word\n * @returns Original or byte-swapped word depending on platform endianness.\n * @example\n * Normalize a 32-bit word for host endianness.\n * ```ts\n * swap8IfBE(0x11223344);\n * ```\n */\nexport const swap8IfBE = isLE\n ? (n) => n\n : (n) => byteSwap(n) >>> 0;\n/**\n * Byte-swaps every word of a Uint32Array in place.\n * @param arr - array to mutate\n * @returns The same array after mutation; callers pass live state arrays here.\n * @example\n * Reverse the byte order of every word in place.\n * ```ts\n * byteSwap32(new Uint32Array([0x11223344]));\n * ```\n */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\n/**\n * Conditionally byte-swaps a Uint32Array on big-endian platforms.\n * @param u - array to normalize for host endianness\n * @returns Original or byte-swapped array depending on platform endianness.\n * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.\n * @example\n * Normalize a word array for host endianness.\n * ```ts\n * swap32IfBE(new Uint32Array([0x11223344]));\n * ```\n */\nexport const swap32IfBE = isLE\n ? (u) => u\n : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string.\n * Uses the built-in function when available and assumes it matches the tested\n * fallback semantics.\n * @param bytes - bytes to encode\n * @returns Lowercase hexadecimal string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Convert bytes to lowercase hexadecimal.\n * ```ts\n * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'\n * ```\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n if (ch >= asciis._0 && ch <= asciis._9)\n return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F)\n return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f)\n return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @param hex - hexadecimal string to decode\n * @returns Decoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Decode lowercase hexadecimal into bytes.\n * ```ts\n * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n * ```\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new TypeError('hex string expected, got ' + typeof hex);\n if (hasHexBuiltin) {\n try {\n return Uint8Array.fromHex(hex);\n }\n catch (error) {\n if (error instanceof SyntaxError)\n throw new RangeError(error.message);\n throw error;\n }\n }\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new RangeError('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new RangeError('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * This yields to the Promise/microtask scheduler queue, not to timers or the\n * full macrotask event loop.\n * @example\n * Yield to the next scheduler tick.\n * ```ts\n * await nextTick();\n * ```\n */\nexport const nextTick = async () => { };\n/**\n * Returns control to the Promise/microtask scheduler every `tick`\n * milliseconds to avoid blocking long loops.\n * @param iters - number of loop iterations to run\n * @param tick - maximum time slice in milliseconds\n * @param cb - callback executed on each iteration\n * @example\n * Run a loop that periodically yields back to the event loop.\n * ```ts\n * await asyncLoop(2, 0, () => {});\n * ```\n */\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * Non-ASCII details are delegated to the platform `TextEncoder`.\n * @param str - string to encode\n * @returns UTF-8 encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode a string as UTF-8 bytes.\n * ```ts\n * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])\n * ```\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new TypeError('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Helper for KDFs: consumes Uint8Array or string.\n * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer.\n * @param data - user-provided KDF input\n * @param errorTitle - label included in thrown errors\n * @returns Byte representation of the input.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Normalize KDF input to bytes.\n * ```ts\n * kdfInputToBytes('password');\n * ```\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n if (typeof data === 'string')\n return utf8ToBytes(data);\n return abytes(data, undefined, errorTitle);\n}\n/**\n * Copies several Uint8Arrays into one.\n * @param arrays - arrays to concatenate\n * @returns Concatenated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Concatenate multiple byte arrays.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n/**\n * Merges default options and passed options.\n * @param defaults - base option object\n * @param opts - user overrides\n * @returns Merged option object. The merge mutates `defaults` in place.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Merge user overrides onto default options.\n * ```ts\n * checkOpts({ dkLen: 32 }, { asyncTick: 10 });\n * ```\n */\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new TypeError('options must be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\n/**\n * Creates a callable hash function from a stateful class constructor.\n * @param hashCons - hash constructor or factory\n * @param info - optional metadata such as DER OID\n * @returns Frozen callable hash wrapper with `.create()`.\n * Wrapper construction eagerly calls `hashCons(undefined)` once to read\n * `outputLen` / `blockLen`, so constructor side effects happen at module\n * init time.\n * @example\n * Wrap a stateful hash constructor into a callable helper.\n * ```ts\n * import { createHasher } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const wrapped = createHasher(sha256.create, { oid: sha256.oid });\n * wrapped(new Uint8Array([1]));\n * ```\n */\nexport function createHasher(hashCons, info = {}) {\n const hashC = (msg, opts) => hashCons(opts)\n .update(msg)\n .digest();\n const tmp = hashCons(undefined);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.canXOF = tmp.canXOF;\n hashC.create = (opts) => hashCons(opts);\n Object.assign(hashC, info);\n return Object.freeze(hashC);\n}\n/**\n * Cryptographically secure PRNG backed by `crypto.getRandomValues`.\n * @param bytesLength - number of random bytes to generate\n * @returns Random bytes.\n * The platform `getRandomValues()` implementation still defines any\n * single-call length cap, and this helper rejects oversize requests\n * with a stable library `RangeError` instead of host-specific errors.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error}\n * @example\n * Generate a fresh random key or nonce.\n * ```ts\n * const key = randomBytes(16);\n * ```\n */\nexport function randomBytes(bytesLength = 32) {\n // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion.\n anumber(bytesLength, 'bytesLength');\n const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n if (typeof cr?.getRandomValues !== 'function')\n throw new Error('crypto.getRandomValues must be defined');\n // Web Cryptography API Level 2 §10.1.1:\n // if `byteLength > 65536`, throw `QuotaExceededError`.\n // Keep the guard explicit so callers can see the quota in code\n // instead of discovering it by reading the spec or host errors.\n // This wrapper surfaces the same quota as a stable library RangeError.\n if (bytesLength > 65536)\n throw new RangeError(`\"bytesLength\" expected <= 65536, got ${bytesLength}`);\n return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/**\n * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.\n * @param suffix - final OID byte for the selected hash.\n * The helper accepts any byte even though only the documented NIST hash\n * suffixes are meaningful downstream.\n * @returns Object containing the DER-encoded OID.\n * @example\n * Build OID metadata for a NIST hash.\n * ```ts\n * oidNist(0x01);\n * ```\n */\nexport const oidNist = (suffix) => ({\n // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.\n // Larger suffix values would need base-128 OID encoding and a different length byte.\n oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n//# sourceMappingURL=utils.js.map","/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { abytes, aexists, aoutput, clean, createView, } from \"./utils.js\";\n/**\n * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`.\n * Returns bits from `b` when `a` is set, otherwise from `c`.\n * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never\n * set the same bit.\n * @param a - selector word\n * @param b - word chosen when selector bit is set\n * @param c - word chosen when selector bit is clear\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit choice primitive.\n * ```ts\n * Chi(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/**\n * Shared 32-bit majority primitive reused by SHA-256 and SHA-1.\n * Returns bits shared by at least two inputs.\n * @param a - first input word\n * @param b - second input word\n * @param c - third input word\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit majority primitive.\n * ```ts\n * Maj(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit\n * strings with partial-byte tails.\n * @param blockLen - internal block size in bytes\n * @param outputLen - digest size in bytes\n * @param padOffset - trailing length field size in bytes\n * @param isLE - whether length and state words are encoded in little-endian\n * @example\n * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow.\n * ```ts\n * import { _SHA1 } from '@noble/hashes/legacy.js';\n * const hash = new _SHA1();\n * hash.update(new Uint8Array([97, 98, 99]));\n * hash.digest();\n * ```\n */\nexport class HashMD {\n blockLen;\n outputLen;\n canXOF = false;\n padOffset;\n isLE;\n // For partial updates less than block size\n buffer;\n view;\n finished = false;\n length = 0;\n pos = 0;\n destroyed = false;\n constructor(blockLen, outputLen, padOffset, isLE) {\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path only when there is no buffered partial block: `take === blockLen` implies\n // `this.pos === 0`, so we can process full blocks directly from the input view.\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from\n // the padding fill above, and JS will overflow before user input can make that half non-zero.\n // So we only need to write the low 64 bits here.\n view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen must be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n // Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return\n // fresh bytes to the caller.\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to ||= new this.constructor();\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n // Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and\n // later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it.\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the\n * square roots of the first eight prime numbers. Exported as a shared table; callers must treat\n * it as read-only because constructors copy words from it by index. */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must\n * treat it as read-only because constructors copy words from it by index. */\nexport const SHA224_IV = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth\n * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only\n * because constructors copy halves from it by index. */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first\n * eight prime numbers. Exported as a shared table; callers must treat it as read-only because\n * constructors copy halves from it by index. */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n//# sourceMappingURL=_md.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high\n// }` to match little-endian word order rather than the property names.\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array\n// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.\nfunction split(lst, le = false) {\n const len = lst.length;\n let Ah = new Uint32Array(len);\n let Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\n// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS\n// bitwise results back to uint32 first, and little-endian callers must swap.\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.\nconst shrSH = (h, _l, s) => h >>> s;\n// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.\nconst rotr32H = (_h, l) => l;\n// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.\nconst rotr32L = (h, _l) => h;\n// High 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`.\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\n// Low 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`.\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// High 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\n// Low 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// Add two split 64-bit words and return the split `{ h, l }` sum.\n// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out\n// of the low sum and instead use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\n// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\n// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\n// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\n// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };\n// Canonical grouped namespace for callers that prefer one object.\n// Named exports stay for direct imports.\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n// Default export mirrors named `u64` for compatibility with object-style imports.\nexport default u64;\n//# sourceMappingURL=_u64.js.map","/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and\n * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}.\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from \"./_md.js\";\nimport * as u64 from \"./_u64.js\";\nimport { clean, createHasher, oidNist, rotr } from \"./utils.js\";\n/**\n * SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits\n * of the cube roots of the first 64 primes (2..311).\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\n/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */\nclass SHA2_32B extends HashMD {\n constructor(outputLen) {\n super(64, outputLen, 8, false);\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */\nexport class _SHA256 extends SHA2_32B {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n A = SHA256_IV[0] | 0;\n B = SHA256_IV[1] | 0;\n C = SHA256_IV[2] | 0;\n D = SHA256_IV[3] | 0;\n E = SHA256_IV[4] | 0;\n F = SHA256_IV[5] | 0;\n G = SHA256_IV[6] | 0;\n H = SHA256_IV[7] | 0;\n constructor() {\n super(32);\n }\n}\n/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */\nexport class _SHA224 extends SHA2_32B {\n A = SHA224_IV[0] | 0;\n B = SHA224_IV[1] | 0;\n C = SHA224_IV[2] | 0;\n D = SHA224_IV[3] | 0;\n E = SHA224_IV[4] | 0;\n F = SHA224_IV[5] | 0;\n G = SHA224_IV[6] | 0;\n H = SHA224_IV[7] | 0;\n constructor() {\n super(28);\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// SHA-384 / SHA-512 round constants from RFC 6234 §5.2:\n// 80 full 64-bit words split into high/low halves.\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\n// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */\nclass SHA2_64B extends HashMD {\n constructor(outputLen) {\n super(128, outputLen, 16, false);\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */\nexport class _SHA512 extends SHA2_64B {\n Ah = SHA512_IV[0] | 0;\n Al = SHA512_IV[1] | 0;\n Bh = SHA512_IV[2] | 0;\n Bl = SHA512_IV[3] | 0;\n Ch = SHA512_IV[4] | 0;\n Cl = SHA512_IV[5] | 0;\n Dh = SHA512_IV[6] | 0;\n Dl = SHA512_IV[7] | 0;\n Eh = SHA512_IV[8] | 0;\n El = SHA512_IV[9] | 0;\n Fh = SHA512_IV[10] | 0;\n Fl = SHA512_IV[11] | 0;\n Gh = SHA512_IV[12] | 0;\n Gl = SHA512_IV[13] | 0;\n Hh = SHA512_IV[14] | 0;\n Hl = SHA512_IV[15] | 0;\n constructor() {\n super(64);\n }\n}\n/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */\nexport class _SHA384 extends SHA2_64B {\n Ah = SHA384_IV[0] | 0;\n Al = SHA384_IV[1] | 0;\n Bh = SHA384_IV[2] | 0;\n Bl = SHA384_IV[3] | 0;\n Ch = SHA384_IV[4] | 0;\n Cl = SHA384_IV[5] | 0;\n Dh = SHA384_IV[6] | 0;\n Dl = SHA384_IV[7] | 0;\n Eh = SHA384_IV[8] | 0;\n El = SHA384_IV[9] | 0;\n Fh = SHA384_IV[10] | 0;\n Fl = SHA384_IV[11] | 0;\n Gh = SHA384_IV[12] | 0;\n Gl = SHA384_IV[13] | 0;\n Hh = SHA384_IV[14] | 0;\n Hl = SHA384_IV[15] | 0;\n constructor() {\n super(48);\n }\n}\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`.\n * These IV literals are checked against that script rather than a dedicated\n * local RFC section.\n */\n/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared\n * RFC 6234 §6.4 compression engine. */\nexport class _SHA512_224 extends SHA2_64B {\n Ah = T224_IV[0] | 0;\n Al = T224_IV[1] | 0;\n Bh = T224_IV[2] | 0;\n Bl = T224_IV[3] | 0;\n Ch = T224_IV[4] | 0;\n Cl = T224_IV[5] | 0;\n Dh = T224_IV[6] | 0;\n Dl = T224_IV[7] | 0;\n Eh = T224_IV[8] | 0;\n El = T224_IV[9] | 0;\n Fh = T224_IV[10] | 0;\n Fl = T224_IV[11] | 0;\n Gh = T224_IV[12] | 0;\n Gl = T224_IV[13] | 0;\n Hh = T224_IV[14] | 0;\n Hl = T224_IV[15] | 0;\n constructor() {\n super(28);\n }\n}\n/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared\n * RFC 6234 §6.4 compression engine. */\nexport class _SHA512_256 extends SHA2_64B {\n Ah = T256_IV[0] | 0;\n Al = T256_IV[1] | 0;\n Bh = T256_IV[2] | 0;\n Bl = T256_IV[3] | 0;\n Ch = T256_IV[4] | 0;\n Cl = T256_IV[5] | 0;\n Dh = T256_IV[6] | 0;\n Dl = T256_IV[7] | 0;\n Eh = T256_IV[8] | 0;\n El = T256_IV[9] | 0;\n Fh = T256_IV[10] | 0;\n Fl = T256_IV[11] | 0;\n Gh = T256_IV[12] | 0;\n Gl = T256_IV[13] | 0;\n Hh = T256_IV[14] | 0;\n Hl = T256_IV[15] | 0;\n constructor() {\n super(32);\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:\n *\n * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.\n * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n * - Each sha256 hash is executing 2^18 bit operations.\n * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-256.\n * ```ts\n * sha256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), \n/* @__PURE__ */ oidNist(0x01));\n/**\n * SHA2-224 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-224.\n * ```ts\n * sha224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(), \n/* @__PURE__ */ oidNist(0x04));\n/**\n * SHA2-512 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512.\n * ```ts\n * sha512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), \n/* @__PURE__ */ oidNist(0x03));\n/**\n * SHA2-384 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-384.\n * ```ts\n * sha384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), \n/* @__PURE__ */ oidNist(0x02));\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/256.\n * ```ts\n * sha512_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(), \n/* @__PURE__ */ oidNist(0x06));\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/224.\n * ```ts\n * sha512_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(), \n/* @__PURE__ */ oidNist(0x05));\n//# sourceMappingURL=sha2.js.map","//#region src/errors/formattingErrors.ts\nconst createInvalidCutoffStyleError = (style) => `generaltranslation Formatting Error: Invalid cutoff style: ${style}.`;\nconst DEFAULT_TERMINATOR_KEY = \"DEFAULT_TERMINATOR_KEY\";\nconst TERMINATOR_MAP = {\n\tellipsis: {\n\t\tfr: {\n\t\t\tterminator: \"…\",\n\t\t\tseparator: \" \"\n\t\t},\n\t\tzh: {\n\t\t\tterminator: \"……\",\n\t\t\tseparator: void 0\n\t\t},\n\t\tja: {\n\t\t\tterminator: \"……\",\n\t\t\tseparator: void 0\n\t\t},\n\t\t[DEFAULT_TERMINATOR_KEY]: {\n\t\t\tterminator: \"…\",\n\t\t\tseparator: void 0\n\t\t}\n\t},\n\tnone: { [DEFAULT_TERMINATOR_KEY]: {\n\t\tterminator: void 0,\n\t\tseparator: void 0\n\t} }\n};\n//#endregion\n//#region src/formatting/custom-formats/CutoffFormat/CutoffFormat.ts\nvar CutoffFormatConstructor = class CutoffFormatConstructor {\n\tstatic resolveLocale(locales) {\n\t\ttry {\n\t\t\tconst localesList = !locales ? [\"en\"] : Array.isArray(locales) ? locales.map(String) : [String(locales)];\n\t\t\tconst [canonicalLocale] = Intl.getCanonicalLocales(localesList);\n\t\t\treturn canonicalLocale ?? \"en\";\n\t\t} catch {\n\t\t\treturn \"en\";\n\t\t}\n\t}\n\t/**\n\t* Constructor\n\t* @param {Intl.LocalesArgument} locales - The locales to use for formatting.\n\t* @param {CutoffFormatOptions} options - The options for formatting.\n\t* @param {number} [options.maxChars] - The maximum number of characters to display.\n\t* - Undefined values are treated as no cutoff.\n\t* - Negative values follow .slice() behavior and terminator will be added before the value.\n\t* - 0 will result in an empty string.\n\t* - If cutoff results in an empty string, no terminator is added.\n\t* @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.\n\t* @param {string} [options.terminator] - Optional override the terminator to use.\n\t* @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.\n\t* - If no terminator is provided, then separator is ignored.\n\t*\n\t* @example\n\t* const format = new CutoffFormat('en', { maxChars: 5 });\n\t* format.format('Hello, world!'); // 'Hello...'\n\t*\n\t* const format = new CutoffFormat('en', { maxChars: -3 });\n\t* format.format('Hello, world!'); // '...ld!'\n\t*/\n\tconstructor(locales, options = {}) {\n\t\tthis.locale = CutoffFormatConstructor.resolveLocale(locales);\n\t\tconst style = options.style ?? \"ellipsis\";\n\t\tif (!TERMINATOR_MAP[style]) throw new Error(createInvalidCutoffStyleError(style));\n\t\tconst presetTerminatorOptions = options.maxChars === void 0 ? void 0 : TERMINATOR_MAP[style][new Intl.Locale(this.locale).language] || TERMINATOR_MAP[style][\"DEFAULT_TERMINATOR_KEY\"];\n\t\tlet terminator = options.terminator ?? presetTerminatorOptions?.terminator;\n\t\tlet separator = terminator != null ? options.separator ?? presetTerminatorOptions?.separator : void 0;\n\t\tthis.additionLength = (terminator?.length ?? 0) + (separator?.length ?? 0);\n\t\tif (options.maxChars !== void 0 && Math.abs(options.maxChars) < this.additionLength) {\n\t\t\tterminator = void 0;\n\t\t\tseparator = void 0;\n\t\t}\n\t\tthis.options = {\n\t\t\tmaxChars: options.maxChars,\n\t\t\tstyle: options.maxChars === void 0 ? void 0 : style,\n\t\t\tterminator,\n\t\t\tseparator\n\t\t};\n\t}\n\t/**\n\t* Format a value according to the cutoff options, returning a formatted string.\n\t*\n\t* @param {string} value - The string value to format with cutoff behavior.\n\t* @returns {string} The formatted string with terminator applied if cutoff occurs.\n\t*\n\t* @example\n\t* const formatter = new CutoffFormatConstructor('en', { maxChars: 8, style: 'ellipsis' });\n\t* formatter.format('Hello, world!'); // Returns 'Hello, w...'\n\t*/\n\tformat(value) {\n\t\treturn this.formatToParts(value).join(\"\");\n\t}\n\t/**\n\t* Format a value to parts according to the cutoff options, returning an array of string parts.\n\t* This method breaks down the formatted result into individual components for more granular control.\n\t*\n\t* @param {string} value - The string value to format with cutoff behavior.\n\t* @returns {PrependedCutoffParts | PostpendedCutoffParts} An array of string parts representing the formatted result.\n\t* - For positive maxChars: [cutoffValue, separator?, terminator?]\n\t* - For negative maxChars: [terminator?, separator?, cutoffValue]\n\t* - For no cutoff: [originalValue]\n\t*\n\t* @example\n\t* const formatter = new CutoffFormatConstructor('en', { maxChars: 5, style: 'ellipsis' });\n\t* formatter.formatToParts('Hello, world!'); // Returns ['Hello', '...']\n\t*/\n\tformatToParts(value) {\n\t\tconst { maxChars, terminator, separator } = this.options;\n\t\tconst adjustedChars = maxChars === void 0 || Math.abs(maxChars) >= value.length ? maxChars : maxChars >= 0 ? Math.max(0, maxChars - this.additionLength) : Math.min(0, maxChars + this.additionLength);\n\t\tconst slicedValue = adjustedChars !== void 0 && adjustedChars > -1 ? value.slice(0, adjustedChars) : value.slice(adjustedChars);\n\t\tif (maxChars == null || adjustedChars == null || adjustedChars === 0 || terminator == null || value.length <= Math.abs(maxChars)) return [slicedValue];\n\t\tif (adjustedChars > 0) return separator != null ? [\n\t\t\tslicedValue,\n\t\t\tseparator,\n\t\t\tterminator\n\t\t] : [slicedValue, terminator];\n\t\treturn separator != null ? [\n\t\t\tterminator,\n\t\t\tseparator,\n\t\t\tslicedValue\n\t\t] : [terminator, slicedValue];\n\t}\n\t/**\n\t* Get the resolved options\n\t* @returns {ResolvedCutoffFormatOptions} The resolved options.\n\t*/\n\tresolvedOptions() {\n\t\treturn this.options;\n\t}\n};\n//#endregion\n//#region src/cache/IntlCache.ts\n/**\n* Object mapping constructor names to their respective constructor functions\n* Includes all native Intl constructors plus custom ones like CutoffFormat\n*/\nconst CustomIntl = {\n\tCollator: Intl.Collator,\n\tDateTimeFormat: Intl.DateTimeFormat,\n\tDisplayNames: Intl.DisplayNames,\n\tListFormat: Intl.ListFormat,\n\tLocale: Intl.Locale,\n\tNumberFormat: Intl.NumberFormat,\n\tPluralRules: Intl.PluralRules,\n\tRelativeTimeFormat: Intl.RelativeTimeFormat,\n\tSegmenter: Intl.Segmenter,\n\tCutoffFormat: CutoffFormatConstructor\n};\n/**\n* Cache for Intl and custom format instances to avoid repeated instantiation\n* Uses a two-level structure: constructor name -> cache key -> instance.\n*/\nvar IntlCache = class {\n\tconstructor() {\n\t\tthis.cache = {};\n\t}\n\t/**\n\t* Generates a consistent cache key from locales and options.\n\t* Handles all LocalesArgument types (string, Locale, array, undefined).\n\t*/\n\tgenerateKey(locales, options = {}) {\n\t\treturn `${!locales ? \"undefined\" : Array.isArray(locales) ? locales.map((l) => String(l)).join(\",\") : String(locales)}:${options ? JSON.stringify(options, Object.keys(options).sort()) : \"{}\"}`;\n\t}\n\t/**\n\t* Gets a cached Intl instance or creates a new one if not found\n\t* @param constructor The name of the Intl constructor to use.\n\t* @param args Constructor arguments (locales, options).\n\t* @returns Cached or newly created Intl instance.\n\t*/\n\tget(constructor, ...args) {\n\t\tconst [locales = \"en\", options = {}] = args;\n\t\tconst key = this.generateKey(locales, options);\n\t\tlet cache = this.cache[constructor];\n\t\tif (cache === void 0) {\n\t\t\tcache = {};\n\t\t\tthis.cache[constructor] = cache;\n\t\t}\n\t\tlet intlObject = cache[key];\n\t\tif (intlObject === void 0) {\n\t\t\tintlObject = new CustomIntl[constructor](...args);\n\t\t\tcache[key] = intlObject;\n\t\t}\n\t\treturn intlObject;\n\t}\n};\n/**\n* Global instance of the Intl cache for use throughout the application\n*/\nconst intlCache = new IntlCache();\n//#endregion\nexport { intlCache as t };\n\n//# sourceMappingURL=IntlCache-ywLCPDGw.mjs.map","import { t as intlCache } from \"./IntlCache-ywLCPDGw.mjs\";\n//#region src/internal.ts\nfunction getCachedPluralRules(locales) {\n\treturn intlCache.get(\"PluralRules\", locales);\n}\n//#endregion\nexport { getCachedPluralRules };\n\n//# sourceMappingURL=internal.mjs.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorKind = void 0;\nvar ErrorKind;\n(function (ErrorKind) {\n /** Argument is unclosed (e.g. `{0`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n /** Argument is empty (e.g. `{}`). */\n ErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n /** Argument is malformed (e.g. `{foo!}``) */\n ErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n /** Expect an argument type (e.g. `{foo,}`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n /** Unsupported argument type (e.g. `{foo,foo}`) */\n ErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n /** Expect an argument style (e.g. `{foo, number, }`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n /** The number skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n /** The date time skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n ErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n /** Missing select argument options (e.g. `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n /**\n * Expecting a message fragment after the `plural` or `selectordinal` selector\n * (e.g. `{foo, plural, one}`)\n */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n /**\n * Duplicate selectors in `plural` or `selectordinal` argument.\n * (e.g. {foo, plural, one {#} one {#}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n /** Duplicate selectors in `select` argument.\n * (e.g. {foo, select, apple {apple} apple {apple}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n /** Plural or select argument option must have `other` clause. */\n ErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n /** The tag is malformed. (e.g. `<bold!>foo</bold!>) */\n ErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n /** The tag name is invalid. (e.g. `<123>foo</123>`) */\n ErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n /** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */\n ErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n /** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */\n ErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n})(ErrorKind || (exports.ErrorKind = ErrorKind = {}));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SKELETON_TYPE = exports.TYPE = void 0;\nexports.isLiteralElement = isLiteralElement;\nexports.isArgumentElement = isArgumentElement;\nexports.isNumberElement = isNumberElement;\nexports.isDateElement = isDateElement;\nexports.isTimeElement = isTimeElement;\nexports.isSelectElement = isSelectElement;\nexports.isPluralElement = isPluralElement;\nexports.isPoundElement = isPoundElement;\nexports.isTagElement = isTagElement;\nexports.isNumberSkeleton = isNumberSkeleton;\nexports.isDateTimeSkeleton = isDateTimeSkeleton;\nexports.createLiteralElement = createLiteralElement;\nexports.createNumberElement = createNumberElement;\nvar TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n /**\n * XML-like tag\n */\n TYPE[TYPE[\"tag\"] = 8] = \"tag\";\n})(TYPE || (exports.TYPE = TYPE = {}));\nvar SKELETON_TYPE;\n(function (SKELETON_TYPE) {\n SKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n SKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n})(SKELETON_TYPE || (exports.SKELETON_TYPE = SKELETON_TYPE = {}));\n/**\n * Type Guards\n */\nfunction isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nfunction isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nfunction isNumberElement(el) {\n return el.type === TYPE.number;\n}\nfunction isDateElement(el) {\n return el.type === TYPE.date;\n}\nfunction isTimeElement(el) {\n return el.type === TYPE.time;\n}\nfunction isSelectElement(el) {\n return el.type === TYPE.select;\n}\nfunction isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nfunction isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nfunction isTagElement(el) {\n return el.type === TYPE.tag;\n}\nfunction isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);\n}\nfunction isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);\n}\nfunction createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nfunction createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WHITE_SPACE_REGEX = exports.SPACE_SEPARATOR_REGEX = void 0;\n// @generated from regex-gen.ts\nexports.SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nexports.WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseDateTimeSkeleton = parseDateTimeSkeleton;\n/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nfunction parseDateTimeSkeleton(skeleton) {\n var result = {};\n skeleton.replace(DATE_TIME_REGEX, function (match) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n // Year\n case 'y':\n result.year = len === 2 ? '2-digit' : 'numeric';\n break;\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`q/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n break;\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n break;\n case 'D':\n case 'F':\n case 'g':\n throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n case 'e':\n if (len < 4) {\n throw new RangeError('`e..eee` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n case 'c':\n if (len < 4) {\n throw new RangeError('`c..ccc` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n // Period\n case 'a': // AM, PM\n result.hour12 = true;\n break;\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');\n // Hour\n case 'h':\n result.hourCycle = 'h12';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'H':\n result.hourCycle = 'h23';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'K':\n result.hourCycle = 'h11';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'k':\n result.hourCycle = 'h24';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n break;\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n break;\n case 'S':\n case 'A':\n throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n result.timeZoneName = len < 4 ? 'short' : 'long';\n break;\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: milliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');\n }\n return '';\n });\n return result;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WHITE_SPACE_REGEX = void 0;\n// @generated from regex-gen.ts\nexports.WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseNumberSkeletonFromString = parseNumberSkeletonFromString;\nexports.parseNumberSkeleton = parseNumberSkeleton;\nvar tslib_1 = require(\"tslib\");\nvar regex_generated_1 = require(\"./regex.generated\");\nfunction parseNumberSkeletonFromString(skeleton) {\n if (skeleton.length === 0) {\n throw new Error('Number skeleton cannot be empty');\n }\n // Parse the skeleton\n var stringTokens = skeleton\n .split(regex_generated_1.WHITE_SPACE_REGEX)\n .filter(function (x) { return x.length > 0; });\n var tokens = [];\n for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {\n var stringToken = stringTokens_1[_i];\n var stemAndOptions = stringToken.split('/');\n if (stemAndOptions.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n var stem = stemAndOptions[0], options = stemAndOptions.slice(1);\n for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {\n var option = options_1[_a];\n if (option.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n }\n tokens.push({ stem: stem, options: options });\n }\n return tokens;\n}\nfunction icuUnitToEcma(unit) {\n return unit.replace(/^(.*?)-/, '');\n}\nvar FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nvar SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nvar INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nvar CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n var result = {};\n if (str[str.length - 1] === 'r') {\n result.roundingPriority = 'morePrecision';\n }\n else if (str[str.length - 1] === 's') {\n result.roundingPriority = 'lessPrecision';\n }\n str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {\n // @@@ case\n if (typeof g2 !== 'string') {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits = g1.length;\n }\n // @@@+ case\n else if (g2 === '+') {\n result.minimumSignificantDigits = g1.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumSignificantDigits = g1.length;\n }\n // .@@## or .@@@ case\n else {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n return result;\n}\nfunction parseSign(str) {\n switch (str) {\n case 'sign-auto':\n return {\n signDisplay: 'auto',\n };\n case 'sign-accounting':\n case '()':\n return {\n currencySign: 'accounting',\n };\n case 'sign-always':\n case '+!':\n return {\n signDisplay: 'always',\n };\n case 'sign-accounting-always':\n case '()!':\n return {\n signDisplay: 'always',\n currencySign: 'accounting',\n };\n case 'sign-except-zero':\n case '+?':\n return {\n signDisplay: 'exceptZero',\n };\n case 'sign-accounting-except-zero':\n case '()?':\n return {\n signDisplay: 'exceptZero',\n currencySign: 'accounting',\n };\n case 'sign-never':\n case '+_':\n return {\n signDisplay: 'never',\n };\n }\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n // Engineering\n var result;\n if (stem[0] === 'E' && stem[1] === 'E') {\n result = {\n notation: 'engineering',\n };\n stem = stem.slice(2);\n }\n else if (stem[0] === 'E') {\n result = {\n notation: 'scientific',\n };\n stem = stem.slice(1);\n }\n if (result) {\n var signDisplay = stem.slice(0, 2);\n if (signDisplay === '+!') {\n result.signDisplay = 'always';\n stem = stem.slice(2);\n }\n else if (signDisplay === '+?') {\n result.signDisplay = 'exceptZero';\n stem = stem.slice(2);\n }\n if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {\n throw new Error('Malformed concise eng/scientific notation');\n }\n result.minimumIntegerDigits = stem.length;\n }\n return result;\n}\nfunction parseNotationOptions(opt) {\n var result = {};\n var signOpts = parseSign(opt);\n if (signOpts) {\n return signOpts;\n }\n return result;\n}\n/**\n * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n */\nfunction parseNumberSkeleton(tokens) {\n var result = {};\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n switch (token.stem) {\n case 'percent':\n case '%':\n result.style = 'percent';\n continue;\n case '%x100':\n result.style = 'percent';\n result.scale = 100;\n continue;\n case 'currency':\n result.style = 'currency';\n result.currency = token.options[0];\n continue;\n case 'group-off':\n case ',_':\n result.useGrouping = false;\n continue;\n case 'precision-integer':\n case '.':\n result.maximumFractionDigits = 0;\n continue;\n case 'measure-unit':\n case 'unit':\n result.style = 'unit';\n result.unit = icuUnitToEcma(token.options[0]);\n continue;\n case 'compact-short':\n case 'K':\n result.notation = 'compact';\n result.compactDisplay = 'short';\n continue;\n case 'compact-long':\n case 'KK':\n result.notation = 'compact';\n result.compactDisplay = 'long';\n continue;\n case 'scientific':\n result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'engineering':\n result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'notation-simple':\n result.notation = 'standard';\n continue;\n // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h\n case 'unit-width-narrow':\n result.currencyDisplay = 'narrowSymbol';\n result.unitDisplay = 'narrow';\n continue;\n case 'unit-width-short':\n result.currencyDisplay = 'code';\n result.unitDisplay = 'short';\n continue;\n case 'unit-width-full-name':\n result.currencyDisplay = 'name';\n result.unitDisplay = 'long';\n continue;\n case 'unit-width-iso-code':\n result.currencyDisplay = 'symbol';\n continue;\n case 'scale':\n result.scale = parseFloat(token.options[0]);\n continue;\n case 'rounding-mode-floor':\n result.roundingMode = 'floor';\n continue;\n case 'rounding-mode-ceiling':\n result.roundingMode = 'ceil';\n continue;\n case 'rounding-mode-down':\n result.roundingMode = 'trunc';\n continue;\n case 'rounding-mode-up':\n result.roundingMode = 'expand';\n continue;\n case 'rounding-mode-half-even':\n result.roundingMode = 'halfEven';\n continue;\n case 'rounding-mode-half-down':\n result.roundingMode = 'halfTrunc';\n continue;\n case 'rounding-mode-half-up':\n result.roundingMode = 'halfExpand';\n continue;\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n case 'integer-width':\n if (token.options.length > 1) {\n throw new RangeError('integer-width stems only accept a single optional option');\n }\n token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {\n if (g1) {\n result.minimumIntegerDigits = g2.length;\n }\n else if (g3 && g4) {\n throw new Error('We currently do not support maximum integer digits');\n }\n else if (g5) {\n throw new Error('We currently do not support exact integer digits');\n }\n return '';\n });\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n result.minimumIntegerDigits = token.stem.length;\n continue;\n }\n if (FRACTION_PRECISION_REGEX.test(token.stem)) {\n // Precision\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision\n // precision-integer case\n if (token.options.length > 1) {\n throw new RangeError('Fraction-precision stems only accept a single optional option');\n }\n token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {\n // .000* case (before ICU67 it was .000+)\n if (g2 === '*') {\n result.minimumFractionDigits = g1.length;\n }\n // .### case\n else if (g3 && g3[0] === '#') {\n result.maximumFractionDigits = g3.length;\n }\n // .00## case\n else if (g4 && g5) {\n result.minimumFractionDigits = g4.length;\n result.maximumFractionDigits = g4.length + g5.length;\n }\n else {\n result.minimumFractionDigits = g1.length;\n result.maximumFractionDigits = g1.length;\n }\n return '';\n });\n var opt = token.options[0];\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display\n if (opt === 'w') {\n result = tslib_1.__assign(tslib_1.__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });\n }\n else if (opt) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(opt));\n }\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision\n if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(token.stem));\n continue;\n }\n var signOpts = parseSign(token.stem);\n if (signOpts) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), signOpts);\n }\n var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n if (conciseScientificAndEngineeringOpts) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), conciseScientificAndEngineeringOpts);\n }\n }\n return result;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./date-time\"), exports);\ntslib_1.__exportStar(require(\"./number\"), exports);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.timeData = void 0;\n// @generated from time-data-gen.ts\n// prettier-ignore \nexports.timeData = {\n \"001\": [\n \"H\",\n \"h\"\n ],\n \"419\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AD\": [\n \"H\",\n \"hB\"\n ],\n \"AE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"AF\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"AG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AL\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"AM\": [\n \"H\",\n \"hB\"\n ],\n \"AO\": [\n \"H\",\n \"hB\"\n ],\n \"AR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AS\": [\n \"h\",\n \"H\"\n ],\n \"AT\": [\n \"H\",\n \"hB\"\n ],\n \"AU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AW\": [\n \"H\",\n \"hB\"\n ],\n \"AX\": [\n \"H\"\n ],\n \"AZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BD\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"BE\": [\n \"H\",\n \"hB\"\n ],\n \"BF\": [\n \"H\",\n \"hB\"\n ],\n \"BG\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"BI\": [\n \"H\",\n \"h\"\n ],\n \"BJ\": [\n \"H\",\n \"hB\"\n ],\n \"BL\": [\n \"H\",\n \"hB\"\n ],\n \"BM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BN\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"BO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"BQ\": [\n \"H\"\n ],\n \"BR\": [\n \"H\",\n \"hB\"\n ],\n \"BS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BT\": [\n \"h\",\n \"H\"\n ],\n \"BW\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"BY\": [\n \"H\",\n \"h\"\n ],\n \"BZ\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CA\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"CC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CD\": [\n \"hB\",\n \"H\"\n ],\n \"CF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CG\": [\n \"H\",\n \"hB\"\n ],\n \"CH\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"CI\": [\n \"H\",\n \"hB\"\n ],\n \"CK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CL\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CN\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"CO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CP\": [\n \"H\"\n ],\n \"CR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CU\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CV\": [\n \"H\",\n \"hB\"\n ],\n \"CW\": [\n \"H\",\n \"hB\"\n ],\n \"CX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CY\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"CZ\": [\n \"H\"\n ],\n \"DE\": [\n \"H\",\n \"hB\"\n ],\n \"DG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"DJ\": [\n \"h\",\n \"H\"\n ],\n \"DK\": [\n \"H\"\n ],\n \"DM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"DO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"DZ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"EC\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"EE\": [\n \"H\",\n \"hB\"\n ],\n \"EG\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ER\": [\n \"h\",\n \"H\"\n ],\n \"ES\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"ET\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"FI\": [\n \"H\"\n ],\n \"FJ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"FM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FO\": [\n \"H\",\n \"h\"\n ],\n \"FR\": [\n \"H\",\n \"hB\"\n ],\n \"GA\": [\n \"H\",\n \"hB\"\n ],\n \"GB\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GD\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GE\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"GF\": [\n \"H\",\n \"hB\"\n ],\n \"GG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GH\": [\n \"h\",\n \"H\"\n ],\n \"GI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GL\": [\n \"H\",\n \"h\"\n ],\n \"GM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GN\": [\n \"H\",\n \"hB\"\n ],\n \"GP\": [\n \"H\",\n \"hB\"\n ],\n \"GQ\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"GR\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"GT\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"GU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GW\": [\n \"H\",\n \"hB\"\n ],\n \"GY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"HK\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"HN\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"HR\": [\n \"H\",\n \"hB\"\n ],\n \"HU\": [\n \"H\",\n \"h\"\n ],\n \"IC\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ID\": [\n \"H\"\n ],\n \"IE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IL\": [\n \"H\",\n \"hB\"\n ],\n \"IM\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IN\": [\n \"h\",\n \"H\"\n ],\n \"IO\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IQ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"IR\": [\n \"hB\",\n \"H\"\n ],\n \"IS\": [\n \"H\"\n ],\n \"IT\": [\n \"H\",\n \"hB\"\n ],\n \"JE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"JM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"JO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"JP\": [\n \"H\",\n \"K\",\n \"h\"\n ],\n \"KE\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"KG\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KH\": [\n \"hB\",\n \"h\",\n \"H\",\n \"hb\"\n ],\n \"KI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KM\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KN\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KP\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KW\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"KY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KZ\": [\n \"H\",\n \"hB\"\n ],\n \"LA\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"LB\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"LC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LI\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"LK\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"LR\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LS\": [\n \"h\",\n \"H\"\n ],\n \"LT\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"LU\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"LV\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"LY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"MC\": [\n \"H\",\n \"hB\"\n ],\n \"MD\": [\n \"H\",\n \"hB\"\n ],\n \"ME\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"MF\": [\n \"H\",\n \"hB\"\n ],\n \"MG\": [\n \"H\",\n \"h\"\n ],\n \"MH\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ML\": [\n \"H\"\n ],\n \"MM\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"MN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MP\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MQ\": [\n \"H\",\n \"hB\"\n ],\n \"MR\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MS\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MT\": [\n \"H\",\n \"h\"\n ],\n \"MU\": [\n \"H\",\n \"h\"\n ],\n \"MV\": [\n \"H\",\n \"h\"\n ],\n \"MW\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MX\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"MY\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"MZ\": [\n \"H\",\n \"hB\"\n ],\n \"NA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NC\": [\n \"H\",\n \"hB\"\n ],\n \"NE\": [\n \"H\"\n ],\n \"NF\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NI\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NL\": [\n \"H\",\n \"hB\"\n ],\n \"NO\": [\n \"H\",\n \"h\"\n ],\n \"NP\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"NR\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NU\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"OM\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"PG\": [\n \"h\",\n \"H\"\n ],\n \"PH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PK\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"PL\": [\n \"H\",\n \"h\"\n ],\n \"PM\": [\n \"H\",\n \"hB\"\n ],\n \"PN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"PR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PS\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PT\": [\n \"H\",\n \"hB\"\n ],\n \"PW\": [\n \"h\",\n \"H\"\n ],\n \"PY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"QA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"RE\": [\n \"H\",\n \"hB\"\n ],\n \"RO\": [\n \"H\",\n \"hB\"\n ],\n \"RS\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"RU\": [\n \"H\"\n ],\n \"RW\": [\n \"H\",\n \"h\"\n ],\n \"SA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SC\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SD\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SE\": [\n \"H\"\n ],\n \"SG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SH\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SI\": [\n \"H\",\n \"hB\"\n ],\n \"SJ\": [\n \"H\"\n ],\n \"SK\": [\n \"H\"\n ],\n \"SL\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SN\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SO\": [\n \"h\",\n \"H\"\n ],\n \"SR\": [\n \"H\",\n \"hB\"\n ],\n \"SS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ST\": [\n \"H\",\n \"hB\"\n ],\n \"SV\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"SX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"TC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TD\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"TF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"TG\": [\n \"H\",\n \"hB\"\n ],\n \"TH\": [\n \"H\",\n \"h\"\n ],\n \"TJ\": [\n \"H\",\n \"h\"\n ],\n \"TL\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"TM\": [\n \"H\",\n \"h\"\n ],\n \"TN\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"TO\": [\n \"h\",\n \"H\"\n ],\n \"TR\": [\n \"H\",\n \"hB\"\n ],\n \"TT\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TW\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"TZ\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"UG\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"US\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"UY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"UZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"VA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"VC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"VG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VN\": [\n \"H\",\n \"h\"\n ],\n \"VU\": [\n \"h\",\n \"H\"\n ],\n \"WF\": [\n \"H\",\n \"hB\"\n ],\n \"WS\": [\n \"h\",\n \"H\"\n ],\n \"XK\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"YE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"YT\": [\n \"H\",\n \"hB\"\n ],\n \"ZA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ZM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ZW\": [\n \"H\",\n \"h\"\n ],\n \"af-ZA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ar-001\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ca-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"en-001\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-HK\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-IL\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"en-MY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"es-BR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-ES\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-GQ\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"fr-CA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gl-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gu-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"hi-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"it-CH\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"it-IT\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"kn-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"ml-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"mr-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"pa-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"ta-IN\": [\n \"hB\",\n \"h\",\n \"hb\",\n \"H\"\n ],\n \"te-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"zu-ZA\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ]\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getBestPattern = getBestPattern;\nvar time_data_generated_1 = require(\"./time-data.generated\");\n/**\n * Returns the best matching date time pattern if a date time skeleton\n * pattern is provided with a locale. Follows the Unicode specification:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n * @param skeleton date time skeleton pattern that possibly includes j, J or C\n * @param locale\n */\nfunction getBestPattern(skeleton, locale) {\n var skeletonCopy = '';\n for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {\n var patternChar = skeleton.charAt(patternPos);\n if (patternChar === 'j') {\n var extraLength = 0;\n while (patternPos + 1 < skeleton.length &&\n skeleton.charAt(patternPos + 1) === patternChar) {\n extraLength++;\n patternPos++;\n }\n var hourLen = 1 + (extraLength & 1);\n var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n var dayPeriodChar = 'a';\n var hourChar = getDefaultHourSymbolFromLocale(locale);\n if (hourChar == 'H' || hourChar == 'k') {\n dayPeriodLen = 0;\n }\n while (dayPeriodLen-- > 0) {\n skeletonCopy += dayPeriodChar;\n }\n while (hourLen-- > 0) {\n skeletonCopy = hourChar + skeletonCopy;\n }\n }\n else if (patternChar === 'J') {\n skeletonCopy += 'H';\n }\n else {\n skeletonCopy += patternChar;\n }\n }\n return skeletonCopy;\n}\n/**\n * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n * of the given `locale` to the corresponding time pattern.\n * @param locale\n */\nfunction getDefaultHourSymbolFromLocale(locale) {\n var hourCycle = locale.hourCycle;\n if (hourCycle === undefined &&\n // @ts-ignore hourCycle(s) is not identified yet\n locale.hourCycles &&\n // @ts-ignore\n locale.hourCycles.length) {\n // @ts-ignore\n hourCycle = locale.hourCycles[0];\n }\n if (hourCycle) {\n switch (hourCycle) {\n case 'h24':\n return 'k';\n case 'h23':\n return 'H';\n case 'h12':\n return 'h';\n case 'h11':\n return 'K';\n default:\n throw new Error('Invalid hourCycle');\n }\n }\n // TODO: Once hourCycle is fully supported remove the following with data generation\n var languageTag = locale.language;\n var regionTag;\n if (languageTag !== 'root') {\n regionTag = locale.maximize().region;\n }\n var hourCycles = time_data_generated_1.timeData[regionTag || ''] ||\n time_data_generated_1.timeData[languageTag || ''] ||\n time_data_generated_1.timeData[\"\".concat(languageTag, \"-001\")] ||\n time_data_generated_1.timeData['001'];\n return hourCycles[0];\n}\n","\"use strict\";\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Parser = void 0;\nvar tslib_1 = require(\"tslib\");\nvar error_1 = require(\"./error\");\nvar types_1 = require(\"./types\");\nvar regex_generated_1 = require(\"./regex.generated\");\nvar icu_skeleton_parser_1 = require(\"@formatjs/icu-skeleton-parser\");\nvar date_time_pattern_generator_1 = require(\"./date-time-pattern-generator\");\nvar SPACE_SEPARATOR_START_REGEX = new RegExp(\"^\".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, \"*\"));\nvar SPACE_SEPARATOR_END_REGEX = new RegExp(\"\".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, \"*$\"));\nfunction createLocation(start, end) {\n return { start: start, end: end };\n}\n// #region Ponyfills\n// Consolidate these variables up top for easier toggling during debugging\nvar hasNativeStartsWith = !!String.prototype.startsWith && '_a'.startsWith('a', 1);\nvar hasNativeFromCodePoint = !!String.fromCodePoint;\nvar hasNativeFromEntries = !!Object.fromEntries;\nvar hasNativeCodePointAt = !!String.prototype.codePointAt;\nvar hasTrimStart = !!String.prototype.trimStart;\nvar hasTrimEnd = !!String.prototype.trimEnd;\nvar hasNativeIsSafeInteger = !!Number.isSafeInteger;\nvar isSafeInteger = hasNativeIsSafeInteger\n ? Number.isSafeInteger\n : function (n) {\n return (typeof n === 'number' &&\n isFinite(n) &&\n Math.floor(n) === n &&\n Math.abs(n) <= 0x1fffffffffffff);\n };\n// IE11 does not support y and u.\nvar REGEX_SUPPORTS_U_AND_Y = true;\ntry {\n var re = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n /**\n * legacy Edge or Xbox One browser\n * Unicode flag support: supported\n * Pattern_Syntax support: not supported\n * See https://github.com/formatjs/formatjs/issues/2822\n */\n REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';\n}\ncatch (_) {\n REGEX_SUPPORTS_U_AND_Y = false;\n}\nvar startsWith = hasNativeStartsWith\n ? // Native\n function startsWith(s, search, position) {\n return s.startsWith(search, position);\n }\n : // For IE11\n function startsWith(s, search, position) {\n return s.slice(position, position + search.length) === search;\n };\nvar fromCodePoint = hasNativeFromCodePoint\n ? String.fromCodePoint\n : // IE11\n function fromCodePoint() {\n var codePoints = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n codePoints[_i] = arguments[_i];\n }\n var elements = '';\n var length = codePoints.length;\n var i = 0;\n var code;\n while (length > i) {\n code = codePoints[i++];\n if (code > 0x10ffff)\n throw RangeError(code + ' is not a valid code point');\n elements +=\n code < 0x10000\n ? String.fromCharCode(code)\n : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);\n }\n return elements;\n };\nvar fromEntries = \n// native\nhasNativeFromEntries\n ? Object.fromEntries\n : // Ponyfill\n function fromEntries(entries) {\n var obj = {};\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var _a = entries_1[_i], k = _a[0], v = _a[1];\n obj[k] = v;\n }\n return obj;\n };\nvar codePointAt = hasNativeCodePointAt\n ? // Native\n function codePointAt(s, index) {\n return s.codePointAt(index);\n }\n : // IE 11\n function codePointAt(s, index) {\n var size = s.length;\n if (index < 0 || index >= size) {\n return undefined;\n }\n var first = s.charCodeAt(index);\n var second;\n return first < 0xd800 ||\n first > 0xdbff ||\n index + 1 === size ||\n (second = s.charCodeAt(index + 1)) < 0xdc00 ||\n second > 0xdfff\n ? first\n : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;\n };\nvar trimStart = hasTrimStart\n ? // Native\n function trimStart(s) {\n return s.trimStart();\n }\n : // Ponyfill\n function trimStart(s) {\n return s.replace(SPACE_SEPARATOR_START_REGEX, '');\n };\nvar trimEnd = hasTrimEnd\n ? // Native\n function trimEnd(s) {\n return s.trimEnd();\n }\n : // Ponyfill\n function trimEnd(s) {\n return s.replace(SPACE_SEPARATOR_END_REGEX, '');\n };\n// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.\nfunction RE(s, flag) {\n return new RegExp(s, flag);\n}\n// #endregion\nvar matchIdentifierAtIndex;\nif (REGEX_SUPPORTS_U_AND_Y) {\n // Native\n var IDENTIFIER_PREFIX_RE_1 = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var _a;\n IDENTIFIER_PREFIX_RE_1.lastIndex = index;\n var match = IDENTIFIER_PREFIX_RE_1.exec(s);\n return (_a = match[1]) !== null && _a !== void 0 ? _a : '';\n };\n}\nelse {\n // IE11\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var match = [];\n while (true) {\n var c = codePointAt(s, index);\n if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {\n break;\n }\n match.push(c);\n index += c >= 0x10000 ? 2 : 1;\n }\n return fromCodePoint.apply(void 0, match);\n };\n}\nvar Parser = /** @class */ (function () {\n function Parser(message, options) {\n if (options === void 0) { options = {}; }\n this.message = message;\n this.position = { offset: 0, line: 1, column: 1 };\n this.ignoreTag = !!options.ignoreTag;\n this.locale = options.locale;\n this.requiresOtherClause = !!options.requiresOtherClause;\n this.shouldParseSkeletons = !!options.shouldParseSkeletons;\n }\n Parser.prototype.parse = function () {\n if (this.offset() !== 0) {\n throw Error('parser can only be used once');\n }\n return this.parseMessage(0, '', false);\n };\n Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {\n var elements = [];\n while (!this.isEOF()) {\n var char = this.char();\n if (char === 123 /* `{` */) {\n var result = this.parseArgument(nestingLevel, expectingCloseTag);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else if (char === 125 /* `}` */ && nestingLevel > 0) {\n break;\n }\n else if (char === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) {\n var position = this.clonePosition();\n this.bump();\n elements.push({\n type: types_1.TYPE.pound,\n location: createLocation(position, this.clonePosition()),\n });\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n this.peek() === 47 // char code for '/'\n ) {\n if (expectingCloseTag) {\n break;\n }\n else {\n return this.error(error_1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));\n }\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n _isAlpha(this.peek() || 0)) {\n var result = this.parseTag(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else {\n var result = this.parseLiteral(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n }\n return { val: elements, err: null };\n };\n /**\n * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n * [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n * are accepted:\n *\n * ```\n * tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"</\" tagName (whitespace)* \">\"\n * tagName ::= [a-z] (PENChar)*\n * PENChar ::=\n * \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n * ```\n *\n * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n * since other tag-based engines like React allow it\n */\n Parser.prototype.parseTag = function (nestingLevel, parentArgType) {\n var startPosition = this.clonePosition();\n this.bump(); // `<`\n var tagName = this.parseTagName();\n this.bumpSpace();\n if (this.bumpIf('/>')) {\n // Self closing tag\n return {\n val: {\n type: types_1.TYPE.literal,\n value: \"<\".concat(tagName, \"/>\"),\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else if (this.bumpIf('>')) {\n var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n if (childrenResult.err) {\n return childrenResult;\n }\n var children = childrenResult.val;\n // Expecting a close tag\n var endTagStartPosition = this.clonePosition();\n if (this.bumpIf('</')) {\n if (this.isEOF() || !_isAlpha(this.char())) {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n var closingTagNameStartPosition = this.clonePosition();\n var closingTagName = this.parseTagName();\n if (tagName !== closingTagName) {\n return this.error(error_1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (!this.bumpIf('>')) {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n return {\n val: {\n type: types_1.TYPE.tag,\n value: tagName,\n children: children,\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else {\n return this.error(error_1.ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));\n }\n }\n else {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));\n }\n };\n /**\n * This method assumes that the caller has peeked ahead for the first tag character.\n */\n Parser.prototype.parseTagName = function () {\n var startOffset = this.offset();\n this.bump(); // the first tag name character\n while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {\n this.bump();\n }\n return this.message.slice(startOffset, this.offset());\n };\n Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {\n var start = this.clonePosition();\n var value = '';\n while (true) {\n var parseQuoteResult = this.tryParseQuote(parentArgType);\n if (parseQuoteResult) {\n value += parseQuoteResult;\n continue;\n }\n var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n if (parseUnquotedResult) {\n value += parseUnquotedResult;\n continue;\n }\n var parseLeftAngleResult = this.tryParseLeftAngleBracket();\n if (parseLeftAngleResult) {\n value += parseLeftAngleResult;\n continue;\n }\n break;\n }\n var location = createLocation(start, this.clonePosition());\n return {\n val: { type: types_1.TYPE.literal, value: value, location: location },\n err: null,\n };\n };\n Parser.prototype.tryParseLeftAngleBracket = function () {\n if (!this.isEOF() &&\n this.char() === 60 /* `<` */ &&\n (this.ignoreTag ||\n // If at the opening tag or closing tag position, bail.\n !_isAlphaOrSlash(this.peek() || 0))) {\n this.bump(); // `<`\n return '<';\n }\n return null;\n };\n /**\n * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n * a character that requires quoting (that is, \"only where needed\"), and works the same in\n * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n */\n Parser.prototype.tryParseQuote = function (parentArgType) {\n if (this.isEOF() || this.char() !== 39 /* `'` */) {\n return null;\n }\n // Parse escaped char following the apostrophe, or early return if there is no escaped char.\n // Check if is valid escaped character\n switch (this.peek()) {\n case 39 /* `'` */:\n // double quote, should return as a single quote.\n this.bump();\n this.bump();\n return \"'\";\n // '{', '<', '>', '}'\n case 123:\n case 60:\n case 62:\n case 125:\n break;\n case 35: // '#'\n if (parentArgType === 'plural' || parentArgType === 'selectordinal') {\n break;\n }\n return null;\n default:\n return null;\n }\n this.bump(); // apostrophe\n var codePoints = [this.char()]; // escaped char\n this.bump();\n // read chars until the optional closing apostrophe is found\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch === 39 /* `'` */) {\n if (this.peek() === 39 /* `'` */) {\n codePoints.push(39);\n // Bump one more time because we need to skip 2 characters.\n this.bump();\n }\n else {\n // Optional closing apostrophe.\n this.bump();\n break;\n }\n }\n else {\n codePoints.push(ch);\n }\n this.bump();\n }\n return fromCodePoint.apply(void 0, codePoints);\n };\n Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {\n if (this.isEOF()) {\n return null;\n }\n var ch = this.char();\n if (ch === 60 /* `<` */ ||\n ch === 123 /* `{` */ ||\n (ch === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||\n (ch === 125 /* `}` */ && nestingLevel > 0)) {\n return null;\n }\n else {\n this.bump();\n return fromCodePoint(ch);\n }\n };\n Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {\n var openingBracePosition = this.clonePosition();\n this.bump(); // `{`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n if (this.char() === 125 /* `}` */) {\n this.bump();\n return this.error(error_1.ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n // argument name\n var value = this.parseIdentifierIfPossible().value;\n if (!value) {\n return this.error(error_1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n switch (this.char()) {\n // Simple argument: `{name}`\n case 125 /* `}` */: {\n this.bump(); // `}`\n return {\n val: {\n type: types_1.TYPE.argument,\n // value does not include the opening and closing braces.\n value: value,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n err: null,\n };\n }\n // Argument with options: `{name, format, ...}`\n case 44 /* `,` */: {\n this.bump(); // `,`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n }\n default:\n return this.error(error_1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n };\n /**\n * Advance the parser until the end of the identifier, if it is currently on\n * an identifier character. Return an empty string otherwise.\n */\n Parser.prototype.parseIdentifierIfPossible = function () {\n var startingPosition = this.clonePosition();\n var startOffset = this.offset();\n var value = matchIdentifierAtIndex(this.message, startOffset);\n var endOffset = startOffset + value.length;\n this.bumpTo(endOffset);\n var endPosition = this.clonePosition();\n var location = createLocation(startingPosition, endPosition);\n return { value: value, location: location };\n };\n Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {\n var _a;\n // Parse this range:\n // {name, type, style}\n // ^---^\n var typeStartPosition = this.clonePosition();\n var argType = this.parseIdentifierIfPossible().value;\n var typeEndPosition = this.clonePosition();\n switch (argType) {\n case '':\n // Expecting a style string number, date, time, plural, selectordinal, or select.\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n case 'number':\n case 'date':\n case 'time': {\n // Parse this range:\n // {name, number, style}\n // ^-------^\n this.bumpSpace();\n var styleAndLocation = null;\n if (this.bumpIf(',')) {\n this.bumpSpace();\n var styleStartPosition = this.clonePosition();\n var result = this.parseSimpleArgStyleIfPossible();\n if (result.err) {\n return result;\n }\n var style = trimEnd(result.val);\n if (style.length === 0) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var styleLocation = createLocation(styleStartPosition, this.clonePosition());\n styleAndLocation = { style: style, styleLocation: styleLocation };\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_1 = createLocation(openingBracePosition, this.clonePosition());\n // Extract style or skeleton\n if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {\n // Skeleton starts with `::`.\n var skeleton = trimStart(styleAndLocation.style.slice(2));\n if (argType === 'number') {\n var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n if (result.err) {\n return result;\n }\n return {\n val: { type: types_1.TYPE.number, value: value, location: location_1, style: result.val },\n err: null,\n };\n }\n else {\n if (skeleton.length === 0) {\n return this.error(error_1.ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);\n }\n var dateTimePattern = skeleton;\n // Get \"best match\" pattern only if locale is passed, if not, let it\n // pass as-is where `parseDateTimeSkeleton()` will throw an error\n // for unsupported patterns.\n if (this.locale) {\n dateTimePattern = (0, date_time_pattern_generator_1.getBestPattern)(skeleton, this.locale);\n }\n var style = {\n type: types_1.SKELETON_TYPE.dateTime,\n pattern: dateTimePattern,\n location: styleAndLocation.styleLocation,\n parsedOptions: this.shouldParseSkeletons\n ? (0, icu_skeleton_parser_1.parseDateTimeSkeleton)(dateTimePattern)\n : {},\n };\n var type = argType === 'date' ? types_1.TYPE.date : types_1.TYPE.time;\n return {\n val: { type: type, value: value, location: location_1, style: style },\n err: null,\n };\n }\n }\n // Regular style or no style.\n return {\n val: {\n type: argType === 'number'\n ? types_1.TYPE.number\n : argType === 'date'\n ? types_1.TYPE.date\n : types_1.TYPE.time,\n value: value,\n location: location_1,\n style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,\n },\n err: null,\n };\n }\n case 'plural':\n case 'selectordinal':\n case 'select': {\n // Parse this range:\n // {name, plural, options}\n // ^---------^\n var typeEndPosition_1 = this.clonePosition();\n this.bumpSpace();\n if (!this.bumpIf(',')) {\n return this.error(error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, tslib_1.__assign({}, typeEndPosition_1)));\n }\n this.bumpSpace();\n // Parse offset:\n // {name, plural, offset:1, options}\n // ^-----^\n //\n // or the first option:\n //\n // {name, plural, one {...} other {...}}\n // ^--^\n var identifierAndLocation = this.parseIdentifierIfPossible();\n var pluralOffset = 0;\n if (argType !== 'select' && identifierAndLocation.value === 'offset') {\n if (!this.bumpIf(':')) {\n return this.error(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n this.bumpSpace();\n var result = this.tryParseDecimalInteger(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, error_1.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);\n if (result.err) {\n return result;\n }\n // Parse another identifier for option parsing\n this.bumpSpace();\n identifierAndLocation = this.parseIdentifierIfPossible();\n pluralOffset = result.val;\n }\n var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n if (optionsResult.err) {\n return optionsResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_2 = createLocation(openingBracePosition, this.clonePosition());\n if (argType === 'select') {\n return {\n val: {\n type: types_1.TYPE.select,\n value: value,\n options: fromEntries(optionsResult.val),\n location: location_2,\n },\n err: null,\n };\n }\n else {\n return {\n val: {\n type: types_1.TYPE.plural,\n value: value,\n options: fromEntries(optionsResult.val),\n offset: pluralOffset,\n pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',\n location: location_2,\n },\n err: null,\n };\n }\n }\n default:\n return this.error(error_1.ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n }\n };\n Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {\n // Parse: {value, number, ::currency/GBP }\n //\n if (this.isEOF() || this.char() !== 125 /* `}` */) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bump(); // `}`\n return { val: true, err: null };\n };\n /**\n * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n */\n Parser.prototype.parseSimpleArgStyleIfPossible = function () {\n var nestedBraces = 0;\n var startPosition = this.clonePosition();\n while (!this.isEOF()) {\n var ch = this.char();\n switch (ch) {\n case 39 /* `'` */: {\n // Treat apostrophe as quoting but include it in the style part.\n // Find the end of the quoted literal text.\n this.bump();\n var apostrophePosition = this.clonePosition();\n if (!this.bumpUntil(\"'\")) {\n return this.error(error_1.ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));\n }\n this.bump();\n break;\n }\n case 123 /* `{` */: {\n nestedBraces += 1;\n this.bump();\n break;\n }\n case 125 /* `}` */: {\n if (nestedBraces > 0) {\n nestedBraces -= 1;\n }\n else {\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n }\n break;\n }\n default:\n this.bump();\n break;\n }\n }\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n };\n Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {\n var tokens = [];\n try {\n tokens = (0, icu_skeleton_parser_1.parseNumberSkeletonFromString)(skeleton);\n }\n catch (e) {\n return this.error(error_1.ErrorKind.INVALID_NUMBER_SKELETON, location);\n }\n return {\n val: {\n type: types_1.SKELETON_TYPE.number,\n tokens: tokens,\n location: location,\n parsedOptions: this.shouldParseSkeletons\n ? (0, icu_skeleton_parser_1.parseNumberSkeleton)(tokens)\n : {},\n },\n err: null,\n };\n };\n /**\n * @param nesting_level The current nesting level of messages.\n * This can be positive when parsing message fragment in select or plural argument options.\n * @param parent_arg_type The parent argument's type.\n * @param parsed_first_identifier If provided, this is the first identifier-like selector of\n * the argument. It is a by-product of a previous parsing attempt.\n * @param expecting_close_tag If true, this message is directly or indirectly nested inside\n * between a pair of opening and closing tags. The nested message will not parse beyond\n * the closing tag boundary.\n */\n Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n var _a;\n var hasOtherClause = false;\n var options = [];\n var parsedSelectors = new Set();\n var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;\n // Parse:\n // one {one apple}\n // ^--^\n while (true) {\n if (selector.length === 0) {\n var startPosition = this.clonePosition();\n if (parentArgType !== 'select' && this.bumpIf('=')) {\n // Try parse `={number}` selector\n var result = this.tryParseDecimalInteger(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, error_1.ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);\n if (result.err) {\n return result;\n }\n selectorLocation = createLocation(startPosition, this.clonePosition());\n selector = this.message.slice(startPosition.offset, this.offset());\n }\n else {\n break;\n }\n }\n // Duplicate selector clauses\n if (parsedSelectors.has(selector)) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR\n : error_1.ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);\n }\n if (selector === 'other') {\n hasOtherClause = true;\n }\n // Parse:\n // one {one apple}\n // ^----------^\n this.bumpSpace();\n var openingBracePosition = this.clonePosition();\n if (!this.bumpIf('{')) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\n : error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n if (fragmentResult.err) {\n return fragmentResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n options.push([\n selector,\n {\n value: fragmentResult.val,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n ]);\n // Keep track of the existing selectors\n parsedSelectors.add(selector);\n // Prep next selector clause.\n this.bumpSpace();\n (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);\n }\n if (options.length === 0) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR\n : error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));\n }\n if (this.requiresOtherClause && !hasOtherClause) {\n return this.error(error_1.ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n return { val: options, err: null };\n };\n Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {\n var sign = 1;\n var startingPosition = this.clonePosition();\n if (this.bumpIf('+')) {\n }\n else if (this.bumpIf('-')) {\n sign = -1;\n }\n var hasDigits = false;\n var decimal = 0;\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {\n hasDigits = true;\n decimal = decimal * 10 + (ch - 48);\n this.bump();\n }\n else {\n break;\n }\n }\n var location = createLocation(startingPosition, this.clonePosition());\n if (!hasDigits) {\n return this.error(expectNumberError, location);\n }\n decimal *= sign;\n if (!isSafeInteger(decimal)) {\n return this.error(invalidNumberError, location);\n }\n return { val: decimal, err: null };\n };\n Parser.prototype.offset = function () {\n return this.position.offset;\n };\n Parser.prototype.isEOF = function () {\n return this.offset() === this.message.length;\n };\n Parser.prototype.clonePosition = function () {\n // This is much faster than `Object.assign` or spread.\n return {\n offset: this.position.offset,\n line: this.position.line,\n column: this.position.column,\n };\n };\n /**\n * Return the code point at the current position of the parser.\n * Throws if the index is out of bound.\n */\n Parser.prototype.char = function () {\n var offset = this.position.offset;\n if (offset >= this.message.length) {\n throw Error('out of bound');\n }\n var code = codePointAt(this.message, offset);\n if (code === undefined) {\n throw Error(\"Offset \".concat(offset, \" is at invalid UTF-16 code unit boundary\"));\n }\n return code;\n };\n Parser.prototype.error = function (kind, location) {\n return {\n val: null,\n err: {\n kind: kind,\n message: this.message,\n location: location,\n },\n };\n };\n /** Bump the parser to the next UTF-16 code unit. */\n Parser.prototype.bump = function () {\n if (this.isEOF()) {\n return;\n }\n var code = this.char();\n if (code === 10 /* '\\n' */) {\n this.position.line += 1;\n this.position.column = 1;\n this.position.offset += 1;\n }\n else {\n this.position.column += 1;\n // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.\n this.position.offset += code < 0x10000 ? 1 : 2;\n }\n };\n /**\n * If the substring starting at the current position of the parser has\n * the given prefix, then bump the parser to the character immediately\n * following the prefix and return true. Otherwise, don't bump the parser\n * and return false.\n */\n Parser.prototype.bumpIf = function (prefix) {\n if (startsWith(this.message, prefix, this.offset())) {\n for (var i = 0; i < prefix.length; i++) {\n this.bump();\n }\n return true;\n }\n return false;\n };\n /**\n * Bump the parser until the pattern character is found and return `true`.\n * Otherwise bump to the end of the file and return `false`.\n */\n Parser.prototype.bumpUntil = function (pattern) {\n var currentOffset = this.offset();\n var index = this.message.indexOf(pattern, currentOffset);\n if (index >= 0) {\n this.bumpTo(index);\n return true;\n }\n else {\n this.bumpTo(this.message.length);\n return false;\n }\n };\n /**\n * Bump the parser to the target offset.\n * If target offset is beyond the end of the input, bump the parser to the end of the input.\n */\n Parser.prototype.bumpTo = function (targetOffset) {\n if (this.offset() > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" must be greater than or equal to the current offset \").concat(this.offset()));\n }\n targetOffset = Math.min(targetOffset, this.message.length);\n while (true) {\n var offset = this.offset();\n if (offset === targetOffset) {\n break;\n }\n if (offset > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" is at invalid UTF-16 code unit boundary\"));\n }\n this.bump();\n if (this.isEOF()) {\n break;\n }\n }\n };\n /** advance the parser through all whitespace to the next non-whitespace code unit. */\n Parser.prototype.bumpSpace = function () {\n while (!this.isEOF() && _isWhiteSpace(this.char())) {\n this.bump();\n }\n };\n /**\n * Peek at the *next* Unicode codepoint in the input without advancing the parser.\n * If the input has been exhausted, then this returns null.\n */\n Parser.prototype.peek = function () {\n if (this.isEOF()) {\n return null;\n }\n var code = this.char();\n var offset = this.offset();\n var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));\n return nextCode !== null && nextCode !== void 0 ? nextCode : null;\n };\n return Parser;\n}());\nexports.Parser = Parser;\n/**\n * This check if codepoint is alphabet (lower & uppercase)\n * @param codepoint\n * @returns\n */\nfunction _isAlpha(codepoint) {\n return ((codepoint >= 97 && codepoint <= 122) ||\n (codepoint >= 65 && codepoint <= 90));\n}\nfunction _isAlphaOrSlash(codepoint) {\n return _isAlpha(codepoint) || codepoint === 47; /* '/' */\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n return (c === 45 /* '-' */ ||\n c === 46 /* '.' */ ||\n (c >= 48 && c <= 57) /* 0..9 */ ||\n c === 95 /* '_' */ ||\n (c >= 97 && c <= 122) /** a..z */ ||\n (c >= 65 && c <= 90) /* A..Z */ ||\n c == 0xb7 ||\n (c >= 0xc0 && c <= 0xd6) ||\n (c >= 0xd8 && c <= 0xf6) ||\n (c >= 0xf8 && c <= 0x37d) ||\n (c >= 0x37f && c <= 0x1fff) ||\n (c >= 0x200c && c <= 0x200d) ||\n (c >= 0x203f && c <= 0x2040) ||\n (c >= 0x2070 && c <= 0x218f) ||\n (c >= 0x2c00 && c <= 0x2fef) ||\n (c >= 0x3001 && c <= 0xd7ff) ||\n (c >= 0xf900 && c <= 0xfdcf) ||\n (c >= 0xfdf0 && c <= 0xfffd) ||\n (c >= 0x10000 && c <= 0xeffff));\n}\n/**\n * Code point equivalent of regex `\\p{White_Space}`.\n * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isWhiteSpace(c) {\n return ((c >= 0x0009 && c <= 0x000d) ||\n c === 0x0020 ||\n c === 0x0085 ||\n (c >= 0x200e && c <= 0x200f) ||\n c === 0x2028 ||\n c === 0x2029);\n}\n/**\n * Code point equivalent of regex `\\p{Pattern_Syntax}`.\n * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isPatternSyntax(c) {\n return ((c >= 0x0021 && c <= 0x0023) ||\n c === 0x0024 ||\n (c >= 0x0025 && c <= 0x0027) ||\n c === 0x0028 ||\n c === 0x0029 ||\n c === 0x002a ||\n c === 0x002b ||\n c === 0x002c ||\n c === 0x002d ||\n (c >= 0x002e && c <= 0x002f) ||\n (c >= 0x003a && c <= 0x003b) ||\n (c >= 0x003c && c <= 0x003e) ||\n (c >= 0x003f && c <= 0x0040) ||\n c === 0x005b ||\n c === 0x005c ||\n c === 0x005d ||\n c === 0x005e ||\n c === 0x0060 ||\n c === 0x007b ||\n c === 0x007c ||\n c === 0x007d ||\n c === 0x007e ||\n c === 0x00a1 ||\n (c >= 0x00a2 && c <= 0x00a5) ||\n c === 0x00a6 ||\n c === 0x00a7 ||\n c === 0x00a9 ||\n c === 0x00ab ||\n c === 0x00ac ||\n c === 0x00ae ||\n c === 0x00b0 ||\n c === 0x00b1 ||\n c === 0x00b6 ||\n c === 0x00bb ||\n c === 0x00bf ||\n c === 0x00d7 ||\n c === 0x00f7 ||\n (c >= 0x2010 && c <= 0x2015) ||\n (c >= 0x2016 && c <= 0x2017) ||\n c === 0x2018 ||\n c === 0x2019 ||\n c === 0x201a ||\n (c >= 0x201b && c <= 0x201c) ||\n c === 0x201d ||\n c === 0x201e ||\n c === 0x201f ||\n (c >= 0x2020 && c <= 0x2027) ||\n (c >= 0x2030 && c <= 0x2038) ||\n c === 0x2039 ||\n c === 0x203a ||\n (c >= 0x203b && c <= 0x203e) ||\n (c >= 0x2041 && c <= 0x2043) ||\n c === 0x2044 ||\n c === 0x2045 ||\n c === 0x2046 ||\n (c >= 0x2047 && c <= 0x2051) ||\n c === 0x2052 ||\n c === 0x2053 ||\n (c >= 0x2055 && c <= 0x205e) ||\n (c >= 0x2190 && c <= 0x2194) ||\n (c >= 0x2195 && c <= 0x2199) ||\n (c >= 0x219a && c <= 0x219b) ||\n (c >= 0x219c && c <= 0x219f) ||\n c === 0x21a0 ||\n (c >= 0x21a1 && c <= 0x21a2) ||\n c === 0x21a3 ||\n (c >= 0x21a4 && c <= 0x21a5) ||\n c === 0x21a6 ||\n (c >= 0x21a7 && c <= 0x21ad) ||\n c === 0x21ae ||\n (c >= 0x21af && c <= 0x21cd) ||\n (c >= 0x21ce && c <= 0x21cf) ||\n (c >= 0x21d0 && c <= 0x21d1) ||\n c === 0x21d2 ||\n c === 0x21d3 ||\n c === 0x21d4 ||\n (c >= 0x21d5 && c <= 0x21f3) ||\n (c >= 0x21f4 && c <= 0x22ff) ||\n (c >= 0x2300 && c <= 0x2307) ||\n c === 0x2308 ||\n c === 0x2309 ||\n c === 0x230a ||\n c === 0x230b ||\n (c >= 0x230c && c <= 0x231f) ||\n (c >= 0x2320 && c <= 0x2321) ||\n (c >= 0x2322 && c <= 0x2328) ||\n c === 0x2329 ||\n c === 0x232a ||\n (c >= 0x232b && c <= 0x237b) ||\n c === 0x237c ||\n (c >= 0x237d && c <= 0x239a) ||\n (c >= 0x239b && c <= 0x23b3) ||\n (c >= 0x23b4 && c <= 0x23db) ||\n (c >= 0x23dc && c <= 0x23e1) ||\n (c >= 0x23e2 && c <= 0x2426) ||\n (c >= 0x2427 && c <= 0x243f) ||\n (c >= 0x2440 && c <= 0x244a) ||\n (c >= 0x244b && c <= 0x245f) ||\n (c >= 0x2500 && c <= 0x25b6) ||\n c === 0x25b7 ||\n (c >= 0x25b8 && c <= 0x25c0) ||\n c === 0x25c1 ||\n (c >= 0x25c2 && c <= 0x25f7) ||\n (c >= 0x25f8 && c <= 0x25ff) ||\n (c >= 0x2600 && c <= 0x266e) ||\n c === 0x266f ||\n (c >= 0x2670 && c <= 0x2767) ||\n c === 0x2768 ||\n c === 0x2769 ||\n c === 0x276a ||\n c === 0x276b ||\n c === 0x276c ||\n c === 0x276d ||\n c === 0x276e ||\n c === 0x276f ||\n c === 0x2770 ||\n c === 0x2771 ||\n c === 0x2772 ||\n c === 0x2773 ||\n c === 0x2774 ||\n c === 0x2775 ||\n (c >= 0x2794 && c <= 0x27bf) ||\n (c >= 0x27c0 && c <= 0x27c4) ||\n c === 0x27c5 ||\n c === 0x27c6 ||\n (c >= 0x27c7 && c <= 0x27e5) ||\n c === 0x27e6 ||\n c === 0x27e7 ||\n c === 0x27e8 ||\n c === 0x27e9 ||\n c === 0x27ea ||\n c === 0x27eb ||\n c === 0x27ec ||\n c === 0x27ed ||\n c === 0x27ee ||\n c === 0x27ef ||\n (c >= 0x27f0 && c <= 0x27ff) ||\n (c >= 0x2800 && c <= 0x28ff) ||\n (c >= 0x2900 && c <= 0x2982) ||\n c === 0x2983 ||\n c === 0x2984 ||\n c === 0x2985 ||\n c === 0x2986 ||\n c === 0x2987 ||\n c === 0x2988 ||\n c === 0x2989 ||\n c === 0x298a ||\n c === 0x298b ||\n c === 0x298c ||\n c === 0x298d ||\n c === 0x298e ||\n c === 0x298f ||\n c === 0x2990 ||\n c === 0x2991 ||\n c === 0x2992 ||\n c === 0x2993 ||\n c === 0x2994 ||\n c === 0x2995 ||\n c === 0x2996 ||\n c === 0x2997 ||\n c === 0x2998 ||\n (c >= 0x2999 && c <= 0x29d7) ||\n c === 0x29d8 ||\n c === 0x29d9 ||\n c === 0x29da ||\n c === 0x29db ||\n (c >= 0x29dc && c <= 0x29fb) ||\n c === 0x29fc ||\n c === 0x29fd ||\n (c >= 0x29fe && c <= 0x2aff) ||\n (c >= 0x2b00 && c <= 0x2b2f) ||\n (c >= 0x2b30 && c <= 0x2b44) ||\n (c >= 0x2b45 && c <= 0x2b46) ||\n (c >= 0x2b47 && c <= 0x2b4c) ||\n (c >= 0x2b4d && c <= 0x2b73) ||\n (c >= 0x2b74 && c <= 0x2b75) ||\n (c >= 0x2b76 && c <= 0x2b95) ||\n c === 0x2b96 ||\n (c >= 0x2b97 && c <= 0x2bff) ||\n (c >= 0x2e00 && c <= 0x2e01) ||\n c === 0x2e02 ||\n c === 0x2e03 ||\n c === 0x2e04 ||\n c === 0x2e05 ||\n (c >= 0x2e06 && c <= 0x2e08) ||\n c === 0x2e09 ||\n c === 0x2e0a ||\n c === 0x2e0b ||\n c === 0x2e0c ||\n c === 0x2e0d ||\n (c >= 0x2e0e && c <= 0x2e16) ||\n c === 0x2e17 ||\n (c >= 0x2e18 && c <= 0x2e19) ||\n c === 0x2e1a ||\n c === 0x2e1b ||\n c === 0x2e1c ||\n c === 0x2e1d ||\n (c >= 0x2e1e && c <= 0x2e1f) ||\n c === 0x2e20 ||\n c === 0x2e21 ||\n c === 0x2e22 ||\n c === 0x2e23 ||\n c === 0x2e24 ||\n c === 0x2e25 ||\n c === 0x2e26 ||\n c === 0x2e27 ||\n c === 0x2e28 ||\n c === 0x2e29 ||\n (c >= 0x2e2a && c <= 0x2e2e) ||\n c === 0x2e2f ||\n (c >= 0x2e30 && c <= 0x2e39) ||\n (c >= 0x2e3a && c <= 0x2e3b) ||\n (c >= 0x2e3c && c <= 0x2e3f) ||\n c === 0x2e40 ||\n c === 0x2e41 ||\n c === 0x2e42 ||\n (c >= 0x2e43 && c <= 0x2e4f) ||\n (c >= 0x2e50 && c <= 0x2e51) ||\n c === 0x2e52 ||\n (c >= 0x2e53 && c <= 0x2e7f) ||\n (c >= 0x3001 && c <= 0x3003) ||\n c === 0x3008 ||\n c === 0x3009 ||\n c === 0x300a ||\n c === 0x300b ||\n c === 0x300c ||\n c === 0x300d ||\n c === 0x300e ||\n c === 0x300f ||\n c === 0x3010 ||\n c === 0x3011 ||\n (c >= 0x3012 && c <= 0x3013) ||\n c === 0x3014 ||\n c === 0x3015 ||\n c === 0x3016 ||\n c === 0x3017 ||\n c === 0x3018 ||\n c === 0x3019 ||\n c === 0x301a ||\n c === 0x301b ||\n c === 0x301c ||\n c === 0x301d ||\n (c >= 0x301e && c <= 0x301f) ||\n c === 0x3020 ||\n c === 0x3030 ||\n c === 0xfd3e ||\n c === 0xfd3f ||\n (c >= 0xfe45 && c <= 0xfe46));\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hoistSelectors = hoistSelectors;\nexports.isStructurallySame = isStructurallySame;\nvar tslib_1 = require(\"tslib\");\nvar types_1 = require(\"./types\");\nfunction cloneDeep(obj) {\n if (Array.isArray(obj)) {\n // @ts-expect-error meh\n return tslib_1.__spreadArray([], obj.map(cloneDeep), true);\n }\n if (obj !== null && typeof obj === 'object') {\n // @ts-expect-error meh\n return Object.keys(obj).reduce(function (cloned, k) {\n // @ts-expect-error meh\n cloned[k] = cloneDeep(obj[k]);\n return cloned;\n }, {});\n }\n return obj;\n}\nfunction hoistPluralOrSelectElement(ast, el, positionToInject) {\n // pull this out of the ast and move it to the top\n var cloned = cloneDeep(el);\n var options = cloned.options;\n cloned.options = Object.keys(options).reduce(function (all, k) {\n var newValue = hoistSelectors(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], ast.slice(0, positionToInject), true), options[k].value, true), ast.slice(positionToInject + 1), true));\n all[k] = {\n value: newValue,\n };\n return all;\n }, {});\n return cloned;\n}\nfunction isPluralOrSelectElement(el) {\n return (0, types_1.isPluralElement)(el) || (0, types_1.isSelectElement)(el);\n}\nfunction findPluralOrSelectElement(ast) {\n return !!ast.find(function (el) {\n if (isPluralOrSelectElement(el)) {\n return true;\n }\n if ((0, types_1.isTagElement)(el)) {\n return findPluralOrSelectElement(el.children);\n }\n return false;\n });\n}\n/**\n * Hoist all selectors to the beginning of the AST & flatten the\n * resulting options. E.g:\n * \"I have {count, plural, one{a dog} other{many dogs}}\"\n * becomes \"{count, plural, one{I have a dog} other{I have many dogs}}\".\n * If there are multiple selectors, the order of which one is hoisted 1st\n * is non-deterministic.\n * The goal is to provide as many full sentences as possible since fragmented\n * sentences are not translator-friendly\n * @param ast AST\n */\nfunction hoistSelectors(ast) {\n for (var i = 0; i < ast.length; i++) {\n var el = ast[i];\n if (isPluralOrSelectElement(el)) {\n return [hoistPluralOrSelectElement(ast, el, i)];\n }\n if ((0, types_1.isTagElement)(el) && findPluralOrSelectElement([el])) {\n throw new Error('Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option');\n }\n }\n return ast;\n}\n/**\n * Collect all variables in an AST to Record<string, TYPE>\n * @param ast AST to collect variables from\n * @param vars Record of variable name to variable type\n */\nfunction collectVariables(ast, vars) {\n if (vars === void 0) { vars = new Map(); }\n ast.forEach(function (el) {\n if ((0, types_1.isArgumentElement)(el) ||\n (0, types_1.isDateElement)(el) ||\n (0, types_1.isTimeElement)(el) ||\n (0, types_1.isNumberElement)(el)) {\n if (el.value in vars && vars.get(el.value) !== el.type) {\n throw new Error(\"Variable \".concat(el.value, \" has conflicting types\"));\n }\n vars.set(el.value, el.type);\n }\n if ((0, types_1.isPluralElement)(el) || (0, types_1.isSelectElement)(el)) {\n vars.set(el.value, el.type);\n Object.keys(el.options).forEach(function (k) {\n collectVariables(el.options[k].value, vars);\n });\n }\n if ((0, types_1.isTagElement)(el)) {\n vars.set(el.value, el.type);\n collectVariables(el.children, vars);\n }\n });\n}\n/**\n * Check if 2 ASTs are structurally the same. This primarily means that\n * they have the same variables with the same type\n * @param a\n * @param b\n * @returns\n */\nfunction isStructurallySame(a, b) {\n var aVars = new Map();\n var bVars = new Map();\n collectVariables(a, aVars);\n collectVariables(b, bVars);\n if (aVars.size !== bVars.size) {\n return {\n success: false,\n error: new Error(\"Different number of variables: [\".concat(Array.from(aVars.keys()).join(', '), \"] vs [\").concat(Array.from(bVars.keys()).join(', '), \"]\")),\n };\n }\n return Array.from(aVars.entries()).reduce(function (result, _a) {\n var key = _a[0], type = _a[1];\n if (!result.success) {\n return result;\n }\n var bType = bVars.get(key);\n if (bType == null) {\n return {\n success: false,\n error: new Error(\"Missing variable \".concat(key, \" in message\")),\n };\n }\n if (bType !== type) {\n return {\n success: false,\n error: new Error(\"Variable \".concat(key, \" has conflicting types: \").concat(types_1.TYPE[type], \" vs \").concat(types_1.TYPE[bType])),\n };\n }\n return result;\n }, { success: true });\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isStructurallySame = exports._Parser = void 0;\nexports.parse = parse;\nvar tslib_1 = require(\"tslib\");\nvar error_1 = require(\"./error\");\nvar parser_1 = require(\"./parser\");\nvar types_1 = require(\"./types\");\nfunction pruneLocation(els) {\n els.forEach(function (el) {\n delete el.location;\n if ((0, types_1.isSelectElement)(el) || (0, types_1.isPluralElement)(el)) {\n for (var k in el.options) {\n delete el.options[k].location;\n pruneLocation(el.options[k].value);\n }\n }\n else if ((0, types_1.isNumberElement)(el) && (0, types_1.isNumberSkeleton)(el.style)) {\n delete el.style.location;\n }\n else if (((0, types_1.isDateElement)(el) || (0, types_1.isTimeElement)(el)) &&\n (0, types_1.isDateTimeSkeleton)(el.style)) {\n delete el.style.location;\n }\n else if ((0, types_1.isTagElement)(el)) {\n pruneLocation(el.children);\n }\n });\n}\nfunction parse(message, opts) {\n if (opts === void 0) { opts = {}; }\n opts = tslib_1.__assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);\n var result = new parser_1.Parser(message, opts).parse();\n if (result.err) {\n var error = SyntaxError(error_1.ErrorKind[result.err.kind]);\n // @ts-expect-error Assign to error object\n error.location = result.err.location;\n // @ts-expect-error Assign to error object\n error.originalMessage = result.err.message;\n throw error;\n }\n if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {\n pruneLocation(result.val);\n }\n return result.val;\n}\ntslib_1.__exportStar(require(\"./types\"), exports);\n// only for testing\nexports._Parser = parser_1.Parser;\nvar manipulator_1 = require(\"./manipulator\");\nObject.defineProperty(exports, \"isStructurallySame\", { enumerable: true, get: function () { return manipulator_1.isStructurallySame; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.printAST = printAST;\nexports.doPrintAST = doPrintAST;\nexports.printDateTimeSkeleton = printDateTimeSkeleton;\nvar tslib_1 = require(\"tslib\");\nvar types_1 = require(\"./types\");\nfunction printAST(ast) {\n return doPrintAST(ast, false);\n}\nfunction doPrintAST(ast, isInPlural) {\n var printedNodes = ast.map(function (el, i) {\n if ((0, types_1.isLiteralElement)(el)) {\n return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1);\n }\n if ((0, types_1.isArgumentElement)(el)) {\n return printArgumentElement(el);\n }\n if ((0, types_1.isDateElement)(el) || (0, types_1.isTimeElement)(el) || (0, types_1.isNumberElement)(el)) {\n return printSimpleFormatElement(el);\n }\n if ((0, types_1.isPluralElement)(el)) {\n return printPluralElement(el);\n }\n if ((0, types_1.isSelectElement)(el)) {\n return printSelectElement(el);\n }\n if ((0, types_1.isPoundElement)(el)) {\n return '#';\n }\n if ((0, types_1.isTagElement)(el)) {\n return printTagElement(el);\n }\n });\n return printedNodes.join('');\n}\nfunction printTagElement(el) {\n return \"<\".concat(el.value, \">\").concat(printAST(el.children), \"</\").concat(el.value, \">\");\n}\nfunction printEscapedMessage(message) {\n return message.replace(/([{}](?:[\\s\\S]*[{}])?)/, \"'$1'\");\n}\nfunction printLiteralElement(_a, isInPlural, isFirstEl, isLastEl) {\n var value = _a.value;\n var escaped = value;\n // If this literal starts with a ' and its not the 1st node, this means the node before it is non-literal\n // and the `'` needs to be unescaped\n if (!isFirstEl && escaped[0] === \"'\") {\n escaped = \"''\".concat(escaped.slice(1));\n }\n // Same logic but for last el\n if (!isLastEl && escaped[escaped.length - 1] === \"'\") {\n escaped = \"\".concat(escaped.slice(0, escaped.length - 1), \"''\");\n }\n escaped = printEscapedMessage(escaped);\n return isInPlural ? escaped.replace('#', \"'#'\") : escaped;\n}\nfunction printArgumentElement(_a) {\n var value = _a.value;\n return \"{\".concat(value, \"}\");\n}\nfunction printSimpleFormatElement(el) {\n return \"{\".concat(el.value, \", \").concat(types_1.TYPE[el.type]).concat(el.style ? \", \".concat(printArgumentStyle(el.style)) : '', \"}\");\n}\nfunction printNumberSkeletonToken(token) {\n var stem = token.stem, options = token.options;\n return options.length === 0\n ? stem\n : \"\".concat(stem).concat(options.map(function (o) { return \"/\".concat(o); }).join(''));\n}\nfunction printArgumentStyle(style) {\n if (typeof style === 'string') {\n return printEscapedMessage(style);\n }\n else if (style.type === types_1.SKELETON_TYPE.dateTime) {\n return \"::\".concat(printDateTimeSkeleton(style));\n }\n else {\n return \"::\".concat(style.tokens.map(printNumberSkeletonToken).join(' '));\n }\n}\nfunction printDateTimeSkeleton(style) {\n return style.pattern;\n}\nfunction printSelectElement(el) {\n var msg = [\n el.value,\n 'select',\n Object.keys(el.options)\n .map(function (id) { return \"\".concat(id, \"{\").concat(doPrintAST(el.options[id].value, false), \"}\"); })\n .join(' '),\n ].join(',');\n return \"{\".concat(msg, \"}\");\n}\nfunction printPluralElement(el) {\n var type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal';\n var msg = [\n el.value,\n type,\n tslib_1.__spreadArray([\n el.offset ? \"offset:\".concat(el.offset) : ''\n ], Object.keys(el.options).map(function (id) { return \"\".concat(id, \"{\").concat(doPrintAST(el.options[id].value, true), \"}\"); }), true).filter(Boolean)\n .join(' '),\n ].join(',');\n return \"{\".concat(msg, \"}\");\n}\n","import { a as defaultBaseUrl, c as createDiagnosticMessage, d as libraryDefaultLocale, i as isSupportedFileFormatTransform, l as formatDiagnosticErrorDetails, n as encode, o as defaultCacheUrl, r as validateFileFormatTransforms, s as defaultRuntimeApiUrl, t as decode, u as defaultTimeout } from \"./base64-r7YWJYWt.mjs\";\nimport { n as stableStringify, t as isVariable } from \"./isVariable-fAKEB7gF.mjs\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport { getCachedPluralRules } from \"@generaltranslation/format/internal\";\nimport { TYPE, parse } from \"@formatjs/icu-messageformat-parser\";\nimport { TYPE as TYPE$1 } from \"@formatjs/icu-messageformat-parser/types.js\";\nimport { printAST } from \"@formatjs/icu-messageformat-parser/printer.js\";\n//#region src/settings/plurals.ts\nconst pluralForms = [\n\t\"singular\",\n\t\"plural\",\n\t\"dual\",\n\t\"zero\",\n\t\"one\",\n\t\"two\",\n\t\"few\",\n\t\"many\",\n\t\"other\"\n];\nfunction isAcceptedPluralForm(form) {\n\treturn pluralForms.includes(form);\n}\n//#endregion\n//#region src/locales/getPluralForm.ts\n/**\n* Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n*\n* @param {number} n - The number to determine the plural form for.\n* @param {PluralType[]} forms - The allowed plural forms.\n* @returns {PluralType} The determined plural form, or an empty string if none fit.\n*/\nfunction _getPluralForm(n, forms = pluralForms, locales = [\"en\"]) {\n\tconst provisionalBranchName = getCachedPluralRules(locales).select(n);\n\tconst absN = Math.abs(n);\n\tif (absN === 0 && forms.includes(\"zero\")) return \"zero\";\n\tif (absN === 1) {\n\t\tif (forms.includes(\"singular\")) return \"singular\";\n\t\tif (forms.includes(\"one\")) return \"one\";\n\t}\n\tif (provisionalBranchName === \"one\" && forms.includes(\"singular\")) return \"singular\";\n\tif (absN === 2) {\n\t\tif (forms.includes(\"dual\")) return \"dual\";\n\t\tif (forms.includes(\"two\")) return \"two\";\n\t}\n\tif (provisionalBranchName === \"two\" && forms.includes(\"dual\")) return \"dual\";\n\tif (forms.includes(provisionalBranchName)) return provisionalBranchName;\n\tif (provisionalBranchName === \"two\" && forms.includes(\"dual\")) return \"dual\";\n\tif (provisionalBranchName === \"two\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"two\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"few\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"few\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"many\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"many\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"other\" && forms.includes(\"plural\")) return \"plural\";\n\treturn \"\";\n}\n//#endregion\n//#region src/utils/minify.ts\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n\tvariable: \"v\",\n\tnumber: \"n\",\n\tdatetime: \"d\",\n\tcurrency: \"c\",\n\t\"relative-time\": \"rt\"\n};\nfunction minifyVariableType(variableType) {\n\treturn VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];\n}\n//#endregion\n//#region src/derive/utils/traverseIcu.ts\n/**\n* Given an ICU string, traverse the AST and call the visitor function for each element that matches the type T\n* @param icu - The ICU string to traverse\n* @param shouldVisit - A function that returns true if the element should be visited\n* @param visitor - A function that is called for each element that matches the type T\n* @returns The modified AST of the ICU string.\n*\n* @note This function is a heavy operation, use sparingly\n*/\nfunction traverseIcu({ icuString, shouldVisit, visitor, options: { recurseIntoVisited = true, ...otherOptions } }) {\n\tconst ast = parse(icuString, otherOptions);\n\thandleChildren(ast);\n\treturn ast;\n\tfunction handleChildren(children) {\n\t\tchildren.map(handleChild);\n\t}\n\tfunction handleChild(child) {\n\t\tlet visited = false;\n\t\tif (shouldVisit(child)) {\n\t\t\tvisitor(child);\n\t\t\tvisited = true;\n\t\t}\n\t\tif (!visited || recurseIntoVisited) {\n\t\t\tif (child.type === TYPE.select || child.type === TYPE.plural) Object.values(child.options).map((option) => option.value).map(handleChildren);\n\t\t\telse if (child.type === TYPE.tag) handleChildren(child.children);\n\t\t}\n\t}\n}\n//#endregion\n//#region src/derive/utils/constants.ts\nconst VAR_IDENTIFIER = \"_gt_\";\nconst VAR_NAME_IDENTIFIER = \"_gt_var_name\";\n//#endregion\n//#region src/derive/utils/regex.ts\nconst GT_INDEXED_IDENTIFIER_REGEX = new RegExp(`^${VAR_IDENTIFIER}\\\\d+$`);\nconst GT_UNINDEXED_IDENTIFIER_REGEX = new RegExp(`^${VAR_IDENTIFIER}$`);\n//#endregion\n//#region src/derive/utils/traverseHelpers.ts\nfunction isGTIndexedSelectElement(child) {\n\treturn child.type === TYPE$1.select && GT_INDEXED_IDENTIFIER_REGEX.test(child.value) && !!child.options.other && (child.options.other.value.length === 0 || child.options.other.value.length > 0 && child.options.other.value[0]?.type === TYPE$1.literal);\n}\nfunction isGTUnindexedSelectElement(child) {\n\treturn child.type === TYPE$1.select && GT_UNINDEXED_IDENTIFIER_REGEX.test(child.value) && !!child.options.other && (child.options.other.value.length === 0 || child.options.other.value.length > 0 && child.options.other.value[0]?.type === TYPE$1.literal);\n}\n//#endregion\n//#region src/derive/decodeVars.ts\n/**\n* Given an encoded ICU string, interpolate only _gt_ variables that have been marked with declareVar()\n* @example\n* const encodedIcu = \"Hi\" + declareVar(\"Brian\") + \", my name is {name}\"\n* // 'Hi {_gt_, select, other {Brian}}, my name is {name}'\n* decodeVars(encodedIcu)\n* // 'Hi Brian, my name is {name}'\n*/\nfunction decodeVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return icuString;\n\tconst variableLocations = [];\n\tfunction visitor(child) {\n\t\tvariableLocations.push({\n\t\t\tstart: child.location?.start.offset ?? 0,\n\t\t\tend: child.location?.end.offset ?? 0,\n\t\t\tvalue: child.options.other.value.length > 0 ? child.options.other.value[0].value : \"\"\n\t\t});\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: {\n\t\t\trecurseIntoVisited: false,\n\t\t\tcaptureLocation: true\n\t\t}\n\t});\n\tlet previousIndex = 0;\n\tconst outputList = [];\n\tfor (let i = 0; i < variableLocations.length; i++) {\n\t\toutputList.push(icuString.slice(previousIndex, variableLocations[i].start));\n\t\toutputList.push(variableLocations[i].value);\n\t\tpreviousIndex = variableLocations[i].end;\n\t}\n\tif (previousIndex < icuString.length) outputList.push(icuString.slice(previousIndex));\n\treturn outputList.join(\"\");\n}\n//#endregion\n//#region src/derive/utils/sanitizeVar.ts\n/**\n* Sanitizes string by escaping ICU syntax\n*\n* Sanitize arbitrary string so it does not break the following ICU message syntax:\n* {_gt_, select, other {string_here}}\n*\n* Escapes ICU special characters by:\n* 1. Doubling all single quotes (U+0027 ')\n* 2. Adding a single quote before the first special character ({}<>)\n* 3. Adding a single quote after the last special character ({}<>)\n*/\nfunction sanitizeVar(string) {\n\tlet result = string.replace(/'/g, \"''\");\n\tconst specialChars = /[{}<>]/;\n\tconst firstSpecialIndex = result.search(specialChars);\n\tif (firstSpecialIndex === -1) return result;\n\tlet lastSpecialIndex = -1;\n\tfor (let i = result.length - 1; i >= 0; i--) if (specialChars.test(result[i])) {\n\t\tlastSpecialIndex = i;\n\t\tbreak;\n\t}\n\tresult = result.slice(0, firstSpecialIndex) + \"'\" + result.slice(firstSpecialIndex, lastSpecialIndex + 1) + \"'\" + result.slice(lastSpecialIndex + 1);\n\treturn result;\n}\n//#endregion\n//#region src/derive/declareVar.ts\n/**\n* Mark as a non-translatable string. Use within a derive() call to mark content as not derivable (e.g., not possible to statically analyze).\n*\n* @example\n* function nonDerivableFunction() {\n* return Math.random();\n* }\n*\n* function derivableFunction() {\n* if (condition) {\n* return declareVar(nonDerivableFunction())\n* }\n* return 'John Doe';\n* }\n*\n* const gt = useGT();\n* gt(`My name is ${derive(derivableFunction())}`);\n*\n* @param {string | number | boolean | null | undefined} variable - The variable to sanitize.\n* @param {Object} [options] - The options for the sanitization.\n* @param {string} [options.$name] - The name of the variable.\n* @returns {string} The sanitized value.\n*/\nfunction declareVar(variable, options) {\n\tconst variableSection = ` other {${sanitizeVar(String(variable ?? \"\"))}}`;\n\tlet nameSection = \"\";\n\tif (options?.$name) nameSection = ` ${VAR_NAME_IDENTIFIER} {${sanitizeVar(options.$name)}}`;\n\treturn `{${VAR_IDENTIFIER}, select,${variableSection}${nameSection}}`;\n}\n//#endregion\n//#region src/derive/derive.ts\n/**\n* Marks content as derivable by the GT compiler and CLI.\n*\n* Use `derive()` when a translation string or context needs content that is\n* computed from source code, but should still be discovered during extraction\n* instead of treated as a runtime interpolation variable. The CLI attempts to\n* resolve the derivable expression into every possible static value and\n* includes those values in the source content that gets translated.\n*\n* `derive()` returns its argument unchanged at runtime.\n*\n* Run `gt validate` after adding or changing `derive()` calls to verify that\n* each derivable expression can be resolved by the CLI before translating or\n* building.\n*\n* @example\n* ```jsx\n* function getSubject() {\n* return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n* }\n* ...\n* gt(`My name is ${derive(getSubject())}`);\n* ```\n*\n* @param {T extends string | boolean | number | null | undefined} content - Content to derive for translation extraction.\n* @returns {T} The same content, unchanged at runtime.\n*/\nfunction derive(content) {\n\treturn content;\n}\n/**\n* @deprecated Use derive() instead.\n*\n* Marks content as derivable by the GT compiler and CLI.\n*\n* Use `derive()` instead of `declareStatic()` for new code. This alias is kept\n* for backwards compatibility and returns its argument unchanged at runtime.\n*\n* Run `gt validate` after adding or changing derived content to verify that\n* each derivable expression can be resolved by the CLI before translating or\n* building.\n*\n* @example\n* ```jsx\n* function getSubject() {\n* return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n* }\n* ...\n* gt(`My name is ${declareStatic(getSubject())}`);\n* ```\n*\n* @param {T extends string | boolean | number | null | undefined} content - Content to derive for translation extraction.\n* @returns {T} The same content, unchanged at runtime.\n*/\nconst declareStatic = derive;\n//#endregion\n//#region src/derive/indexVars.ts\n/**\n* Given an ICU string adds identifiers to each _gt_ placeholder\n* indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'\n*/\nfunction indexVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return icuString;\n\tconst variableLocations = [];\n\tfunction visitor(child) {\n\t\tvariableLocations.push({\n\t\t\tstart: child.location?.start.offset ?? 0,\n\t\t\tend: child.location?.end.offset ?? 0,\n\t\t\totherStart: child.options.other.location?.start.offset ?? 0,\n\t\t\totherEnd: child.options.other.location?.end.offset ?? 0\n\t\t});\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: {\n\t\t\trecurseIntoVisited: false,\n\t\t\tcaptureLocation: true\n\t\t}\n\t});\n\tconst result = [];\n\tlet current = 0;\n\tfor (let i = 0; i < variableLocations.length; i++) {\n\t\tconst { start, end, otherStart, otherEnd } = variableLocations[i];\n\t\tresult.push(icuString.slice(current, start));\n\t\tresult.push(icuString.slice(start, start + 4 + 1));\n\t\tresult.push(String(i + 1));\n\t\tresult.push(icuString.slice(start + 4 + 1, otherStart));\n\t\tresult.push(\"{}\");\n\t\tresult.push(icuString.slice(otherEnd, end));\n\t\tcurrent = end;\n\t}\n\tresult.push(icuString.slice(current, icuString.length));\n\treturn result.join(\"\");\n}\n//#endregion\n//#region src/derive/extractVars.ts\n/**\n* Given an unindexed ICU string, extracts all the _gt_ variables and an indexed mapping of the variable to the values\n*\n* extractVars('Hello {_gt_, select, other {World}}') => { _gt_1: 'World' }\n*\n* @param {string} icuString - The ICU string to extract variables from.\n* @returns {Record<string, string>} A mapping of the variable to the value.\n*/\nfunction extractVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return {};\n\tlet index = 1;\n\tconst variables = {};\n\tfunction visitor(child) {\n\t\tvariables[child.value + index] = child.options.other.value.length ? child.options.other.value[0]?.value : \"\";\n\t\tindex += 1;\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: { recurseIntoVisited: false }\n\t});\n\treturn variables;\n}\n//#endregion\n//#region src/derive/condenseVars.ts\n/**\n* Given an indexed ICU string, condenses any select to an argument\n* indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'\n* @param {string} icuString - The ICU string to condense.\n* @returns {string} The condensed ICU string.\n*/\nfunction condenseVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return icuString;\n\tfunction visitor(child) {\n\t\tchild.type = TYPE$1.argument;\n\t\tReflect.deleteProperty(child, \"options\");\n\t}\n\treturn printAST(traverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTIndexedSelectElement,\n\t\tvisitor,\n\t\toptions: { recurseIntoVisited: false }\n\t}));\n}\n//#endregion\n//#region src/backwards-compatability/typeChecking.ts\n/**\n* Checks if a JSX child is an old variable object format\n* @param child - The JSX child to check.\n* @returns True if the child is an old variable object (has 'key' property)\n*/\nfunction isOldVariableObject(child) {\n\treturn typeof child === \"object\" && child != null && \"key\" in child;\n}\n/**\n* Checks if a JSX child is a new variable object format\n* @param child - The JSX child to check.\n* @returns True if the child is a new variable object (has 'k' property)\n*/\nfunction isNewVariableObject(child) {\n\treturn typeof child === \"object\" && child != null && \"k\" in child;\n}\n/**\n* Checks if a JSX child is an old JSX element format\n* @param child - The JSX child to check.\n* @returns True if the child is an old JSX element (has 'type' and 'props' properties)\n*/\nfunction isOldJsxElement(child) {\n\treturn typeof child === \"object\" && child != null && \"type\" in child && \"props\" in child;\n}\n/**\n* Checks if a JSX child follows the old format (string, old variable object, or old JSX element)\n* @param child - The JSX child to check.\n* @returns True if the child is in the old format.\n*/\nfunction isOldJsxChild(child) {\n\tif (typeof child === \"string\") return true;\n\tif (isOldVariableObject(child)) return true;\n\treturn isOldJsxElement(child);\n}\n/**\n* Checks if JSX children follow the old format\n* @param children - The JSX children to check (can be string, array, or single child)\n* @returns True if all children are in the old format.\n*/\nfunction isOldJsxChildren(children) {\n\tif (typeof children === \"string\") return true;\n\tif (Array.isArray(children)) return !children.some((child) => !isOldJsxChild(child));\n\treturn isOldJsxChild(children);\n}\n//#endregion\n//#region src/backwards-compatability/dataConversion.ts\n/**\n* Convert request data from old format to new format\n*/\nfunction getNewJsxChild(child) {\n\tif (typeof child === \"string\") return child;\n\tif (isOldVariableObject(child)) return getNewVariableObject(child);\n\treturn getNewJsxElement(child);\n}\nfunction getNewJsxChildren(children) {\n\tif (typeof children === \"string\") return children;\n\tif (Array.isArray(children)) return children.map(getNewJsxChild);\n\treturn getNewJsxChild(children);\n}\nfunction getNewJsxElement(element) {\n\tif (typeof element === \"string\") return element;\n\tlet t = void 0;\n\tif (element.type != null) t = element.type;\n\tlet c = void 0;\n\tif (element.props?.children != null) c = getNewJsxChildren(element.props.children);\n\treturn {\n\t\t...t && { t },\n\t\t...c && { c },\n\t\td: getNewGTProp(element.props[\"data-_gt\"]),\n\t\ti: element.props[\"data-_gt\"].id\n\t};\n}\nfunction getNewBranchType(branch) {\n\tif (branch === \"branch\") return \"b\";\n\treturn \"p\";\n}\nfunction getNewVariableType(variable) {\n\tswitch (variable) {\n\t\tcase \"number\": return \"n\";\n\t\tcase \"variable\": return \"v\";\n\t\tcase \"datetime\": return \"d\";\n\t\tcase \"currency\": return \"c\";\n\t\tdefault: return \"v\";\n\t}\n}\nfunction getNewVariableObject(variable) {\n\tlet v = void 0;\n\tif (variable.variable != null) v = getNewVariableType(variable.variable);\n\tlet i = void 0;\n\tif (variable.id != null) i = variable.id;\n\treturn {\n\t\tk: variable.key,\n\t\t...v && { v },\n\t\t...i && { i }\n\t};\n}\nfunction getNewGTProp(dataGT) {\n\tlet b = void 0;\n\tif (dataGT.branches) b = Object.fromEntries(Object.entries(dataGT.branches).map(([key, value]) => [key, getNewJsxChildren(value)]));\n\tlet t;\n\tif (dataGT.transformation) t = getNewBranchType(dataGT.transformation);\n\treturn {\n\t\t...b && { b },\n\t\t...t && { t }\n\t};\n}\n/**\n* Convert response data from current format to old format\n*/\nfunction getOldJsxChild(child) {\n\tif (typeof child === \"string\") return child;\n\tif (isNewVariableObject(child)) return getOldVariableObject(child);\n\treturn getOldJsxElement(child);\n}\nfunction getOldJsxChildren(children) {\n\tif (isOldJsxChildren(children)) return children;\n\tif (typeof children === \"string\") return children;\n\tif (Array.isArray(children)) return children.map(getOldJsxChild);\n\treturn getOldJsxChild(children);\n}\nfunction getOldJsxElement(element) {\n\tconst type = element.t;\n\tlet children = void 0;\n\tif (element.c != null) children = getOldJsxChildren(element.c);\n\tconst dataGT = getOldGTProp(element.d || {}, element.i);\n\treturn {\n\t\ttype,\n\t\tprops: {\n\t\t\tchildren,\n\t\t\t\"data-_gt\": dataGT\n\t\t}\n\t};\n}\nfunction getOldBranchType(branch) {\n\tif (branch === \"b\") return \"branch\";\n\treturn \"plural\";\n}\nfunction getOldVariableType(variable) {\n\tswitch (variable) {\n\t\tcase \"n\": return \"number\";\n\t\tcase \"v\": return \"variable\";\n\t\tcase \"d\": return \"datetime\";\n\t\tcase \"c\": return \"currency\";\n\t\tdefault: return \"variable\";\n\t}\n}\nfunction getOldVariableObject(variable) {\n\tlet v = void 0;\n\tif (variable.v != null) v = getOldVariableType(variable.v);\n\tlet i = void 0;\n\tif (variable.i != null) i = variable.i;\n\treturn {\n\t\tkey: variable.k,\n\t\t...v && { variable: v },\n\t\t...i && { id: i }\n\t};\n}\nfunction getOldGTProp(dataGT, i) {\n\tlet transformation = void 0;\n\tif (dataGT.t != null) transformation = getOldBranchType(dataGT.t);\n\tlet branches = void 0;\n\tif (dataGT.b != null) branches = Object.fromEntries(Object.entries(dataGT.b).map(([key, value]) => [key, getOldJsxChildren(value)]));\n\treturn {\n\t\tid: i,\n\t\t...transformation && { transformation },\n\t\t...branches && { branches }\n\t};\n}\n//#endregion\n//#region src/backwards-compatability/oldHashJsxChildren.ts\n/**\n* Calculates a unique hash for a given string using SHA-256.\n*\n* @param {string} string - The string to be hashed.\n* @returns {string} The resulting hash as a hexadecimal string.\n*/\nfunction oldHashString(string) {\n\treturn bytesToHex(sha256(utf8ToBytes(string)));\n}\n/**\n* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n*\n* @param {any} childrenAsObjects - The children objects to be hashed.\n* @param {string} context - The context for the children.\n* @param {string} id - The ID for the JSX children object.\n* @param {function} hashFunction - Custom hash function.\n* @returns {string} - The unique hash of the children.\n*/\nfunction oldHashJsxChildren({ source, context, id, dataFormat }, hashFunction = oldHashString) {\n\treturn hashFunction(stableStringify({\n\t\tsource: sanitizeJsxChildren(source),\n\t\t...id && { id },\n\t\t...context && { context },\n\t\t...dataFormat && { dataFormat }\n\t}));\n}\nconst sanitizeChild = (child) => {\n\tif (child && typeof child === \"object\") {\n\t\tif (\"props\" in child) {\n\t\t\tconst newChild = {};\n\t\t\tconst dataGt = child?.props?.[\"data-_gt\"];\n\t\t\tif (dataGt?.branches) newChild.branches = Object.fromEntries(Object.entries(dataGt.branches).map(([key, value]) => [key, sanitizeJsxChildren(value)]));\n\t\t\tif (child?.props?.children) newChild.children = sanitizeJsxChildren(child.props.children);\n\t\t\tif (child?.props?.[\"data-_gt\"]?.transformation) newChild.transformation = child.props[\"data-_gt\"].transformation;\n\t\t\treturn newChild;\n\t\t}\n\t\tif (\"key\" in child) return {\n\t\t\tkey: child.key,\n\t\t\t...child.variable && { variable: child.variable }\n\t\t};\n\t}\n\treturn child;\n};\nfunction sanitizeJsxChildren(childrenAsObjects) {\n\treturn Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);\n}\n//#endregion\nexport { VAR_IDENTIFIER, VAR_NAME_IDENTIFIER, condenseVars, createDiagnosticMessage, declareStatic, declareVar, decode, decodeVars, defaultBaseUrl, defaultCacheUrl, defaultRuntimeApiUrl, defaultTimeout, derive, encode, extractVars, formatDiagnosticErrorDetails, getNewBranchType, getNewGTProp, getNewJsxChild, getNewJsxChildren, getNewJsxElement, getNewVariableObject, getNewVariableType, getOldBranchType, getOldGTProp, getOldJsxChild, getOldJsxChildren, getOldJsxElement, getOldVariableObject, getOldVariableType, _getPluralForm as getPluralForm, indexVars, isAcceptedPluralForm, isNewVariableObject, isOldJsxChildren, isOldVariableObject, isSupportedFileFormatTransform, isVariable, libraryDefaultLocale, minifyVariableType, oldHashJsxChildren, oldHashString, pluralForms, validateFileFormatTransforms };\n\n//# sourceMappingURL=internal.mjs.map","import { VariableTransformationSuffix } from 'generaltranslation/types';\nimport { GTTag, VariableProps } from '../types-dir/types';\nimport getVariableName from './getVariableName';\nimport { minifyVariableType } from 'generaltranslation/internal';\n\ntype VariableElementProps = {\n 'data-_gt': GTTag & {\n transformation: 'variable';\n };\n [key: string]: unknown;\n};\n\nexport function isVariableElementProps(\n props: unknown\n): props is VariableElementProps {\n return (\n typeof props === 'object' &&\n !!props &&\n 'data-_gt' in props &&\n typeof props['data-_gt'] === 'object' &&\n !!props['data-_gt'] &&\n 'transformation' in props['data-_gt'] &&\n props['data-_gt']?.transformation === 'variable'\n );\n}\n\nexport default function getVariableProps(\n props: VariableElementProps\n): VariableProps {\n const variableType: VariableTransformationSuffix =\n props['data-_gt']?.variableType || 'variable';\n\n const result: VariableProps = {\n variableName: getVariableName(props, variableType),\n variableType: minifyVariableType(variableType),\n injectionType: props['data-_gt']?.injectionType || 'manual',\n variableValue: (() => {\n if (typeof props.value !== 'undefined') return props.value;\n if (typeof props.date !== 'undefined') return props.date;\n if (typeof props['data-_gt-unformatted-value'] !== 'undefined')\n return props['data-_gt-unformatted-value'];\n if (typeof props.children !== 'undefined') return props.children;\n return undefined;\n })(),\n variableOptions: (() => {\n const variableOptions = {\n ...(typeof props.currency !== 'undefined' && {\n currency: props.currency,\n }),\n ...(typeof props.unit !== 'undefined' && {\n unit: props.unit,\n }),\n ...(typeof props.baseDate !== 'undefined' && {\n baseDate: props.baseDate,\n }),\n ...(typeof props.options !== 'undefined' && props.options),\n };\n if (Object.keys(variableOptions).length) return variableOptions;\n if (typeof props['data-_gt-variable-options'] === 'string')\n return JSON.parse(props['data-_gt-variable-options']);\n return props['data-_gt-variable-options'] || undefined;\n })(),\n };\n\n return result;\n}\n","import {\n getPluralForm,\n isAcceptedPluralForm,\n} from 'generaltranslation/internal';\n\n/**\n * Main function to get the appropriate branch based on the provided number and branches.\n *\n * @param {number} n - The number to determine the branch for.\n * @param {any} branches - The object containing possible branches.\n * @returns {any} The determined branch.\n */\nexport default function getPluralBranch(\n n: number,\n locales: string[],\n branches: Record<string, unknown>\n) {\n let branchName = '';\n let branch = null;\n if (typeof n === 'number' && !branch && branches) {\n const pluralForms = Object.keys(branches).filter(isAcceptedPluralForm);\n branchName = getPluralForm(n, pluralForms, locales);\n }\n if (branchName && !branch) branch = branches[branchName];\n return branch;\n}\n","import { TaggedElement, GTTag } from '../types-dir/types';\n\nexport default function getGTTag(child: TaggedElement): GTTag | null {\n if (child && child.props && child.props['data-_gt']) {\n return child.props['data-_gt'];\n }\n return null;\n}\n","import React, { ReactNode } from 'react';\nimport getVariableProps, {\n isVariableElementProps,\n} from '../variables/_getVariableProps';\nimport { libraryDefaultLocale } from 'generaltranslation/internal';\nimport getPluralBranch from '../branches/plurals/getPluralBranch';\nimport {\n RenderVariable,\n TaggedChild,\n TaggedChildren,\n TaggedElement,\n} from '../types-dir/types';\nimport getGTTag from './getGTTag';\n\nexport default function renderDefaultChildren({\n children,\n defaultLocale = libraryDefaultLocale,\n renderVariable,\n}: {\n children: TaggedChildren;\n defaultLocale: string;\n renderVariable: RenderVariable;\n}): React.ReactNode {\n const handleSingleChildElement = (child: TaggedElement): ReactNode => {\n const generaltranslation = getGTTag(child);\n\n // Variable\n if (isVariableElementProps(child.props)) {\n const { variableType, variableValue, variableOptions, injectionType } =\n getVariableProps(child.props);\n return renderVariable({\n variableType,\n variableValue,\n variableOptions,\n locales: [defaultLocale],\n injectionType,\n });\n }\n\n // Plural\n if (generaltranslation?.transformation === 'plural') {\n const branches = generaltranslation.branches || {};\n if (typeof child.props.n !== 'number') {\n return child.props.children != null\n ? handleChildren(child.props.children)\n : null;\n }\n const resolvedBranch = getPluralBranch(\n child.props.n,\n [defaultLocale],\n branches\n );\n return handleChildren(\n (resolvedBranch !== null\n ? resolvedBranch\n : child.props.children) as TaggedChildren\n );\n }\n\n // Branch\n if (generaltranslation?.transformation === 'branch') {\n const { children, branch } = child.props;\n const branches = generaltranslation.branches || {};\n const branchKey =\n branch == null || branch === '' ? undefined : branch.toString();\n return handleChildren(\n branchKey && branches[branchKey] !== undefined\n ? branches[branchKey]\n : children\n );\n }\n\n // Fragment\n if (generaltranslation?.transformation === 'fragment') {\n return React.createElement(React.Fragment, {\n key: child.props.key,\n children: handleChildren(child.props.children),\n });\n }\n\n // Default\n if (child.props.children) {\n return React.cloneElement(child, {\n ...child.props,\n 'data-_gt': undefined,\n children: handleChildren(child.props.children) as TaggedChildren,\n });\n }\n return React.cloneElement(child, { ...child.props, 'data-_gt': undefined });\n };\n\n const handleSingleChild = (child: TaggedChild): ReactNode => {\n if (React.isValidElement(child)) {\n return handleSingleChildElement(child);\n }\n return child;\n };\n\n const handleChildren = (children: TaggedChildren): ReactNode => {\n return Array.isArray(children)\n ? React.Children.map(children, handleSingleChild)\n : handleSingleChild(children);\n };\n\n return handleChildren(children);\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\n/**\n * @description A function that gets a value from a dictionary, only one level\n * @param dictionary - dictionary to get the value from\n * @param id - id of the value to get\n */\nexport function get(dictionary: Dictionary, id: string | number) {\n if (dictionary == null) {\n throw new Error('Cannot index into an undefined dictionary');\n }\n if (Array.isArray(dictionary)) {\n return dictionary[id as number];\n }\n return dictionary[id as string];\n}\n\n/**\n * @description A function that sets a value in a dictionary\n * @param dictionary - dictionary to set the value in\n * @param id - id of the value to set\n * @param value - value to set\n */\nexport function set(\n dictionary: Dictionary,\n id: string | number,\n value: Dictionary | DictionaryEntry\n) {\n if (Array.isArray(dictionary)) {\n dictionary[id as number] = value;\n } else {\n (dictionary as Record<string, Dictionary | DictionaryEntry>)[id as string] =\n value;\n }\n}\n","import React, { ReactElement, isValidElement, ReactNode } from 'react';\nimport { isAcceptedPluralForm } from 'generaltranslation/internal';\nimport {\n GTTag,\n TaggedChild,\n TaggedChildren,\n TaggedElement,\n TaggedElementProps,\n} from '../types-dir/types';\nimport {\n Transformation,\n TransformationPrefix,\n VariableTransformationSuffix,\n} from 'generaltranslation/types';\n\ntype GTComponentType = {\n _gtt?: Transformation;\n};\n\nexport default function addGTIdentifier(\n children: ReactNode,\n startingIndex: number = 0\n): TaggedChildren {\n // Object to keep track of the current index for GT IDs\n let index = startingIndex;\n\n /**\n * Function to create a GTTag object for a ReactElement\n * @param child - The ReactElement for which the GTTag is created\n * @returns - The GTTag object\n */\n const createGTTag = (child: ReactElement<Record<string, unknown>>): GTTag => {\n const { type, props } = child;\n index += 1;\n const result: GTTag = { id: index, injectionType: 'manual' };\n let transformation: Transformation | undefined;\n try {\n transformation =\n typeof type === 'function' ? (type as GTComponentType)._gtt : undefined;\n } catch {\n /* empty */\n }\n if (transformation) {\n const transformationParts = transformation.split('-');\n // If the component was inserted automatically by the compiler\n if (\n transformationParts[1] === 'automatic' ||\n transformationParts[2] === 'automatic'\n ) {\n result.injectionType = 'automatic';\n }\n\n if (transformationParts[0] === 'translate') {\n // Convert nested <T> to fragments\n // This will nullify translation specific attributes of child, i.e. id, context, etc.\n transformationParts[0] = 'fragment';\n }\n if (transformationParts[0] === 'variable') {\n result.variableType =\n (transformationParts?.[1] as VariableTransformationSuffix) ||\n 'variable';\n }\n if (transformationParts[0] === 'plural') {\n const pluralBranches = Object.entries(props).reduce(\n (acc, [branchName, branch]) => {\n if (isAcceptedPluralForm(branchName)) {\n (acc as Record<string, TaggedChildren>)[branchName] =\n addGTIdentifier(branch as ReactNode, index);\n }\n return acc;\n },\n {} as Record<string, TaggedChildren>\n );\n if (Object.keys(pluralBranches).length)\n result.branches = pluralBranches;\n }\n if (transformationParts[0] === 'branch') {\n const { children: _children, branch: _branch, ...branches } = props;\n // Filter out data-* attributes injected by build tools\n const filteredBranches = Object.fromEntries(\n Object.entries(branches).filter(([key]) => !key.startsWith('data-'))\n );\n const resultBranches = Object.entries(filteredBranches).reduce(\n (acc, [branchName, branch]) => {\n (acc as Record<string, TaggedChildren>)[branchName] =\n addGTIdentifier(branch as ReactNode, index);\n return acc;\n },\n {} as Record<string, TaggedChildren>\n );\n if (Object.keys(resultBranches).length)\n result.branches = resultBranches;\n }\n result.transformation = transformationParts[0] as TransformationPrefix;\n }\n return result;\n };\n\n function handleSingleChildElement(\n child: ReactElement<Record<string, unknown>>\n ): TaggedElement {\n const { props } = child;\n\n // Create new props for the element, including the GT identifier and a key\n const generaltranslation: GTTag = createGTTag(child);\n const newProps: TaggedElementProps = {\n ...props,\n 'data-_gt': generaltranslation,\n };\n if (props.children && !generaltranslation.variableType) {\n newProps.children = handleChildren(props.children as ReactNode);\n }\n if (child.type === React.Fragment) {\n newProps['data-_gt'].transformation = 'fragment';\n }\n return React.cloneElement(child, newProps) as TaggedElement;\n }\n\n function handleSingleChild(child: ReactNode): TaggedChild {\n if (isValidElement(child)) {\n return handleSingleChildElement(\n child as ReactElement<Record<string, unknown>>\n );\n }\n return child;\n }\n\n function handleChildren(children: ReactNode): TaggedChildren {\n if (Array.isArray(children)) {\n return React.Children.map(children, handleSingleChild);\n } else {\n return handleSingleChild(children);\n }\n }\n\n return handleChildren(children);\n}\n","export const PACKAGE_NAME = '@generaltranslation/react-core';\n","import {\n createDiagnosticMessage,\n formatDiagnosticErrorDetails,\n type DiagnosticMessageInput,\n} from 'generaltranslation/internal';\nimport { PACKAGE_NAME } from './constants';\n\ntype ReactCoreDiagnosticInput = Omit<DiagnosticMessageInput, 'source'>;\n\nexport function createReactCoreDiagnostic(\n input: ReactCoreDiagnosticInput\n): string {\n return createDiagnosticMessage({\n source: PACKAGE_NAME,\n ...input,\n });\n}\n\nexport { formatDiagnosticErrorDetails };\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createReactCoreDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { PACKAGE_NAME } from './constants';\n\n// ---- ERRORS ---- //\n\nexport const projectIdMissingError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const devApiKeyProductionError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Production environments cannot use a development API key',\n fix: 'Replace it with a production API key before deploying',\n});\n\nexport const apiKeyInProductionError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'The API key is available to client-side production code',\n fix: 'Move translation credentials to a server-only environment before deploying',\n});\n\nexport const createNoAuthError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation is not configured',\n fix: 'Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly',\n});\n\nexport const createPluralMissingError = (children: unknown) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<Plural> could not choose a plural form for \"${children}\"`,\n fix: 'Pass the required \"n\" option to <Plural>',\n });\n\nexport const createClientSideTDictionaryCollisionError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<T id=\"${id}\"> conflicts with a dictionary entry using the same ID`,\n fix: 'Rename the <T> id or the dictionary key so each translation source has a unique ID',\n });\n\nexport const createClientSideTHydrationError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<T id=\"${id}\"> is rendering in a client component without a saved translation`,\n why: 'This can cause hydration mismatches',\n fix: 'Use a dictionary with useGT() or push translations from the command line before rendering this component on the client',\n });\n\nexport const dynamicTranslationError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translations could not be loaded',\n wayOut: 'Source content will render as a fallback',\n fix: 'Check your runtime translation configuration and try again',\n});\n\nexport const createGenericRuntimeTranslationError = (\n id: string | undefined,\n hash: string,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: id\n ? `Translation could not be found for id \"${id}\" and hash \"${hash}\"`\n : `Translation could not be found for hash \"${hash}\"`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check that runtime translation is configured',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const runtimeTranslationError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation could not be completed',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `The message \"${message}\" is missing variables: \"${variables.join('\", \"')}\"`,\n fix: 'Provide values for these variables before rendering the translation',\n });\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName}(\"${string}\")${id ? ` with id \"${id}\"` : ''} could not find a translation`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check your dictionary/runtime translation configuration',\n });\n\nexport const invalidLocalesError = (locales: string[]) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createEmptyIdError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 't.obj() received an empty id',\n fix: 'Pass a non-empty dictionary id',\n });\n\nexport const createSubtreeNotFoundError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary subtree \"${id}\" could not be found`,\n fix: 'Check that the id matches your dictionary structure',\n });\n\nexport const createDictionaryEntryError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'A dictionary entry cannot be injected as a subtree',\n fix: 'Pass a dictionary object instead',\n });\n\nexport const createCannotInjectDictionaryEntryError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened:\n 'A dictionary entry cannot be merged into another dictionary entry',\n fix: 'Pass a dictionary subtree instead',\n });\n\nexport const createInvalidIcuDictionaryEntryError = (id: string | undefined) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n fix: 'Fix the ICU message before rendering this translation',\n });\n\n// ---- WARNINGS ---- //\n\nexport const projectIdMissingWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const createNoEntryFoundWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `No valid dictionary entry was found for id \"${id}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `Dictionary entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createNoEntryTranslationWarning = (\n id: string,\n prefixedId: string\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `t(\"${id}\") could not find a translation for dictionary item \"${prefixedId}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Translation hashes do not match',\n reassurance: 'The translation will still render',\n fix: 'Update your translations to the newest version to avoid stale content',\n details: [`expected ${expectedHash}`, `received ${receivedHash}`],\n });\n\nexport const APIKeyMissingWarn = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `${PACKAGE_NAME} Warning: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const runtimeTranslationTimeoutWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation timed out',\n});\n\nexport const createUnsupportedLocaleWarning = (\n validatedLocale: string,\n newLocale: string,\n packageName: string = PACKAGE_NAME\n) => {\n return (\n `${packageName} Warning: \"${newLocale}\" is not a supported locale. ` +\n `Update supported locales in your dashboard or gt.config.json. ` +\n `Falling back to \"${validatedLocale}\".`\n );\n};\n\nexport const dictionaryMissingWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'No dictionary was found',\n fix: 'Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations',\n});\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n wayOut: 'Source content will render as a fallback',\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\n// Unlikely edge case: A <_T> component was injected outside of a <Derive> boundary. This would be caused by the compiler overeagerly injecting <_T> components.\nexport const warnNestedInternalTComponent = `${PACKAGE_NAME} Warning: A <_T> component was found injected outside of a <Derive> boundary. This may affect translation resolution for this component.`;\n","import { PACKAGE_NAME } from './constants';\n\n/**\n * Invoked when a method that was designated for overriding is invoked by @generaltranslation/react-core.\n * This is an internal library error due to incorrect implementation of a wrapper library.\n * @param methodName\n * @returns Error object\n */\nexport function createInternalUsageError(methodName: string): Error {\n return new Error(\n `${PACKAGE_NAME}: The ${methodName} function was not overridden. This is likely the result of importing directly from \"generaltranslation/react-core\".`\n );\n}\n","import React from 'react';\nimport { TaggedElement, TaggedElementProps } from '../types-dir/types';\nimport { AuthFromEnvParams, AuthFromEnvReturn } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\nexport function isValidTaggedElement(target: unknown): target is TaggedElement {\n return React.isValidElement<TaggedElementProps>(target);\n}\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function readAuthFromEnv(_params: AuthFromEnvParams): AuthFromEnvReturn {\n throw createInternalUsageError('readAuthFromEnv');\n}\n","//#region src/types-dir/jsx/content.ts\n/**\n* Map of data-_gt properties to their corresponding React props\n*/\nconst HTML_CONTENT_PROPS = {\n\tpl: \"placeholder\",\n\tti: \"title\",\n\talt: \"alt\",\n\tarl: \"aria-label\",\n\tarb: \"aria-labelledby\",\n\tard: \"aria-describedby\"\n};\n//#endregion\nexport { HTML_CONTENT_PROPS as t };\n\n//# sourceMappingURL=types-DY1ZTHWr.mjs.map","import getVariableName from '../variables/getVariableName';\nimport { TaggedChild, TaggedChildren, TaggedElement } from '../types-dir/types';\nimport { isValidTaggedElement } from '../utils/utils';\nimport { minifyVariableType } from 'generaltranslation/internal';\nimport {\n GTProp,\n HTML_CONTENT_PROPS,\n HtmlContentPropKeysRecord,\n JsxChild,\n JsxChildren,\n JsxElement,\n Variable,\n} from '@generaltranslation/format/types';\nimport type { Transformation } from 'generaltranslation/types';\n\n/**\n * Gets the tag name of a React element.\n * @param {ReactElement} child - The React element.\n * @returns {string} - The tag name of the React element.\n */\nconst getTagName = (child: TaggedElement): string => {\n if (!child) return '';\n const { type, props } = child;\n if (type && typeof type === 'function') {\n if (\n 'displayName' in type &&\n typeof type.displayName === 'string' &&\n type.displayName\n )\n return type.displayName;\n if ('name' in type && typeof type.name === 'string' && type.name)\n return type.name;\n }\n if (type && typeof type === 'string') return type;\n if (props.href) return 'a';\n if (props['data-_gt']?.id) return `C${props['data-_gt'].id}`;\n return 'function';\n};\nconst createGTProp = (\n transformation: Transformation,\n props: Record<string, unknown>,\n branches?: Record<string, TaggedChildren>\n): GTProp | undefined => {\n // Add translatable HTML content props\n let newGTProp: GTProp = Object.entries(HTML_CONTENT_PROPS).reduce<GTProp>(\n (acc, [minifiedName, fullName]) => {\n const value = props[fullName];\n if (typeof value === 'string') {\n acc[minifiedName as keyof HtmlContentPropKeysRecord] = value;\n }\n return acc;\n },\n {}\n );\n\n // Check if plural\n if (transformation === 'plural' && branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'p' };\n }\n if (transformation === 'branch' && branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'b' };\n }\n\n return Object.keys(newGTProp).length ? newGTProp : undefined;\n};\n\n/**\n * Handles a single child element.\n * @param {TaggedElement} child - The child to handle.\n * @returns {JsxElement | Variable} The minified element.\n */\nconst handleSingleChildElement = (\n child: TaggedElement\n): JsxElement | Variable => {\n const { props } = child;\n const minifiedElement: JsxElement = {\n t: getTagName(child),\n };\n if (props['data-_gt']) {\n // Get generaltranslation props\n const generaltranslation = props['data-_gt'];\n\n // Check if variable\n const transformation = generaltranslation.transformation;\n if (transformation === 'variable') {\n const variableType = generaltranslation.variableType || 'variable';\n const variableName = getVariableName(props, variableType);\n const minifiedVariableType = minifyVariableType(variableType);\n return {\n i: generaltranslation.id,\n k: variableName,\n v: minifiedVariableType,\n };\n }\n\n // Add id\n minifiedElement.i = generaltranslation.id;\n\n // Add GT prop\n minifiedElement.d = createGTProp(\n transformation as Transformation,\n props,\n generaltranslation.branches\n );\n\n // Add translatable HTML content props\n let newGTProp: GTProp = Object.entries(HTML_CONTENT_PROPS).reduce<GTProp>(\n (acc, [minifiedName, fullName]) => {\n const value = props[fullName];\n if (typeof value === 'string') {\n acc[minifiedName as keyof HtmlContentPropKeysRecord] = value;\n }\n return acc;\n },\n {}\n );\n\n // Check if plural\n if (transformation === 'plural' && generaltranslation.branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(generaltranslation.branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'p' };\n }\n if (transformation === 'branch' && generaltranslation.branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(generaltranslation.branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'b' };\n }\n\n minifiedElement.d = Object.keys(newGTProp).length ? newGTProp : undefined;\n }\n if (props.children) {\n minifiedElement.c = writeChildrenAsObjects(props.children);\n }\n return minifiedElement;\n};\n\nconst handleSingleChild = (child: TaggedChild): JsxChild => {\n if (isValidTaggedElement(child)) {\n return handleSingleChildElement(child);\n }\n if (typeof child === 'number') return child.toString();\n return child as JsxChild;\n};\n\n/**\n * Transforms children elements into objects, processing each child recursively if needed.\n * TaggedChildren are transformed into JsxChildren\n * @param {Children} children - The children to process.\n * @returns {object} The processed children as objects.\n */\nexport default function writeChildrenAsObjects(\n children: TaggedChildren\n): JsxChildren {\n const result = Array.isArray(children)\n ? children.map(handleSingleChild)\n : handleSingleChild(children);\n return result;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get } from './indexDict';\n\nexport function isValidDictionaryEntry(\n value: unknown\n): value is DictionaryEntry {\n if (typeof value === 'string') {\n return true;\n }\n\n if (Array.isArray(value)) {\n if (typeof value?.[0] !== 'string') {\n return false;\n }\n const provisionalMetadata = value?.[1];\n if (typeof provisionalMetadata === 'undefined') return true;\n if (provisionalMetadata && typeof provisionalMetadata === 'object')\n return true;\n }\n\n return false;\n}\n\nexport function getDictionaryEntry<T extends Dictionary>(\n dictionary: T,\n id: string\n): Dictionary | DictionaryEntry | undefined {\n let current: Dictionary | DictionaryEntry = dictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n if (typeof current !== 'object' && !Array.isArray(current)) {\n return undefined;\n }\n current = get(current as Dictionary, key);\n }\n return current;\n}\n","import { DictionaryEntry, MetaEntry } from '../types-dir/types';\n\nexport default function getEntryAndMetadata(value: DictionaryEntry): {\n entry: string;\n metadata?: MetaEntry;\n} {\n if (Array.isArray(value)) {\n if (value.length === 1) {\n return { entry: value[0] };\n }\n if (value.length === 2) {\n return { entry: value[0], metadata: value[1] as MetaEntry };\n }\n }\n return { entry: value };\n}\n","import React, { ReactNode } from 'react';\nimport {\n TaggedChildren,\n TaggedElement,\n TranslatedChildren,\n RenderVariable,\n TranslatedElement,\n VariableProps,\n} from '../types-dir/types';\nimport getVariableProps, {\n isVariableElementProps,\n} from '../variables/_getVariableProps';\nimport renderDefaultChildren from './renderDefaultChildren';\nimport { isVariable, libraryDefaultLocale } from 'generaltranslation/internal';\nimport getPluralBranch from '../branches/plurals/getPluralBranch';\nimport {\n HTML_CONTENT_PROPS,\n HtmlContentPropValuesRecord,\n} from '@generaltranslation/format/types';\nimport getGTTag from './getGTTag';\n\nfunction renderTranslatedElement({\n sourceElement,\n targetElement,\n locales = [libraryDefaultLocale],\n renderVariable,\n}: {\n sourceElement: TaggedElement;\n targetElement: TranslatedElement;\n locales: string[];\n renderVariable: RenderVariable;\n}): React.ReactNode {\n // Get props and generaltranslation\n const { props: sourceProps } = sourceElement;\n const sourceGT = sourceProps['data-_gt'];\n const transformation = sourceGT?.transformation;\n\n // Get translated props\n const unprocessedTargetGT = targetElement.d;\n const translatedProps: HtmlContentPropValuesRecord = {};\n if (unprocessedTargetGT) {\n Object.entries(HTML_CONTENT_PROPS).forEach(([minifiedName, fullName]) => {\n if (\n unprocessedTargetGT[minifiedName as keyof typeof HTML_CONTENT_PROPS]\n ) {\n translatedProps[fullName] = unprocessedTargetGT[\n minifiedName as keyof typeof HTML_CONTENT_PROPS\n ] as string;\n }\n });\n }\n\n // plural (choose a branch)\n if (transformation === 'plural') {\n const n = sourceElement.props.n;\n if (typeof n !== 'number') {\n return renderDefaultChildren({\n children: sourceElement,\n defaultLocale: locales[0],\n renderVariable,\n });\n }\n const sourceBranches = sourceGT.branches || {};\n const resolvedSourceBranch = getPluralBranch(n, locales, sourceBranches);\n const sourceBranch =\n resolvedSourceBranch !== null\n ? resolvedSourceBranch\n : sourceElement.props.children;\n const targetBranches = targetElement.d?.b || {};\n const resolvedTargetBranch = getPluralBranch(n, locales, targetBranches);\n const targetBranch =\n resolvedTargetBranch !== null ? resolvedTargetBranch : targetElement.c;\n return renderTranslatedChildren({\n source: sourceBranch as TaggedChildren,\n target: targetBranch as TranslatedChildren,\n locales,\n renderVariable,\n });\n }\n\n // branch (choose a branch)\n if (transformation === 'branch') {\n const { branch, children } = sourceProps;\n const branchKey =\n branch == null || branch === '' ? undefined : branch.toString();\n const sourceBranches = sourceGT.branches || {};\n const targetBranches = targetElement.d?.b || {};\n const sourceBranch =\n branchKey && sourceBranches[branchKey] !== undefined\n ? sourceBranches[branchKey]\n : children;\n const targetBranch =\n branchKey && targetBranches[branchKey] !== undefined\n ? targetBranches[branchKey]\n : targetElement.c;\n return renderTranslatedChildren({\n source: sourceBranch as TaggedChildren,\n target: targetBranch as TranslatedChildren,\n locales,\n renderVariable,\n });\n }\n\n // fragment (create a valid fragment)\n if (transformation === 'fragment' && targetElement.c) {\n return React.createElement(React.Fragment, {\n key: sourceElement.props.key,\n children: renderTranslatedChildren({\n source: sourceProps.children as TaggedChildren,\n target: targetElement.c,\n locales,\n renderVariable,\n }) as TaggedChildren,\n });\n }\n\n // other\n if (sourceProps?.children && targetElement?.c) {\n return React.cloneElement(sourceElement, {\n ...sourceProps,\n ...translatedProps,\n 'data-_gt': undefined,\n children: renderTranslatedChildren({\n source: sourceProps.children as TaggedChildren,\n target: targetElement.c,\n locales,\n renderVariable,\n }) as TaggedChildren,\n });\n }\n\n // fallback\n return renderDefaultChildren({\n children: sourceElement,\n defaultLocale: locales[0],\n renderVariable,\n });\n}\n\nexport default function renderTranslatedChildren({\n source,\n target,\n locales = [libraryDefaultLocale],\n renderVariable,\n}: {\n source: TaggedChildren;\n target: TranslatedChildren;\n locales: string[];\n renderVariable: RenderVariable;\n}): ReactNode {\n // Most straightforward case, return a valid React node\n if ((target === null || typeof target === 'undefined') && source)\n return renderDefaultChildren({\n children: source,\n defaultLocale: locales[0],\n renderVariable,\n });\n if (typeof target === 'string') return target;\n\n // Convert source to an array in case target has multiple children where source only has one\n if (Array.isArray(target) && !Array.isArray(source) && source)\n source = [source];\n\n // Multiple children\n if (Array.isArray(source) && Array.isArray(target)) {\n // Track the variables\n const variables: Record<string, VariableProps['variableValue']> = {};\n const variablesOptions: Record<string, VariableProps['variableOptions']> =\n {};\n const variableInjectionTypes: Record<\n string,\n VariableProps['injectionType']\n > = {};\n\n // Extract source elements\n // Extract variable props\n // Filter out variable elements\n const sourceElements: TaggedElement[] = source.filter(\n (sourceChild): sourceChild is TaggedElement => {\n if (React.isValidElement(sourceChild)) {\n if (isVariableElementProps(sourceChild.props)) {\n const {\n variableName,\n variableValue,\n variableOptions,\n injectionType,\n } = getVariableProps(sourceChild.props);\n variables[variableName] = variableValue;\n variablesOptions[variableName] = variableOptions;\n variableInjectionTypes[variableName] = injectionType;\n } else {\n return true;\n }\n }\n return false;\n }\n );\n\n // TODO: pre-index these to avoid O(n/2) lookups\n const findMatchingSourceElement = (\n targetElement: TranslatedElement\n ): TaggedElement | undefined => {\n return (\n sourceElements.find((sourceChild): sourceChild is TaggedElement => {\n const generaltranslation = getGTTag(sourceChild);\n if (typeof generaltranslation?.id !== 'undefined') {\n const sourceId = generaltranslation.id;\n const targetId = targetElement.i;\n return sourceId === targetId;\n }\n return false;\n }) || sourceElements.shift()\n ); // assumes fixed order, not recommended\n };\n\n // map target to source\n return target.map((targetChild, index) => {\n if (typeof targetChild === 'string')\n return (\n <React.Fragment key={`string_${index}`}>{targetChild}</React.Fragment>\n );\n\n // Render variable\n if (isVariable(targetChild)) {\n return (\n <React.Fragment key={`var_${index}`}>\n {renderVariable({\n variableType: targetChild.v || 'v',\n variableValue: variables[targetChild.k],\n variableOptions: variablesOptions[targetChild.k],\n locales,\n injectionType: variableInjectionTypes[targetChild.k] || 'manual',\n })}\n </React.Fragment>\n );\n }\n\n // Render element (targetChild is a TranslatedElement)\n const matchingSourceElement = findMatchingSourceElement(\n targetChild as TranslatedElement\n );\n if (!matchingSourceElement) return null;\n return (\n <React.Fragment key={`element_${index}`}>\n {renderTranslatedElement({\n sourceElement: matchingSourceElement,\n targetElement: targetChild,\n locales,\n renderVariable,\n })}\n </React.Fragment>\n );\n });\n }\n\n // Single child\n if (target && typeof target === 'object' && !Array.isArray(target)) {\n const targetType: 'variable' | 'element' = isVariable(target)\n ? 'variable'\n : 'element';\n\n if (React.isValidElement(source)) {\n if (targetType === 'element') {\n return renderTranslatedElement({\n sourceElement: source,\n targetElement: target as TranslatedElement,\n locales,\n renderVariable,\n });\n }\n\n // Render variable\n if (isVariableElementProps(source.props)) {\n const { variableValue, variableOptions, variableType, injectionType } =\n getVariableProps(source.props);\n return renderVariable({\n variableType,\n variableValue,\n variableOptions,\n locales,\n injectionType,\n });\n }\n }\n }\n\n // fallback\n return renderDefaultChildren({\n children: source,\n defaultLocale: locales[0],\n renderVariable,\n });\n}\n","import { RenderMethod } from '../types-dir/types';\n\n// Apply an 8 second timeout for non dev/testing environments\nexport const getDefaultRenderSettings = (\n environment: 'development' | 'production' | 'test' = 'production'\n): {\n method: RenderMethod;\n timeout: number;\n} => ({\n method: 'default',\n timeout: environment === 'development' ? 8000 : 12000,\n});\n","import React from 'react';\n/**\n * renderSkeleton is a function that handles the rendering behavior for the skeleton loading method.\n * It replaces all content with empty strings\n * @returns an empty string\n */\nexport default function renderSkeleton(): React.ReactNode {\n return '';\n}\n","/**\n * Cookie name for tracking the referrer locale\n */\nexport const defaultLocaleCookieName = 'generaltranslation.locale';\n/**\n * Cookie name for tracking the user's selected region\n */\nexport const defaultRegionCookieName = 'generaltranslation.region';\n/**\n * Cookie name for persisting the enableI18n feature flag\n * \"true\" or \"false\"\n */\nexport const defaultEnableI18nCookieName = 'generaltranslation.enable-i18n';\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\n\n/**\n * Type guard function that checks if a value is a DictionaryEntry\n * @param value - The value to check\n * @returns true if the value is a DictionaryEntry, false otherwise\n */\nexport function isDictionaryEntry(\n value: Dictionary | DictionaryEntry | undefined\n): value is DictionaryEntry {\n if (value === undefined) {\n return false;\n }\n\n // Check if it's a string (Entry)\n if (typeof value === 'string') {\n return true;\n }\n\n // Check if it's an array\n if (Array.isArray(value)) {\n // Must have 1 or 2 elements\n if (value.length !== 1 && value.length !== 2) {\n return false;\n }\n\n // First element must be a string (Entry)\n if (typeof value[0] !== 'string') {\n return false;\n }\n\n // If there's a second element, it must be an object (MetaEntry)\n if (\n value.length === 2 &&\n (typeof value[1] !== 'object' ||\n value[1] === null ||\n (!('$context' in value[1]) &&\n !('$maxChars' in value[1]) &&\n !('$_hash' in value[1])))\n ) {\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\nconst isPrimitiveOrArray = (value: unknown): boolean =>\n typeof value === 'string' || Array.isArray(value);\n\nconst isObjectDictionary = (value: unknown): boolean =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport default function mergeDictionaries(\n defaultLocaleDictionary: Dictionary,\n localeDictionary: Dictionary\n): Dictionary {\n if (Array.isArray(defaultLocaleDictionary)) {\n return defaultLocaleDictionary.map((value, key) => {\n // Merge Dictionary Entry\n if (isDictionaryEntry(value)) {\n return (localeDictionary as (Dictionary | DictionaryEntry)[])[key];\n }\n // Merge Dictionary\n return mergeDictionaries(\n value as Dictionary,\n (localeDictionary as (Dictionary | DictionaryEntry)[])[\n key\n ] as Dictionary\n );\n });\n }\n // Merge primitive and array values\n const mergedDictionary: Dictionary = {\n ...Object.fromEntries(\n Object.entries(defaultLocaleDictionary).filter(([, value]) =>\n isPrimitiveOrArray(value)\n )\n ),\n ...Object.fromEntries(\n Object.entries(localeDictionary).filter(([, value]) =>\n isPrimitiveOrArray(value)\n )\n ),\n };\n\n // Get nested dictionaries\n const defaultDictionaryKeys = Object.entries(defaultLocaleDictionary)\n .filter(([, value]) => isObjectDictionary(value))\n .map(([key]) => key);\n\n const localeDictionaryKeys = Object.entries(localeDictionary)\n .filter(([, value]) => isObjectDictionary(value))\n .map(([key]) => key);\n\n // Merge nested dictionaries recursively\n const allKeys = new Set([...defaultDictionaryKeys, ...localeDictionaryKeys]);\n for (const key of allKeys) {\n mergedDictionary[key] = mergeDictionaries(\n (get(defaultLocaleDictionary, key) || {}) as Dictionary,\n (get(localeDictionary, key) || {}) as Dictionary\n );\n }\n\n return mergedDictionary;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get, set } from './indexDict';\n\nexport function getSubtree<T extends Dictionary>({\n dictionary,\n id,\n}: {\n dictionary: T;\n id: string;\n}): Dictionary | DictionaryEntry | undefined {\n if (id === '') {\n return dictionary;\n }\n\n let current: Dictionary | DictionaryEntry = dictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n current = get(current as Dictionary, key);\n }\n return current;\n}\n\n/**\n * @description A function that gets a subtree from a dictionary\n * @param dictionary - new dictionary to get the subtree from\n * @param id - id of the subtree to get\n * @param sourceDictionary - source dictionary to model off of\n * @returns\n */\nexport function getSubtreeWithCreation<T extends Dictionary>({\n dictionary,\n id,\n sourceDictionary,\n}: {\n dictionary: T;\n id: string;\n sourceDictionary: T;\n}): Dictionary | DictionaryEntry | undefined {\n if (id === '') {\n return dictionary;\n }\n\n let current: Dictionary | DictionaryEntry = dictionary;\n const sourceCurrent: Dictionary | DictionaryEntry = sourceDictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n if (get(current as Dictionary, key) === undefined) {\n // We know this wont be type Dictionary because we should have already checked for that\n if (Array.isArray(get(sourceCurrent as Dictionary, key))) {\n set(current as Dictionary, key, [] as Dictionary);\n } else {\n set(current as Dictionary, key, {} as Dictionary);\n }\n }\n current = get(current as Dictionary, key);\n }\n return current;\n}\n","import {\n Dictionary,\n DictionaryEntry,\n TranslatedChildren,\n} from '../types-dir/types';\nimport { get, set } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\nconst DANGEROUS_KEYS = ['constructor', 'prototype', '__proto__'];\nfunction isDangerousKey(key: string): boolean {\n if (DANGEROUS_KEYS.includes(key)) {\n return true;\n }\n return false;\n}\n\n/**\n * @description Injects an entry into a translations object\n * @param translations - The translations object to inject the entry into\n * @param entry - The entry to inject\n * @param hash - The hash of the entry\n * @param sourceDictionary - The source dictionary to model the new dictionary after\n */\nexport function injectEntry(\n dictionaryEntry: DictionaryEntry,\n dictionary: Dictionary | DictionaryEntry,\n id: string,\n sourceDictionary: Dictionary | DictionaryEntry\n) {\n // If the dictionary is a DictionaryEntry, return it\n if (isDictionaryEntry(dictionary)) {\n return dictionaryEntry;\n }\n\n // Iterate over all but last key\n const keys = id.split('.');\n keys.forEach((key) => {\n if (isDangerousKey(key)) {\n throw new Error(`Invalid key: ${key}`);\n }\n });\n dictionary ||= {};\n for (const key of keys.slice(0, -1)) {\n // Create new value if it doesn't exist\n if (get(dictionary, key) == null) {\n set(\n dictionary,\n key,\n Array.isArray(get(sourceDictionary as Dictionary, key))\n ? []\n : ({} as Dictionary)\n );\n }\n // Iterate\n dictionary = get(dictionary, key) as Dictionary;\n sourceDictionary = get(sourceDictionary as Dictionary, key) as Dictionary;\n }\n // Inject the entry into the last key\n const lastKey = keys[keys.length - 1];\n set(dictionary, lastKey, dictionaryEntry);\n}\n\n/**\n * @description Merge results into a dictionary\n * @param dictionary - The dictionary to merge the results into\n * @param results - The results to merge into the dictionary\n * @param sourceDictionary - The source dictionary to model the new dictionary after\n * @returns The merged dictionary\n */\nexport function mergeResultsIntoDictionary(\n dictionary: Dictionary,\n results: [string, TranslatedChildren][],\n sourceDictionary: Dictionary\n): Dictionary {\n results.forEach(([id, result]) => {\n injectEntry(result as string, dictionary, id, sourceDictionary);\n });\n return dictionary;\n}\n","import { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport { set } from './indexDict';\n\n/**\n * @description Iterate over tree and remove metadata leaving just the entry\n */\nexport function stripMetadataFromEntries(dictionary: Dictionary): Dictionary {\n let result: Dictionary = {};\n if (Array.isArray(dictionary)) {\n result = [];\n }\n Object.entries(dictionary).forEach(([key, value]) => {\n if (isDictionaryEntry(value)) {\n const { entry } = getEntryAndMetadata(value);\n set(result, key, entry);\n } else {\n set(result, key, stripMetadataFromEntries(value));\n }\n });\n return result;\n}\n","import { n as stableStringify, t as isVariable } from \"./isVariable-fAKEB7gF.mjs\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, utf8ToBytes } from \"@noble/hashes/utils.js\";\n//#region src/id/hashSource.ts\n/**\n* Calculates a unique hash for a given string using SHA-256.\n*\n* First 16 characters of hash, hex encoded.\n*\n* @param {string} string - The string to be hashed.\n* @returns {string} The resulting hash as a hexadecimal string.\n*/\nfunction hashString(string) {\n\treturn bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n/**\n* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n*\n* @param {any} childrenAsObjects - The children objects to be hashed.\n* @param {string} [context] - The context for the children.\n* @param {string} [id] - The ID for the JSX children object.\n* @param {number} [maxChars] - The maxChars limit for the JSX children object.\n* @param {string} [dataFormat] - The data format of the sources.\n* @param {function} [hashFunction] - Custom hash function.\n* @returns {string} - The unique hash of the children.\n*/\nfunction hashSource({ source, context, id, maxChars, dataFormat }, hashFunction = hashString) {\n\tlet sanitizedSource;\n\tif (dataFormat === \"JSX\") sanitizedSource = sanitizeJsxChildren(source);\n\telse sanitizedSource = source;\n\treturn hashFunction(stableStringify({\n\t\tsource: sanitizedSource,\n\t\t...id && { id },\n\t\t...context && { context },\n\t\t...maxChars != null && { maxChars: Math.abs(maxChars) },\n\t\t...dataFormat && { dataFormat }\n\t}));\n}\n/**\n* Sanitizes a child object by removing the data-_gt attribute and its branches.\n*\n* @param child - The child object to sanitize.\n* @returns The sanitized child object.\n*\n*/\nconst sanitizeChild = (child) => {\n\tif (child && typeof child === \"object\") {\n\t\tconst newChild = {};\n\t\tif (\"c\" in child && child.c) newChild.c = sanitizeJsxChildren(child.c);\n\t\tif (\"d\" in child) {\n\t\t\tconst generaltranslation = child?.d;\n\t\t\tif (generaltranslation?.b) newChild.b = Object.fromEntries(Object.entries(generaltranslation.b).map(([key, value]) => [key, sanitizeJsxChildren(value)]));\n\t\t\tif (generaltranslation?.t) newChild.t = generaltranslation.t;\n\t\t}\n\t\tif (isVariable(child)) return {\n\t\t\tk: child.k,\n\t\t\t...child.v && { v: child.v }\n\t\t};\n\t\treturn newChild;\n\t}\n\treturn child;\n};\nfunction sanitizeJsxChildren(childrenAsObjects) {\n\treturn Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);\n}\n//#endregion\n//#region src/id/hashTemplate.ts\nfunction hashTemplate(template, hashFunction = hashString) {\n\treturn hashFunction(stableStringify(template));\n}\n//#endregion\nexport { hashSource as n, hashString as r, hashTemplate as t };\n\n//# sourceMappingURL=id-DEaFhGqX.mjs.map","import { hashSource } from 'generaltranslation/id';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { set } from './indexDict';\nimport { indexVars } from 'generaltranslation/internal';\n\n/**\n * @description Given a dictionary, adds hashes to all dictionary entries\n * @param dictionary - The dictionary to add hashes to\n * @param id - The starting point of dictionary (if subtree)\n */\nexport function injectHashes(\n dictionary: Dictionary,\n id: string = ''\n): { dictionary: Dictionary; updateDictionary: boolean } {\n let updateDictionary = false;\n Object.entries(dictionary).forEach(([key, value]) => {\n const wholeId = id ? `${id}.${key}` : key;\n if (isDictionaryEntry(value)) {\n // eslint-disable-next-line prefer-const\n let { entry, metadata } = getEntryAndMetadata(value);\n if (!metadata?.$_hash) {\n metadata ||= {};\n metadata.$_hash = hashSource({\n source: indexVars(entry),\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: Math.abs(metadata.$maxChars),\n }),\n id: wholeId,\n dataFormat: 'ICU',\n });\n set(dictionary, key, [entry, metadata]);\n updateDictionary = true;\n }\n } else {\n const { updateDictionary: updateFlag } = injectHashes(value, wholeId);\n updateDictionary = updateDictionary || updateFlag;\n }\n });\n return { dictionary, updateDictionary };\n}\n","import { Dictionary, Translations } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { injectEntry } from './injectEntry';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Injects translations into a dictionary\n * @param dictionary - The dictionary to inject translations into\n * @param translationsDictionary - The translations to inject into the dictionary\n * @param translations - The translations to inject into the dictionary\n * @param id - The id of the dictionary to inject translations into\n */\nexport function injectTranslations(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n translations: Translations,\n missingTranslations: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[],\n prefixToRemove: string = ''\n): { dictionary: Dictionary; updateDictionary: boolean } {\n let updateDictionary = false;\n const prefixToRemoveArray = prefixToRemove ? prefixToRemove.split('.') : [];\n missingTranslations.forEach(({ metadata }) => {\n const { $_hash, $id } = metadata;\n\n const id =\n prefixToRemoveArray.length > 0\n ? $id.split('.').slice(prefixToRemoveArray.length).join('.')\n : $id;\n\n // Look up in translations object\n const translationEntry = getDictionaryEntry(translationsDictionary, id);\n // Look up in translations dictionary\n let dictTransEntry = undefined;\n if (isDictionaryEntry(translationEntry))\n dictTransEntry = getEntryAndMetadata(translationEntry).entry;\n // Fall back to what was already in the translations dictionary\n const value = translations[$_hash] || dictTransEntry;\n if (!value) {\n return;\n }\n\n injectEntry(value as string, translationsDictionary, id, dictionary);\n updateDictionary = true;\n });\n return {\n dictionary: translationsDictionary as Dictionary,\n updateDictionary,\n };\n}\n","import { Dictionary } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { injectEntry } from './injectEntry';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Injects fallbacks into a dictionary\n * @param dictionary - The dictionary to inject translations into\n * @param translationsDictionary - The translations to inject into the dictionary\n * @param translations - The translations to inject into the dictionary\n * @param id - The id of the dictionary to inject translations into\n */\nexport function injectFallbacks(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n missingTranslations: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[],\n prefixToRemove: string = ''\n) {\n const prefixToRemoveArray = prefixToRemove ? prefixToRemove.split('.') : [];\n missingTranslations.forEach(({ source, metadata }) => {\n const { $id } = metadata;\n\n const id =\n prefixToRemoveArray.length > 0\n ? $id.split('.').slice(prefixToRemoveArray.length).join('.')\n : $id;\n\n // Look up in translations object\n const translationEntry = getDictionaryEntry(translationsDictionary, id);\n // Look up in translations dictionary\n let dictTransEntry = undefined;\n if (isDictionaryEntry(translationEntry))\n dictTransEntry = getEntryAndMetadata(translationEntry).entry;\n // Fall back to source\n const value = dictTransEntry || source;\n\n injectEntry(value as string, translationsDictionary, id, dictionary);\n });\n return translationsDictionary;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport { getSubtree } from './getSubtree';\nimport { get, set } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport mergeDictionaries from './mergeDictionaries';\nimport {\n createDictionaryEntryError,\n createCannotInjectDictionaryEntryError,\n createSubtreeNotFoundError,\n} from '../errors-dir/createErrors';\n\n/**\n * @description Given a subtree and a dictionary, injects the subtree into the dictionary at the given id\n * @param dictionary - The dictionary to inject the subtree into\n * @param subtree - The subtree to inject into the dictionary\n * @param id - The id of the subtree to inject into the dictionary\n */\nexport function injectAndMerge(\n dictionary: Dictionary,\n subtree: Dictionary,\n id: string\n) {\n const dictionarySubtree = getSubtree({ dictionary, id });\n if (!dictionarySubtree) {\n throw new Error(createSubtreeNotFoundError(id));\n }\n if (isDictionaryEntry(dictionarySubtree)) {\n throw new Error(createDictionaryEntryError());\n }\n const mergedSubtree = mergeDictionaries(\n dictionarySubtree as Dictionary,\n subtree\n );\n // Inject the merged subtree into the dictionary\n return injectSubtree(dictionary, mergedSubtree, id);\n}\n\nfunction injectSubtree(\n dictionary: Dictionary,\n subtree: Dictionary,\n id: string\n) {\n const dictionarySubtree = getDictionaryEntry(dictionary, id);\n if (!dictionarySubtree) {\n throw new Error(createSubtreeNotFoundError(id));\n }\n if (isDictionaryEntry(dictionarySubtree)) {\n throw new Error(createCannotInjectDictionaryEntryError());\n }\n const ids = id.split('.');\n const shortenedId = ids.slice(0, -1);\n const lastId = ids[ids.length - 1];\n let current: Dictionary | DictionaryEntry = dictionary;\n shortenedId.forEach((id) => {\n current = get(current as Dictionary, id);\n });\n set(current as Dictionary, lastId, subtree);\n return dictionary;\n}\n","import { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { get } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Collects all untranslated entries from a dictionary\n * @param dictionary - The dictionary to collect untranslated entries from\n * @param translationsDictionary - The translated dictionary to compare against\n * @param id - The id of the dictionary to collect untranslated entries from\n * @returns An array of untranslated entries\n */\nexport function collectUntranslatedEntries(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n id: string = ''\n): {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n}[] {\n const untranslatedEntries: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[] = [];\n Object.entries(dictionary).forEach(([key, value]) => {\n const wholeId = id ? `${id}.${key}` : key;\n if (isDictionaryEntry(value)) {\n const { entry, metadata } = getEntryAndMetadata(value);\n\n if (!get(translationsDictionary, key)) {\n untranslatedEntries.push({\n source: entry,\n metadata: {\n $id: wholeId,\n $context: metadata?.$context,\n $maxChars: metadata?.$maxChars,\n $_hash: metadata?.$_hash || '',\n },\n });\n }\n } else {\n untranslatedEntries.push(\n ...collectUntranslatedEntries(\n value,\n (get(translationsDictionary, key) ||\n (Array.isArray(value) ? [] : {})) as Dictionary,\n wholeId\n )\n );\n }\n });\n return untranslatedEntries;\n}\n","import { VAR_IDENTIFIER, condenseVars, decode, extractVars } from \"generaltranslation/internal\";\nimport { formatCutoff, formatMessage } from \"@generaltranslation/format\";\n//#region src/logs/logger.ts\nvar logger_default = {\n\twarn(message) {\n\t\tconsole.warn(message);\n\t},\n\terror(message) {\n\t\tconsole.error(message);\n\t},\n\tinfo(message) {\n\t\tconsole.info(message);\n\t},\n\tdebug(message) {\n\t\tconsole.debug(message);\n\t}\n};\n//#endregion\n//#region src/utils/extractVariables.ts\n/**\n* Given an object of options, returns an object with no gt-related options\n*\n* TODO: next major version, this should extract any sugar syntax options\n* TODO: next major version, options should be Record<string, string>\n*/\nfunction extractVariables(options) {\n\treturn Object.fromEntries(Object.entries(options).filter(([key]) => key !== \"$id\" && key !== \"$context\" && key !== \"$maxChars\" && key !== \"$hash\" && key !== \"$_hash\" && key !== \"$_source\" && key !== \"$_fallback\" && key !== \"$format\" && key !== \"$_locales\" && key !== \"$locale\"));\n}\n//#endregion\n//#region src/translation-functions/utils/messages.ts\nconst createInterpolationFailureMessage = (message) => `String interpolation failed for message: \"${message}\".`;\n//#endregion\n//#region src/translation-functions/utils/formatMessage.ts\n/**\n* Given an encoded message and variables, formats the message.\n* On error, the original encoded message is returned with a warning.\n* @param encodedMsg\n* @param variables\n* @returns\n*/\nfunction formatMessage$1(encodedMsg, variables, locales, dataFormat) {\n\ttry {\n\t\treturn formatMessage(encodedMsg, {\n\t\t\tvariables,\n\t\t\tlocales,\n\t\t\tdataFormat\n\t\t});\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(encodedMsg));\n\t\treturn encodedMsg;\n\t}\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateIcuMessage.ts\n/**\n* Applies string interpolation and cutoff formatting. Fallsback to the original message if interpolation fails.\n* @param {string} message - The message to interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns {string} - The interpolated message.\n*/\nfunction interpolateIcuMessage(encodedMsg, options) {\n\tif (!encodedMsg) return encodedMsg;\n\tconst source = options.$_fallback;\n\tconst variables = extractVariables(options);\n\ttry {\n\t\tconst declaredVars = extractVars(source || \"\");\n\t\treturn formatCutoff(formatMessage$1(Object.keys(declaredVars).length ? condenseVars(encodedMsg) : encodedMsg, {\n\t\t\t...variables,\n\t\t\t...declaredVars,\n\t\t\t[VAR_IDENTIFIER]: \"other\"\n\t\t}, options.$locale ?? options.$_locales, options.$format), { maxChars: options.$maxChars });\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(encodedMsg));\n\t\tif (options.$_fallback != null) return interpolateIcuMessage(options.$_fallback, {\n\t\t\t...options,\n\t\t\t$_fallback: void 0\n\t\t});\n\t\treturn formatCutoff(encodedMsg, { maxChars: options.$maxChars });\n\t}\n}\n//#endregion\n//#region src/translation-functions/msg/decodeOptions.ts\n/**\n* Decodes the options from an encoded message.\n* @param encodedMsg The message to decode.\n* @returns The decoded options.\n*/\nfunction decodeOptions(encodedMsg) {\n\tif (encodedMsg.lastIndexOf(\":\") === -1) return null;\n\tconst optionsEncoding = encodedMsg.slice(encodedMsg.lastIndexOf(\":\") + 1);\n\ttry {\n\t\treturn JSON.parse(decode(optionsEncoding));\n\t} catch {\n\t\treturn null;\n\t}\n}\n//#endregion\n//#region src/translation-functions/utils/isEncodedTranslationOptions.ts\n/**\n* Given a decoded options object, validate that includes required decoded options\n* These required options are added by msg() during the encoding process.\n*/\nfunction isEncodedTranslationOptions(decodedOptions) {\n\treturn !!(decodedOptions.$_hash && decodedOptions.$_source);\n}\n//#endregion\nexport { extractVariables as a, createInterpolationFailureMessage as i, decodeOptions as n, logger_default as o, interpolateIcuMessage as r, isEncodedTranslationOptions as t };\n\n//# sourceMappingURL=isEncodedTranslationOptions-BOwWa_-J.mjs.map","import { o as logger_default, r as interpolateIcuMessage } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\nimport { createDiagnosticMessage, defaultCacheUrl, defaultRuntimeApiUrl, indexVars, libraryDefaultLocale } from \"generaltranslation/internal\";\nimport { LocaleConfig, formatCutoff, isValidLocale, resolveCanonicalLocale, standardizeLocale } from \"@generaltranslation/format\";\nimport { GT } from \"generaltranslation\";\nimport { hashSource } from \"generaltranslation/id\";\n//#region src/i18n-manager/validation/publishValidationResults.ts\n/**\n* Throw errors if there are any errors and log warnings if there are any warnings\n* @param {ValidationResult[]} results - The results to print\n* @param {string} [prefix] - The prefix to add to the results\n* @param {boolean} [throwOnError] - Whether to throw an error if there are any errors\n*\n* TODO: dedupe messages\n* TODO: logging system\n*/\nfunction publishValidationResults(results, prefix = \"\", throwOnError = true) {\n\tresults.forEach((result) => {\n\t\tswitch (result.type) {\n\t\t\tcase \"error\":\n\t\t\t\tlogger_default.error(prefix + result.message);\n\t\t\t\tbreak;\n\t\t\tcase \"warning\":\n\t\t\t\tlogger_default.warn(prefix + result.message);\n\t\t\t\tbreak;\n\t\t}\n\t});\n\tif (throwOnError && results.some((result) => result.type === \"error\")) throw new Error(\"Validation errors occurred\");\n}\n//#endregion\n//#region src/i18n-manager/utils/getLoadTranslationsType.ts\n/**\n* Based on the configurtion return the load translations type\n*\n* cacheUrl = null means disabled\n*/\nfunction getLoadTranslationsType(config) {\n\tif (config.loadTranslations) return \"custom\";\n\telse if (config.cacheUrl) return \"remote\";\n\telse if ((config.cacheUrl === void 0 || config.cacheUrl === defaultCacheUrl) && config.projectId) return \"gt-remote\";\n\telse return \"disabled\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateLoadTranslations.ts\n/**\n* Load translation configuration\n*\n* Types of load translations:\n* - GT_REMOTE: use the default remote store URL {@link defaultCacheUrl}\n* - REMOTE: use a custom remote store URL\n* - CUSTOM: use a custom translations loader\n* - DISABLED: no translations loading\n*\n* Requirements:\n* - REMOTE:\n* - GT_REMOTE:\n* - projectId is needed\n* - CUSTOM:\n* - loadTranslations is needed\n* - DISABLED:\n* - no requirements\n*/\nfunction validateLoadTranslations(params) {\n\tconst results = [];\n\tconst { projectId, loadTranslations } = params;\n\tswitch (getLoadTranslationsType(params)) {\n\t\tcase \"remote\":\n\t\tcase \"gt-remote\":\n\t\t\tif (!projectId) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Loading translations from a remote store needs a projectId\",\n\t\t\t\t\tfix: \"Add projectId to the I18nManager config or disable remote translation loading\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tif (!loadTranslations) results.push({\n\t\t\t\ttype: \"error\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Custom translation loading needs loadTranslations\",\n\t\t\t\t\tfix: \"Provide a loadTranslations function or disable custom translation loading\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"disabled\": break;\n\t}\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/utils/getTranslationApiType.ts\n/**\n* Based on the configurtion return the runtime translation type\n* @param params - The parameters to validate\n* @returns The runtime translation type\n*/\nfunction getTranslationApiType(params) {\n\tconst usesDefaultRuntimeUrl = params.runtimeUrl === void 0 || params.runtimeUrl === defaultRuntimeApiUrl;\n\tif (usesDefaultRuntimeUrl && params.projectId && (params.devApiKey || params.apiKey)) return \"gt\";\n\telse if (params.runtimeUrl && !usesDefaultRuntimeUrl) return \"custom\";\n\telse return \"disabled\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateTranslationApi.ts\n/**\n* Validate the translation API configuration\n* @param params - The parameters to validate\n* @returns The validation results\n*\n* Types of translation API:\n* - GT: use the default runtime API URL {@link defaultRuntimeApiUrl}\n* - CUSTOM: use a custom runtime API URL\n* - DISABLED: no runtime API translation\n*\n* Requirements:\n* - CUSTOM:\n* - GT:\n* - projectId is needed\n* - devApiKey or apiKey is needed\n* - DISABLED:\n* - no requirements\n*\n* TODO: reject dev api key in production\n*/\nfunction validateTranslationApi(params) {\n\tconst results = [];\n\tswitch (getTranslationApiType(params)) {\n\t\tcase \"custom\":\n\t\tcase \"gt\":\n\t\t\tif (!params.projectId) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Runtime translation needs a projectId\",\n\t\t\t\t\tfix: \"Add projectId to the I18nManager config or disable runtime translation\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tif (!params.devApiKey && !params.apiKey) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Runtime translation needs devApiKey or apiKey\",\n\t\t\t\t\tfix: \"Add credentials to the I18nManager config or disable runtime translation\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"disabled\": break;\n\t}\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/utils/getGTServicesEnabled.ts\n/**\n* Returns true if GT services are enabled\n* @param config - The configuration\n* @returns True if GT services are enabled\n*/\nfunction getGTServicesEnabled(config) {\n\treturn getLoadTranslationsType(config) === \"gt-remote\" || getTranslationApiType(config) === \"gt\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateLocales.ts\n/**\n* Validate the locales configuration\n* @param params - The parameters to validate\n* @returns The validation results\n*\n* Only apply if using GT services\n*/\nfunction validateLocales(params) {\n\tconst results = [];\n\tif (!getGTServicesEnabled(params)) return results;\n\tconst { defaultLocale, locales, customMapping } = params;\n\tnew Set([...defaultLocale ? [defaultLocale] : [], ...locales || []]).forEach((locale) => {\n\t\tif (!isValidLocale(locale, customMapping)) results.push({\n\t\t\ttype: \"error\",\n\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\twhatHappened: `Locale \"${locale}\" is not valid`,\n\t\t\t\tfix: \"Use a valid BCP 47 locale code or add a custom mapping\"\n\t\t\t})\n\t\t});\n\t});\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateDictionary.ts\n/**\n* Dictionary configuration\n*\n* Requirements:\n* - loadDictionary requires dictionary so the default locale always has a source dictionary\n*/\nfunction validateDictionary(params) {\n\tconst results = [];\n\tif (params.loadDictionary && !params.dictionary) results.push({\n\t\ttype: \"error\",\n\t\tmessage: createDiagnosticMessage({\n\t\t\twhatHappened: \"loadDictionary needs a source dictionary\",\n\t\t\tfix: \"Provide dictionary so the default locale has source content\"\n\t\t})\n\t});\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/validation/validateConfig.ts\n/**\n* Validate the configuration\n* @param config - The configuration to validate\n* @returns The validation results\n*/\nfunction validateConfig(config) {\n\tconst results = [];\n\tresults.push(...validateLoadTranslations(config));\n\tresults.push(...validateTranslationApi(config));\n\tresults.push(...validateLocales(config));\n\tresults.push(...validateDictionary(config));\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/createTranslateMany.ts\n/**\n* Create a translate many function\n* @param locale - The locale\n* @returns The translate many function\n*/\nfunction createTranslateManyFactory(gtInstance, timeout, metadata = {}) {\n\treturn (locale) => (sources) => gtInstance.translateMany(sources, {\n\t\t...metadata,\n\t\ttargetLocale: locale\n\t}, timeout);\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/createRemoteTranslationLoader.ts\n/**\n* Creates a translations loader function that loads translations from a remote store (CDN or other)\n* @param params - The parameters for the createRemoteTranslationLoader function\n* @returns A translations loader function\n*\n* TODO: validate projectId, cacheUrl, _versionId, _branchId\n*/\nfunction createRemoteTranslationLoader(params) {\n\tconst unlocalizedUrl = generateUrl(params);\n\tconst loader = async (locale) => {\n\t\tlocale = resolveCanonicalLocale(locale, params.customMapping);\n\t\tconst url = unlocalizedUrl.replace(\"[locale]\", locale);\n\t\tconst response = await fetch(url);\n\t\tif (!response.ok) throw new Error(`Failed to load translations from ${url}`);\n\t\treturn await response.json();\n\t};\n\treturn loader;\n}\n/**\n* Generate a URL for a translations file\n*/\nfunction generateUrl(params) {\n\tconst { cacheUrl = defaultCacheUrl, projectId, _versionId, _branchId } = params;\n\tconst versionIdSegment = _versionId ? `/${_versionId}` : \"\";\n\tconst branchIdQuery = _branchId ? `?branchId=${_branchId}` : \"\";\n\treturn `${cacheUrl}/${projectId}/[locale]` + versionIdSegment + branchIdQuery;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/createFallbackTranslationLoader.ts\n/**\n* Creates a fallback translations loader function that loads translations from a fallback source\n* @returns A translations loader function\n*/\nfunction createFallbackTranslationLoader() {\n\tconst loader = async (_locale) => {\n\t\treturn {};\n\t};\n\treturn loader;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/routeCreateTranslationLoader.ts\n/**\n* Creates a translation loader function that loads translations from a remote store (CDN or other)\n* @param params - The parameters for the createTranslationLoader function\n* @param params.type - The type of translation loader to create\n* @param params.remoteTranslationLoaderParams - The parameters for the remote translation loader\n* @param params.loadTranslations - The custom translations loader function\n* @returns A translation loader function\n*/\nfunction routeCreateTranslationLoader({ type, remoteTranslationLoaderParams, loadTranslations }) {\n\tif (type === \"disabled\") logger_default.warn(\"I18nManager: No translation loader found. No translations will be loaded.\");\n\tconst { cacheUrl, projectId, _versionId, _branchId, customMapping } = remoteTranslationLoaderParams;\n\tswitch (type) {\n\t\tcase \"remote\":\n\t\tcase \"gt-remote\": return createRemoteTranslationLoader({\n\t\t\tcacheUrl,\n\t\t\tprojectId: projectId || \"\",\n\t\t\t_versionId,\n\t\t\t_branchId,\n\t\t\tcustomMapping\n\t\t});\n\t\tcase \"custom\": return loadTranslations;\n\t\tcase \"disabled\": return createFallbackTranslationLoader();\n\t}\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/dictionary-helpers.ts\nfunction getDictionaryPath(id) {\n\tconst path = id ? id.split(\".\") : [];\n\tfor (const segment of path) assertSafeDictionaryPathSegment(segment, id);\n\treturn path;\n}\nfunction assertSafeDictionaryPathSegment(segment, path) {\n\tif (segment === \"__proto__\" || segment === \"constructor\" || segment === \"prototype\") throw new Error(`Dictionary path \"${path}\" contains an unsafe segment`);\n}\nfunction isDictionaryObject(value) {\n\treturn typeof value === \"object\" && value != null && !Array.isArray(value);\n}\nfunction cloneDictionaryValue(value) {\n\tif (value === void 0 || typeof value === \"string\") return value;\n\treturn structuredClone(value);\n}\nfunction getDictionaryValueAtPath(dictionary, path) {\n\tlet current = dictionary;\n\tfor (const segment of getDictionaryPath(path)) {\n\t\tif (!isDictionaryObject(current)) return;\n\t\tcurrent = current[segment];\n\t}\n\treturn current;\n}\nfunction setDictionaryValueAtPath(dictionary, path, value) {\n\tconst segments = getDictionaryPath(path);\n\tif (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);\n\tif (segments.length === 0) {\n\t\tif (isDictionaryObject(value)) replaceDictionary(dictionary, value);\n\t\treturn;\n\t}\n\tlet current = dictionary;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst next = current[segment];\n\t\tif (!isDictionaryObject(next)) current[segment] = {};\n\t\tcurrent = current[segment];\n\t}\n\tconst leafSegment = segments[segments.length - 1];\n\tcurrent[leafSegment] = value;\n}\nfunction getDictionaryEntry(value) {\n\tif (!isDictionaryLeafNode(value)) return;\n\treturn {\n\t\tentry: Array.isArray(value) ? value[0] : value,\n\t\toptions: Array.isArray(value) ? value[1] ?? {} : {}\n\t};\n}\nfunction getDictionaryValue(value) {\n\tif (Object.keys(value.options).length === 0) return value.entry;\n\treturn [value.entry, value.options];\n}\nfunction resolveDictionaryLookupOptions(options) {\n\tconst { $format, context, ...rest } = options;\n\treturn {\n\t\t...rest,\n\t\t$format: isStringFormat($format) ? $format : \"ICU\",\n\t\t...rest.$context === void 0 && typeof context === \"string\" && { $context: context }\n\t};\n}\nfunction isDictionaryLeafNode(value) {\n\tif (typeof value === \"string\") return true;\n\tif (!Array.isArray(value) || typeof value[0] !== \"string\") return false;\n\tif (value.length === 1) return true;\n\treturn value.length === 2 && isDictionaryOptions(value[1]);\n}\nfunction isDictionaryOptions(value) {\n\tif (typeof value !== \"object\" || value == null || Array.isArray(value)) return false;\n\tconst options = value;\n\treturn (options.$context === void 0 || typeof options.$context === \"string\") && (options.$format === void 0 || isStringFormat(options.$format)) && (options.$maxChars === void 0 || typeof options.$maxChars === \"number\") && (options.context === void 0 || typeof options.context === \"string\");\n}\nfunction isStringFormat(value) {\n\treturn value === \"ICU\" || value === \"I18NEXT\" || value === \"STRING\";\n}\nfunction replaceDictionary(target, source) {\n\tfor (const key of Object.keys(target)) delete target[key];\n\tfor (const key of Object.keys(source)) target[key] = source[key];\n}\nfunction assertSafeDictionaryObject(dictionary, parentPath = \"\") {\n\tfor (const [key, value] of Object.entries(dictionary)) {\n\t\tconst path = parentPath ? `${parentPath}.${key}` : key;\n\t\tassertSafeDictionaryPathSegment(key, path);\n\t\tif (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);\n\t}\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/DictionarySourceNotFoundError.ts\nvar DictionarySourceNotFoundError = class extends Error {\n\tconstructor(id) {\n\t\tsuper(`I18nManager: source dictionary entry ${id} is not defined`);\n\t\tthis.name = \"DictionarySourceNotFoundError\";\n\t}\n};\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/materialize-dictionary.ts\n/**\n* Builds the dictionary value for a requested path by combining existing target\n* translations with runtime translations of any source leaves that are missing.\n*/\nasync function materializeDictionaryValue({ key, sourceValue, targetValue, translateEntry }) {\n\tif (getDictionaryEntry(targetValue) !== void 0) return cloneDictionaryValue(targetValue);\n\tif (isDictionaryObject(targetValue) && !isDictionaryObject(sourceValue)) return cloneDictionaryValue(targetValue);\n\tconst sourceEntry = getDictionaryEntry(sourceValue);\n\tif (sourceEntry !== void 0) return await translateEntry(key, sourceEntry);\n\tif (!isDictionaryObject(sourceValue)) throw new DictionarySourceNotFoundError(key);\n\tconst targetDictionary = isDictionaryObject(targetValue) ? targetValue : {};\n\tconst keys = new Set([...Object.keys(sourceValue), ...Object.keys(targetDictionary)]);\n\tconst entries = await Promise.all(Array.from(keys).map(async (childKey) => {\n\t\tconst childPath = key ? `${key}.${childKey}` : childKey;\n\t\tassertSafeDictionaryPathSegment(childKey, childPath);\n\t\tconst childSource = sourceValue[childKey];\n\t\tif (childSource === void 0) return [childKey, cloneDictionaryValue(targetDictionary[childKey])];\n\t\treturn [childKey, await materializeDictionaryValue({\n\t\t\tkey: childPath,\n\t\t\tsourceValue: childSource,\n\t\t\ttargetValue: targetDictionary[childKey],\n\t\t\ttranslateEntry\n\t\t})];\n\t}));\n\treturn Object.fromEntries(entries);\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/DictionaryCache.ts\nfunction cloneDictionaryEntry(entry) {\n\treturn {\n\t\tentry: entry.entry,\n\t\toptions: structuredClone(entry.options)\n\t};\n}\nvar DictionaryCache = class {\n\tconstructor({ init, lifecycle = {}, runtimeTranslate }) {\n\t\tthis.pendingTranslations = /* @__PURE__ */ new Map();\n\t\tthis.pendingMaterializations = /* @__PURE__ */ new Map();\n\t\tthis.cache = structuredClone(init);\n\t\tthis.runtimeTranslate = runtimeTranslate;\n\t\tthis.lifecycle = lifecycle;\n\t}\n\tgetEntry(key) {\n\t\tconst value = getDictionaryValueAtPath(this.cache, key);\n\t\tconst entry = getDictionaryEntry(value);\n\t\tif (entry === void 0) return;\n\t\tconst outputEntry = cloneDictionaryEntry(entry);\n\t\tthis.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: value,\n\t\t\toutputValue: outputEntry\n\t\t});\n\t\treturn outputEntry;\n\t}\n\tgetValue(key) {\n\t\tconst value = getDictionaryValueAtPath(this.cache, key);\n\t\tif (value === void 0) return;\n\t\tconst outputValue = cloneDictionaryValue(value);\n\t\tthis.lifecycle.onDictionaryObjectCacheHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: value,\n\t\t\toutputValue\n\t\t});\n\t\treturn outputValue;\n\t}\n\tsetValue(key, value) {\n\t\tsetDictionaryValueAtPath(this.cache, key, cloneDictionaryValue(value));\n\t}\n\tgetInternalCache() {\n\t\treturn cloneDictionaryValue(this.cache);\n\t}\n\tasync materializeValue(key, sourceValue, targetValue = getDictionaryValueAtPath(this.cache, key)) {\n\t\tlet materializationPromise = this.pendingMaterializations.get(key);\n\t\tif (!materializationPromise) {\n\t\t\tmaterializationPromise = materializeDictionaryValue({\n\t\t\t\tkey,\n\t\t\t\tsourceValue,\n\t\t\t\ttargetValue,\n\t\t\t\ttranslateEntry: async (entryKey, sourceEntry) => getDictionaryValue(await this.materializeEntry(entryKey, sourceEntry))\n\t\t\t}).then((value) => {\n\t\t\t\tthis.setValue(key, value);\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tthis.pendingMaterializations.set(key, materializationPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn await materializationPromise;\n\t\t} finally {\n\t\t\tthis.pendingMaterializations.delete(key);\n\t\t}\n\t}\n\tasync materializeEntry(key, sourceEntry) {\n\t\tlet translationPromise = this.pendingTranslations.get(key);\n\t\tif (!translationPromise) {\n\t\t\ttranslationPromise = this.runtimeTranslate(key, sourceEntry).then((value) => {\n\t\t\t\tsetDictionaryValueAtPath(this.cache, key, value);\n\t\t\t\tconst entry = getDictionaryEntry(value);\n\t\t\t\tif (entry === void 0) throw new Error(\"DictionaryCache materializeEntry did not return a DictionaryEntry\");\n\t\t\t\tthis.lifecycle.onMiss?.({\n\t\t\t\t\tinputKey: key,\n\t\t\t\t\tcacheKey: key,\n\t\t\t\t\tcacheValue: value,\n\t\t\t\t\toutputValue: cloneDictionaryEntry(entry)\n\t\t\t\t});\n\t\t\t\treturn cloneDictionaryEntry(entry);\n\t\t\t});\n\t\t\tthis.pendingTranslations.set(key, translationPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn cloneDictionaryEntry(await translationPromise);\n\t\t} finally {\n\t\t\tthis.pendingTranslations.delete(key);\n\t\t}\n\t}\n};\n//#endregion\n//#region src/i18n-manager/translations-manager/ResourceCache.ts\nvar ResourceCache = class {\n\tconstructor({ load, lifecycle = {}, ttl }) {\n\t\tthis.cache = /* @__PURE__ */ new Map();\n\t\tthis.pendingLoads = /* @__PURE__ */ new Map();\n\t\tthis.loadResource = load;\n\t\tthis.lifecycle = lifecycle;\n\t\tthis.ttl = ttl === null ? -1 : ttl ?? 6e4;\n\t}\n\tget(key) {\n\t\tconst entry = this.cache.get(key);\n\t\tif (!entry || this.isExpired(entry)) return;\n\t\tthis.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: entry,\n\t\t\toutputValue: entry.value\n\t\t});\n\t\treturn entry.value;\n\t}\n\tset(key, value, { expiresAt = this.getExpiresAt() } = {}) {\n\t\tthis.cache.set(key, {\n\t\t\texpiresAt,\n\t\t\tvalue\n\t\t});\n\t}\n\tasync getOrLoad(key) {\n\t\treturn this.get(key) ?? await this.load(key);\n\t}\n\tasync load(key) {\n\t\tlet loadPromise = this.pendingLoads.get(key);\n\t\tif (!loadPromise) {\n\t\t\tloadPromise = this.loadResource(key).then((value) => {\n\t\t\t\tconst entry = {\n\t\t\t\t\texpiresAt: this.getExpiresAt(),\n\t\t\t\t\tvalue\n\t\t\t\t};\n\t\t\t\tthis.cache.set(key, entry);\n\t\t\t\tthis.lifecycle.onMiss?.({\n\t\t\t\t\tinputKey: key,\n\t\t\t\t\tcacheKey: key,\n\t\t\t\t\tcacheValue: entry,\n\t\t\t\t\toutputValue: entry.value\n\t\t\t\t});\n\t\t\t\treturn entry;\n\t\t\t});\n\t\t\tthis.pendingLoads.set(key, loadPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn (await loadPromise).value;\n\t\t} finally {\n\t\t\tthis.pendingLoads.delete(key);\n\t\t}\n\t}\n\tgetExpiresAt() {\n\t\treturn this.ttl < 0 ? this.ttl : Date.now() + this.ttl;\n\t}\n\tisExpired(entry) {\n\t\treturn entry.expiresAt > 0 && entry.expiresAt < Date.now();\n\t}\n};\n//#endregion\n//#region src/utils/hashMessage.ts\n/**\n* Hash a message string\n*/\nfunction hashMessage(message, options) {\n\tconst metadataOptions = options;\n\tif (metadataOptions.$_hash != null) return metadataOptions.$_hash;\n\treturn hashSource({\n\t\tsource: options.$format === \"ICU\" ? indexVars(message) : message,\n\t\t...metadataOptions.$context && { context: metadataOptions.$context },\n\t\t...metadataOptions.$id && { id: metadataOptions.$id },\n\t\t...metadataOptions.$maxChars != null && { maxChars: Math.abs(metadataOptions.$maxChars) },\n\t\tdataFormat: options.$format\n\t});\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/TranslationsCache.ts\nconst DEFAULT_BATCH_CONFIG = {\n\tmaxConcurrentRequests: 100,\n\tmaxBatchSize: 25,\n\tbatchInterval: 50\n};\nfunction getPositiveValue(value, defaultValue) {\n\tif (value === void 0 || !Number.isFinite(value) || value <= 0) return defaultValue;\n\treturn value;\n}\nfunction getPositiveInteger(value, defaultValue) {\n\tif (value === void 0 || !Number.isFinite(value)) return defaultValue;\n\tconst integer = Math.trunc(value);\n\treturn integer > 0 ? integer : defaultValue;\n}\nfunction normalizeBatchConfig(batchConfig) {\n\treturn {\n\t\tmaxConcurrentRequests: getPositiveInteger(batchConfig?.maxConcurrentRequests, DEFAULT_BATCH_CONFIG.maxConcurrentRequests),\n\t\tmaxBatchSize: getPositiveInteger(batchConfig?.maxBatchSize, DEFAULT_BATCH_CONFIG.maxBatchSize),\n\t\tbatchInterval: getPositiveValue(batchConfig?.batchInterval, DEFAULT_BATCH_CONFIG.batchInterval)\n\t};\n}\n/**\n* A cache for a single locale's translations\n*\n* Principles:\n* - This class is language agnostic, and should never store the locale code as a parameter.\n* Locale logic is handled at the LocalesCache level. Use a callback function that has the\n* locale parameter embedded if you wish to use the locale code.\n*/\nvar TranslationsCache = class {\n\t/**\n\t* Constructor\n\t* @param {Object} params - The parameters for the cache\n\t* @param {Record<Hash, TranslationValue>} params.init - The initial cache\n\t* @param {Function} params.fallback - Get the fallback value for a cache miss\n\t*/\n\tconstructor({ init, translateMany, lifecycle = {}, batchConfig }) {\n\t\tthis.pendingTranslations = /* @__PURE__ */ new Map();\n\t\tthis.queue = [];\n\t\tthis.batchTimer = null;\n\t\tthis.activeRequests = 0;\n\t\tthis.cache = structuredClone(init);\n\t\tthis.translateMany = translateMany;\n\t\tthis.batchConfig = normalizeBatchConfig(batchConfig);\n\t\tthis.lifecycle = lifecycle;\n\t}\n\t/**\n\t* Get the translation value for a given key\n\t* @param key - The translation key\n\t* @returns The translation value\n\t*/\n\tget(key) {\n\t\tconst cacheKey = this.getCacheKey(key);\n\t\tconst value = this.cache[cacheKey];\n\t\tif (value != null) this.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey,\n\t\t\tcacheValue: value,\n\t\t\toutputValue: value\n\t\t});\n\t\treturn value;\n\t}\n\t/**\n\t* Miss the cache\n\t* @param key - The translation key\n\t* @returns The translation value\n\t*/\n\tasync miss(key) {\n\t\tconst cacheKey = this.getCacheKey(key);\n\t\tlet translationPromise = this.pendingTranslations.get(cacheKey);\n\t\tif (!translationPromise) {\n\t\t\ttranslationPromise = this.translate(key);\n\t\t\tthis.pendingTranslations.set(cacheKey, translationPromise);\n\t\t}\n\t\ttry {\n\t\t\tconst value = await translationPromise;\n\t\t\tif (value != null) this.lifecycle.onMiss?.({\n\t\t\t\tinputKey: key,\n\t\t\t\tcacheKey,\n\t\t\t\tcacheValue: value,\n\t\t\t\toutputValue: value\n\t\t\t});\n\t\t\treturn value;\n\t\t} finally {\n\t\t\tthis.pendingTranslations.delete(cacheKey);\n\t\t}\n\t}\n\tgetInternalCache() {\n\t\treturn structuredClone(this.cache);\n\t}\n\tgetCacheKey(key) {\n\t\treturn hashMessage(key.message, key.options);\n\t}\n\ttranslate(key) {\n\t\tconst translationPromise = this.enqueueTranslation(key);\n\t\tif (this.queue.length >= this.batchConfig.maxBatchSize) this.flushNow();\n\t\telse this.scheduleBatch();\n\t\treturn translationPromise;\n\t}\n\tflushNow() {\n\t\tif (this.batchTimer) {\n\t\t\tclearTimeout(this.batchTimer);\n\t\t\tthis.batchTimer = null;\n\t\t}\n\t\tthis.drainQueue();\n\t}\n\tscheduleBatch() {\n\t\tif (this.batchTimer) return;\n\t\tthis.batchTimer = setTimeout(() => {\n\t\t\tthis.batchTimer = null;\n\t\t\tthis.drainQueue();\n\t\t}, this.batchConfig.batchInterval);\n\t}\n\tdrainQueue() {\n\t\twhile (this.queue.length > 0 && this.activeRequests < this.batchConfig.maxConcurrentRequests) {\n\t\t\tconst batch = this.queue.splice(0, this.batchConfig.maxBatchSize);\n\t\t\tthis.sendBatchRequest(batch);\n\t\t}\n\t\tif (this.queue.length > 0) this.scheduleBatch();\n\t}\n\tenqueueTranslation(key) {\n\t\tconst hash = this.getCacheKey(key);\n\t\tconst options = key.options;\n\t\tconst metadataOptions = options;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.queue.push({\n\t\t\t\tkey: hash,\n\t\t\t\tsource: key.message,\n\t\t\t\tmetadata: {\n\t\t\t\t\thash,\n\t\t\t\t\t...metadataOptions.$context && { context: metadataOptions.$context },\n\t\t\t\t\t...metadataOptions.$id && { id: metadataOptions.$id },\n\t\t\t\t\t...metadataOptions.$maxChars != null && { maxChars: Math.abs(metadataOptions.$maxChars) },\n\t\t\t\t\tdataFormat: options.$format\n\t\t\t\t},\n\t\t\t\tresolve: (value) => resolve(value),\n\t\t\t\treject\n\t\t\t});\n\t\t});\n\t}\n\tasync sendBatchRequest(batch) {\n\t\tthis.activeRequests++;\n\t\tconst requests = convertBatchToTranslateManyParams(batch);\n\t\tconst response = await this.sendBatchRequestWithErrorHandling(batch, requests);\n\t\tif (response) this.handleTranslationResponse(batch, response);\n\t\tthis.activeRequests--;\n\t}\n\tasync sendBatchRequestWithErrorHandling(batch, requests) {\n\t\ttry {\n\t\t\treturn await this.translateMany(requests);\n\t\t} catch (error) {\n\t\t\tfor (const entry of batch) entry.reject(error);\n\t\t\treturn;\n\t\t}\n\t}\n\thandleTranslationResponse(batch, response) {\n\t\tfor (const entry of batch) {\n\t\t\tconst { key } = entry;\n\t\t\tconst result = response[key];\n\t\t\tif (result && result.success) {\n\t\t\t\tconst translation = result.translation;\n\t\t\t\tthis.cache[key] = translation;\n\t\t\t\tentry.resolve(translation);\n\t\t\t} else entry.reject(result?.error);\n\t\t}\n\t}\n};\n/**\n* Convert a TranslationKey to a TranslateManyEntry\n*/\nfunction convertBatchToTranslateManyParams(batch) {\n\treturn batch.reduce((acc, entry) => {\n\t\tacc[entry.key] = {\n\t\t\tsource: entry.source,\n\t\t\tmetadata: entry.metadata\n\t\t};\n\t\treturn acc;\n\t}, {});\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/LocalesCache.ts\nvar LocalesCache = class {\n\tconstructor({ ttl, batchConfig, defaultLocale, dictionary = {}, loadTranslations, loadDictionary, createTranslateMany, translateDictionaryEntry, lifecycle }) {\n\t\tthis.translations = new ResourceCache({\n\t\t\tttl,\n\t\t\tload: async (locale) => new TranslationsCache({\n\t\t\t\tinit: await loadTranslations(locale),\n\t\t\t\tlifecycle: createTranslationsCacheLifecycle(locale, lifecycle),\n\t\t\t\ttranslateMany: createTranslateMany(locale),\n\t\t\t\tbatchConfig\n\t\t\t}),\n\t\t\tlifecycle: {\n\t\t\t\tonHit: lifecycle.onLocalesCacheHit,\n\t\t\t\tonMiss: lifecycle.onLocalesCacheMiss\n\t\t\t}\n\t\t});\n\t\tthis.dictionaries = new ResourceCache({\n\t\t\tttl,\n\t\t\tload: async (locale) => createDictionaryCache({\n\t\t\t\tlocale,\n\t\t\t\tdictionary: await loadDictionary(locale),\n\t\t\t\ttranslate: translateDictionaryEntry,\n\t\t\t\tlifecycle\n\t\t\t}),\n\t\t\tlifecycle: {\n\t\t\t\tonHit: lifecycle.onLocalesDictionaryCacheHit,\n\t\t\t\tonMiss: lifecycle.onLocalesDictionaryCacheMiss\n\t\t\t}\n\t\t});\n\t\tthis.dictionaries.set(defaultLocale, createDictionaryCache({\n\t\t\tlocale: defaultLocale,\n\t\t\tdictionary,\n\t\t\ttranslate: translateDictionaryEntry,\n\t\t\tlifecycle\n\t\t}), { expiresAt: -1 });\n\t}\n\tgetTranslations(locale) {\n\t\treturn this.translations.get(locale);\n\t}\n\tgetOrLoadTranslations(locale) {\n\t\treturn this.translations.getOrLoad(locale);\n\t}\n\tgetDictionary(locale) {\n\t\treturn this.dictionaries.get(locale);\n\t}\n\tgetOrLoadDictionary(locale) {\n\t\treturn this.dictionaries.getOrLoad(locale);\n\t}\n};\nfunction createTranslationsCacheLifecycle(locale, lifecycle) {\n\treturn {\n\t\tonHit: withLocale(locale, lifecycle.onTranslationsCacheHit),\n\t\tonMiss: withLocale(locale, lifecycle.onTranslationsCacheMiss)\n\t};\n}\nfunction createDictionaryCache({ locale, dictionary, translate, lifecycle }) {\n\tconst { onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit } = lifecycle;\n\treturn new DictionaryCache({\n\t\tinit: dictionary,\n\t\truntimeTranslate: (key, sourceEntry) => translate(locale, key, sourceEntry),\n\t\tlifecycle: {\n\t\t\tonHit: withLocale(locale, onDictionaryCacheHit),\n\t\t\tonMiss: withLocale(locale, onDictionaryCacheMiss),\n\t\t\tonDictionaryObjectCacheHit: withLocale(locale, onDictionaryObjectCacheHit)\n\t\t}\n\t});\n}\nfunction withLocale(locale, callback) {\n\treturn callback ? (params) => callback({\n\t\tlocale,\n\t\t...params\n\t}) : void 0;\n}\n//#endregion\n//#region src/i18n-manager/event-subscription/types.ts\nconst LOCALES_CACHE_HIT_EVENT_NAME = \"locales-cache-hit\";\nconst LOCALES_CACHE_MISS_EVENT_NAME = \"locales-cache-miss\";\nconst TRANSLATIONS_CACHE_HIT_EVENT_NAME = \"translations-cache-hit\";\nconst TRANSLATIONS_CACHE_MISS_EVENT_NAME = \"translations-cache-miss\";\nconst LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME = \"locales-dictionary-cache-hit\";\nconst LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME = \"locales-dictionary-cache-miss\";\nconst DICTIONARY_CACHE_HIT_EVENT_NAME = \"dictionary-cache-hit\";\nconst DICTIONARY_CACHE_MISS_EVENT_NAME = \"dictionary-cache-miss\";\nconst DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME = \"dictionary-object-cache-hit\";\n//#endregion\n//#region src/i18n-manager/lifecycle-hooks/createLifecycleCallbacks.ts\n/**\n* Maps consumer-facing lifecycle callbacks to internal locales cache lifecycle callbacks.\n* The consumer API exposes simplified params (locale, hash, value) while the internal\n* API uses the full cache lifecycle params (inputKey, cacheKey, cacheValue, outputValue).\n*\n* @deprecated - move to subscription api instead\n*/\nfunction createLifecycleCallbacks(emit, hasListeners = () => true) {\n\treturn {\n\t\tonLocalesCacheHit: (params) => {\n\t\t\tif (!hasListeners(\"locales-cache-hit\")) return;\n\t\t\temit(LOCALES_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\ttranslations: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonLocalesCacheMiss: (params) => {\n\t\t\tif (!hasListeners(\"locales-cache-miss\")) return;\n\t\t\temit(LOCALES_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\ttranslations: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonTranslationsCacheHit: (params) => {\n\t\t\temit(TRANSLATIONS_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\thash: params.cacheKey,\n\t\t\t\ttranslation: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonTranslationsCacheMiss: (params) => {\n\t\t\temit(TRANSLATIONS_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\thash: params.cacheKey,\n\t\t\t\ttranslation: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonLocalesDictionaryCacheHit: (params) => {\n\t\t\tif (!hasListeners(\"locales-dictionary-cache-hit\")) return;\n\t\t\temit(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\tdictionary: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonLocalesDictionaryCacheMiss: (params) => {\n\t\t\tif (!hasListeners(\"locales-dictionary-cache-miss\")) return;\n\t\t\temit(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\tdictionary: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonDictionaryCacheHit: (params) => {\n\t\t\temit(DICTIONARY_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryEntry: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonDictionaryCacheMiss: (params) => {\n\t\t\temit(DICTIONARY_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryEntry: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonDictionaryObjectCacheHit: (params) => {\n\t\t\temit(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryValue: params.outputValue\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/i18n-manager/event-subscription/EventEmitter.ts\n/**\n* Base class for event emitters\n*/\nvar EventEmitter = class {\n\tconstructor() {\n\t\tthis.listeners = {};\n\t}\n\tgetOrCreateListeners(eventName) {\n\t\tif (!this.listeners[eventName]) this.listeners[eventName] = /* @__PURE__ */ new Set();\n\t\treturn this.listeners[eventName];\n\t}\n\t/**\n\t* Subscribe to an event, returns an unsubscribe function\n\t*/\n\tsubscribe(eventName, listener) {\n\t\tconst set = this.getOrCreateListeners(eventName);\n\t\tset.add(listener);\n\t\treturn () => {\n\t\t\tset.delete(listener);\n\t\t};\n\t}\n\t/**\n\t* Emit an event\n\t*/\n\temit(eventName, event) {\n\t\tthis.listeners[eventName]?.forEach((subscriber) => subscriber(event));\n\t}\n\thasListeners(eventName) {\n\t\treturn (this.listeners[eventName]?.size ?? 0) > 0;\n\t}\n};\n//#endregion\n//#region src/i18n-manager/lifecycle-hooks/subscribeLifecycleCallbacks.ts\n/**\n* Subscribes to the lifecycle callbacks and emits the events to the event emitter\n* @deprecated - move to subscription api instead\n*\n* NOTE: we do not have to worry about unsubscribe here as this is a deprecated api\n* and is only used internally\n*/\nfunction subscribeLifecycleCallbacks({ onLocalesCacheHit, onLocalesCacheMiss, onTranslationsCacheHit, onTranslationsCacheMiss, onLocalesDictionaryCacheHit, onLocalesDictionaryCacheMiss, onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit }, subscribe) {\n\tif (onLocalesCacheHit) subscribe(LOCALES_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonLocalesCacheHit({\n\t\t\t...event,\n\t\t\tvalue: event.translations\n\t\t});\n\t});\n\tif (onLocalesCacheMiss) subscribe(LOCALES_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonLocalesCacheMiss({\n\t\t\t...event,\n\t\t\tvalue: event.translations\n\t\t});\n\t});\n\tif (onTranslationsCacheHit) subscribe(TRANSLATIONS_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonTranslationsCacheHit({\n\t\t\t...event,\n\t\t\tvalue: event.translation\n\t\t});\n\t});\n\tif (onTranslationsCacheMiss) subscribe(TRANSLATIONS_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonTranslationsCacheMiss({\n\t\t\t...event,\n\t\t\tvalue: event.translation\n\t\t});\n\t});\n\tif (onLocalesDictionaryCacheHit) subscribe(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonLocalesDictionaryCacheHit(event);\n\t});\n\tif (onLocalesDictionaryCacheMiss) subscribe(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonLocalesDictionaryCacheMiss(event);\n\t});\n\tif (onDictionaryCacheHit) subscribe(DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonDictionaryCacheHit(event);\n\t});\n\tif (onDictionaryCacheMiss) subscribe(DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonDictionaryCacheMiss(event);\n\t});\n\tif (onDictionaryObjectCacheHit) subscribe(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonDictionaryObjectCacheHit(event);\n\t});\n}\n//#endregion\n//#region src/i18n-manager/I18nManager.ts\n/**\n* Default translation timeout in milliseconds for a runtime translation request\n*/\nconst DEFAULT_TRANSLATION_TIMEOUT = 12e3;\n/**\n* Class for managing translation functionality\n* @template TranslationValue - The type of the translation that will be cached\n*/\nvar I18nManager = class extends EventEmitter {\n\t/**\n\t* Creates an instance of I18nManager.\n\t* TODO: resolve gtConfig from just file path\n\t* @param params - The parameters for the I18nManager constructor\n\t* @param params.config - The configuration for the I18nManager\n\t*/\n\tconstructor(params) {\n\t\tsuper();\n\t\tthis.resolveTranslationSync = (locale, message, options) => {\n\t\t\treturn this.lookupTranslation(locale, message, options);\n\t\t};\n\t\tpublishValidationResults(validateConfig(params), \"I18nManager: \");\n\t\tthis.config = standardizeConfig(params);\n\t\tthis.localeConfig = new LocaleConfig({\n\t\t\tdefaultLocale: this.config.defaultLocale,\n\t\t\tlocales: this.config.locales,\n\t\t\tcustomMapping: this.config.customMapping\n\t\t});\n\t\tconst loadTranslations = routeCreateTranslationLoader({\n\t\t\tloadTranslations: params.loadTranslations,\n\t\t\ttype: getLoadTranslationsType(params),\n\t\t\tremoteTranslationLoaderParams: {\n\t\t\t\tcacheUrl: params.cacheUrl,\n\t\t\t\tprojectId: params.projectId,\n\t\t\t\t_versionId: params._versionId,\n\t\t\t\t_branchId: params._branchId,\n\t\t\t\tcustomMapping: params.customMapping\n\t\t\t}\n\t\t});\n\t\tconst loadDictionary = params.loadDictionary ?? (() => Promise.resolve({}));\n\t\tconst runtimeTranslationTimeout = this.config.runtimeTranslation?.timeout ?? DEFAULT_TRANSLATION_TIMEOUT;\n\t\tconst runtimeTranslationMetadata = this.config.runtimeTranslation?.metadata ?? {};\n\t\tconst createTranslateMany = createTranslateManyFactory(this.getGTClassClean(), runtimeTranslationTimeout, runtimeTranslationMetadata);\n\t\tsubscribeLifecycleCallbacks(params.lifecycle ?? {}, (...args) => this.subscribe(...args));\n\t\tconst lifecycle = createLifecycleCallbacks((...args) => this.emit(...args), (eventName) => this.hasListeners(eventName));\n\t\tthis.localesCache = new LocalesCache({\n\t\t\tdefaultLocale: this.config.defaultLocale,\n\t\t\tdictionary: params.dictionary,\n\t\t\tloadTranslations,\n\t\t\tloadDictionary,\n\t\t\tcreateTranslateMany,\n\t\t\ttranslateDictionaryEntry: (locale, id, sourceEntry) => this.translateDictionaryEntry(locale, id, sourceEntry),\n\t\t\tttl: this.config.cacheExpiryTime,\n\t\t\tbatchConfig: this.config.batchConfig,\n\t\t\tlifecycle\n\t\t});\n\t}\n\t/**\n\t* Subscribes to a change in a translation entry (eg a runtime translation)\n\t* @param listener - The subscriber function\n\t* @param locale - The locale of the translation entry\n\t* @param hash - The hash of the translation entry\n\t* @returns An unsubscribe function\n\t*\n\t* Pair this with {@link lookupTranslation} to get the translation entry\n\t*/\n\tsubscribeToTranslationsCacheMiss(listener, locale, hash) {\n\t\treturn this.subscribe(TRANSLATIONS_CACHE_MISS_EVENT_NAME, (event) => {\n\t\t\tif (event.locale !== locale || event.hash !== hash) return;\n\t\t\tlistener(event);\n\t\t});\n\t}\n\t/**\n\t* Get the default locale\n\t*/\n\tgetDefaultLocale() {\n\t\treturn this.config.defaultLocale;\n\t}\n\t/**\n\t* Get the locales\n\t*/\n\tgetLocales() {\n\t\treturn this.config.locales;\n\t}\n\t/**\n\t* Get the custom locale mapping\n\t*/\n\tgetCustomMapping() {\n\t\treturn this.config.customMapping;\n\t}\n\t/**\n\t* Get the version ID\n\t*/\n\tgetVersionId() {\n\t\treturn this.config._versionId;\n\t}\n\t/**\n\t* Get a gt class instance\n\t* @param locale - The locale to bind to the GT instance. When omitted, the GT instance is locale agnostic.\n\t* TODO: keep a cache to avoid creating new instances unnecessarily\n\t*/\n\tgetGTClass(locale) {\n\t\treturn this.getGTClassClean(locale ? this.resolveLocale(locale) : void 0);\n\t}\n\t/**\n\t* Is translation enabled?\n\t*/\n\tisTranslationEnabled() {\n\t\treturn this.config.enableI18n;\n\t}\n\t/**\n\t* Get the translation loader function\n\t* @deprecated wrap a cb around loadTranslations instead\n\t*/\n\tgetTranslationLoader() {\n\t\treturn (locale) => this.loadTranslations(locale);\n\t}\n\t/**\n\t* Loads in translations for a given locale\n\t* Edge case usage: access the translations object directly\n\t*/\n\tasync loadTranslations(locale) {\n\t\ttry {\n\t\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!translationLocale) return {};\n\t\t\treturn (await this.localesCache.getOrLoadTranslations(translationLocale)).getInternalCache();\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Loads in the dictionary for a given locale\n\t* Edge case usage: access the dictionary object directly\n\t*/\n\tasync loadDictionary(locale) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getDefaultDictionaryCache()?.getInternalCache() ?? {};\n\t\t\treturn (await this.localesCache.getOrLoadDictionary(dictionaryLocale)).getInternalCache();\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry\n\t*/\n\tlookupDictionary(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveDictionaryCacheLocale(locale);\n\t\t\treturn this.localesCache.getDictionary(dictionaryLocale)?.getEntry(id);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry or subtree\n\t*/\n\tlookupDictionaryObj(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveDictionaryCacheLocale(locale);\n\t\t\treturn this.localesCache.getDictionary(dictionaryLocale)?.getValue(id);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupDictionaryWithFallback(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getSourceDictionaryEntry(id);\n\t\t\tconst dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);\n\t\t\tlet dictionaryEntry = dictionaryCache.getEntry(id);\n\t\t\tif (dictionaryEntry === void 0) dictionaryEntry = await dictionaryCache.materializeEntry(id, this.getSourceDictionaryEntry(id));\n\t\t\treturn dictionaryEntry;\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry or subtree\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupDictionaryObjWithFallback(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getSourceDictionaryObject(id);\n\t\t\tconst dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);\n\t\t\tconst targetObject = dictionaryCache.getValue(id);\n\t\t\tconst sourceObject = this.getSourceDictionaryObject(id, { throwOnMissing: false });\n\t\t\tif (sourceObject === void 0) {\n\t\t\t\tif (targetObject !== void 0) return targetObject;\n\t\t\t\tthrow new DictionarySourceNotFoundError(id);\n\t\t\t}\n\t\t\treturn await dictionaryCache.materializeValue(id, sourceObject, targetObject);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\tasync translateDictionaryEntry(locale, id, sourceEntry) {\n\t\tconst translation = await this.lookupTranslationWithFallbackResolved(locale, sourceEntry.entry, resolveDictionaryLookupOptions(sourceEntry.options));\n\t\tif (typeof translation !== \"string\") throw new Error(`Dictionary entry \"${id}\" could not be translated into a string. Check the source entry and translation loader output.`);\n\t\treturn translation;\n\t}\n\tgetSourceDictionaryEntry(id) {\n\t\tconst sourceEntry = this.getDefaultDictionaryCache()?.getEntry(id);\n\t\tif (sourceEntry === void 0) throw new DictionarySourceNotFoundError(id);\n\t\treturn sourceEntry;\n\t}\n\tgetSourceDictionaryObject(id, { throwOnMissing = true } = {}) {\n\t\tconst sourceObject = this.getDefaultDictionaryCache()?.getValue(id);\n\t\tif (sourceObject === void 0 && throwOnMissing) throw new DictionarySourceNotFoundError(id);\n\t\treturn sourceObject;\n\t}\n\tgetDefaultDictionaryCache() {\n\t\treturn this.localesCache.getDictionary(this.config.defaultLocale);\n\t}\n\tresolveDictionaryCacheLocale(locale) {\n\t\treturn this.resolveCacheLocale(locale) ?? this.config.defaultLocale;\n\t}\n\t/**\n\t* Just lookup a translation\n\t*/\n\tlookupTranslation(locale, message, options) {\n\t\ttry {\n\t\t\tconst { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);\n\t\t\tif (!translationLocale) return message;\n\t\t\tconst txCache = this.localesCache.getTranslations(translationLocale);\n\t\t\tif (!txCache) return void 0;\n\t\t\treturn txCache.get({\n\t\t\t\tmessage,\n\t\t\t\toptions: lookupOptions\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a translation\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupTranslationWithFallback(locale, message, options) {\n\t\ttry {\n\t\t\treturn await this.lookupTranslationWithFallbackResolved(locale, message, options);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Saves a current lookup translation function immune to expiry\n\t* Useful for operations involving lookup callbacks like useGT()\n\t* @param locale - The locale to get the lookup translation for\n\t* @param prefetchEntries - Any entries we want to prefetch during the async period\n\t* @returns A lookup translation function\n\t*\n\t* @important prefetchEntries must all be the same locale\n\t*/\n\tasync getLookupTranslation(locale, prefetchEntries = []) {\n\t\ttry {\n\t\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!translationLocale) return (message) => message;\n\t\t\tconst resolvedPrefetchEntries = resolvePrefetchEntriesByLocale(prefetchEntries, translationLocale, (entryLocale) => this.resolveCacheLocale(entryLocale) ?? this.resolveLocale(entryLocale));\n\t\t\tif (resolvedPrefetchEntries.length !== prefetchEntries.length) logger_default.warn(`I18nManager: getLookupTranslation(): prefetchEntries must all be the same locale, ignoring all entries that are not for ${translationLocale}`);\n\t\t\tconst txCache = await this.localesCache.getOrLoadTranslations(translationLocale);\n\t\t\tawait Promise.all(resolvedPrefetchEntries.filter((entry) => txCache.get(entry) == null).map((entry) => txCache.miss(entry)));\n\t\t\treturn (message, options = {}) => {\n\t\t\t\treturn txCache.get({\n\t\t\t\t\tmessage,\n\t\t\t\t\toptions: this.resolveLookupOptions(options)\n\t\t\t\t});\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn (message) => message;\n\t\t}\n\t}\n\t/**\n\t* Get the translations\n\t* @deprecated use loadTranslations instead\n\t*/\n\tasync getTranslations(locale) {\n\t\ttry {\n\t\t\treturn this.loadTranslations(locale);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Get translation for a given locale and message\n\t*\n\t* @param {string} locale - The locale to get the translation for\n\t* @returns A function that resolves the translations for a given message and options synchronously\n\t*\n\t* Note: we can assume that the translation is a string because we are passing a string\n\t*\n\t* @deprecated use getLookupTranslation instead\n\t*/\n\tasync getTranslationResolver(locale) {\n\t\treturn this.getLookupTranslation(locale);\n\t}\n\t/**\n\t* Returns true if translation is required\n\t* @param {string} locale - The user's locale\n\t* @returns {boolean} True if translation is required, otherwise false\n\t*/\n\trequiresTranslation(locale) {\n\t\tconst defaultLocale = this.getDefaultLocale();\n\t\tconst locales = this.getLocales();\n\t\treturn this.isTranslationEnabled() && this.localeConfig.requiresTranslation(locale, defaultLocale, locales);\n\t}\n\t/**\n\t* Returns true if dialect translation is required\n\t* @param {string} locale - The user's locale\n\t* @returns {boolean} True if dialect translation is required, otherwise false\n\t*/\n\trequiresDialectTranslation(locale) {\n\t\tconst defaultLocale = this.getDefaultLocale();\n\t\treturn this.requiresTranslation(locale) && this.localeConfig.isSameLanguage(defaultLocale, locale);\n\t}\n\t/**\n\t* Handle errors\n\t* Soft error in production, throw in development\n\t*/\n\thandleError(error) {\n\t\tif (error instanceof DictionarySourceNotFoundError) throw error;\n\t\tswitch (this.config.environment) {\n\t\t\tcase \"development\": throw error;\n\t\t\tdefault:\n\t\t\t\tlogger_default.error(\"I18nManager: \" + error);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tresolveLocale(locale) {\n\t\tconst resolvedLocale = this.localeConfig.determineLocale(locale);\n\t\tif (!this.localeConfig.isValidLocale(locale) || !resolvedLocale) throw new Error(`Locale \"${locale}\" is not valid. Use a valid BCP 47 locale code or add a custom mapping.`);\n\t\treturn resolvedLocale;\n\t}\n\t/**\n\t* Resolve the locale key used to load/read locale caches.\n\t* Returns undefined when the requested locale can use source content.\n\t*/\n\tresolveCacheLocale(locale) {\n\t\tconst resolvedLocale = this.resolveLocale(locale);\n\t\tif (this.requiresTranslation(resolvedLocale)) return resolvedLocale;\n\t\tconst aliasLocale = this.localeConfig.resolveAliasLocale(standardizeLocale(locale));\n\t\tif (this.requiresTranslation(aliasLocale)) return aliasLocale;\n\t}\n\tresolveLookupParams(locale, options) {\n\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\treturn {\n\t\t\ttranslationLocale,\n\t\t\toptions: translationLocale ? this.resolveLookupOptions(options, translationLocale) : options\n\t\t};\n\t}\n\tresolveLookupOptions(options = {}, translationLocale) {\n\t\tif (!options.$locale) return options;\n\t\treturn {\n\t\t\t...options,\n\t\t\t$locale: translationLocale ?? this.resolveCacheLocale(options.$locale) ?? this.resolveLocale(options.$locale)\n\t\t};\n\t}\n\tasync lookupTranslationWithFallbackResolved(locale, message, options) {\n\t\tconst { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);\n\t\tif (!translationLocale) return message;\n\t\tconst txCache = await this.localesCache.getOrLoadTranslations(translationLocale);\n\t\tlet translation = txCache.get({\n\t\t\tmessage,\n\t\t\toptions: lookupOptions\n\t\t});\n\t\tif (translation == null) translation = await txCache.miss({\n\t\t\tmessage,\n\t\t\toptions: lookupOptions\n\t\t});\n\t\treturn translation;\n\t}\n\t/**\n\t* A helper function to create a gt class that is locale agnostic\n\t* This is helpful for when our getLocale function is bound to a\n\t* specific context\n\t*/\n\tgetGTClassClean(locale) {\n\t\treturn new GT({\n\t\t\tsourceLocale: this.config.defaultLocale,\n\t\t\ttargetLocale: locale,\n\t\t\tlocales: Array.from(new Set(this.config.locales.map((locale) => this.localeConfig.resolveCanonicalLocale(locale)))),\n\t\t\tcustomMapping: this.config.customMapping,\n\t\t\tprojectId: this.config.projectId,\n\t\t\tbaseUrl: this.config.runtimeUrl || void 0,\n\t\t\tapiKey: this.config.apiKey,\n\t\t\tdevApiKey: this.config.devApiKey\n\t\t});\n\t}\n};\n/**\n* Standardize the config\n* @param config - The config to standardize\n* @returns The standardized config\n*/\nfunction standardizeConfig(config) {\n\tconst gtServicesEnabled = getGTServicesEnabled(config);\n\tconst dedupedLocales = dedupeLocales({\n\t\tdefaultLocale: config.defaultLocale || libraryDefaultLocale,\n\t\tlocales: config.locales || [libraryDefaultLocale],\n\t\tcustomMapping: config.customMapping\n\t});\n\treturn {\n\t\tenvironment: config.environment || \"production\",\n\t\tenableI18n: config.enableI18n !== void 0 ? config.enableI18n : true,\n\t\tprojectId: config.projectId,\n\t\tdevApiKey: config.devApiKey,\n\t\tapiKey: config.apiKey,\n\t\truntimeUrl: config.runtimeUrl,\n\t\tcacheExpiryTime: config.cacheExpiryTime,\n\t\tbatchConfig: config.batchConfig,\n\t\truntimeTranslation: config.runtimeTranslation,\n\t\t_versionId: config._versionId,\n\t\t...gtServicesEnabled ? standardizeLocales(dedupedLocales) : dedupedLocales\n\t};\n}\n/**\n* Dedupe locales and add defaultLocale\n*/\nfunction dedupeLocales({ defaultLocale, locales, customMapping }) {\n\treturn {\n\t\tdefaultLocale,\n\t\tlocales: Array.from(new Set([defaultLocale, ...locales])),\n\t\tcustomMapping: customMapping || {}\n\t};\n}\n/**\n* Standardize all locales in config\n* Only apply if using GT services\n*/\nfunction standardizeLocales(config) {\n\treturn {\n\t\tdefaultLocale: standardizeLocale(config.defaultLocale),\n\t\tlocales: config.locales.map((locale) => {\n\t\t\tif (typeof config.customMapping?.[locale] === \"string\" ? config.customMapping?.[locale] : config.customMapping?.[locale]?.code) return locale;\n\t\t\telse return standardizeLocale(locale);\n\t\t}),\n\t\tcustomMapping: Object.fromEntries(Object.entries(config.customMapping || {}).map(([key, value]) => [key, typeof value === \"string\" ? standardizeLocale(value) : {\n\t\t\t...value,\n\t\t\t...value.code ? { code: standardizeLocale(value.code) } : {}\n\t\t}]))\n\t};\n}\n/**\n* Resolve prefetch entry locales and keep entries matching the active locale.\n* @template TranslationType - The type of the translation\n* @param {PrefetchEntry<TranslationType>[]} prefetchEntries - The prefetch entries to filter\n* @param {string} locale - The locale to filter by\n* @returns {PrefetchEntry<TranslationType>[]} The filtered prefetch entries\n*/\nfunction resolvePrefetchEntriesByLocale(prefetchEntries, locale, resolveLocale) {\n\treturn prefetchEntries.flatMap((entry) => {\n\t\tconst entryLocale = entry.options.$locale;\n\t\tif (entryLocale == null) return [entry];\n\t\ttry {\n\t\t\tconst resolvedLocale = resolveLocale(entryLocale);\n\t\t\tif (resolvedLocale !== locale) return [];\n\t\t\treturn [{\n\t\t\t\tmessage: entry.message,\n\t\t\t\toptions: {\n\t\t\t\t\t...entry.options,\n\t\t\t\t\t$locale: resolvedLocale\n\t\t\t\t}\n\t\t\t}];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t});\n}\n//#endregion\n//#region src/i18n-manager/singleton-operations.ts\nlet i18nManager = void 0;\nlet fallbackDefaultLocale = libraryDefaultLocale;\nconst fallbackConditionStore = { getLocale: () => fallbackDefaultLocale };\nlet conditionStore = fallbackConditionStore;\n/**\n* Get the singleton instance of I18nManager\n* @returns The singleton instance of I18nManager\n* @template U - The type of the translation that will be cached\n*/\nfunction getI18nManager() {\n\tif (!i18nManager) {\n\t\tlogger_default.warn(\"getI18nManager(): I18nManager was not initialized. Falling back to the default locale until initializeGT() configures translations.\");\n\t\ti18nManager = new I18nManager({\n\t\t\tdefaultLocale: libraryDefaultLocale,\n\t\t\tlocales: [libraryDefaultLocale]\n\t\t});\n\t}\n\treturn i18nManager;\n}\n/**\n* Resolve the current locale from the configured runtime condition source.\n*/\nfunction getCurrentLocale() {\n\treturn conditionStore.getLocale();\n}\n/**\n* Configure the runtime condition source.\n*/\nfunction setConditionStore(nextConditionStore) {\n\tconditionStore = nextConditionStore;\n}\n/**\n* Reset the runtime condition source to the active manager's default-locale fallback.\n*/\nfunction resetConditionStore() {\n\tconditionStore = fallbackConditionStore;\n}\n/**\n* Configure the singleton instance of I18nManager\n* @param config - The configuration for the I18nManager\n*\n* Wrapper libraries will export a configure function that will call this function.\n*/\nfunction setI18nManager(i18nManagerInstance) {\n\ti18nManager = i18nManagerInstance;\n\tfallbackDefaultLocale = i18nManagerInstance.getDefaultLocale();\n\tresetConditionStore();\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateStringMessage.ts\n/**\n* String interpolation function\n*/\nfunction interpolateStringMessage(encodedMsg, options) {\n\treturn formatCutoff(encodedMsg, {\n\t\tlocales: options.$locale ?? options.$_locales,\n\t\tmaxChars: options.$maxChars\n\t});\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateMessage.ts\n/**\n* Interpolation router function for all {@link StringFormat} types\n*/\nfunction interpolateMessage({ source, target, options, sourceLocale }) {\n\tif (target != null) return routeInterpolation(target, {\n\t\t$_fallback: source,\n\t\t...options\n\t});\n\treturn routeInterpolation(source, getSourceOptions(options, sourceLocale));\n}\n/**\n* Route to appropriate formatting function\n*/\nfunction routeInterpolation(content, options) {\n\tswitch (options.$format ?? \"STRING\") {\n\t\tcase \"ICU\": return interpolateIcuMessage(content, options);\n\t\tcase \"I18NEXT\":\n\t\tcase \"STRING\": return interpolateStringMessage(content, options);\n\t\tdefault: return content;\n\t}\n}\nfunction getSourceOptions(options, sourceLocale) {\n\tif (!sourceLocale) return options;\n\treturn {\n\t\t...options,\n\t\t$locale: sourceLocale\n\t};\n}\n//#endregion\n//#region src/translation-functions/internal/helpers.ts\n/**\n* Just do a simple lookup of the translation\n*/\nfunction resolveJsx(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"JSX\");\n\treturn i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions);\n}\n/**\n* Lookup translation, fallback to source\n*/\nfunction resolveJsxWithFallback(locale, content, options = {}) {\n\treturn resolveJsx(locale, content, options) ?? content;\n}\n/**\n* Lookup translation\n* fallback to runtime translate\n* Fallback to source\n*/\nasync function resolveJsxWithRuntimeFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"JSX\");\n\treturn await i18nManager.lookupTranslationWithFallback(lookupOptions.$locale, content, lookupOptions) ?? content;\n}\n/**\n* Just do a simple lookup of the translation\n* And interpolate\n*/\nfunction resolveStringContent(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\tconst translation = i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions);\n\tif (translation == null) return void 0;\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: translation,\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Lookup translation, fallback to source\n*/\nfunction resolveStringContentWithFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions),\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Lookup translation\n* fallback to runtime translate\n* Fallback to source\n*/\nasync function resolveStringContentWithRuntimeFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: await i18nManager.lookupTranslationWithFallback(lookupOptions.$locale, content, lookupOptions),\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Add the default format to caller-provided lookup options.\n*/\nfunction createLookupOptions(locale, options, defaultFormat) {\n\treturn {\n\t\t...options,\n\t\t$format: options.$format ?? defaultFormat,\n\t\t$locale: locale\n\t};\n}\n//#endregion\n//#region src/helpers/locale.ts\n/**\n* Get the current locale\n* @returns The current locale\n*\n* @example\n* const locale = getLocale();\n* console.log(locale); // 'en-US'\n*/\nfunction getLocale() {\n\treturn getCurrentLocale();\n}\n/**\n* Get the configured locales\n* @returns The configured locales\n*\n* @example\n* const locales = getLocales();\n* console.log(locales); // ['en-US', 'es-ES']\n*/\nfunction getLocales() {\n\treturn getI18nManager().getLocales();\n}\n/**\n* Get the default locale\n* @returns The default locale\n*\n* @example\n* const defaultLocale = getDefaultLocale();\n* console.log(defaultLocale); // 'en-US'\n*/\nfunction getDefaultLocale() {\n\treturn getI18nManager().getDefaultLocale();\n}\n/**\n* Get the locale properties\n* @param {string} [locale] - The locale to get the properties for. When not provided, uses the current locale.\n* @returns The locale properties\n*\n* @example\n* const localeProperties = getLocaleProperties();\n*\n* @example\n* const localeProperties = getLocaleProperties('en-US');\n*/\nfunction getLocaleProperties(locale = getCurrentLocale()) {\n\treturn getI18nManager().getGTClass().getLocaleProperties(locale);\n}\n//#endregion\n//#region src/helpers/versionId.ts\n/**\n* Get the version ID for the current source\n* @returns The version ID, if set\n*\n* @example\n* const versionId = getVersionId();\n* console.log(versionId); // 'abc123'\n*/\nfunction getVersionId() {\n\treturn getI18nManager().getVersionId();\n}\n//#endregion\nexport { hashMessage as C, resolveDictionaryLookupOptions as E, TRANSLATIONS_CACHE_MISS_EVENT_NAME as S, isDictionaryObject as T, setI18nManager as _, getLocales as a, LOCALES_CACHE_MISS_EVENT_NAME as b, resolveJsxWithFallback as c, resolveStringContentWithFallback as d, resolveStringContentWithRuntimeFallback as f, setConditionStore as g, getI18nManager as h, getLocaleProperties as i, resolveJsxWithRuntimeFallback as l, getCurrentLocale as m, getDefaultLocale as n, createLookupOptions as o, interpolateMessage as p, getLocale as r, resolveJsx as s, getVersionId as t, resolveStringContent as u, I18nManager as v, getDictionaryEntry as w, LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME as x, DICTIONARY_CACHE_MISS_EVENT_NAME as y };\n\n//# sourceMappingURL=versionId-BTjLA0FZ.mjs.map","import { n as decodeOptions, r as interpolateIcuMessage, t as isEncodedTranslationOptions } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\n//#region src/translation-functions/msg/decodeMsg.ts\nfunction decodeMsg(encodedMsg) {\n\tif (typeof encodedMsg === \"string\" && encodedMsg.lastIndexOf(\":\") !== -1) return encodedMsg.slice(0, encodedMsg.lastIndexOf(\":\"));\n\treturn encodedMsg;\n}\n//#endregion\n//#region src/translation-functions/fallbacks/gtFallback.ts\n/**\n* A fallback function for the gt() function that decodes and interpolates.\n* @param {string | null | undefined} message - The ICU formatted message to interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns - The decoded and interpolated message.\n*\n* @note This function is useful as a placeholder when for incrementally migrating to the m() function.\n* @example\n* // A backwards compatible translation function\n* function getMessage(gt: GTFunctionType = gtFallback) {\n* return gt('Hello, world!');\n* }\n*\n* // Here i18n has been implemented\n* function WithTranslation() {\n* const gt = useGT();\n* return <>{getMessage(gt)}</>;\n* }\n*\n*\n* // i18n has not yet been implemented yet\n* function WithoutTranslations() {\n* return <>{getMessage()}</>;\n* }\n*/\nconst gtFallback = (message, options = {}) => {\n\treturn interpolateIcuMessage(message, options);\n};\n//#endregion\n//#region src/translation-functions/fallbacks/mFallback.ts\n/**\n* A fallback function for the m() function that decodes and interpolates.\n* @param {string | null | undefined} encodedMsg - The encoded message to decode and interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns - The decoded and interpolated message.\n*\n* @note This function is useful as a placeholder when for incrementally migrating to the m() function.\n* @example\n* // A backwards compatible translation function\n* function getMessage(m: MFunctionType = mFallback) {\n* return m(msg('Hello, world!'));\n* }\n*\n* // Here i18n has been implemented\n* function WithTranslation() {\n* const m = useMessages();\n* return <>{getMessage(m)}</>;\n* }\n*\n*\n* // i18n has not yet been implemented yet\n* function WithoutTranslations() {\n* return <>{getMessage()}</>;\n* }\n*/\nconst mFallback = (encodedMsg, options = {}) => {\n\tif (!encodedMsg) return encodedMsg;\n\tif (isEncodedTranslationOptions(decodeOptions(encodedMsg) ?? {})) return decodeMsg(encodedMsg);\n\treturn interpolateIcuMessage(encodedMsg, options);\n};\n//#endregion\nexport { gtFallback as n, decodeMsg as r, mFallback as t };\n\n//# sourceMappingURL=mFallback-pqVm9wDk.mjs.map","import { a as extractVariables, i as createInterpolationFailureMessage, n as decodeOptions, o as logger_default } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\nimport { C as hashMessage, a as getLocales, d as resolveStringContentWithFallback, i as getLocaleProperties, m as getCurrentLocale, n as getDefaultLocale, r as getLocale, t as getVersionId } from \"./versionId-BTjLA0FZ.mjs\";\nimport { n as gtFallback, r as decodeMsg, t as mFallback } from \"./mFallback-pqVm9wDk.mjs\";\nimport { VAR_IDENTIFIER, declareStatic, declareVar, decodeVars, derive, encode, libraryDefaultLocale } from \"generaltranslation/internal\";\nimport { formatMessage } from \"@generaltranslation/format\";\n//#region src/translation-functions/t.ts\n/**\n* Translate a message\n* @param {string} message - The message to translate.\n* @param options - The options for the translation.\n* @returns The translated message.\n*/\nfunction t(message, options = {}) {\n\treturn resolveStringContentWithFallback(options.$locale ?? getCurrentLocale(), message, {\n\t\t$format: \"ICU\",\n\t\t...options\n\t});\n}\n//#endregion\n//#region src/translation-functions/msg/msg.ts\nfunction msg(message, options) {\n\tif (typeof message !== \"string\") {\n\t\tif (!options) return message;\n\t\treturn message.map((m, i) => msg(m, {\n\t\t\t...options,\n\t\t\t...options.$id && { $id: `${options.$id}.${i}` }\n\t\t}));\n\t}\n\tif (!options) return message;\n\tconst variables = extractVariables(options);\n\tlet interpolatedString = message;\n\ttry {\n\t\tinterpolatedString = formatMessage(message, {\n\t\t\tlocales: [libraryDefaultLocale],\n\t\t\tvariables: {\n\t\t\t\t...variables,\n\t\t\t\t[VAR_IDENTIFIER]: \"other\"\n\t\t\t}\n\t\t});\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(message));\n\t\treturn message;\n\t}\n\tconst $_source = message;\n\tconst $_hash = options.$_hash || hashMessage(message, {\n\t\t$format: \"ICU\",\n\t\t...options\n\t});\n\tconst encodedOptions = {\n\t\t...options,\n\t\t$_source,\n\t\t$_hash\n\t};\n\tconst optionsEncoding = encode(JSON.stringify(encodedOptions));\n\treturn `${interpolatedString}:${optionsEncoding}`;\n}\n//#endregion\nexport { declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocale, getLocaleProperties, getLocales, getVersionId, gtFallback, mFallback, msg, t };\n\n//# sourceMappingURL=index.mjs.map","import React from 'react';\n\n/**\n * Marks JSX children as derivable by the GT compiler and CLI.\n *\n * Use `<Derive>` inside translated JSX when child content is computed from\n * source code, but should still be discovered during extraction instead of\n * treated as a runtime interpolation variable. The CLI attempts to resolve the\n * derivable children into every possible static value and includes those values\n * in the source content that gets translated.\n *\n * `<Derive>` renders its children unchanged at runtime.\n *\n * Run `gt validate` after adding or changing `<Derive>` usage to verify that\n * each derivable expression can be resolved by the CLI before translating or\n * building.\n *\n * @example\n * ```jsx\n * function getSubject() {\n * return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n * }\n * ...\n * <T>\n * <Derive>\n * {getSubject()}\n * </Derive>\n * is going to school today.\n * </T>\n * ```\n *\n * @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.\n * @returns {T} The same children, unchanged at runtime.\n */\nfunction Derive<T extends React.ReactNode>({ children }: { children: T }): T {\n return children;\n}\n\n/**\n * @deprecated Use `<Derive>` instead.\n *\n * Marks JSX children as derivable by the GT compiler and CLI.\n *\n * Use `<Derive>` instead of `<Static>` for new code. This alias is kept for\n * backwards compatibility and renders its children unchanged at runtime.\n *\n * Run `gt validate` after adding or changing derived JSX content to verify that\n * each derivable expression can be resolved by the CLI before translating or\n * building.\n *\n * @example\n * ```jsx\n * function getSubject() {\n * return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n * }\n * ...\n * <T>\n * <Static>\n * {getSubject()}\n * </Static>\n * is going to school today.\n * </T>\n * ```\n *\n * @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.\n * @returns {T} The same children, unchanged at runtime.\n */\nfunction Static<T extends React.ReactNode>(props: { children: T }): T {\n return Derive(props);\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nDerive._gtt = 'derive';\nStatic._gtt = 'derive';\n\nexport { Derive, Static };\n","import { createContext, useContext } from 'react';\nimport { GTContextType } from '../types-dir/context';\n\nexport const GTContext = createContext<GTContextType | undefined>(undefined);\n\nexport default function useGTContext(\n errorString = 'useGTContext() must be used within a <GTProvider>!'\n): GTContextType {\n const context = useContext(GTContext);\n if (typeof context === 'undefined') {\n throw new Error(errorString);\n }\n return context;\n}\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<Num>` component renders a formatted number string, allowing customization of the name, default value, and formatting options.\n * It formats the number according to the current locale and optionally passed formatting options.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <Num\n * options={{ style: \"decimal\", maximumFractionDigits: 2 }}\n * >\n * 1000\n * </Num>\n * ```\n *\n * @param {number | string | null | undefined} children - Content to render inside the number component.\n * @param {string[]} [locales] - Optional locales to use for number formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.\n * @returns {React.JSX.Element} The formatted number component.\n */\nfunction Num({\n children,\n locales,\n options = {},\n}: {\n children: number | string | null | undefined;\n name?: string;\n locales?: string[];\n options?: Intl.NumberFormatOptions; // Optional options for the number formatting\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n\n let renderedValue: string | number =\n typeof children === 'string' ? parseFloat(children) : children;\n if (typeof renderedValue === 'number') {\n if (!locales) {\n locales ||= [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n // Using Intl.NumberFormat for consistent number formatting\n renderedValue = gt.formatNum(renderedValue, { locales, ...options });\n }\n return <>{renderedValue}</>;\n}\n/** @internal _gtt - The GT transformation for the component. */\nNum._gtt = 'variable-number';\n\nexport default Num;\n","import React from 'react';\n\n/**\n * The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.\n * If `children` is provided, it will be used; otherwise, the `value` is rendered.\n *\n * @example Inline usage:\n * ```jsx\n * function MyComponent() {\n * const name = 'Archie';\n * return (\n * <T>\n * <p>\n * Hello, <Var> {name} </Var>!\n * </p>\n * </T>\n * );\n * }\n * ```\n *\n *\n * @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.\n * @returns {JSX.Element} The rendered variable component with either `children` or `value`.\n */\nfunction Var({\n children,\n}: {\n children?: unknown;\n name?: string;\n}): React.JSX.Element | null {\n return <>{children}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nVar._gtt = 'variable-variable';\n\nexport default Var;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <Currency currency=\"USD\">\n * 1000\n * </Currency>\n * ```\n *\n * @param {number | string | null | undefined} children - Content to render inside the currency component.\n * @param {string} [currency=\"USD\"] - The currency type (e.g., USD, EUR, etc.).\n * @param {string[]} [locales] - Optional locales to use for currency formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options to customize how the currency is displayed.\n * @returns {JSX.Element} The formatted currency component.\n */\nfunction Currency({\n children,\n currency = 'USD',\n locales,\n options = {},\n}: {\n children: number | string | null | undefined;\n currency?: string;\n name?: string;\n locales?: string[];\n options?: Intl.NumberFormatOptions;\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n let renderedValue: string | number =\n typeof children === 'string' ? parseFloat(children) : children;\n if (typeof renderedValue === 'number') {\n if (!locales) {\n locales ||= [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n // Format the value using Intl.NumberFormat\n renderedValue = gt.formatCurrency(renderedValue, currency, {\n locales,\n ...options,\n });\n }\n\n return <>{renderedValue}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nCurrency._gtt = 'variable-currency';\n\nexport default Currency;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.\n * It utilizes the current locale and optional format settings to display the date.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <DateTime>\n * {new Date()}\n * </DateTime>\n * ```\n *\n * @param {Date} children - Content to render inside the date component.\n * @param {string[]} [locales] - Optional locales to use for date formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.\n * @returns {JSX.Element} The formatted date or time component.\n */\nfunction DateTime({\n children,\n locales,\n options = {},\n}: {\n children: Date | null | undefined;\n name?: string;\n locales?: string[];\n options?: Intl.DateTimeFormatOptions; // Optional formatting options for the date\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n\n if (!locales) {\n locales = [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n const result = gt\n .formatDateTime(children, { locales, ...options })\n .replace(/[\\u200F\\u202B\\u202E]/g, '');\n\n // Note: This component may cause hydration errors when the output differs\n // between server and client (e.g., different timezones or locales).\n // We cannot use suppressHydrationWarning because this is a purely logical\n // component that returns a text fragment, not a DOM element.\n return <>{result}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nDateTime._gtt = 'variable-datetime';\n\nexport default DateTime;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<RelativeTime>` component renders a localized relative time string\n * (e.g., \"2 hours ago\", \"in 3 days\") using `Intl.RelativeTimeFormat`.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * // Auto-select unit from a Date\n * <RelativeTime date={someDate} />\n * // → \"2 hours ago\"\n * ```\n *\n * @example\n * ```jsx\n * // Explicit value and unit\n * <RelativeTime value={-1} unit=\"day\" />\n * // → \"yesterday\"\n * ```\n *\n * @param {Date} [date] - A date to compute relative time from now. Mutually exclusive with `value`/`unit`.\n * @param {number} [value] - Explicit numeric value for relative time. Requires `unit`.\n * @param {Intl.RelativeTimeFormatUnit} [unit] - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year'). Required when using `value`.\n * @param {string} [name] - Optional name for the variable, used by the GT CLI for additional context during extraction.\n * @param {string[]} [locales] - Optional locales for formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.RelativeTimeFormatOptions} [options={}] - Optional formatting options following `Intl.RelativeTimeFormatOptions`.\n * @returns {JSX.Element | null} The formatted relative time string.\n */\nfunction RelativeTime({\n date,\n children,\n value,\n unit,\n baseDate,\n locales,\n options = {},\n}: {\n date?: Date | null | undefined;\n children?: Date | null | undefined;\n /** Used by the GT CLI for additional context during extraction. */\n name?: string;\n value?: number;\n unit?: Intl.RelativeTimeFormatUnit;\n /** Base date for computing relative time. Defaults to `new Date()` at render time. Required for hydration safety. */\n baseDate?: Date;\n locales?: string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n const gt = context?.gt || new GT();\n\n if (!locales) {\n locales = [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n\n // Resolve the date from either `date` prop or `children` (for backwards compat)\n const resolvedDate = date ?? children;\n\n if (process.env.NODE_ENV === 'development' && value !== undefined && !unit) {\n // eslint-disable-next-line no-console\n console.warn(\n '<RelativeTime>: `value` was provided without `unit`. The `value` prop will be ignored.'\n );\n }\n\n let result: string;\n\n if (value !== undefined && unit) {\n // Explicit value + unit mode\n result = gt.formatRelativeTime(value, unit, {\n locales,\n numeric: options.numeric,\n style: options.style,\n localeMatcher: options.localeMatcher,\n });\n } else if (resolvedDate != null) {\n // Auto-select unit from Date\n result = gt.formatRelativeTimeFromDate(resolvedDate, {\n locales,\n baseDate: baseDate ?? new Date(),\n numeric: options.numeric,\n style: options.style,\n localeMatcher: options.localeMatcher,\n });\n } else {\n return null;\n }\n\n // Note: This component may cause hydration errors when the output differs\n // between server and client (e.g., relative time changing between render passes).\n // We cannot use suppressHydrationWarning because this is a purely logical\n // component that returns a text fragment, not a DOM element.\n return <>{result}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nRelativeTime._gtt = 'variable-relative-time';\n\nexport default RelativeTime;\n","import Num from '../variables/Num';\nimport Var from '../variables/Var';\nimport Currency from '../variables/Currency';\nimport DateTime from '../variables/DateTime';\nimport RelativeTime from '../variables/RelativeTime';\nimport { RelativeTimeFormatOptions, RenderVariable } from '../types-dir/types';\n\nconst renderVariable: RenderVariable = ({\n variableType,\n variableValue,\n variableOptions,\n}) => {\n if (variableType === 'n') {\n const numOptions = variableOptions as Intl.NumberFormatOptions | undefined;\n const numValue =\n typeof variableValue === 'string' || typeof variableValue === 'number'\n ? variableValue\n : variableValue == null\n ? variableValue\n : undefined;\n return <Num options={numOptions}>{numValue}</Num>;\n } else if (variableType === 'd') {\n const dateTimeOptions = variableOptions as\n | Intl.DateTimeFormatOptions\n | undefined;\n const dateValue = variableValue instanceof Date ? variableValue : undefined;\n return <DateTime options={dateTimeOptions}>{dateValue}</DateTime>;\n } else if (variableType === 'c') {\n const currencyOptions = variableOptions as\n | Intl.NumberFormatOptions\n | undefined;\n const currencyValue =\n typeof variableValue === 'string' || typeof variableValue === 'number'\n ? variableValue\n : variableValue == null\n ? variableValue\n : undefined;\n return <Currency options={currencyOptions}>{currencyValue}</Currency>;\n } else if (variableType === 'rt') {\n // RelativeTime supports two modes:\n // 1. value + unit (e.g., value=-3, unit=\"hour\") — explicit relative time\n // 2. date (Date object) — auto-select unit from date difference\n const relativeTimeOptions = variableOptions as\n | RelativeTimeFormatOptions\n | undefined;\n if (typeof variableValue === 'number' && relativeTimeOptions?.unit) {\n return (\n <RelativeTime\n value={variableValue}\n unit={relativeTimeOptions.unit}\n baseDate={relativeTimeOptions?.baseDate}\n options={relativeTimeOptions}\n />\n );\n }\n const dateValue =\n variableValue instanceof Date\n ? variableValue\n : typeof variableValue === 'string' || typeof variableValue === 'number'\n ? new Date(variableValue)\n : undefined;\n return (\n <RelativeTime\n date={dateValue && !isNaN(dateValue.getTime()) ? dateValue : undefined}\n baseDate={relativeTimeOptions?.baseDate}\n options={relativeTimeOptions}\n />\n );\n }\n return <Var>{variableValue}</Var>;\n};\nexport default renderVariable;\n","// dangerouslyUseable.ts\n// A tiny Suspense-compatible cache for client-created promises.\n// Works with React 19's `use()` and <Suspense/>, but is *not* officially supported.\n// Caveats: dev-only behavior/warnings may change across React minors.\n\nexport type CacheKey =\n | string\n | number\n | symbol\n | ReadonlyArray<unknown>\n | Readonly<Record<string, unknown>>;\n\ntype Status = 'pending' | 'fulfilled' | 'rejected';\n\nexport type Thenable<T> = Promise<T> & {\n status?: Status;\n value?: T;\n reason?: unknown;\n};\n\ntype Cell<T> = {\n thenable: Thenable<T>;\n createdAt: number;\n expiresAt: number; // ms epoch\n};\n\nexport type UseableOptions = {\n /** How long to keep a resolved/rejected promise before it’s eligible for GC. Default: Infinity */\n ttl?: number;\n /** Provide your own Map if you want scoping or SSR hydration games. */\n cache?: Map<string, Cell<unknown>>;\n};\n\nconst DEFAULT_TTL = Number.POSITIVE_INFINITY;\nconst REGISTRY_KEY = '__DANGEROUS_USE_REGISTRY__';\n\ntype GlobalRegistry = typeof globalThis & {\n [REGISTRY_KEY]?: Map<string, Cell<unknown>>;\n};\n\n// Module-scoped cache; you can pass your own via options.\nconst registryGlobal = globalThis as GlobalRegistry;\nconst globalRegistry: Map<string, Cell<unknown>> = registryGlobal[\n REGISTRY_KEY\n] ?? (registryGlobal[REGISTRY_KEY] = new Map());\n\n/** Stable-ish stringify for keys. */\nfunction stableStringify(x: unknown, seen = new WeakSet<object>()): string {\n const t = typeof x;\n if (x == null || t === 'number' || t === 'boolean' || t === 'bigint')\n return String(x);\n if (t === 'string') return JSON.stringify(x);\n if (t === 'symbol') return `:sym(${(x as symbol).description ?? ''})`;\n if (t === 'function') return `:fn(${(x as Function).name || 'anon'})`;\n if (Array.isArray(x))\n return `[${x.map((v) => stableStringify(v, seen)).join(',')}]`;\n if (t === 'object') {\n const obj = x as Record<string, unknown>;\n if (seen.has(obj)) return ':circular';\n seen.add(obj);\n const keys = Object.keys(obj).sort();\n const body = keys\n .map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`)\n .join(',');\n seen.delete(obj);\n return `{${body}}`;\n }\n return String(x);\n}\n\nfunction keyToString(key: CacheKey): string {\n if (\n typeof key === 'string' ||\n typeof key === 'number' ||\n typeof key === 'symbol'\n ) {\n return String(key);\n }\n return stableStringify(key);\n}\n\n/** Mark a native promise with status/value/reason and return it as a Thenable. */\nfunction instrument<T>(p: Promise<T>): Thenable<T> {\n const t = p as Thenable<T>;\n if (t.status == null) {\n t.status = 'pending';\n p.then(\n (v) => {\n t.status = 'fulfilled';\n t.value = v;\n },\n (e) => {\n t.status = 'rejected';\n t.reason = e;\n }\n );\n }\n return t;\n}\n\n/**\n * Create or load a cached thenable for use() *even if* it's created during render.\n * On first call (per key), invokes `create()`, instruments the promise,\n * caches it, and returns the same thenable instance forever (or until invalidated / TTL elapses).\n */\nexport function useable<T>(\n key: CacheKey,\n create: () => Promise<T>,\n opts?: UseableOptions\n): Thenable<T> {\n const registry = opts?.cache ?? globalRegistry;\n const now = Date.now();\n const ttl = opts?.ttl ?? DEFAULT_TTL;\n const k = keyToString(key);\n\n const hit = registry.get(k);\n if (hit && hit.expiresAt > now) return hit.thenable as Thenable<T>;\n\n // Miss (or expired): create once and cache\n const base = create();\n const thenable = instrument(base);\n const cell: Cell<T> = {\n thenable,\n createdAt: now,\n expiresAt: now + ttl,\n };\n registry.set(k, cell);\n\n if (ttl !== Infinity) {\n // Optional post-set cleanup: once settled, schedule removal after TTL.\n const cleanup = () => {\n const latest = registry.get(k);\n if (latest && latest.thenable === thenable) {\n setTimeout(\n () => {\n const stillLatest = registry.get(k);\n if (stillLatest && stillLatest.thenable === thenable) {\n registry.delete(k);\n }\n },\n Math.max(0, ttl)\n );\n }\n };\n thenable.then(cleanup, cleanup);\n }\n\n return thenable;\n}\n\n/** Kick off work early without reading. */\nexport function preload<T>(\n key: CacheKey,\n create: () => Promise<T>,\n opts?: UseableOptions\n): void {\n void useable(key, create, opts);\n}\n\n/** Invalidate a key; the next call will recreate the promise. */\nexport function invalidate(key: CacheKey, opts?: UseableOptions): void {\n const registry = opts?.cache ?? globalRegistry;\n registry.delete(keyToString(key));\n}\n\n/** If resolved, synchronously read the cached value without suspending. */\nexport function peek<T>(key: CacheKey, opts?: UseableOptions): T | undefined {\n const registry = opts?.cache ?? globalRegistry;\n const cell = registry.get(keyToString(key));\n const t = cell?.thenable as Thenable<T> | undefined;\n return t?.status === 'fulfilled' ? t.value : undefined;\n}\n\n/**\n * ⚠️ DEV-ONLY: Mute React’s \"uncached promise\" console warning.\n * You should NOT need this if you use `useable()` correctly, but… you asked for risky.\n */\nexport function muteReactUncachedPromiseWarning(enable = true): void {\n if (typeof window === 'undefined') return; // only patch in browser\n const CONSOLE_FLAG = '__DANGEROUS_MUTE_REACT_UNCACHED_PROMISE__';\n const pattern = /A component was suspended by an uncached promise/i;\n const patchedConsole = console as Console & Record<string, unknown>;\n if (enable) {\n if (!patchedConsole[CONSOLE_FLAG]) {\n const originalError = console.error.bind(console);\n patchedConsole[CONSOLE_FLAG] = true;\n console.error = (...args: unknown[]) => {\n if (typeof args[0] === 'string' && pattern.test(args[0])) return;\n originalError(...args);\n };\n }\n } else if (patchedConsole[CONSOLE_FLAG]) {\n // There is no safe way to restore the original without storing it;\n // If you need toggling, store and restore explicitly.\n }\n}\n","// The code in this file is adapted from gt-next's React 18/19 compatibility shim.\n// It avoids statically importing `use` from React so bundlers don't attempt\n// to resolve a non-existent named export in React 18.\n\nimport * as React from 'react';\n\n// `use` is only officially available in React 19. Some environments (e.g. Next)\n// vendor it earlier, but plain React 18 does not export it.\n// Use an opaque property access to prevent bundlers from rewriting\n// this into a static named import.\nlet reactUse: typeof React.use | undefined;\ntry {\n // Indirect property access via Function constructor avoids static analysis.\n const getProp = Function('o', 'k', 'return o[k]') as (\n o: unknown,\n k: string\n ) => unknown;\n reactUse = getProp(React as unknown, 'use') as typeof React.use | undefined;\n} catch {\n // ignore\n}\n\nexport default reactUse;\n","import React, { Suspense } from 'react';\nimport renderDefaultChildren from '../rendering/renderDefaultChildren';\nimport { addGTIdentifier, writeChildrenAsObjects } from '../internal';\nimport useGTContext from '../provider/GTContext';\nimport renderTranslatedChildren from '../rendering/renderTranslatedChildren';\nimport { useMemo } from 'react';\nimport renderVariable from '../rendering/renderVariable';\nimport { hashSource } from 'generaltranslation/id';\nimport renderSkeleton from '../rendering/renderSkeleton';\nimport { TranslatedChildren } from '../types-dir/types';\nimport { useable } from '../promises/dangerouslyUsable';\nimport reactUse from '../utils/use';\n\n/**\n * Build-time translation component that renders its children in the user's given locale.\n *\n * @example\n * ```jsx\n * // Basic usage:\n * <T id=\"welcome_message\">\n * Hello, <Var>{name}</Var>!\n * </T>\n * ```\n *\n * @example\n * ```jsx\n * // Translating a plural\n * <T id=\"item_count\">\n * <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>\n * You have <Num children={n}/> items.\n * </Plural>\n * </T>\n * ```\n *\n * @param {React.ReactNode} children - The content to be translated or displayed.\n * @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.\n * @param {any} [context] - Additional context for translation key generation.\n *\n * @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.\n *\n * @throws {Error} If a plural translation is requested but the `n` option is not provided.\n */\nfunction T({\n children,\n id,\n context,\n _hash,\n ...options\n}: {\n children: React.ReactNode;\n id?: string;\n context?: string;\n _hash?: string;\n $id?: string;\n $context?: string;\n $maxChars?: number;\n [key: string]: unknown;\n}): React.JSX.Element | undefined {\n if (!children) return undefined;\n\n // Compatibility with different options\n id = id ?? options?.$id;\n context = context ?? options?.$context;\n const maxChars =\n typeof options?.$maxChars === 'number' ? options.$maxChars : undefined;\n\n const {\n translations,\n translationRequired,\n developmentApiEnabled,\n dialectTranslationRequired,\n registerJsxForTranslation,\n renderSettings,\n locale,\n defaultLocale,\n } = useGTContext(`<T> used on the client-side outside of <GTProvider>`);\n\n const taggedChildren = useMemo(() => addGTIdentifier(children), [children]);\n\n // ----- FETCH TRANSLATION ----- //\n\n // Dependency flag to avoid recalculating hash whenever translation object changes\n\n let translationEntry: TranslatedChildren | null | undefined;\n\n if (id) {\n translationEntry = translations?.[id];\n }\n\n if (typeof translationEntry === 'undefined' && _hash) {\n translationEntry = translations?.[_hash];\n }\n\n // Calculate necessary info for fetching translation / generating translation\n const [childrenAsObjects, hash] = useMemo(() => {\n // skip hashing:\n if (\n !translationRequired || // Translation not required\n translationEntry // Translation already exists under the id\n ) {\n return [undefined, ''];\n }\n // calculate hash\n const childrenAsObjects = writeChildrenAsObjects(taggedChildren);\n const hash: string = hashSource({\n source: childrenAsObjects,\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(id && { id }),\n dataFormat: 'JSX',\n });\n return [childrenAsObjects, hash];\n }, [\n taggedChildren,\n context,\n id,\n maxChars,\n translationRequired,\n translationEntry,\n ]);\n\n // get translation entry on hash\n if (typeof translationEntry === 'undefined') {\n translationEntry = translations?.[hash];\n }\n\n // ----- RENDER METHODS ----- //\n\n // for default/fallback rendering\n const renderDefault = () => {\n return renderDefaultChildren({\n children: taggedChildren,\n defaultLocale,\n renderVariable,\n });\n };\n\n const renderTranslation = (target: TranslatedChildren) => {\n return renderTranslatedChildren({\n source: taggedChildren,\n target,\n locales: [locale, defaultLocale],\n renderVariable,\n });\n };\n\n // ----- RENDER BEHAVIOR ----- //\n\n // Fallback if:\n if (\n !translationRequired || // no translation required\n // !translationEnabled || // translation not enabled\n (translations && !translationEntry && !developmentApiEnabled) || // cache miss and dev runtime translation disabled (production)\n translationEntry === null // error fetching translation\n ) {\n return <>{renderDefault()}</>;\n }\n\n if (translationEntry) {\n return (\n <Suspense fallback={renderTranslation(translationEntry)}>\n {renderTranslation(translationEntry)}\n </Suspense>\n );\n }\n\n const getTranslationPromise = async () => {\n if (\n !developmentApiEnabled || // runtime translation disabled\n !locale // locale not loaded\n ) {\n return renderDefault();\n }\n if (translationEntry) return renderTranslation(translationEntry);\n try {\n const translatedChildren = await registerJsxForTranslation({\n source: childrenAsObjects,\n targetLocale: locale,\n metadata: {\n id,\n hash,\n context,\n ...(maxChars != null && { maxChars }),\n },\n });\n if (!translatedChildren) return renderDefault();\n return renderTranslation(translatedChildren);\n } catch (error) {\n console.warn(error);\n return renderDefault();\n }\n };\n\n if (reactUse) {\n const resolvedTranslation = reactUse(\n useable(\n [\n 'getTranslationPromise', // prefix key\n developmentApiEnabled,\n JSON.stringify(childrenAsObjects),\n locale,\n id,\n hash,\n context,\n maxChars,\n ],\n () => getTranslationPromise()\n )\n );\n return (\n <Suspense fallback={resolvedTranslation}>{resolvedTranslation}</Suspense>\n );\n }\n\n let loadingFallback;\n if (renderSettings.method === 'skeleton') {\n loadingFallback = renderSkeleton();\n } else if (renderSettings.method === 'replace') {\n loadingFallback = renderDefault();\n } else {\n // default\n loadingFallback = dialectTranslationRequired\n ? renderDefault()\n : renderSkeleton();\n }\n\n return (\n <Suspense fallback={loadingFallback}>{getTranslationPromise()}</Suspense>\n );\n}\n/** @internal _gtt - The GT transformation for the component. */\nT._gtt = 'translate-client';\n\nexport default T;\n","import useGTContext from '../../provider/GTContext';\nimport { _Messages, Translations } from '../../types-dir/types';\nimport { useable } from '../../promises/dangerouslyUsable';\nimport { useCallback } from 'react';\nimport reactUse from '../../utils/use';\n\n/**\n * Gets the translation function `gt` provided by `<GTProvider>`.\n *\n * @returns {Function} A translation function that accepts an ICU message format string and returns the translation of that string.\n *\n * @example\n * const gt = useGT();\n * console.log(gt('To be or not to be...'));\n *\n * @example\n * const gt = useGT();\n * gt('My name is {customName}', { customName: \"Brian\", id: 'my-name', context: 'a proper noun' } )\n */\nexport default function useGT(_messages?: _Messages) {\n const {\n developmentApiEnabled,\n translationRequired,\n _preloadMessages,\n _filterMessagesForPreload,\n _gtFunction,\n locale,\n } = useGTContext(\n `useGT(): No context provided. You're trying to get the gt() function from the useGT() hook, which can be called within a <GTProvider>.`\n );\n\n let preloadedTranslations: Translations | undefined;\n if (_messages && reactUse && developmentApiEnabled && translationRequired) {\n const untranslatedMessages = _filterMessagesForPreload(_messages);\n if (untranslatedMessages.length > 0) {\n preloadedTranslations = reactUse(\n useable(\n [\n '_preloadMessages', // prefix key\n locale, // should change on locale\n JSON.stringify(untranslatedMessages), // should change when messages change\n ],\n () => _preloadMessages(untranslatedMessages)\n )\n );\n }\n }\n\n function _gt(\n string: string,\n options: Record<string, unknown> & {\n $id?: string;\n $context?: string;\n $maxChars?: number;\n $_hash?: string;\n } = {}\n ): string {\n return _gtFunction(string, options, preloadedTranslations);\n }\n\n /**\n * @param {string} message\n * @param {InlineTranslationOptions} options Interpolated variables and translation context.\n * @param {string} [options.$context] - Additional context for the translation.\n * @param {string} [options.$id] - Optional identifier for the translation string.\n * @param {number} [options.$maxChars] - Maximum number of characters for the translated message.\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @returns The translated version of content\n *\n * @example\n * gt('Hello, world!'); // Translates 'Hello, world!'\n *\n * @example\n * // With a context and a custom identifier:\n * gt('My name is {name}', { name: \"John\", $context: 'name is a proper noun' } )); // Translates 'My name is {name}' and replaces {name} with 'John'\n */\n const gt = useCallback(_gt, [preloadedTranslations, _gtFunction]);\n\n return gt;\n}\n","import useGTContext from '../../provider/GTContext';\n\n/**\n * Gets the dictionary access function `t` provided by `<GTProvider>`.\n *\n * @param {string} [id] - Optional prefix to prepend to the translation keys.\n * @returns {Function} A translation function that accepts a key string and returns the translated value.\n *\n * @example\n * const t = useTranslations('user');\n * console.log(t('name')); // Translates item 'user.name'\n *\n * const t = useTranslations();\n * console.log(t('hello')); // Translates item 'hello'\n */\nexport default function useTranslations(id?: string): ((\n id: string,\n options?: Record<string, unknown>\n) => string) & {\n obj: (id: string, options?: Record<string, unknown>) => unknown | undefined;\n} {\n // Create a prefix for translation keys if an id is provided\n const getId = (suffix: string) => {\n return id ? `${id}.${suffix}` : suffix;\n };\n\n // Get the translation context\n const { _dictionaryFunction, _dictionaryObjFunction } = useGTContext(\n `useTranslations('${id}'): No context provided. You're trying to get the t() function on the client, which can only be done inside a <GTProvider>.`\n );\n\n /**\n * @description A function that translates a dictionary entry based on its `id` and options.\n * @param {string} id The identifier of the dictionary entry to translate.\n * @param {DictionaryTranslationOptions} options for translating strings.\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @param {number} [options.$maxChars] - Maximum number of characters for the translated message.\n * @returns The translated version of the dictionary entry.\n *\n * @example\n * t('greetings.greeting1'); // Translates item in dictionary under greetings.greeting1\n *\n * @example\n * // dictionary entry\n * {\n * greetings: {\n * greeting2: \"Hello, {name}!\"\n * greeting3: [\"Hi, {name}!\", { $context: 'an informal greeting' }]\n * }\n * }\n *\n * // Translates item in dictionary under greetings.greeting2 and replaces {name} with 'John'\n * t('greetings.greeting2', { name: 'John' });\n *\n * // Translates item in dictionary under greetings.greeting3 and replaces {name} with 'John'\n * t('greetings.greeting3', { name: 'John' });\n */\n function t(id: string, options: Record<string, unknown> = {}): string {\n const prefixedId = getId(id);\n return _dictionaryFunction(prefixedId, options);\n }\n\n function obj(\n id: string,\n options: Record<string, unknown> = {}\n ): unknown | undefined {\n const prefixedId = getId(id);\n return _dictionaryObjFunction(id, prefixedId, options);\n }\n\n t.obj = obj;\n\n return t;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the application's default locale from the `<GTProvider>` context.\n *\n * If no default locale is passed to the `<GTProvider>`, it defaults to providing 'en'.\n *\n * @returns {string} The application's default locale, e.g., 'en-US'.\n *\n * @example\n * const locale = useDefaultLocale();\n * console.log(locale); // 'en-US'\n */\nexport default function useDefaultLocale(): string {\n return useGTContext(\n 'useDefaultLocale(): Unable to access default locale outside of a <GTProvider>'\n ).defaultLocale;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the user's locale from the `<GTProvider>` context.\n *\n * @returns {string} The user's locale, e.g., 'en-US'.\n *\n * @example\n * const locale = useLocale();\n * console.log(locale); // 'en-US'\n */\nexport default function useLocale(): string {\n return useGTContext(\n \"useLocale(): Unable to access user's locale outside of a <GTProvider>\"\n ).locale;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the version ID from the `<GTProvider>` context.\n *\n * @returns {string | undefined} The version ID for the current source, if set.\n *\n * @example\n * const versionId = useVersionId();\n * console.log(versionId); // 'abc123'\n */\nexport default function useVersionId(): string | undefined {\n return useGTContext(\n 'useVersionId(): Unable to access version ID outside of a <GTProvider>'\n )._versionId;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * A React hook that retrieves the user's currently selected region from the `<GTProvider>` context.\n *\n * Returns the `region` value as a string (e.g., `\"US\"`, `\"CA\"`) or `undefined` if no region has been set.\n *\n * @returns {string | undefined} The currently active region code, or `undefined` if not set.\n *\n * @example\n * ```tsx\n * const region = useRegion();\n *\n * if (!region) {\n * console.log(\"No region set yet\");\n * } else {\n * console.log(`Current region: ${region}`);\n * }\n * ```\n */\nexport default function useRegion(): string | undefined {\n return useGTContext(\n \"useRegion(): Unable to access user's region outside of a <GTProvider>\"\n ).region;\n}\n","import * as React from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n dynamicTranslationError,\n createGenericRuntimeTranslationError,\n runtimeTranslationTimeoutWarning,\n} from '../../errors-dir/createErrors';\nimport {\n RenderMethod,\n TranslatedChildren,\n Translations,\n} from '../../types-dir/types';\nimport {\n TranslateIcuCallback,\n TranslateChildrenCallback,\n} from '../../types-dir/runtime';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport {\n maxConcurrentRequests,\n maxBatchSize,\n batchInterval,\n} from '../config/defaultProps';\nimport { GT } from 'generaltranslation';\nimport type { TranslateManyEntry } from 'generaltranslation/types';\n\ntype TranslationRequestMetadata = {\n hash: string;\n id?: string;\n context?: string;\n maxChars?: number;\n [attr: string]: unknown;\n};\n\ntype TranslationRequestQueueItem =\n | {\n dataFormat: 'ICU';\n source: string;\n metadata: TranslationRequestMetadata;\n resolve: (value: TranslatedChildren) => void;\n reject: (error: unknown) => void; // kept for API compatibility (unused after change)\n }\n | {\n dataFormat: 'JSX';\n source: JsxChildren;\n metadata: TranslationRequestMetadata;\n resolve: (value: TranslatedChildren) => void;\n reject: (error: unknown) => void; // kept for API compatibility (unused after change)\n };\n\nexport default function useRuntimeTranslation({\n gt,\n locale,\n versionId: _versionId, // kept for API compatibility (not used)\n defaultLocale,\n runtimeUrl,\n renderSettings,\n setTranslations,\n environment,\n ...additionalMetadata\n}: {\n gt: GT;\n locale: string;\n versionId?: string;\n defaultLocale?: string;\n runtimeUrl?: string | null;\n renderSettings: {\n method: RenderMethod;\n timeout?: number;\n };\n environment: 'development' | 'production' | 'test';\n setTranslations: React.Dispatch<React.SetStateAction<Translations | null>>;\n [key: string]: unknown;\n}): {\n registerIcuForTranslation: TranslateIcuCallback;\n registerJsxForTranslation: TranslateChildrenCallback;\n developmentApiEnabled: boolean;\n} {\n // ------ EARLY RETURN IF DISABLED ----- //\n const developmentApiEnabled =\n !!gt.projectId &&\n !!runtimeUrl &&\n !!gt.devApiKey &&\n environment === 'development';\n\n if (!developmentApiEnabled) {\n const disabledError = (fn: string) =>\n Promise.reject(\n new Error(`${fn}() failed because translation is disabled`)\n );\n return {\n developmentApiEnabled,\n registerIcuForTranslation: () =>\n disabledError('registerIcuForTranslation'),\n registerJsxForTranslation: () =>\n disabledError('registerJsxForTranslation'),\n };\n }\n\n // ---------- CONFIG SNAPSHOT (stable via ref, updated each render) ---------- //\n const cfgRef = useRef({\n gt,\n locale,\n baseMetadata: {\n ...additionalMetadata,\n projectId: gt.projectId,\n sourceLocale: defaultLocale,\n },\n timeout: renderSettings.timeout,\n });\n cfgRef.current.gt = gt;\n cfgRef.current.locale = locale;\n cfgRef.current.baseMetadata = {\n ...additionalMetadata,\n projectId: gt.projectId,\n sourceLocale: defaultLocale,\n };\n cfgRef.current.timeout = renderSettings.timeout;\n\n // ---------- LIFECYCLE & STAGING (avoid setState before mount) ---------- //\n const mountedRef = useRef(false);\n const stagedResultsRef = useRef<Translations | null>(null);\n const [flushTick, setFlushTick] = useState(0);\n\n const mergeIntoTranslations = useCallback(\n (delta: Translations) => {\n setTranslations((prev) => {\n const keys = Object.keys(delta);\n if (keys.length === 0) return prev;\n const next = prev ? { ...prev } : {};\n let changed = false;\n for (const k of keys) {\n const nv = delta[k];\n const pv = prev?.[k];\n if (!Object.is(pv, nv)) {\n next[k] = nv;\n changed = true;\n }\n }\n return changed ? next : prev;\n });\n },\n [setTranslations]\n );\n\n const stageAndRequestFlush = useCallback((delta: Translations) => {\n stagedResultsRef.current = {\n ...stagedResultsRef.current,\n ...delta,\n };\n // Only trigger a state change after mount; before mount, we'll flush on mount.\n if (mountedRef.current) setFlushTick((t) => t + 1);\n }, []);\n\n // Mount/unmount: mark mounted and flush anything staged pre-mount.\n useEffect(() => {\n mountedRef.current = true;\n if (stagedResultsRef.current) {\n const staged = stagedResultsRef.current;\n stagedResultsRef.current = null;\n mergeIntoTranslations(staged);\n }\n return () => {\n mountedRef.current = false;\n };\n }, [mergeIntoTranslations]);\n\n // Perform the actual setTranslations in an effect (runs post-commit).\n useEffect(() => {\n if (!mountedRef.current) return;\n const staged = stagedResultsRef.current;\n if (staged) {\n stagedResultsRef.current = null;\n mergeIntoTranslations(staged);\n }\n }, [flushTick, mergeIntoTranslations]);\n\n // ---------- REQUEST/QUEUE STATE ---------- //\n const activeRequestsRef = useRef(0);\n const requestQueueRef = useRef<Map<string, TranslationRequestQueueItem>>(\n new Map()\n );\n const pendingRequestQueueRef = useRef<\n Map<string, Promise<TranslatedChildren>>\n >(new Map());\n\n // ---------- BATCH SENDER (no state writes here) ---------- //\n const sendBatchRequest = useCallback(\n async (\n batch: Map<string, TranslationRequestQueueItem>\n ): Promise<Translations> => {\n if (batch.size === 0) return {};\n activeRequestsRef.current += 1;\n\n const { gt, locale, baseMetadata, timeout } = cfgRef.current;\n const requests = Array.from(batch.values());\n const newTranslations: Translations = {};\n const resultsMap = new Map<string, TranslatedChildren | null>();\n\n try {\n const requestsRecord: Record<string, TranslateManyEntry> = {};\n for (const req of requests) {\n const { source, metadata } = req;\n requestsRecord[metadata.hash] = {\n source,\n metadata: { ...metadata, dataFormat: req.dataFormat },\n };\n }\n\n const results = await gt.translateMany(\n requestsRecord,\n {\n ...baseMetadata,\n targetLocale: locale,\n },\n timeout\n );\n\n for (const req of requests) {\n const { hash, id } = req.metadata;\n const result = results[hash];\n if (result && result.success) {\n const value = result.translation;\n newTranslations[hash] = value;\n resultsMap.set(hash, value);\n } else if (result && result.error) {\n console.warn(\n createGenericRuntimeTranslationError(\n id,\n hash,\n result.error || 'An upstream error occurred.'\n )\n );\n newTranslations[hash] = null;\n resultsMap.set(hash, null);\n } else {\n console.warn(\n createGenericRuntimeTranslationError(\n id,\n hash,\n 'Unknown response format'\n ),\n result\n );\n newTranslations[hash] = null;\n resultsMap.set(hash, null);\n }\n }\n } catch (e: unknown) {\n if (\n typeof e === 'object' &&\n e !== null &&\n 'name' in e &&\n e.name === 'AbortError'\n ) {\n console.warn(runtimeTranslationTimeoutWarning);\n } else {\n console.warn(dynamicTranslationError, e);\n }\n // Mark every request in this batch as null, and warn.\n requests.forEach((r) => {\n newTranslations[r.metadata.hash] = null;\n resultsMap.set(r.metadata.hash, null);\n });\n } finally {\n activeRequestsRef.current -= 1;\n // Resolve the promises for this batch (never reject).\n requests.forEach((r) => {\n const res = resultsMap.get(r.metadata.hash);\n if (res === undefined) {\n console.warn(\n `No translation result for ${r.metadata.hash}; resolving as null.`\n );\n r.resolve(null as unknown as TranslatedChildren);\n } else {\n r.resolve(res as TranslatedChildren);\n }\n });\n }\n\n return newTranslations;\n },\n []\n );\n\n // ---------- TIMER-DRIVEN FLUSHER (no polling effect) ---------- //\n const flushTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const tickRef = useRef<() => Promise<void>>(async () => {});\n\n const stageAndScheduleNext = useCallback(\n (batchResult: Translations) => {\n // Stage results and request the commit effect to run\n stageAndRequestFlush(batchResult);\n\n // If more work remains, schedule another flush cycle\n if (requestQueueRef.current.size > 0) {\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n }\n },\n [stageAndRequestFlush]\n );\n\n const installTick = useCallback(() => {\n tickRef.current = async () => {\n // Respect concurrency cap\n if (activeRequestsRef.current >= maxConcurrentRequests) {\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n return;\n }\n\n const q = requestQueueRef.current;\n if (q.size === 0) return;\n\n const batchEntries = Array.from(q.entries()).slice(\n 0,\n Math.min(maxBatchSize, q.size)\n );\n const batch = new Map(batchEntries);\n batchEntries.forEach(([k]) => q.delete(k));\n\n const batchResult = await sendBatchRequest(batch);\n stageAndScheduleNext(batchResult);\n };\n }, [sendBatchRequest, stageAndScheduleNext]);\n\n const scheduleFlush = useCallback(\n (immediate = false) => {\n installTick();\n if (immediate) {\n if (flushTimerRef.current) {\n clearTimeout(flushTimerRef.current);\n flushTimerRef.current = null;\n }\n void tickRef.current(); // Safe pre-mount: will only stage results\n return;\n }\n if (flushTimerRef.current) return; // already armed\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n },\n [installTick]\n );\n\n // ---------- REGISTRATION (returns Promises for Suspense) ---------- //\n const createRegistration = useCallback(\n <T extends 'ICU' | 'JSX'>(dataFormat: T) =>\n (params: {\n source: T extends 'ICU' ? string : JsxChildren | undefined;\n targetLocale: string;\n metadata: TranslationRequestMetadata;\n }): Promise<TranslatedChildren> => {\n const key = `${params.metadata.hash}:${params.targetLocale}`;\n\n const existing = pendingRequestQueueRef.current.get(key);\n if (existing) return existing;\n\n const p = new Promise<TranslatedChildren>((resolve /*, reject */) => {\n const item: TranslationRequestQueueItem =\n dataFormat === 'JSX'\n ? {\n dataFormat: 'JSX',\n source: params.source as JsxChildren,\n metadata: {\n ...params.metadata,\n ...(params.metadata.maxChars != null && {\n maxChars: Math.abs(params.metadata.maxChars),\n }),\n },\n resolve,\n reject: () => {}, // no-op; we no longer reject\n }\n : {\n dataFormat: 'ICU',\n source: params.source as string,\n metadata: {\n ...params.metadata,\n ...(params.metadata.maxChars != null && {\n maxChars: Math.abs(params.metadata.maxChars),\n }),\n },\n resolve,\n reject: () => {}, // no-op; we no longer reject\n };\n\n requestQueueRef.current.set(key, item);\n\n const canFlushNow =\n requestQueueRef.current.size >= maxBatchSize &&\n activeRequestsRef.current < maxConcurrentRequests;\n\n // Kick the scheduler; immediate is safe (no state writes pre-mount)\n scheduleFlush(canFlushNow);\n }).finally(() => {\n pendingRequestQueueRef.current.delete(key);\n });\n\n pendingRequestQueueRef.current.set(key, p);\n return p;\n },\n [scheduleFlush]\n );\n\n const registerIcuForTranslation = useMemo(\n () => createRegistration('ICU'),\n [createRegistration]\n );\n const registerJsxForTranslation = useMemo(\n () => createRegistration('JSX'),\n [createRegistration]\n );\n\n // Cleanup any stray timer on unmount (does not drive batching)\n useEffect(() => {\n return () => {\n if (flushTimerRef.current) clearTimeout(flushTimerRef.current);\n };\n }, []);\n\n return {\n developmentApiEnabled,\n registerIcuForTranslation,\n registerJsxForTranslation,\n };\n}\n","import { hashSource } from 'generaltranslation/id';\nimport {\n InlineTranslationOptions,\n Translations,\n _Messages,\n _Message,\n} from '../../../types-dir/types';\nimport type { StringFormat } from '@generaltranslation/format/types';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport { GT } from 'generaltranslation';\nimport {\n createStringRenderError,\n createStringRenderWarning,\n createStringTranslationError,\n} from '../../../errors-dir/createErrors';\nimport { decodeMsg, decodeOptions } from '../../../messages/messages';\nimport {\n extractVars,\n condenseVars,\n indexVars,\n VAR_IDENTIFIER,\n} from 'generaltranslation/internal';\n\ntype MReturnType<T> = T extends string ? string : T;\n\ntype RenderMessageParams = {\n message: string;\n variables: Record<string, unknown> | undefined;\n locales: string[];\n fallback?: string;\n id?: string;\n maxChars?: number;\n format?: StringFormat;\n};\n\nexport default function useCreateInternalUseGTFunction({\n gt,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment,\n}: {\n gt: GT;\n translations: Translations | null;\n locale: string;\n defaultLocale: string;\n translationRequired: boolean;\n developmentApiEnabled: boolean;\n registerIcuForTranslation: TranslateIcuCallback;\n environment: 'development' | 'production' | 'test';\n}): {\n _gtFunction: (\n message: string,\n options?: InlineTranslationOptions,\n preloadedTranslations?: Translations\n ) => string;\n _mFunction: <T extends string | null | undefined>(\n message: T,\n options?: Record<string, unknown>,\n preloadedTranslations?: Translations\n ) => T extends string ? string : T;\n _filterMessagesForPreload: (_messages: _Messages) => _Messages;\n _preloadMessages: (_messages: _Messages) => Promise<Translations>;\n} {\n // --------- HELPER FUNCTIONS ------- //\n\n /**\n * @description Format message and fallback:\n * (1) format message\n * (2) format fallback\n * (3)\n * - PRODUCTION: return fallback (unformatted)\n * - DEVELOPMENT: throw error\n */\n function renderMessageHelper({\n message,\n variables,\n locales,\n fallback,\n id,\n maxChars,\n format,\n }: RenderMessageParams) {\n try {\n // (1) Try to format message\n const declaredVars = extractVars(fallback || '');\n const formattedMessage = gt.formatMessage(\n Object.keys(declaredVars).length ? condenseVars(message) : message,\n {\n locales,\n variables: {\n ...variables,\n ...declaredVars,\n [VAR_IDENTIFIER]: 'other',\n },\n dataFormat: format,\n }\n );\n // Apply cutoff formatting\n const cutoffMessage = gt.formatCutoff(formattedMessage, { maxChars });\n return cutoffMessage;\n } catch (error) {\n if (environment === 'production') {\n console.warn(createStringRenderWarning(message, id, error));\n } else {\n // (3) If no fallback, throw error (non-prod)\n if (!fallback) {\n throw new Error(createStringRenderError(message, id, error));\n }\n\n console.error(createStringRenderError(message, id, error));\n }\n\n // (2) If format fails, format fallback\n if (fallback) {\n return renderMessageHelper({\n message: fallback,\n locales,\n variables,\n id,\n maxChars,\n });\n }\n\n // (3) Fallback to original message (unformatted)\n const cutoffMessage = gt.formatCutoff(message, { maxChars });\n return cutoffMessage; // fallback to original message (unformatted)\n }\n }\n\n function initializeGT(\n message: string,\n options: Record<string, unknown> & {\n $context?: string;\n $maxChars?: number;\n $id?: string;\n $_hash?: string;\n } = {}\n ) {\n if (!message || typeof message !== 'string') return null;\n\n const {\n $id: id,\n $context: context,\n $maxChars: maxChars,\n $_hash: _hash,\n $format: rawFormat,\n ...variables\n } = options;\n const format =\n typeof rawFormat === 'string' ? (rawFormat as StringFormat) : undefined;\n\n // Update renderContent to use actual variables\n const renderMessage = (\n msg: string,\n locales: string[],\n fallback?: string\n ) => {\n return renderMessageHelper({\n message: msg,\n locales,\n variables,\n id,\n fallback,\n maxChars,\n format,\n });\n };\n\n // Calculate hash\n const calculateHash = () =>\n hashSource({\n source: indexVars(message),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(id && { id }),\n dataFormat: format || 'ICU',\n });\n\n return {\n id,\n context,\n maxChars,\n _hash,\n variables,\n calculateHash,\n renderMessage,\n };\n }\n\n function getTranslationData(\n calculateHash: () => string,\n id?: string,\n _hash?: string\n ) {\n let translationEntry;\n let hash = ''; // empty string because 1) it has to be a string but 2) we don't always need to calculate it\n if (id) {\n translationEntry = translations?.[id];\n }\n if (_hash && typeof translationEntry === 'undefined') {\n hash = _hash;\n translationEntry = translations?.[_hash];\n }\n // Use calculated hash to index\n if (typeof translationEntry === 'undefined') {\n hash = calculateHash();\n translationEntry = translations?.[hash];\n }\n return {\n translationEntry,\n hash,\n };\n }\n\n const _filterMessagesForPreload = (_messages: _Messages): _Messages => {\n const result = [];\n for (const { message, ...options } of _messages) {\n const init = initializeGT(message, options);\n if (!init) continue;\n const { id, _hash, calculateHash } = init;\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n if (!translationEntry) {\n result.push({ message, ...options, $_hash: hash });\n }\n }\n return result;\n };\n\n const _preloadMessages = async (_messages: _Messages) => {\n const preloadedTranslations: Translations = {};\n const preload = async ({ message, ...options }: _Message) => {\n // Setup\n const init = initializeGT(message, options);\n if (!init) return;\n const { id, context, maxChars, _hash, calculateHash } = init;\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n // Return if no translation needed\n if (translationEntry) {\n preloadedTranslations[hash] = translationEntry;\n }\n // Await the creation of the translation\n // Should update the translations object\n preloadedTranslations[hash] = await registerIcuForTranslation({\n source: indexVars(message),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(id && { id }),\n ...(maxChars != null && { maxChars }),\n hash,\n },\n });\n };\n await Promise.all(_messages.map(preload));\n return preloadedTranslations;\n };\n\n const _gtFunction = (\n message: string,\n options: InlineTranslationOptions = {},\n preloadedTranslations: Translations | undefined\n ) => {\n // ----- SET UP ----- //\n const init = initializeGT(message, options);\n if (!init) return '';\n const { id, context, maxChars, _hash, calculateHash, renderMessage } = init;\n\n // ----- EARLY RETURN IF TRANSLATION NOT REQUIRED ----- //\n // Check: translation required\n if (!translationRequired) return renderMessage(message, [defaultLocale]);\n\n // ----- GET TRANSLATION ----- //\n\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n\n // ----- RENDER TRANSLATION ----- //\n\n if (translationEntry === null) {\n return renderMessage(message, [defaultLocale]);\n }\n\n // If a translation already exists\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n message\n );\n }\n\n if (typeof preloadedTranslations?.[hash] !== 'undefined') {\n if (preloadedTranslations?.[hash]) {\n return renderMessage(\n preloadedTranslations?.[hash] as string,\n [locale, defaultLocale],\n message\n );\n }\n return renderMessage(message, [defaultLocale]);\n }\n\n if (!developmentApiEnabled) {\n console.warn(createStringTranslationError(message, id, 'gt'));\n return renderMessage(message, [defaultLocale]);\n }\n\n registerIcuForTranslation({\n source: indexVars(message),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(id && { id }),\n ...(maxChars != null && { maxChars }),\n hash: hash || '',\n },\n });\n\n return renderMessage(message, [defaultLocale]);\n };\n\n const _mFunction = <T extends string | null | undefined>(\n encodedMsg: T,\n options: Record<string, unknown> = {},\n preloadedTranslations: Translations | undefined\n ): T extends string ? string : T => {\n // Return if message is not a string\n if (!encodedMsg) return encodedMsg as MReturnType<T>;\n\n const decodedOptions = decodeOptions(encodedMsg);\n if (!decodedOptions || !decodedOptions.$_hash || !decodedOptions.$_source) {\n return _gtFunction(\n encodedMsg,\n options,\n preloadedTranslations\n ) as MReturnType<T>;\n }\n\n // Disaggregate options and construct render function\n\n const {\n $_hash,\n $_source,\n $context: context,\n $hash: _$hash,\n $id: _$id,\n $maxChars: maxChars,\n $format: format,\n ...decodedVariables\n } = decodedOptions;\n\n const renderMessage = (\n msg: string,\n locales: string[],\n fallback?: string\n ) => {\n return renderMessageHelper({\n message: msg,\n locales,\n variables: decodedVariables,\n fallback,\n maxChars,\n format,\n });\n };\n\n // Return if default locale\n if (!translationRequired)\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n\n // Check translation entry\n const translationEntry = translations?.[decodedOptions.$_hash];\n\n // Check translations\n if (translationEntry === null) {\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n // If a translation already exists\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n $_source\n ) as MReturnType<T>;\n }\n\n if (!developmentApiEnabled) {\n console.warn(\n createStringTranslationError($_source, decodeMsg(encodedMsg), 'm')\n );\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n if (typeof preloadedTranslations?.[$_hash] !== 'undefined') {\n if (preloadedTranslations?.[$_hash]) {\n return renderMessage(\n preloadedTranslations?.[$_hash] as string,\n [locale, defaultLocale],\n $_source\n ) as MReturnType<T>;\n }\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n registerIcuForTranslation({\n source: indexVars($_source),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(maxChars != null && { maxChars }),\n hash: $_hash,\n },\n });\n\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n };\n\n return {\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n };\n}\n","import { useCallback } from 'react';\nimport {\n Dictionary,\n DictionaryTranslationOptions,\n Translations,\n} from '../../../types-dir/types';\nimport {\n getDictionaryEntry,\n isValidDictionaryEntry,\n} from '../../../dictionaries/getDictionaryEntry';\nimport getEntryAndMetadata from '../../../dictionaries/getEntryAndMetadata';\nimport {\n createInvalidDictionaryEntryWarning,\n createInvalidIcuDictionaryEntryError,\n createInvalidIcuDictionaryEntryWarning,\n createNoEntryFoundWarning,\n} from '../../../errors-dir/createErrors';\nimport { hashSource } from 'generaltranslation/id';\nimport { GT } from 'generaltranslation';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport {\n extractVars,\n indexVars,\n VAR_IDENTIFIER,\n condenseVars,\n} from 'generaltranslation/internal';\nimport type { StringFormat } from '@generaltranslation/format/types';\n\nexport default function useCreateInternalUseTranslationsFunction(\n gt: GT,\n dictionary: Dictionary | undefined,\n dictionaryTranslations: Dictionary | undefined,\n translations: Translations | null,\n locale: string,\n defaultLocale: string,\n translationRequired: boolean,\n dialectTranslationRequired: boolean,\n developmentApiEnabled: boolean,\n registerIcuForTranslation: TranslateIcuCallback,\n environment: 'development' | 'production' | 'test'\n) {\n return useCallback(\n (id: string, options: DictionaryTranslationOptions = {}): string => {\n // Check: dictionary exists\n if (!dictionary) {\n return '';\n }\n\n // Get entry\n const value = getDictionaryEntry(dictionary, id);\n\n // Check: no entry found\n if (!value) {\n console.warn(createNoEntryFoundWarning(id));\n return '';\n }\n\n // Check: invalid entry\n if (!isValidDictionaryEntry(value)) {\n console.warn(createInvalidDictionaryEntryWarning(id));\n return '';\n }\n\n // Get entry and metadata\n const { entry, metadata } = getEntryAndMetadata(value);\n\n // ----- SET UP ----- //\n\n // Check: reject invalid content\n if (!entry || typeof entry !== 'string') return '';\n\n // Extract format from options\n const { $format: format, ...variableOptions } =\n options as DictionaryTranslationOptions & { $format?: StringFormat };\n const maxChars =\n metadata?.$maxChars ??\n (typeof options.$maxChars === 'number' ? options.$maxChars : undefined);\n\n // Render method\n const renderMessage = (\n message: string,\n locales: string[],\n fallback?: string\n ) => {\n try {\n // (1) Try to format message\n const declaredVars = extractVars(fallback || '');\n const formattedMessage = gt.formatMessage(\n Object.keys(declaredVars).length ? condenseVars(message) : message,\n {\n locales,\n variables: {\n ...variableOptions,\n ...declaredVars,\n [VAR_IDENTIFIER]: 'other',\n },\n dataFormat: format,\n }\n );\n const cutoffMessage = gt.formatCutoff(formattedMessage, {\n maxChars,\n });\n return cutoffMessage;\n } catch (error) {\n if (environment === 'production') {\n console.warn(\n createInvalidIcuDictionaryEntryWarning(id),\n 'Error: ',\n error\n );\n } else {\n // (3) If no fallback, throw error (non-prod)\n if (!fallback)\n throw new Error(\n `${createInvalidIcuDictionaryEntryError(id)} Error: ${error}`\n );\n\n console.error(\n createInvalidIcuDictionaryEntryError(id),\n 'Error: ',\n error\n );\n }\n\n // (2) If format fails, format fallback\n if (fallback) {\n return renderMessage(fallback, locales);\n }\n\n // (3) Fallback to original message (unformatted)\n const cutoffMessage = gt.formatCutoff(message, {\n maxChars,\n });\n return cutoffMessage; // fallback to original message (unformatted)}\n }\n };\n\n // Check: translation not required\n if (!translationRequired) return renderMessage(entry, [defaultLocale]);\n\n // ----- CHECK DICTIONARY TRANSLATIONS ----- //\n const dictionaryTranslation = getDictionaryEntry(\n dictionaryTranslations || {},\n id\n );\n if (\n dictionaryTranslation &&\n isValidDictionaryEntry(dictionaryTranslation)\n ) {\n const { entry } = getEntryAndMetadata(dictionaryTranslation);\n return renderMessage(entry, [locale, defaultLocale]);\n }\n\n // ----- CHECK TRANSLATIONS ----- //\n\n let translationEntry = translations?.[id];\n let hash = '';\n const getHash = () =>\n hashSource({\n source: indexVars(entry),\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: Math.abs(metadata.$maxChars),\n }),\n id,\n dataFormat: 'ICU',\n });\n if (!translationEntry) {\n hash = getHash();\n translationEntry = translations?.[hash];\n }\n\n // Check translation successful\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n entry\n );\n }\n\n if (translationEntry === null) {\n return renderMessage(entry, [defaultLocale]);\n }\n\n // Check if runtime translation is enabled\n if (!developmentApiEnabled) {\n return renderMessage(entry, [defaultLocale]);\n }\n\n // ----- TRANSLATE ON DEMAND ----- //\n // development only\n\n // Translate Content\n registerIcuForTranslation({\n source: indexVars(entry),\n targetLocale: locale,\n metadata: {\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: metadata.$maxChars,\n }),\n id,\n hash: hash || getHash(),\n },\n });\n\n // renderSettings.method must be ignored because t() is synchronous &\n // t() should never return an empty string because functions reason about strings based on falsiness\n return renderMessage(entry, [defaultLocale]);\n },\n [\n dictionary,\n dictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n dialectTranslationRequired,\n ]\n );\n}\n","import { useMemo } from 'react';\nimport {\n requiresTranslation,\n isSameLanguage,\n isValidLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n invalidCanonicalLocalesError,\n invalidLocalesError,\n} from '../../../errors-dir/createErrors';\nimport { UseDetermineLocaleParams, UseDetermineLocaleReturn } from './types';\n\nexport function useLocaleState({\n _locale,\n defaultLocale,\n locales: _locales,\n ssr,\n localeCookieName,\n customMapping,\n useDetermineLocale,\n enableI18n,\n reloadOnLocaleUpdate,\n}: {\n _locale: string;\n defaultLocale: string;\n locales: string[];\n ssr: boolean;\n localeCookieName: string;\n customMapping?: CustomMapping;\n enableI18n: boolean;\n useDetermineLocale: (\n params: UseDetermineLocaleParams\n ) => UseDetermineLocaleReturn;\n reloadOnLocaleUpdate?: boolean;\n}) {\n // Locale standardization\n const locales = useMemo(() => {\n return Array.from(\n new Set([defaultLocale, ...(enableI18n ? _locales : [])])\n );\n }, [defaultLocale, _locales, enableI18n]);\n\n const [locale, setLocale] = useDetermineLocale({\n locale: _locale,\n defaultLocale,\n locales,\n ssr,\n localeCookieName,\n customMapping,\n enableI18n,\n reloadOnLocaleUpdate,\n });\n\n const [translationRequired, dialectTranslationRequired] = useMemo(() => {\n // User locale is not default locale or equivalent\n const translationRequired = requiresTranslation(\n defaultLocale,\n locale,\n locales,\n customMapping\n );\n\n // User locale is not default locale but is a dialect of the same language\n const dialectTranslationRequired =\n translationRequired && isSameLanguage(defaultLocale, locale);\n\n // Check: invalid locale\n if (!customMapping) {\n const invalidLocales: string[] = [];\n locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (customMapping) {\n const invalidCanonicalLocales: string[] = [];\n locales.forEach((locale) => {\n if (!isValidLocale(locale, customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n return [translationRequired, dialectTranslationRequired];\n }, [defaultLocale, locale, locales]);\n\n return {\n locale, // the user's locale\n setLocale, // set the user's locale\n locales, // available locales\n translationRequired, // whether translation is required, e.g. \"en\" -> \"fr\"\n dialectTranslationRequired, // whether dialect translation is required, e.g. \"en-US\" to \"en-GB\"\n };\n}\n","import { useEffect } from 'react';\nimport {\n apiKeyInProductionError,\n APIKeyMissingWarn,\n projectIdMissingWarning,\n} from '../../errors-dir/createErrors';\nimport {\n defaultCacheUrl,\n defaultRuntimeApiUrl,\n} from 'generaltranslation/internal';\nimport { createUnsupportedLocalesWarning } from '../../errors-dir/createErrors';\nimport { getSupportedLocale } from '@generaltranslation/supported-locales';\n\nexport function useErrorChecks({\n devApiKey,\n projectId,\n runtimeUrl,\n loadTranslationsType,\n cacheUrl,\n locales,\n environment,\n}: {\n devApiKey?: string;\n projectId: string;\n runtimeUrl: string | null;\n loadTranslationsType: string;\n cacheUrl: string | null;\n locales: string[];\n environment: 'development' | 'production' | 'test';\n}) {\n useEffect(() => {\n // Check: no devApiKey in production\n if (environment === 'production' && devApiKey) {\n throw new Error(apiKeyInProductionError);\n }\n\n // Check: projectId missing while using cache/runtime in dev\n if (\n loadTranslationsType !== 'custom' &&\n (cacheUrl || runtimeUrl) &&\n !projectId &&\n environment === 'development'\n ) {\n console.warn(projectIdMissingWarning);\n }\n\n // Check: An API key is required for runtime translation\n if (\n projectId && // must have projectId for this check to matter anyways\n runtimeUrl &&\n loadTranslationsType !== 'custom' && // this usually conincides with not using runtime tx\n !devApiKey &&\n environment === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (\n runtimeUrl === defaultRuntimeApiUrl ||\n (cacheUrl === defaultCacheUrl && loadTranslationsType === 'default')\n ) {\n const warningLocales = locales.filter(\n (locale) => !getSupportedLocale(locale)\n );\n if (warningLocales.length) {\n console.warn(createUnsupportedLocalesWarning(warningLocales));\n }\n }\n }, [\n devApiKey,\n loadTranslationsType,\n cacheUrl,\n runtimeUrl,\n projectId,\n locales,\n ]);\n}\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport { dictionaryMissingWarning } from '../errors-dir/createErrors';\nimport { CustomLoader, Dictionary } from '../types-dir/types';\n\nexport default async function loadDictionaryHelper(\n locale: string,\n loadDictionary: CustomLoader\n): Promise<Dictionary | undefined> {\n const locales = Array.from(\n new Set([locale, getLocaleProperties(locale).languageCode])\n );\n for (const currentLocale of locales) {\n try {\n const result = await loadDictionary(currentLocale);\n if (result) {\n return result as Dictionary;\n }\n } catch {\n /* empty */\n }\n }\n // eslint-disable-next-line no-console\n console.warn(dictionaryMissingWarning);\n\n return undefined;\n}\n","import { useEffect, useState } from 'react';\nimport { CustomLoader } from '../../types-dir/types';\nimport { Dictionary } from '../../types-dir/types';\nimport loadDictionaryHelper from '../../dictionaries/loadDictionaryHelper';\n\nexport function useLoadDictionary({\n _dictionary,\n _dictionaryTranslations = {},\n loadDictionary,\n locale,\n defaultLocale,\n}: {\n _dictionary: Dictionary | undefined;\n _dictionaryTranslations: Dictionary | undefined;\n loadDictionary: CustomLoader | undefined;\n locale: string;\n defaultLocale: string;\n}) {\n const [dictionary, setDictionary] = useState<Dictionary | undefined>(\n _dictionary\n );\n const [dictionaryTranslations, setDictionaryTranslations] = useState<\n Dictionary | undefined\n >(_dictionaryTranslations);\n\n // Resolve dictionary when not provided, but using custom dictionary loader\n useEffect(() => {\n // Early return if dictionary is provided or not loading translation dictionary\n if (!loadDictionary) return;\n\n let storeResults = true;\n\n (async () => {\n // Load dictionary for default locale\n const defaultLocaleDictionary =\n (await loadDictionaryHelper(defaultLocale, loadDictionary)) || {};\n\n // Load dictionary for locale\n const localeDictionary =\n (await loadDictionaryHelper(locale, loadDictionary)) || {};\n\n // // Merge dictionaries\n // const mergedDictionary = mergeDictionaries(\n // defaultLocaleDictionary,\n // localeDictionary\n // );\n\n // Update dictionary\n if (storeResults) {\n setDictionary(defaultLocaleDictionary || {});\n }\n\n // Update dictionary translations\n if (storeResults) {\n setDictionaryTranslations(localeDictionary || {});\n }\n })();\n\n // cancel load if a dep changes\n return () => {\n storeResults = false;\n };\n }, [loadDictionary, locale, defaultLocale]);\n return {\n dictionary,\n setDictionary,\n dictionaryTranslations,\n setDictionaryTranslations,\n };\n}\n","import { GT } from 'generaltranslation';\n\nexport default async function fetchTranslations({\n cacheUrl,\n projectId,\n locale,\n versionId,\n gt,\n}: {\n cacheUrl: string;\n projectId: string;\n locale: string;\n versionId?: string;\n gt: GT;\n}) {\n if (!projectId || !cacheUrl || !locale) return {};\n locale = gt.resolveCanonicalLocale(locale);\n const response = await fetch(\n versionId\n ? `${cacheUrl}/${projectId}/${locale}/${versionId}`\n : `${cacheUrl}/${projectId}/${locale}`\n ); // fetch from cache\n const result = await response.json();\n return result;\n}\n","import { customLoadTranslationsError } from '../../errors-dir/createErrors';\nimport fetchTranslations from '../../utils/fetchTranslations';\nimport { CustomLoader, Translations } from '../../types-dir/types';\nimport { useEffect, useRef, useState } from 'react';\nimport { GT } from 'generaltranslation';\nimport { defaultCacheUrl } from 'generaltranslation/internal';\n\nexport function useLoadTranslations({\n _translations,\n translationRequired,\n loadTranslationsType,\n loadTranslations,\n locale,\n cacheUrl,\n projectId,\n _versionId,\n gt,\n}: {\n _translations: Translations | null;\n translationRequired: boolean;\n loadTranslationsType: string;\n loadTranslations?: CustomLoader;\n locale: string;\n cacheUrl: string | null;\n projectId: string;\n _versionId?: string;\n gt: GT;\n}) {\n /** Key for translation tracking:\n * Cache Loading -> translations = null\n * Cache Fail (for locale) -> translations = {}\n * Cache Fail (for hash) -> translations[hash] = undefined\n */\n\n /**\n * Initialize translations\n */\n function initializeTranslations() {\n if (_translations) {\n return _translations;\n } else if (translationRequired && loadTranslationsType !== 'disabled') {\n return null;\n } else {\n // No need to load translations ever\n return {};\n }\n }\n\n const [translations, setTranslations] = useState<Translations | null>(\n initializeTranslations()\n );\n\n /**\n * Reset translations if locale changes (null to trigger a new cache fetch)\n * Should never run on mount\n *\n * TODO: its possible that this adds an unnecessary re-render, perhaps the request could be embeded directly in this useEffect instead?\n */\n const didMount = useRef(false);\n useEffect(() => {\n // Reset should never run on mount\n if (!didMount.current) {\n didMount.current = true;\n return;\n }\n\n setTranslations(\n translationRequired && loadTranslationsType !== 'disabled' ? null : {}\n );\n }, [locale, loadTranslationsType]);\n\n /**\n * Update translations\n */\n useEffect(() => {\n // Early return if no need to translate\n if (\n translations ||\n !translationRequired ||\n loadTranslationsType === 'disabled'\n ) {\n return;\n }\n\n // Fetch translations\n let storeResults = true;\n (async () => {\n let result;\n switch (loadTranslationsType) {\n case 'custom':\n // check is redundant, but makes ts happy\n if (loadTranslations) {\n try {\n result = await loadTranslations(locale);\n } catch (error) {\n console.error(customLoadTranslationsError(locale), error);\n }\n }\n break;\n case 'default':\n try {\n result = await fetchTranslations({\n cacheUrl: cacheUrl || defaultCacheUrl,\n projectId,\n locale,\n versionId: _versionId,\n gt,\n });\n } catch (error) {\n console.error(error);\n }\n break;\n }\n\n // fallback to empty object if failed or disabled\n if (!result) {\n result = {};\n }\n\n // Record results\n if (storeResults) {\n setTranslations(result); // not classified as a translation error, because we can still fetch from API\n }\n })();\n\n // Cancel fetch if a dep changes\n return () => {\n storeResults = false;\n };\n }, [\n translations,\n translationRequired,\n loadTranslationsType,\n cacheUrl,\n projectId,\n locale,\n _versionId,\n gt,\n ]);\n\n return {\n translations,\n setTranslations,\n };\n}\n","import { useCallback } from 'react';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport {\n Dictionary,\n DictionaryEntry,\n DictionaryTranslationOptions,\n TranslatedChildren,\n Translations,\n} from '../../../types-dir/types';\nimport {\n createEmptyIdError,\n createNoEntryFoundWarning,\n} from '../../../errors-dir/createErrors';\nimport {\n getSubtree,\n getSubtreeWithCreation,\n} from '../../../dictionaries/getSubtree';\nimport { isDictionaryEntry } from '../../../dictionaries/isDictionaryEntry';\nimport { stripMetadataFromEntries } from '../../../dictionaries/stripMetadataFromEntries';\nimport mergeDictionaries from '../../../dictionaries/mergeDictionaries';\nimport { mergeResultsIntoDictionary } from '../../../dictionaries/injectEntry';\nimport { injectHashes } from '../../../dictionaries/injectHashes';\nimport { collectUntranslatedEntries } from '../../../dictionaries/collectUntranslatedEntries';\nimport { injectTranslations } from '../../../dictionaries/injectTranslations';\nimport { injectFallbacks } from '../../../dictionaries/injectFallbacks';\nimport { injectAndMerge } from '../../../dictionaries/injectAndMerge';\nimport { indexVars } from 'generaltranslation/internal';\n\nexport function useCreateInternalUseTranslationsObjFunction(\n dictionary: Dictionary,\n dictionaryTranslations: Dictionary,\n setDictionary: Function,\n setDictionaryTranslations: Function,\n translations: Translations | null,\n locale: string,\n defaultLocale: string,\n translationRequired: boolean,\n dialectTranslationRequired: boolean,\n developmentApiEnabled: boolean,\n registerIcuForTranslation: TranslateIcuCallback,\n gtFunction: (id: string, options: DictionaryTranslationOptions) => string\n) {\n return useCallback(\n (\n id: string,\n idWithParent: string,\n options: DictionaryTranslationOptions = {}\n ): Dictionary | DictionaryEntry | undefined => {\n if (idWithParent === '') {\n throw new Error(createEmptyIdError());\n }\n // (1) Get subtree\n const subtree = getSubtree({\n dictionary,\n id: idWithParent,\n });\n // Check: no subtree found\n if (!subtree) {\n console.warn(createNoEntryFoundWarning(idWithParent));\n return {};\n }\n // Check: if subTreeTranslation is a dictionaryEntry\n if (isDictionaryEntry(subtree)) {\n return gtFunction(id, options);\n }\n // Check: if is default locale\n if (!translationRequired) {\n // remove metadata from entries\n return stripMetadataFromEntries(subtree);\n }\n const translatedSubtree = getSubtreeWithCreation({\n dictionary: dictionaryTranslations,\n id: idWithParent,\n sourceDictionary: dictionaryTranslations,\n });\n\n // (2) Calculate subtreeWithHashes, dictionaryTranslationsWithTranslations, translatedSubtreeWithFallbacks, and untranslatedEntries\n // Note: the following four operations can technically be combined into one traversal, but this\n // strategy is much more readable and much easier to test/debug\n // Inject hashes into subtree\n const { dictionary: subtreeWithHashes, updateDictionary } = injectHashes(\n structuredClone(subtree) as Dictionary,\n idWithParent\n );\n // Collect untranslated entries\n const untranslatedEntries = collectUntranslatedEntries(\n subtreeWithHashes as Dictionary,\n translatedSubtree as Dictionary,\n idWithParent\n );\n // Inject translations into translation subtree\n const {\n dictionary: dictionaryTranslationsWithTranslations,\n updateDictionary: updateDictionaryTranslations,\n } = injectTranslations(\n subtreeWithHashes as Dictionary,\n structuredClone(translatedSubtree) as Dictionary,\n translations || {},\n untranslatedEntries,\n idWithParent\n );\n // Inject fallbacks into translation subtree\n const translatedSubtreeWithFallbacks = injectFallbacks(\n subtreeWithHashes as Dictionary,\n structuredClone(dictionaryTranslationsWithTranslations) as Dictionary,\n untranslatedEntries,\n idWithParent\n );\n\n // (3) For each untranslated entry, translate it\n if (developmentApiEnabled) {\n Promise.allSettled(\n untranslatedEntries.map(\n async (\n untranslatedEntry\n ): Promise<[string, TranslatedChildren]> => {\n const { source, metadata } = untranslatedEntry;\n const id = metadata?.$id;\n return [\n id,\n await registerIcuForTranslation({\n source: indexVars(source),\n targetLocale: locale,\n metadata: {\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: metadata.$maxChars,\n }),\n id,\n hash: metadata?.$_hash,\n },\n }),\n ];\n }\n )\n ).then((settledResults) => {\n // Filter out only successful promises and extract their values\n const successfulResults: [string, TranslatedChildren][] =\n settledResults\n .filter(\n (\n result\n ): result is PromiseFulfilledResult<\n [string, TranslatedChildren]\n > => result.status === 'fulfilled'\n )\n .map((result) => result.value);\n // Only proceed if we have successful results\n if (successfulResults.length > 0) {\n // Merge the results into the dictionaryTranslations object\n setDictionaryTranslations((prev: Dictionary) =>\n mergeResultsIntoDictionary(prev, successfulResults, dictionary)\n );\n }\n });\n }\n\n // (4) Update the dictionaryTranslations object and dictionary\n // inject translatedSubtreeWithFallbacks and new subtree objects\n // Need the setTimeout to avoid render-phase updates\n if (updateDictionary) {\n setTimeout(() => {\n setDictionary((prev: Dictionary) =>\n injectAndMerge(prev, subtreeWithHashes, idWithParent)\n );\n }, 0);\n }\n if (updateDictionaryTranslations) {\n setTimeout(() => {\n setDictionaryTranslations((prev: Dictionary) =>\n mergeDictionaries(prev, dictionaryTranslationsWithTranslations)\n );\n }, 0);\n }\n\n // (5) Copy the dictionaryTranslations object\n return structuredClone(translatedSubtreeWithFallbacks);\n },\n [\n dictionary,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n dictionaryTranslations,\n ]\n );\n}\n","import { useState } from 'react';\nimport { UseEnableI18nParams, UseEnableI18nReturn } from './types';\n\n// Fallback behavior for useEnableI18n\nexport function useEnableI18n({\n enableI18n: _enableI18n,\n}: UseEnableI18nParams): UseEnableI18nReturn {\n const [enableI18n] = useState(_enableI18n);\n return { enableI18n };\n}\n","import { createInternalUsageError } from '../../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function isSSREnabled(): boolean {\n throw createInternalUsageError('isSSREnabled');\n}\n","import { createInternalUsageError } from '../../../errors-dir/internalErrors';\nimport { UseDetermineLocaleParams, UseDetermineLocaleReturn } from './types';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function useDetermineLocale(\n _params: UseDetermineLocaleParams\n): UseDetermineLocaleReturn {\n throw createInternalUsageError('useDetermineLocale');\n}\n","import { createInternalUsageError } from '../../errors-dir/internalErrors';\nimport { UseRegionStateParams, UseRegionStateReturn } from './types';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function useRegionState(\n _params: UseRegionStateParams\n): UseRegionStateReturn {\n throw createInternalUsageError('useRegionState');\n}\n","import { Suspense, useMemo } from 'react';\nimport { GTContext } from './GTContext';\nimport {\n defaultCacheUrl,\n defaultRuntimeApiUrl,\n libraryDefaultLocale,\n} from 'generaltranslation/internal';\nimport useRuntimeTranslation from './hooks/useRuntimeTranslation';\nimport { getDefaultRenderSettings } from '../rendering/getDefaultRenderSettings';\nimport useCreateInternalUseGTFunction from './hooks/translation/useCreateInternalUseGTFunction';\nimport useCreateInternalUseTranslationsFunction from './hooks/translation/useCreateInternalUseTranslationsFunction';\nimport {\n defaultLocaleCookieName,\n defaultRegionCookieName,\n defaultEnableI18nCookieName,\n} from '../utils/cookies';\nimport { InternalGTProviderProps } from '../types-dir/config';\nimport { useLocaleState } from './hooks/locales/useLocaleState';\nimport { useErrorChecks } from './hooks/useErrorChecks';\nimport { resolveAliasLocale } from '@generaltranslation/format';\nimport { GT } from 'generaltranslation';\nimport { useLoadDictionary } from './hooks/useLoadDictionary';\nimport { useLoadTranslations } from './hooks/useLoadTranslations';\nimport { useCreateInternalUseTranslationsObjFunction } from './hooks/translation/useCreateInternalUseTranslationsObjFunction';\nimport { useEnableI18n as _useEnableI18n } from './hooks/useEnableI18n';\n\n// Deprecated functions, will be removed in a future version\nimport { readAuthFromEnv as _readAuthFromEnv } from '../utils/utils';\nimport { isSSREnabled } from './helpers/isSSREnabled';\nimport { useDetermineLocale as _useDetermineLocale } from './hooks/locales/useDetermineLocale';\nimport { useRegionState as _useRegionState } from './hooks/useRegionState';\n\nexport default function GTProvider({\n children,\n config,\n environment = 'production',\n projectId: _projectId = config?.projectId || '',\n devApiKey: _devApiKey = config?.devApiKey || '',\n _versionId = config?._versionId,\n dictionary: _dictionary = {},\n locales = config?.locales || [],\n defaultLocale = config?.defaultLocale || libraryDefaultLocale,\n cacheUrl = config?.cacheUrl || defaultCacheUrl,\n runtimeUrl = config?.runtimeUrl || defaultRuntimeApiUrl,\n renderSettings = config?.renderSettings ||\n getDefaultRenderSettings(environment),\n ssr = config?.ssr || isSSREnabled(),\n localeCookieName = config?.localeCookieName || defaultLocaleCookieName,\n locale: _locale = '',\n region: _region,\n loadDictionary,\n loadTranslations,\n fallback = undefined,\n translations: _translations = null,\n customMapping = config?.customMapping,\n enableI18n: _enableI18n = config?.enableI18n !== undefined\n ? config.enableI18n\n : true,\n enableI18nLoaded,\n reloadOnLocaleUpdate,\n useEnableI18n = _useEnableI18n,\n readAuthFromEnv = _readAuthFromEnv,\n useDetermineLocale = _useDetermineLocale,\n useRegionState = _useRegionState,\n ...metadata\n}: InternalGTProviderProps) {\n // ---------- PROPS ---------- //\n if (_locale) {\n _locale = resolveAliasLocale(_locale, customMapping);\n }\n\n // Read env to get projectId and API key\n const { projectId, devApiKey } = readAuthFromEnv({\n projectId: _projectId,\n devApiKey: _devApiKey,\n });\n\n // Enable I18n feature flags\n const { enableI18n } = useEnableI18n({\n enableI18n: _enableI18n,\n enableI18nLoaded,\n enableI18nCookieName: defaultEnableI18nCookieName,\n ssr,\n });\n\n // Get locale data including\n // locale - the user's locale\n // setLocale - function to set the user's locale\n // locales - approved locales for the project\n // translationRequired - whether translation is required\n // dialectTranslationRequired - whether dialect translation (e.g. en-US -> en-GB) is required\n const {\n locale,\n setLocale,\n locales: approvedLocales,\n translationRequired,\n dialectTranslationRequired,\n } = useLocaleState({\n _locale,\n defaultLocale,\n locales,\n ssr,\n localeCookieName,\n customMapping,\n useDetermineLocale,\n enableI18n,\n reloadOnLocaleUpdate,\n });\n\n // Define the region instance\n const { region, setRegion } = useRegionState({\n _region,\n ssr,\n regionCookieName: defaultRegionCookieName,\n });\n\n // Define the GT instance\n // Used for custom mapping and as a driver for the runtime translation\n const gt = useMemo(\n () =>\n new GT({\n devApiKey,\n sourceLocale: defaultLocale,\n targetLocale: locale,\n projectId,\n baseUrl: runtimeUrl || undefined,\n customMapping,\n }),\n [devApiKey, defaultLocale, projectId, runtimeUrl, customMapping]\n );\n\n // Determine the type of translation loading\n // custom - custom loading function provided\n // default - using GT provided cache\n // disabled - no translation loading\n const loadTranslationsType = useMemo(() => {\n return (\n (loadTranslations && 'custom') ||\n (cacheUrl && projectId && 'default') ||\n 'disabled'\n );\n }, [loadTranslations, cacheUrl, projectId]);\n\n // ---------- LOAD DICTIONARY ---------- //\n\n const {\n dictionary,\n setDictionary,\n dictionaryTranslations,\n setDictionaryTranslations,\n } = useLoadDictionary({\n _dictionary,\n _dictionaryTranslations: {},\n loadDictionary,\n locale,\n defaultLocale,\n });\n\n // ---------- ERROR AND WARNING CHECKS ---------- //\n\n useErrorChecks({\n devApiKey,\n projectId,\n runtimeUrl,\n loadTranslationsType,\n cacheUrl,\n locales,\n environment,\n });\n\n // ---------- TRANSLATION STATE ---------- //\n\n const { translations, setTranslations } = useLoadTranslations({\n _translations,\n translationRequired,\n loadTranslationsType,\n loadTranslations,\n locale,\n cacheUrl,\n projectId,\n _versionId,\n gt,\n });\n\n // ------- RUNTIME TRANSLATION ----- //\n\n const {\n registerIcuForTranslation,\n registerJsxForTranslation,\n developmentApiEnabled,\n } = useRuntimeTranslation({\n gt,\n locale,\n versionId: _versionId,\n defaultLocale,\n runtimeUrl,\n renderSettings,\n setTranslations,\n environment,\n ...metadata,\n });\n\n // ---------- USE GT ---------- //\n\n const {\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n } = useCreateInternalUseGTFunction({\n gt,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment,\n });\n\n // ---------- USE DICT ---------- //\n\n const _dictionaryFunction = useCreateInternalUseTranslationsFunction(\n gt,\n dictionary,\n dictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment\n );\n\n const _dictionaryObjFunction = useCreateInternalUseTranslationsObjFunction(\n dictionary || {},\n dictionaryTranslations || {},\n setDictionary,\n setDictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n _dictionaryFunction\n );\n\n // ----- RETURN ----- //\n\n const display = !!((!translationRequired || translations) && locale);\n\n // hang until cache response, then render translations or loading state (when waiting on API response)\n return (\n <GTContext.Provider\n value={{\n gt,\n registerIcuForTranslation,\n registerJsxForTranslation,\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n _dictionaryFunction,\n _dictionaryObjFunction,\n developmentApiEnabled,\n locale,\n locales: approvedLocales,\n setLocale,\n defaultLocale,\n region,\n setRegion,\n translations,\n translationRequired,\n dialectTranslationRequired,\n projectId,\n renderSettings,\n _versionId,\n }}\n >\n <Suspense fallback={fallback}>{display ? children : fallback}</Suspense>\n </GTContext.Provider>\n );\n}\n","import { useContext } from 'react';\nimport { getPluralBranch } from '../../internal';\nimport { createPluralMissingError } from '../../errors-dir/createErrors';\nimport { libraryDefaultLocale } from 'generaltranslation/internal';\nimport { GTContext } from '../../provider/GTContext';\n\n/**\n * The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).\n * It determines which content to display by matching the value of `n` to the appropriate pluralization branch,\n * based on the current locale or a default locale. If no matching plural branch is found, the component renders\n * the fallback `children` content.\n *\n * @example\n * ```jsx\n * <Plural\n * n={1}\n * one=\"There is 1 item\"\n * other=\"There are {n} items\"\n * />\n * ```\n * In this example, if `n` is 1, it renders `\"There is 1 item\"`. If `n` is a different number, it renders\n * `\"There are {n} items\"`.\n *\n * @param {any} [children] - Fallback content to render if no matching plural branch is found.\n * @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.\n * @param {string} [locales] - Optional parameter, the locale to use for pluralization format. If not provided and wrapped\n * in <GTProvider> will automatically populate this value as user's current locale. If not provided and not wrapped in\n * <GTProvider>, will use the library default locale (en-US).\n * @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular\n * and `other` for plural forms, but it may vary depending on the locale.\n * @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.\n * @throws {Error} If `n` is not provided or not a valid number.\n */\nfunction Plural({\n children,\n n,\n locales,\n ...branches\n}: {\n children?: React.ReactNode;\n n?: number;\n locales?: string;\n [key: string]: unknown;\n}): React.JSX.Element {\n const context = useContext(GTContext);\n let defaultLocale;\n if (context) {\n locales ||= context.locale;\n defaultLocale ||= context.defaultLocale;\n }\n const providerLocales = [\n ...(locales ? [locales] : []),\n defaultLocale || libraryDefaultLocale,\n ];\n if (typeof n !== 'number')\n throw new Error(createPluralMissingError(children));\n return <>{getPluralBranch(n, providerLocales, branches) || children}</>;\n}\n\nPlural._gtt = 'plural';\n\nexport default Plural;\n","/**\n * The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.\n * It allows for flexible content switching based on the `branch` prop and an object of possible branches (`...branches`).\n * If the specified `branch` is present in the `branches` object, it renders the content of that branch.\n * If the `branch` is not found, it renders the provided `children` as fallback content.\n *\n * @example\n * ```jsx\n * <Branch\n * branch=\"summary\"\n * summary={<p>This is a summary</p>}\n * details={<p>Details here</p>}\n * >\n * <p>Fallback content</p>\n * </Branch>\n * ```\n * If the `branch` prop is set to `\"summary\"`, it will render `<p>This is a summary</p>`. If the `branch` is not set or does not match any keys in the branches object, it renders the fallback content `<p>Fallback content</p>`.\n *\n * @param {any} [children] - Fallback content to render if no matching branch is found.\n * @param {any} [name=\"branch\"] - Optional name for the component, used for metadata or tracking purposes.\n * @param {string} [branch] - The name of the branch to render. The component looks for this key in the `...branches` object.\n * @param {...{[key: string]: any}} [branches] - A spread object containing possible branches as keys and their corresponding content as values.\n * @returns {React.JSX.Element} The rendered branch or fallback content.\n */\nfunction Branch({\n children,\n branch,\n ...branches\n}: {\n children?: unknown;\n branch?: string | number | boolean;\n [key: string]: unknown;\n}): React.JSX.Element {\n branch = branch?.toString();\n // ignore data-* attributes\n if (typeof branch === 'string' && branch.startsWith('data-')) {\n branch = undefined;\n }\n const renderedBranch =\n branch && typeof branches[branch] !== 'undefined'\n ? branches[branch]\n : children;\n return <>{renderedBranch}</>;\n}\n/** @internal _gtt - The GT transformation for the component. */\nBranch._gtt = 'branch';\nexport default Branch;\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the user's list of supported locales from the `<GTProvider>` context.\n *\n * @returns {string[]} The user's locales, e.g., ['en-US', 'fr', 'jp'].\n *\n * @example\n * const locales = useLocales();\n * console.log(locale); // ['en-US', 'fr', 'jp]\n */\nexport default function useLocales(): string[] {\n return useGTContext(\n 'useLocales(): Unable to access configured locales outside of a <GTProvider>'\n ).locales;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Sets the user's locale in the `<GTProvider>` context.\n * If the locale passed is not supported, will fallback on current locale and then defaultLocale if necessary.\n * @note Unless a locale has explicitly been passed to the `<GTProvider>`, this will override the user's browser preferences. The locale passed to `<GTProvider>` will always take priority.\n *\n * @returns {(locale: string) => void} A function that sets the user's locale.\n *\n * @example\n * setLocale('en-US');\n */\nexport default function useSetLocale(): (locale: string) => void {\n const { setLocale } = useGTContext(\n \"setLocale(): Unable to access user's locale outside of a <GTProvider>\"\n );\n return setLocale;\n}\n","import React from 'react';\nimport { LocaleSelectorProps } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport default function LocaleSelector(\n _props: LocaleSelectorProps\n): React.JSX.Element | null {\n throw createInternalUsageError('LocaleSelector');\n}\n","import { useCallback, useMemo } from 'react';\nimport useGTContext from '../provider/GTContext';\n\n/**\n *\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {(locale: string) => void} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport default function useLocaleSelector(locales?: string[]) {\n // Retrieve the locale, locales, and setLocale function\n const { locales: contextLocales, locale, setLocale, gt } = useGTContext();\n\n // sort\n const sortedLocales = useMemo(() => {\n if (!contextLocales || contextLocales.length === 0) {\n return [];\n }\n const collator = new Intl.Collator();\n return [...contextLocales].sort((a, b) =>\n collator.compare(\n gt.getLocaleProperties(a).nativeNameWithRegionCode,\n gt.getLocaleProperties(b).nativeNameWithRegionCode\n )\n );\n }, [contextLocales, gt]);\n\n // create getLocaleProperties callback\n const getLocalePropertiesCallback = useCallback(\n (locale: string) => {\n return gt.getLocaleProperties(locale);\n },\n [gt]\n );\n\n return {\n locale,\n locales: locales ? locales : sortedLocales,\n setLocale,\n getLocaleProperties: getLocalePropertiesCallback,\n };\n}\n","import React from 'react';\nimport { RegionSelectorProps } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport default function RegionSelector<Regions extends string[]>(\n _props: RegionSelectorProps<Regions>\n): React.JSX.Element | null {\n throw createInternalUsageError('RegionSelector');\n}\n","import type { LocaleProperties } from '@generaltranslation/format/types';\nimport useGTContext from '../provider/GTContext';\n\n/**\n * Returns the configured GT class instance.\n *\n * @returns {GT} The configured GT class instance.\n *\n * @example\n * const gt = useGTClass();\n * console.log(gt.getLocaleProperties('en-US'));\n */\nexport function useGTClass() {\n return useGTContext(\n 'useGTClass(): Unable to access configured GT class instance outside of a <GTProvider>'\n ).gt;\n}\n\n/**\n * Returns the locale properties for the given locale.\n *\n * @param {string} locale - The locale to get the properties for.\n * @returns {LocaleProperties} The locale properties for the given locale.\n *\n * @example\n * const localeProperties = useLocaleProperties('en-US');\n * console.log(localeProperties);\n */\nexport function useLocaleProperties(locale: string): LocaleProperties {\n const gt = useGTClass();\n return gt.getLocaleProperties(locale);\n}\n","import { useMemo } from 'react';\nimport useGTContext from '../provider/GTContext';\nimport { getLocaleProperties } from '@generaltranslation/format';\n\ntype RegionData = {\n code: string;\n name: string;\n emoji: string;\n locale: string;\n};\n\n/**\n * React hook for managing region selection logic in applications supporting multiple regions.\n *\n * This hook provides the necessary data and handlers to implement a region selector UI component.\n * It returns the current region, a list of available regions, region metadata, and functions to update the region or associated locale.\n *\n * ### Parameters\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object.<string, string|{name?: string, emoji?: string, locale?: string}>} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * ### Returns\n * @returns {{\n * region: string | undefined,\n * setRegion: (region: string) => void,\n * regions: string[],\n * regionData: Map<string, { code: string, name: string, emoji: string, locale: string }>,\n * locale: string,\n * setLocale: (locale: string) => void\n * }} An object containing:\n * - `region`: The currently selected region code.\n * - `setRegion`: Function to update the selected region.\n * - `regions`: Array of available region codes.\n * - `regionData`: Map of region codes to their display data (name, emoji, locale).\n * - `locale`: The current locale.\n * - `setLocale`: Function to update the locale.\n *\n * ### Example\n * ```tsx\n * const {\n * region,\n * setRegion,\n * regions,\n * regionData,\n * locale,\n * setLocale\n * } = useRegionSelector({\n * customMapping: { US: { name: \"United States\", emoji: \"🇺🇸\" } }\n * });\n *\n * return (\n * <select value={region} onChange={e => setRegion(e.target.value)}>\n * {regions.map(r => (\n * <option key={r} value={r}>\n * {regionData.get(r)?.name}\n * </option>\n * ))}\n * </select>\n * );\n * ```\n */\nexport function useRegionSelector(\n {\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion = true,\n sortRegionsAlphabetically = true,\n }: {\n regions?: string[];\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n } = {\n prioritizeCurrentLocaleRegion: true,\n sortRegionsAlphabetically: true,\n }\n) {\n // Retrieve the locale, locales, and setLocale function\n const { locales, locale, setLocale, gt, region, setRegion } = useGTContext();\n const { regionCode: localeRegion } = gt.getLocaleProperties(locale);\n\n const [\n regions, // ordered list of ISO 3166 region codes\n regionData, // map of ISO 3166 region codes to region display data, potentially not ordered\n ] = useMemo<[string[], Map<string, RegionData>]>(() => {\n const regionToLocaleMap = new Map(\n locales.map((l) => {\n const lp = getLocaleProperties(l, locale, gt.customMapping); // has to be directly called so sourceLocale can be in the user's current locale\n return [lp.regionCode, lp];\n })\n );\n\n const regions = _regions\n ? [..._regions]\n : Array.from(regionToLocaleMap?.keys() || [localeRegion]);\n\n const regionData = new Map<string, RegionData>(\n regions.map((r: string) => {\n return [\n r,\n {\n locale: regionToLocaleMap?.get(r)?.code || locale,\n ...gt.getRegionProperties(r),\n ...(typeof customMapping?.[r] === 'string'\n ? { name: customMapping?.[r] }\n : customMapping?.[r]),\n },\n ];\n })\n );\n\n if (sortRegionsAlphabetically) {\n regions.sort((a, b) =>\n new Intl.Collator().compare(\n regionData.get(a)!.name,\n regionData.get(b)!.name\n )\n );\n }\n\n if (prioritizeCurrentLocaleRegion) {\n const localeRegionIndex = regions.indexOf(localeRegion);\n if (localeRegionIndex > 0) {\n // 0 because no action is needed if it's already at the start\n regions.splice(localeRegionIndex, 1);\n regions.unshift(localeRegion);\n }\n }\n\n return [regions, regionData];\n }, [_regions, region, locale, locales, gt]);\n\n return {\n region,\n setRegion,\n regions,\n regionData,\n locales,\n locale,\n localeRegion,\n setLocale,\n };\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.\n *\n * If no locale is provided, the direction for the current user's locale is returned.\n *\n * @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.\n * @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.\n *\n * @example\n * const dir = useLocaleDirection(); // e.g., 'ltr'\n * const arabicDir = useLocaleDirection('ar'); // 'rtl'\n */\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const { gt } = useGTContext(\n 'useLocaleDirection(): Unable to access configured GT class instance outside of a <GTProvider>'\n );\n return gt.getLocaleDirection(locale);\n}\n","import useGTContext from '../../provider/GTContext';\nimport { _Messages, Translations } from '../../types-dir/types';\nimport { useable } from '../../promises/dangerouslyUsable';\nimport { MFunctionType } from '../../types-dir/types';\nimport { useCallback } from 'react';\nimport reactUse from '../../utils/use';\n\n/**\n * Gets the message decoding and translation function `m` provided by `<GTProvider>`.\n *\n * @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.\n *\n * @example\n * const encodedMessage = msg(\"Hello, world\")\n * const m = useMessages();\n * m(encodedMessage) // returns \"Hello, world\" translated\n *\n * @example\n * const encodedMessage = msg(\"My name is {name}\", { name: \"Brian\" });\n * const m = useMessages();\n * m(encodedMessage) // returns \"My name is Brian\" translated\n */\nexport default function useMessages(_messages?: _Messages): MFunctionType {\n const {\n developmentApiEnabled,\n translationRequired,\n _preloadMessages,\n _filterMessagesForPreload,\n _mFunction,\n locale,\n } = useGTContext(\n `useMessages(): No context provided. You're trying to get the m() function from the useMessages() hook, which can be called within a <GTProvider>.`\n );\n\n let preloadedTranslations: Translations | undefined;\n if (_messages && reactUse && developmentApiEnabled && translationRequired) {\n const untranslatedMessages = _filterMessagesForPreload(_messages);\n if (untranslatedMessages.length > 0) {\n preloadedTranslations = reactUse(\n useable(\n [\n '_preloadMessages', // prefix key\n locale, // should change on locale\n JSON.stringify(untranslatedMessages), // should change when messages change\n ],\n () => _preloadMessages(untranslatedMessages)\n )\n );\n }\n }\n\n function _m<T extends string | null | undefined>(\n encodedMsg: T,\n options: Record<string, unknown> = {}\n ): T extends string ? string : T {\n return _mFunction(encodedMsg, options, preloadedTranslations);\n }\n\n /**\n * @param {string} encodedMsg - The encoded message string, typically created by the `msg()` utility.\n * @param {InlineTranslationOptions} options\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @returns A translation\n *\n * @example\n * const example = msg(\"Hello, world\")\n * const m = useMessages()\n * m(example); // Translates 'Hello, world!'\n *\n * @example\n * // With a context and a custom identifier:\n * const example2 = msg(\"My name is name\", { name: \"John\", $context: \"name is a proper noun\" })\n * const m = useMessages()\n * m(example2); // Translates 'My name is John' in context\n */\n const m = useCallback(_m, [preloadedTranslations, _mFunction]);\n\n return m;\n}\n"],"x_google_ignoreList":[3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"mappings":"mqCAAA,MAAM,EAAuB,CAC3B,SAAU,QACV,OAAQ,IACR,SAAU,OACV,SAAU,OACV,gBAAiB,OAClB,CAID,SAAwB,GACtB,EAAiC,EAAE,CACnC,EACQ,CAIR,OAHI,OAAO,EAAM,MAAS,SAAiB,EAAM,KAG1C,OAFkB,EAAqB,IAAiB,QAEf,GADlC,EAAM,aACsC,KCZ5D,SAAS,GAAe,EAAM,CAC7B,IAAM,EAAU,EAAK,MAAM,CAE3B,OADK,EACE,UAAU,KAAK,EAAQ,CAAG,EAAU,GAAG,EAAQ,GADjC,GAGtB,SAAS,EAAc,EAAM,CAC5B,IAAM,EAAU,EAAK,MAAM,CACvB,EAAM,EAAQ,OAClB,KAAO,EAAM,GAAG,CACf,IAAM,EAAO,EAAQ,EAAM,GAC3B,GAAI,IAAS,KAAO,IAAS,KAAO,IAAS,IAAK,MAClD,IAED,OAAO,EAAQ,MAAM,EAAG,EAAI,CAE7B,SAAS,GAAmB,EAAM,CACjC,OAAO,EAAK,QAAQ,cAAgB,GAAU,EAAM,aAAa,CAAC,CAEnE,SAAS,GAAc,EAAS,CAC/B,GAAI,CAAC,EAAS,MAAO,GACrB,IAAM,EAAa,MAAM,QAAQ,EAAQ,CAAG,EAAQ,KAAK,KAAK,CAAG,EAEjE,OADK,EAAW,MAAM,CACf,GAAe,YAAY,IAAa,CADhB,GAGhC,SAAS,EAA6B,EAAO,CACxC,MAAS,KACb,OAAO,OAAO,EAAM,CAErB,SAAS,GAAwB,CAAE,SAAQ,WAAU,eAAc,cAAa,MAAK,MAAK,SAAQ,UAAS,WAAW,C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,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,SAAU,CACN,IACA,KACA,KACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,SAAU,CACN,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,KACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,IACA,KACA,KACA,IACH,CACJ,cC14CD,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,GAAM,CAAC,CAC7D,EAAQ,eAAiB,EACzB,IAAI,EAAA,IAAA,CAQJ,SAAS,EAAe,EAAU,EAAQ,CAEtC,IAAK,IADD,EAAe,GACV,EAAa,EAAG,EAAa,EAAS,OAAQ,IAAc,CACjE,IAAI,EAAc,EAAS,OAAO,EAAW,CAC7C,GAAI,IAAgB,IAAK,CAErB,IADA,IAAI,EAAc,EACX,EAAa,EAAI,EAAS,QAC7B,EAAS,OAAO,EAAa,EAAE,GAAK,GACpC,IACA,IAEJ,IAAI,EAAU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gBACD,CAAC,CAIF,GAAe,CACb,aACA,YACA,aACA,wBACA,WACA,UACA,cACD,CAAC,CAIF,GAAM,CAAE,eAAc,oBAAoB,GAAoB,CAC5D,gBACA,sBACA,wBACA,mBACA,SACA,WACA,YACA,aACA,KACD,CAAC,CAII,CACJ,6BACA,6BACA,0BACE,GAAsB,CACxB,KACA,SACA,UAAW,EACX,gBACA,aACA,iBACA,mBACA,cACA,GAAG,GACJ,CAAC,CAII,CACJ,eACA,cACA,6BACA,qBACE,GAA+B,CACjC,KACA,eACA,SACA,gBACA,sBACA,yBACA,6BACA,cACD,CAAC,CAII,GAAsB,GAC1B,EACA,GACA,GACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,EACD,CAEK,EAAyB,GAC7B,IAAc,EAAE,CAChB,IAA0B,EAAE,CAC5B,GACA,GACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACD,CAIK,GAAU,CAAC,GAAG,CAAC,GAAuB,IAAiB,GAG7D,OACE,EAAC,EAAU,SAAX,CACE,MAAO,CACL,KACA,6BACA,6BACA,eACA,cACA,6BACA,oBACA,uBACA,yBACA,yBACA,SACA,QAAS,GACT,aACA,gBACA,UACA,aACA,eACA,sBACA,6BACA,YACA,iBACA,aACD,UAED,EAAC,EAAD,CAAoB,oBAAW,GAAU,EAAW,EAAoB,CAAA,CACrD,CAAA,CC3PzB,SAAS,GAAO,CACd,WACA,IACA,UACA,GAAG,GAMiB,CACpB,IAAM,EAAU,EAAW,EAAU,CACjC,EACA,IACF,IAAY,EAAQ,OACpB,IAAkB,EAAQ,eAE5B,IAAM,EAAkB,CACtB,GAAI,EAAU,CAAC,EAAQ,CAAG,EAAE,CAC5B,GAAA,KACD,CACD,GAAI,OAAO,GAAM,SACf,MAAU,MAAM,GAAyB,EAAS,CAAC,CACrD,OAAO,EAAA,EAAA,CAAA,SAAG,GAAgB,EAAG,EAAiB,EAAS,EAAI,EAAY,CAAA,CAGzE,GAAO,KAAO,SCnCd,SAAS,GAAO,CAC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OAAS,IAChC,EAAwBA,GACtB,GACE,CACE,mBACA,EACA,KAAK,UAAU,EAAqB,CACrC,KACK,EAAiB,EAAqB,CAC7C,CACF,EAIL,SAAS,EACP,EACA,EAAmC,EAAE,CACN,CAC/B,OAAO,EAAW,EAAY,EAAS,EAAsB,CAsB/D,OAFU,EAAY,EAAI,CAAC,EAAuB,EAAW,CAErD"}
|
|
1
|
+
{"version":3,"file":"index.esm.min.mjs","names":["stableStringify","u64.split","TYPE","TYPE$1","getPluralForm","stableStringify","numOptions","dateTimeOptions","currencyOptions","React","reactUse","reactUse","_useEnableI18n","_readAuthFromEnv","_useDetermineLocale","_useRegionState","readAuthFromEnv","useEnableI18n","useRegionState","reactUse"],"sources":["../src/variables/getVariableName.ts","../../core/dist/base64-r7YWJYWt.mjs","../../core/dist/isVariable-fAKEB7gF.mjs","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js","../../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js","../../format/dist/IntlCache-ywLCPDGw.mjs","../../format/dist/internal.mjs","../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/error.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/types.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/date-time.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/regex.generated.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/number.js","../../../node_modules/.pnpm/@formatjs+icu-skeleton-parser@1.8.16/node_modules/@formatjs/icu-skeleton-parser/index.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/time-data.generated.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/date-time-pattern-generator.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/parser.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/manipulator.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/index.js","../../../node_modules/.pnpm/@formatjs+icu-messageformat-parser@2.11.4/node_modules/@formatjs/icu-messageformat-parser/printer.js","../../core/dist/internal.mjs","../src/variables/_getVariableProps.ts","../src/branches/plurals/getPluralBranch.ts","../src/rendering/getGTTag.ts","../src/rendering/renderDefaultChildren.tsx","../src/dictionaries/indexDict.ts","../src/internal/addGTIdentifier.ts","../src/errors-dir/constants.ts","../src/errors-dir/diagnostics.ts","../src/errors-dir/createErrors.ts","../src/errors-dir/internalErrors.ts","../src/utils/utils.tsx","../../format/dist/types-DY1ZTHWr.mjs","../src/internal/writeChildrenAsObjects.ts","../src/dictionaries/getDictionaryEntry.ts","../src/dictionaries/getEntryAndMetadata.ts","../src/rendering/renderTranslatedChildren.tsx","../src/rendering/getDefaultRenderSettings.ts","../src/rendering/renderSkeleton.tsx","../src/utils/cookies.ts","../src/dictionaries/isDictionaryEntry.ts","../src/dictionaries/mergeDictionaries.ts","../src/dictionaries/getSubtree.ts","../src/dictionaries/injectEntry.ts","../src/dictionaries/stripMetadataFromEntries.ts","../../core/dist/id-DEaFhGqX.mjs","../src/dictionaries/injectHashes.ts","../src/dictionaries/injectTranslations.ts","../src/dictionaries/injectFallbacks.ts","../src/dictionaries/injectAndMerge.ts","../src/dictionaries/collectUntranslatedEntries.ts","../../i18n/dist/isEncodedTranslationOptions-BOwWa_-J.mjs","../../i18n/dist/versionId-BTjLA0FZ.mjs","../../i18n/dist/mFallback-pqVm9wDk.mjs","../../i18n/dist/index.mjs","../src/variables/Derive.tsx","../src/provider/GTContext.ts","../src/variables/Num.tsx","../src/variables/Var.tsx","../src/variables/Currency.tsx","../src/variables/DateTime.tsx","../src/variables/RelativeTime.tsx","../src/rendering/renderVariable.tsx","../src/promises/dangerouslyUsable.ts","../src/utils/use.ts","../src/translation/T.tsx","../src/translation/hooks/useGT.tsx","../src/translation/hooks/useTranslations.tsx","../src/hooks/useDefaultLocale.ts","../src/hooks/useLocale.ts","../src/hooks/useVersionId.ts","../src/hooks/useRegion.ts","../src/provider/hooks/useRuntimeTranslation.ts","../src/provider/hooks/translation/useCreateInternalUseGTFunction.ts","../src/provider/hooks/translation/useCreateInternalUseTranslationsFunction.ts","../src/provider/hooks/locales/useLocaleState.ts","../src/provider/hooks/useErrorChecks.ts","../src/dictionaries/loadDictionaryHelper.ts","../src/provider/hooks/useLoadDictionary.ts","../src/utils/fetchTranslations.ts","../src/provider/hooks/useLoadTranslations.ts","../src/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.ts","../src/provider/hooks/useEnableI18n.ts","../src/provider/helpers/isSSREnabled.ts","../src/provider/hooks/locales/useDetermineLocale.ts","../src/provider/hooks/useRegionState.ts","../src/provider/GTProvider.tsx","../src/branches/plurals/Plural.tsx","../src/branches/Branch.tsx","../src/hooks/useLocales.ts","../src/hooks/useSetLocale.ts","../src/ui/LocaleSelector.tsx","../src/hooks/useLocaleSelector.ts","../src/ui/RegionSelector.tsx","../src/hooks/useGTClass.ts","../src/hooks/useRegionSelector.ts","../src/hooks/useLocaleDirection.ts","../src/translation/hooks/useMessages.ts"],"sourcesContent":["const defaultVariableNames = {\n variable: 'value',\n number: 'n',\n datetime: 'date',\n currency: 'cost',\n 'relative-time': 'time',\n} as const;\n\nexport const baseVariablePrefix = '_gt_';\n\nexport default function getVariableName(\n props: Record<string, unknown> = {},\n variableType: keyof typeof defaultVariableNames\n): string {\n if (typeof props.name === 'string') return props.name;\n const baseVariableName = defaultVariableNames[variableType] || 'value';\n const gtTag = props['data-_gt'] as { id?: number } | undefined;\n return `${baseVariablePrefix}${baseVariableName}_${gtTag?.id}`;\n}\n","//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction lowercaseFirstWord(text) {\n\treturn text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api2.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://runtime2.gtx.dev\";\n//#endregion\n//#region src/utils/isSupportedFileFormatTransform.ts\nconst SUPPORTED_TRANSFORMATIONS = {\n\tGTJSON: [\"GTJSON\"],\n\tJSON: [\"JSON\"],\n\tPO: [\"PO\"],\n\tPOT: [\"POT\", \"PO\"],\n\tYAML: [\"YAML\"],\n\tMDX: [\"MDX\"],\n\tMD: [\"MD\"],\n\tTS: [\"TS\"],\n\tJS: [\"JS\"],\n\tHTML: [\"HTML\"],\n\tTXT: [\"TXT\"],\n\tTWILIO_CONTENT_JSON: [\"TWILIO_CONTENT_JSON\"]\n};\n/**\n* This function checks if a file format transformation is supported during translation\n* @param from - The source file format.\n* @param to - The target file format.\n* @returns True if the transformation is supported, false otherwise\n*/\nfunction isSupportedFileFormatTransform(from, to) {\n\treturn SUPPORTED_TRANSFORMATIONS[from]?.includes(to) ?? false;\n}\n//#endregion\n//#region src/translate/utils/validateFileFormatTransform.ts\n/**\n* Returns a user-facing validation error when a requested file format transform\n* is missing source format context or is not currently supported.\n*/\nfunction getFileFormatTransformError(file) {\n\tif (!file.transformFormat) return void 0;\n\tconst fileLabel = file.fileName ?? file.fileId ?? \"unknown file\";\n\tif (!file.fileFormat) return `fileFormat is required when transformFormat is provided for ${fileLabel}`;\n\tif (!isSupportedFileFormatTransform(file.fileFormat, file.transformFormat)) return `Unsupported file format transform: ${file.fileFormat} -> ${file.transformFormat}`;\n}\n/**\n* Validates file format transforms before sending upload/enqueue requests.\n*/\nfunction validateFileFormatTransforms(files) {\n\tfor (const file of files) {\n\t\tconst error = getFileFormatTransformError(file);\n\t\tif (error) throw new Error(error);\n\t}\n}\n//#endregion\n//#region src/utils/base64.ts\nfunction encode(data) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(data, \"utf8\").toString(\"base64\");\n\tconst bytes = new TextEncoder().encode(data);\n\tlet binary = \"\";\n\tfor (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);\n\treturn btoa(binary);\n}\nfunction decode(base64) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(base64, \"base64\").toString(\"utf8\");\n\tconst binary = atob(base64);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn new TextDecoder().decode(bytes);\n}\n//#endregion\nexport { defaultBaseUrl as a, createDiagnosticMessage as c, libraryDefaultLocale as d, isSupportedFileFormatTransform as i, formatDiagnosticErrorDetails as l, encode as n, defaultCacheUrl as o, validateFileFormatTransforms as r, defaultRuntimeApiUrl as s, decode as t, defaultTimeout as u };\n\n//# sourceMappingURL=base64-r7YWJYWt.mjs.map","//#region src/utils/stableStringify.ts\n/**\n* Deterministic JSON stringification with sorted object keys.\n* Drop-in replacement for `fast-json-stable-stringify` for plain\n* JSON-compatible data (no toJSON, no circular references).\n*/\nfunction _stringify(node) {\n\tif (node === void 0) return void 0;\n\tif (node === null) return \"null\";\n\tif (typeof node === \"number\") return isFinite(node) ? \"\" + node : \"null\";\n\tif (typeof node !== \"object\") return JSON.stringify(node);\n\tif (Array.isArray(node)) {\n\t\tlet out = \"[\";\n\t\tfor (let i = 0; i < node.length; i++) {\n\t\t\tif (i) out += \",\";\n\t\t\tout += _stringify(node[i]) || \"null\";\n\t\t}\n\t\treturn out + \"]\";\n\t}\n\tconst keys = Object.keys(node).sort();\n\tlet out = \"\";\n\tfor (const key of keys) {\n\t\tconst value = _stringify(node[key]);\n\t\tif (!value) continue;\n\t\tif (out) out += \",\";\n\t\tout += JSON.stringify(key) + \":\" + value;\n\t}\n\treturn \"{\" + out + \"}\";\n}\nfunction stableStringify(data) {\n\treturn _stringify(data) ?? \"\";\n}\n//#endregion\n//#region src/utils/isVariable.ts\nfunction isVariable(obj) {\n\tconst variableObj = obj;\n\tif (variableObj && typeof variableObj === \"object\" && typeof variableObj.k === \"string\") {\n\t\tconst k = Object.keys(variableObj);\n\t\tif (k.length === 1) return true;\n\t\tif (k.length === 2) {\n\t\t\tif (typeof variableObj.i === \"number\") return true;\n\t\t\tif (typeof variableObj.v === \"string\") return true;\n\t\t}\n\t\tif (k.length === 3) {\n\t\t\tif (typeof variableObj.v === \"string\" && typeof variableObj.i === \"number\") return true;\n\t\t}\n\t}\n\treturn false;\n}\n//#endregion\nexport { stableStringify as n, isVariable as t };\n\n//# sourceMappingURL=isVariable-fAKEB7gF.mjs.map","/**\n * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.\n * @param a - value to test\n * @returns `true` when the value is a Uint8Array-compatible view.\n * @example\n * Check whether a value is a Uint8Array-compatible view.\n * ```ts\n * isBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function isBytes(a) {\n // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.\n // The fallback still requires a real ArrayBuffer view, so plain\n // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and\n // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.\n return (a instanceof Uint8Array ||\n (ArrayBuffer.isView(a) &&\n a.constructor.name === 'Uint8Array' &&\n 'BYTES_PER_ELEMENT' in a &&\n a.BYTES_PER_ELEMENT === 1));\n}\n/**\n * Asserts something is a non-negative integer.\n * @param n - number to validate\n * @param title - label included in thrown errors\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a non-negative integer option.\n * ```ts\n * anumber(32, 'length');\n * ```\n */\nexport function anumber(n, title = '') {\n if (typeof n !== 'number') {\n const prefix = title && `\"${title}\" `;\n throw new TypeError(`${prefix}expected number, got ${typeof n}`);\n }\n if (!Number.isSafeInteger(n) || n < 0) {\n const prefix = title && `\"${title}\" `;\n throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);\n }\n}\n/**\n * Asserts something is Uint8Array.\n * @param value - value to validate\n * @param length - optional exact length constraint\n * @param title - label included in thrown errors\n * @returns The validated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate that a value is a byte array.\n * ```ts\n * abytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function abytes(value, length, title = '') {\n const bytes = isBytes(value);\n const len = value?.length;\n const needsLen = length !== undefined;\n if (!bytes || (needsLen && len !== length)) {\n const prefix = title && `\"${title}\" `;\n const ofLen = needsLen ? ` of length ${length}` : '';\n const got = bytes ? `length=${len}` : `type=${typeof value}`;\n const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got;\n if (!bytes)\n throw new TypeError(message);\n throw new RangeError(message);\n }\n return value;\n}\n/**\n * Copies bytes into a fresh Uint8Array.\n * Buffer-style slices can alias the same backing store, so callers that need ownership should copy.\n * @param bytes - source bytes to clone\n * @returns Freshly allocated copy of `bytes`.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Clone a byte array before mutating it.\n * ```ts\n * const copy = copyBytes(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function copyBytes(bytes) {\n // `Uint8Array.from(...)` would also accept arrays / other typed arrays. Keep this helper strict\n // because callers use it at byte-validation boundaries before mutating the detached copy.\n return Uint8Array.from(abytes(bytes));\n}\n/**\n * Asserts something is a wrapped hash constructor.\n * @param h - hash constructor to validate\n * @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}\n * @throws On invalid hash metadata ranges or values. {@link RangeError}\n * @throws If the hash metadata allows empty outputs or block sizes. {@link Error}\n * @example\n * Validate a callable hash wrapper.\n * ```ts\n * import { ahash } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * ahash(sha256);\n * ```\n */\nexport function ahash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new TypeError('Hash must wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n // HMAC and KDF callers treat these as real byte lengths; allowing zero lets fake wrappers pass\n // validation and can produce empty outputs instead of failing fast.\n if (h.outputLen < 1)\n throw new Error('\"outputLen\" must be >= 1');\n if (h.blockLen < 1)\n throw new Error('\"blockLen\" must be >= 1');\n}\n/**\n * Asserts a hash instance has not been destroyed or finished.\n * @param instance - hash instance to validate\n * @param checkFinished - whether to reject finalized instances\n * @throws If the hash instance has already been destroyed or finalized. {@link Error}\n * @example\n * Validate that a hash instance is still usable.\n * ```ts\n * import { aexists } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aexists(hash);\n * ```\n */\nexport function aexists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\n/**\n * Asserts output is a sufficiently-sized byte array.\n * @param out - destination buffer\n * @param instance - hash instance providing output length\n * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Validate a caller-provided digest buffer.\n * ```ts\n * import { aoutput } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const hash = sha256.create();\n * aoutput(new Uint8Array(hash.outputLen), hash);\n * ```\n */\nexport function aoutput(out, instance) {\n abytes(out, undefined, 'digestInto() output');\n const min = instance.outputLen;\n if (out.length < min) {\n throw new RangeError('\"digestInto() output\" expected to be of length >=' + min);\n }\n}\n/**\n * Casts a typed array view to Uint8Array.\n * @param arr - source typed array\n * @returns Uint8Array view over the same buffer.\n * @example\n * Reinterpret a typed array as bytes.\n * ```ts\n * u8(new Uint32Array([1, 2]));\n * ```\n */\nexport function u8(arr) {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Casts a typed array view to Uint32Array.\n * `arr.byteOffset` must already be 4-byte aligned or the platform\n * Uint32Array constructor will throw.\n * @param arr - source typed array\n * @returns Uint32Array view over the same buffer.\n * @example\n * Reinterpret a byte array as 32-bit words.\n * ```ts\n * u32(new Uint8Array(8));\n * ```\n */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/**\n * Zeroizes typed arrays in place. Warning: JS provides no guarantees.\n * @param arrays - arrays to overwrite with zeros\n * @example\n * Zeroize sensitive buffers in place.\n * ```ts\n * clean(new Uint8Array([1, 2, 3]));\n * ```\n */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/**\n * Creates a DataView for byte-level manipulation.\n * @param arr - source typed array\n * @returns DataView over the same buffer region.\n * @example\n * Create a DataView over an existing buffer.\n * ```ts\n * createView(new Uint8Array(4));\n * ```\n */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/**\n * Rotate-right operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the right.\n * ```ts\n * rotr(0x12345678, 8);\n * ```\n */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n/**\n * Rotate-left operation for uint32 values.\n * @param word - source word\n * @param shift - shift amount in bits\n * @returns Rotated word.\n * @example\n * Rotate a 32-bit word to the left.\n * ```ts\n * rotl(0x12345678, 8);\n * ```\n */\nexport function rotl(word, shift) {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Whether the current platform is little-endian. */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/**\n * Byte-swap operation for uint32 values.\n * @param word - source word\n * @returns Word with reversed byte order.\n * @example\n * Reverse the byte order of a 32-bit word.\n * ```ts\n * byteSwap(0x11223344);\n * ```\n */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/**\n * Conditionally byte-swaps one 32-bit word on big-endian platforms.\n * @param n - source word\n * @returns Original or byte-swapped word depending on platform endianness.\n * @example\n * Normalize a 32-bit word for host endianness.\n * ```ts\n * swap8IfBE(0x11223344);\n * ```\n */\nexport const swap8IfBE = isLE\n ? (n) => n\n : (n) => byteSwap(n) >>> 0;\n/**\n * Byte-swaps every word of a Uint32Array in place.\n * @param arr - array to mutate\n * @returns The same array after mutation; callers pass live state arrays here.\n * @example\n * Reverse the byte order of every word in place.\n * ```ts\n * byteSwap32(new Uint32Array([0x11223344]));\n * ```\n */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\n/**\n * Conditionally byte-swaps a Uint32Array on big-endian platforms.\n * @param u - array to normalize for host endianness\n * @returns Original or byte-swapped array depending on platform endianness.\n * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.\n * @example\n * Normalize a word array for host endianness.\n * ```ts\n * swap32IfBE(new Uint32Array([0x11223344]));\n * ```\n */\nexport const swap32IfBE = isLE\n ? (u) => u\n : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string.\n * Uses the built-in function when available and assumes it matches the tested\n * fallback semantics.\n * @param bytes - bytes to encode\n * @returns Lowercase hexadecimal string.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Convert bytes to lowercase hexadecimal.\n * ```ts\n * bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'\n * ```\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n if (ch >= asciis._0 && ch <= asciis._9)\n return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F)\n return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f)\n return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @param hex - hexadecimal string to decode\n * @returns Decoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @example\n * Decode lowercase hexadecimal into bytes.\n * ```ts\n * hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n * ```\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new TypeError('hex string expected, got ' + typeof hex);\n if (hasHexBuiltin) {\n try {\n return Uint8Array.fromHex(hex);\n }\n catch (error) {\n if (error instanceof SyntaxError)\n throw new RangeError(error.message);\n throw error;\n }\n }\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new RangeError('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new RangeError('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * This yields to the Promise/microtask scheduler queue, not to timers or the\n * full macrotask event loop.\n * @example\n * Yield to the next scheduler tick.\n * ```ts\n * await nextTick();\n * ```\n */\nexport const nextTick = async () => { };\n/**\n * Returns control to the Promise/microtask scheduler every `tick`\n * milliseconds to avoid blocking long loops.\n * @param iters - number of loop iterations to run\n * @param tick - maximum time slice in milliseconds\n * @param cb - callback executed on each iteration\n * @example\n * Run a loop that periodically yields back to the event loop.\n * ```ts\n * await asyncLoop(2, 0, () => {});\n * ```\n */\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * Non-ASCII details are delegated to the platform `TextEncoder`.\n * @param str - string to encode\n * @returns UTF-8 encoded bytes.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Encode a string as UTF-8 bytes.\n * ```ts\n * utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])\n * ```\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new TypeError('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Helper for KDFs: consumes Uint8Array or string.\n * String inputs are UTF-8 encoded; byte-array inputs stay aliased to the caller buffer.\n * @param data - user-provided KDF input\n * @param errorTitle - label included in thrown errors\n * @returns Byte representation of the input.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Normalize KDF input to bytes.\n * ```ts\n * kdfInputToBytes('password');\n * ```\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n if (typeof data === 'string')\n return utf8ToBytes(data);\n return abytes(data, undefined, errorTitle);\n}\n/**\n * Copies several Uint8Arrays into one.\n * @param arrays - arrays to concatenate\n * @returns Concatenated byte array.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Concatenate multiple byte arrays.\n * ```ts\n * concatBytes(new Uint8Array([1]), new Uint8Array([2]));\n * ```\n */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n/**\n * Merges default options and passed options.\n * @param defaults - base option object\n * @param opts - user overrides\n * @returns Merged option object. The merge mutates `defaults` in place.\n * @throws On wrong argument types. {@link TypeError}\n * @example\n * Merge user overrides onto default options.\n * ```ts\n * checkOpts({ dkLen: 32 }, { asyncTick: 10 });\n * ```\n */\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new TypeError('options must be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\n/**\n * Creates a callable hash function from a stateful class constructor.\n * @param hashCons - hash constructor or factory\n * @param info - optional metadata such as DER OID\n * @returns Frozen callable hash wrapper with `.create()`.\n * Wrapper construction eagerly calls `hashCons(undefined)` once to read\n * `outputLen` / `blockLen`, so constructor side effects happen at module\n * init time.\n * @example\n * Wrap a stateful hash constructor into a callable helper.\n * ```ts\n * import { createHasher } from '@noble/hashes/utils.js';\n * import { sha256 } from '@noble/hashes/sha2.js';\n * const wrapped = createHasher(sha256.create, { oid: sha256.oid });\n * wrapped(new Uint8Array([1]));\n * ```\n */\nexport function createHasher(hashCons, info = {}) {\n const hashC = (msg, opts) => hashCons(opts)\n .update(msg)\n .digest();\n const tmp = hashCons(undefined);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.canXOF = tmp.canXOF;\n hashC.create = (opts) => hashCons(opts);\n Object.assign(hashC, info);\n return Object.freeze(hashC);\n}\n/**\n * Cryptographically secure PRNG backed by `crypto.getRandomValues`.\n * @param bytesLength - number of random bytes to generate\n * @returns Random bytes.\n * The platform `getRandomValues()` implementation still defines any\n * single-call length cap, and this helper rejects oversize requests\n * with a stable library `RangeError` instead of host-specific errors.\n * @throws On wrong argument types. {@link TypeError}\n * @throws On wrong argument ranges or values. {@link RangeError}\n * @throws If the current runtime does not provide `crypto.getRandomValues`. {@link Error}\n * @example\n * Generate a fresh random key or nonce.\n * ```ts\n * const key = randomBytes(16);\n * ```\n */\nexport function randomBytes(bytesLength = 32) {\n // Match the repo's other length-taking helpers instead of relying on Uint8Array coercion.\n anumber(bytesLength, 'bytesLength');\n const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n if (typeof cr?.getRandomValues !== 'function')\n throw new Error('crypto.getRandomValues must be defined');\n // Web Cryptography API Level 2 §10.1.1:\n // if `byteLength > 65536`, throw `QuotaExceededError`.\n // Keep the guard explicit so callers can see the quota in code\n // instead of discovering it by reading the spec or host errors.\n // This wrapper surfaces the same quota as a stable library RangeError.\n if (bytesLength > 65536)\n throw new RangeError(`\"bytesLength\" expected <= 65536, got ${bytesLength}`);\n return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/**\n * Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.\n * @param suffix - final OID byte for the selected hash.\n * The helper accepts any byte even though only the documented NIST hash\n * suffixes are meaningful downstream.\n * @returns Object containing the DER-encoded OID.\n * @example\n * Build OID metadata for a NIST hash.\n * ```ts\n * oidNist(0x01);\n * ```\n */\nexport const oidNist = (suffix) => ({\n // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.\n // Larger suffix values would need base-128 OID encoding and a different length byte.\n oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n//# sourceMappingURL=utils.js.map","/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { abytes, aexists, aoutput, clean, createView, } from \"./utils.js\";\n/**\n * Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`.\n * Returns bits from `b` when `a` is set, otherwise from `c`.\n * The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never\n * set the same bit.\n * @param a - selector word\n * @param b - word chosen when selector bit is set\n * @param c - word chosen when selector bit is clear\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit choice primitive.\n * ```ts\n * Chi(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/**\n * Shared 32-bit majority primitive reused by SHA-256 and SHA-1.\n * Returns bits shared by at least two inputs.\n * @param a - first input word\n * @param b - second input word\n * @param c - third input word\n * @returns Mixed 32-bit word.\n * @example\n * Combine three words with the shared 32-bit majority primitive.\n * ```ts\n * Maj(0xffffffff, 0x12345678, 0x87654321);\n * ```\n */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n * Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit\n * strings with partial-byte tails.\n * @param blockLen - internal block size in bytes\n * @param outputLen - digest size in bytes\n * @param padOffset - trailing length field size in bytes\n * @param isLE - whether length and state words are encoded in little-endian\n * @example\n * Use a concrete subclass to get the shared Merkle-Damgard update/digest flow.\n * ```ts\n * import { _SHA1 } from '@noble/hashes/legacy.js';\n * const hash = new _SHA1();\n * hash.update(new Uint8Array([97, 98, 99]));\n * hash.digest();\n * ```\n */\nexport class HashMD {\n blockLen;\n outputLen;\n canXOF = false;\n padOffset;\n isLE;\n // For partial updates less than block size\n buffer;\n view;\n finished = false;\n length = 0;\n pos = 0;\n destroyed = false;\n constructor(blockLen, outputLen, padOffset, isLE) {\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path only when there is no buffered partial block: `take === blockLen` implies\n // `this.pos === 0`, so we can process full blocks directly from the input view.\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from\n // the padding fill above, and JS will overflow before user input can make that half non-zero.\n // So we only need to write the low 64 bits here.\n view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen must be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n // Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return\n // fresh bytes to the caller.\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to ||= new this.constructor();\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n // Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and\n // later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it.\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the\n * square roots of the first eight prime numbers. Exported as a shared table; callers must treat\n * it as read-only because constructors copy words from it by index. */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must\n * treat it as read-only because constructors copy words from it by index. */\nexport const SHA224_IV = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth\n * through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only\n * because constructors copy halves from it by index. */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen\n * big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first\n * eight prime numbers. Exported as a shared table; callers must treat it as read-only because\n * constructors copy halves from it by index. */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n//# sourceMappingURL=_md.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high\n// }` to match little-endian word order rather than the property names.\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array\n// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.\nfunction split(lst, le = false) {\n const len = lst.length;\n let Ah = new Uint32Array(len);\n let Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\n// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS\n// bitwise results back to uint32 first, and little-endian callers must swap.\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.\nconst shrSH = (h, _l, s) => h >>> s;\n// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\n// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.\nconst rotr32H = (_h, l) => l;\n// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.\nconst rotr32L = (h, _l) => h;\n// High 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`.\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\n// Low 32-bit half of a 64-bit left rotate, valid for `s` in `1..31`.\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// High 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\n// Low 32-bit half of a 64-bit left rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// Add two split 64-bit words and return the split `{ h, l }` sum.\n// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out\n// of the low sum and instead use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\n// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\n// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\n// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\n// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\n// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };\n// Canonical grouped namespace for callers that prefer one object.\n// Named exports stay for direct imports.\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n// Default export mirrors named `u64` for compatibility with object-style imports.\nexport default u64;\n//# sourceMappingURL=_u64.js.map","/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and\n * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}.\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from \"./_md.js\";\nimport * as u64 from \"./_u64.js\";\nimport { clean, createHasher, oidNist, rotr } from \"./utils.js\";\n/**\n * SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits\n * of the cube roots of the first 64 primes (2..311).\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\n/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */\nclass SHA2_32B extends HashMD {\n constructor(outputLen) {\n super(64, outputLen, 8, false);\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */\nexport class _SHA256 extends SHA2_32B {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n A = SHA256_IV[0] | 0;\n B = SHA256_IV[1] | 0;\n C = SHA256_IV[2] | 0;\n D = SHA256_IV[3] | 0;\n E = SHA256_IV[4] | 0;\n F = SHA256_IV[5] | 0;\n G = SHA256_IV[6] | 0;\n H = SHA256_IV[7] | 0;\n constructor() {\n super(32);\n }\n}\n/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */\nexport class _SHA224 extends SHA2_32B {\n A = SHA224_IV[0] | 0;\n B = SHA224_IV[1] | 0;\n C = SHA224_IV[2] | 0;\n D = SHA224_IV[3] | 0;\n E = SHA224_IV[4] | 0;\n F = SHA224_IV[5] | 0;\n G = SHA224_IV[6] | 0;\n H = SHA224_IV[7] | 0;\n constructor() {\n super(28);\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// SHA-384 / SHA-512 round constants from RFC 6234 §5.2:\n// 80 full 64-bit words split into high/low halves.\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\n// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */\nclass SHA2_64B extends HashMD {\n constructor(outputLen) {\n super(128, outputLen, 16, false);\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n // HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves\n // update()/digest() callable on reused instances.\n this.destroyed = true;\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */\nexport class _SHA512 extends SHA2_64B {\n Ah = SHA512_IV[0] | 0;\n Al = SHA512_IV[1] | 0;\n Bh = SHA512_IV[2] | 0;\n Bl = SHA512_IV[3] | 0;\n Ch = SHA512_IV[4] | 0;\n Cl = SHA512_IV[5] | 0;\n Dh = SHA512_IV[6] | 0;\n Dl = SHA512_IV[7] | 0;\n Eh = SHA512_IV[8] | 0;\n El = SHA512_IV[9] | 0;\n Fh = SHA512_IV[10] | 0;\n Fl = SHA512_IV[11] | 0;\n Gh = SHA512_IV[12] | 0;\n Gl = SHA512_IV[13] | 0;\n Hh = SHA512_IV[14] | 0;\n Hl = SHA512_IV[15] | 0;\n constructor() {\n super(64);\n }\n}\n/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */\nexport class _SHA384 extends SHA2_64B {\n Ah = SHA384_IV[0] | 0;\n Al = SHA384_IV[1] | 0;\n Bh = SHA384_IV[2] | 0;\n Bl = SHA384_IV[3] | 0;\n Ch = SHA384_IV[4] | 0;\n Cl = SHA384_IV[5] | 0;\n Dh = SHA384_IV[6] | 0;\n Dl = SHA384_IV[7] | 0;\n Eh = SHA384_IV[8] | 0;\n El = SHA384_IV[9] | 0;\n Fh = SHA384_IV[10] | 0;\n Fl = SHA384_IV[11] | 0;\n Gh = SHA384_IV[12] | 0;\n Gl = SHA384_IV[13] | 0;\n Hh = SHA384_IV[14] | 0;\n Hl = SHA384_IV[15] | 0;\n constructor() {\n super(48);\n }\n}\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`.\n * These IV literals are checked against that script rather than a dedicated\n * local RFC section.\n */\n/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and\n * stored as sixteen big-endian 32-bit halves. */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared\n * RFC 6234 §6.4 compression engine. */\nexport class _SHA512_224 extends SHA2_64B {\n Ah = T224_IV[0] | 0;\n Al = T224_IV[1] | 0;\n Bh = T224_IV[2] | 0;\n Bl = T224_IV[3] | 0;\n Ch = T224_IV[4] | 0;\n Cl = T224_IV[5] | 0;\n Dh = T224_IV[6] | 0;\n Dl = T224_IV[7] | 0;\n Eh = T224_IV[8] | 0;\n El = T224_IV[9] | 0;\n Fh = T224_IV[10] | 0;\n Fl = T224_IV[11] | 0;\n Gh = T224_IV[12] | 0;\n Gl = T224_IV[13] | 0;\n Hh = T224_IV[14] | 0;\n Hl = T224_IV[15] | 0;\n constructor() {\n super(28);\n }\n}\n/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared\n * RFC 6234 §6.4 compression engine. */\nexport class _SHA512_256 extends SHA2_64B {\n Ah = T256_IV[0] | 0;\n Al = T256_IV[1] | 0;\n Bh = T256_IV[2] | 0;\n Bl = T256_IV[3] | 0;\n Ch = T256_IV[4] | 0;\n Cl = T256_IV[5] | 0;\n Dh = T256_IV[6] | 0;\n Dl = T256_IV[7] | 0;\n Eh = T256_IV[8] | 0;\n El = T256_IV[9] | 0;\n Fh = T256_IV[10] | 0;\n Fl = T256_IV[11] | 0;\n Gh = T256_IV[12] | 0;\n Gl = T256_IV[13] | 0;\n Hh = T256_IV[14] | 0;\n Hl = T256_IV[15] | 0;\n constructor() {\n super(32);\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:\n *\n * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.\n * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n * - Each sha256 hash is executing 2^18 bit operations.\n * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-256.\n * ```ts\n * sha256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), \n/* @__PURE__ */ oidNist(0x01));\n/**\n * SHA2-224 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-224.\n * ```ts\n * sha224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(), \n/* @__PURE__ */ oidNist(0x04));\n/**\n * SHA2-512 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512.\n * ```ts\n * sha512(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), \n/* @__PURE__ */ oidNist(0x03));\n/**\n * SHA2-384 hash function from RFC 4634.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-384.\n * ```ts\n * sha384(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), \n/* @__PURE__ */ oidNist(0x02));\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/256.\n * ```ts\n * sha512_256(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(), \n/* @__PURE__ */ oidNist(0x06));\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.\n * @param msg - message bytes to hash\n * @returns Digest bytes.\n * @example\n * Hash a message with SHA2-512/224.\n * ```ts\n * sha512_224(new Uint8Array([97, 98, 99]));\n * ```\n */\nexport const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(), \n/* @__PURE__ */ oidNist(0x05));\n//# sourceMappingURL=sha2.js.map","//#region src/errors/formattingErrors.ts\nconst createInvalidCutoffStyleError = (style) => `generaltranslation Formatting Error: Invalid cutoff style: ${style}.`;\nconst DEFAULT_TERMINATOR_KEY = \"DEFAULT_TERMINATOR_KEY\";\nconst TERMINATOR_MAP = {\n\tellipsis: {\n\t\tfr: {\n\t\t\tterminator: \"…\",\n\t\t\tseparator: \" \"\n\t\t},\n\t\tzh: {\n\t\t\tterminator: \"……\",\n\t\t\tseparator: void 0\n\t\t},\n\t\tja: {\n\t\t\tterminator: \"……\",\n\t\t\tseparator: void 0\n\t\t},\n\t\t[DEFAULT_TERMINATOR_KEY]: {\n\t\t\tterminator: \"…\",\n\t\t\tseparator: void 0\n\t\t}\n\t},\n\tnone: { [DEFAULT_TERMINATOR_KEY]: {\n\t\tterminator: void 0,\n\t\tseparator: void 0\n\t} }\n};\n//#endregion\n//#region src/formatting/custom-formats/CutoffFormat/CutoffFormat.ts\nvar CutoffFormatConstructor = class CutoffFormatConstructor {\n\tstatic resolveLocale(locales) {\n\t\ttry {\n\t\t\tconst localesList = !locales ? [\"en\"] : Array.isArray(locales) ? locales.map(String) : [String(locales)];\n\t\t\tconst [canonicalLocale] = Intl.getCanonicalLocales(localesList);\n\t\t\treturn canonicalLocale ?? \"en\";\n\t\t} catch {\n\t\t\treturn \"en\";\n\t\t}\n\t}\n\t/**\n\t* Constructor\n\t* @param {Intl.LocalesArgument} locales - The locales to use for formatting.\n\t* @param {CutoffFormatOptions} options - The options for formatting.\n\t* @param {number} [options.maxChars] - The maximum number of characters to display.\n\t* - Undefined values are treated as no cutoff.\n\t* - Negative values follow .slice() behavior and terminator will be added before the value.\n\t* - 0 will result in an empty string.\n\t* - If cutoff results in an empty string, no terminator is added.\n\t* @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.\n\t* @param {string} [options.terminator] - Optional override the terminator to use.\n\t* @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.\n\t* - If no terminator is provided, then separator is ignored.\n\t*\n\t* @example\n\t* const format = new CutoffFormat('en', { maxChars: 5 });\n\t* format.format('Hello, world!'); // 'Hello...'\n\t*\n\t* const format = new CutoffFormat('en', { maxChars: -3 });\n\t* format.format('Hello, world!'); // '...ld!'\n\t*/\n\tconstructor(locales, options = {}) {\n\t\tthis.locale = CutoffFormatConstructor.resolveLocale(locales);\n\t\tconst style = options.style ?? \"ellipsis\";\n\t\tif (!TERMINATOR_MAP[style]) throw new Error(createInvalidCutoffStyleError(style));\n\t\tconst presetTerminatorOptions = options.maxChars === void 0 ? void 0 : TERMINATOR_MAP[style][new Intl.Locale(this.locale).language] || TERMINATOR_MAP[style][\"DEFAULT_TERMINATOR_KEY\"];\n\t\tlet terminator = options.terminator ?? presetTerminatorOptions?.terminator;\n\t\tlet separator = terminator != null ? options.separator ?? presetTerminatorOptions?.separator : void 0;\n\t\tthis.additionLength = (terminator?.length ?? 0) + (separator?.length ?? 0);\n\t\tif (options.maxChars !== void 0 && Math.abs(options.maxChars) < this.additionLength) {\n\t\t\tterminator = void 0;\n\t\t\tseparator = void 0;\n\t\t}\n\t\tthis.options = {\n\t\t\tmaxChars: options.maxChars,\n\t\t\tstyle: options.maxChars === void 0 ? void 0 : style,\n\t\t\tterminator,\n\t\t\tseparator\n\t\t};\n\t}\n\t/**\n\t* Format a value according to the cutoff options, returning a formatted string.\n\t*\n\t* @param {string} value - The string value to format with cutoff behavior.\n\t* @returns {string} The formatted string with terminator applied if cutoff occurs.\n\t*\n\t* @example\n\t* const formatter = new CutoffFormatConstructor('en', { maxChars: 8, style: 'ellipsis' });\n\t* formatter.format('Hello, world!'); // Returns 'Hello, w...'\n\t*/\n\tformat(value) {\n\t\treturn this.formatToParts(value).join(\"\");\n\t}\n\t/**\n\t* Format a value to parts according to the cutoff options, returning an array of string parts.\n\t* This method breaks down the formatted result into individual components for more granular control.\n\t*\n\t* @param {string} value - The string value to format with cutoff behavior.\n\t* @returns {PrependedCutoffParts | PostpendedCutoffParts} An array of string parts representing the formatted result.\n\t* - For positive maxChars: [cutoffValue, separator?, terminator?]\n\t* - For negative maxChars: [terminator?, separator?, cutoffValue]\n\t* - For no cutoff: [originalValue]\n\t*\n\t* @example\n\t* const formatter = new CutoffFormatConstructor('en', { maxChars: 5, style: 'ellipsis' });\n\t* formatter.formatToParts('Hello, world!'); // Returns ['Hello', '...']\n\t*/\n\tformatToParts(value) {\n\t\tconst { maxChars, terminator, separator } = this.options;\n\t\tconst adjustedChars = maxChars === void 0 || Math.abs(maxChars) >= value.length ? maxChars : maxChars >= 0 ? Math.max(0, maxChars - this.additionLength) : Math.min(0, maxChars + this.additionLength);\n\t\tconst slicedValue = adjustedChars !== void 0 && adjustedChars > -1 ? value.slice(0, adjustedChars) : value.slice(adjustedChars);\n\t\tif (maxChars == null || adjustedChars == null || adjustedChars === 0 || terminator == null || value.length <= Math.abs(maxChars)) return [slicedValue];\n\t\tif (adjustedChars > 0) return separator != null ? [\n\t\t\tslicedValue,\n\t\t\tseparator,\n\t\t\tterminator\n\t\t] : [slicedValue, terminator];\n\t\treturn separator != null ? [\n\t\t\tterminator,\n\t\t\tseparator,\n\t\t\tslicedValue\n\t\t] : [terminator, slicedValue];\n\t}\n\t/**\n\t* Get the resolved options\n\t* @returns {ResolvedCutoffFormatOptions} The resolved options.\n\t*/\n\tresolvedOptions() {\n\t\treturn this.options;\n\t}\n};\n//#endregion\n//#region src/cache/IntlCache.ts\n/**\n* Object mapping constructor names to their respective constructor functions\n* Includes all native Intl constructors plus custom ones like CutoffFormat\n*/\nconst CustomIntl = {\n\tCollator: Intl.Collator,\n\tDateTimeFormat: Intl.DateTimeFormat,\n\tDisplayNames: Intl.DisplayNames,\n\tListFormat: Intl.ListFormat,\n\tLocale: Intl.Locale,\n\tNumberFormat: Intl.NumberFormat,\n\tPluralRules: Intl.PluralRules,\n\tRelativeTimeFormat: Intl.RelativeTimeFormat,\n\tSegmenter: Intl.Segmenter,\n\tCutoffFormat: CutoffFormatConstructor\n};\n/**\n* Cache for Intl and custom format instances to avoid repeated instantiation\n* Uses a two-level structure: constructor name -> cache key -> instance.\n*/\nvar IntlCache = class {\n\tconstructor() {\n\t\tthis.cache = {};\n\t}\n\t/**\n\t* Generates a consistent cache key from locales and options.\n\t* Handles all LocalesArgument types (string, Locale, array, undefined).\n\t*/\n\tgenerateKey(locales, options = {}) {\n\t\treturn `${!locales ? \"undefined\" : Array.isArray(locales) ? locales.map((l) => String(l)).join(\",\") : String(locales)}:${options ? JSON.stringify(options, Object.keys(options).sort()) : \"{}\"}`;\n\t}\n\t/**\n\t* Gets a cached Intl instance or creates a new one if not found\n\t* @param constructor The name of the Intl constructor to use.\n\t* @param args Constructor arguments (locales, options).\n\t* @returns Cached or newly created Intl instance.\n\t*/\n\tget(constructor, ...args) {\n\t\tconst [locales = \"en\", options = {}] = args;\n\t\tconst key = this.generateKey(locales, options);\n\t\tlet cache = this.cache[constructor];\n\t\tif (cache === void 0) {\n\t\t\tcache = {};\n\t\t\tthis.cache[constructor] = cache;\n\t\t}\n\t\tlet intlObject = cache[key];\n\t\tif (intlObject === void 0) {\n\t\t\tintlObject = new CustomIntl[constructor](...args);\n\t\t\tcache[key] = intlObject;\n\t\t}\n\t\treturn intlObject;\n\t}\n};\n/**\n* Global instance of the Intl cache for use throughout the application\n*/\nconst intlCache = new IntlCache();\n//#endregion\nexport { intlCache as t };\n\n//# sourceMappingURL=IntlCache-ywLCPDGw.mjs.map","import { t as intlCache } from \"./IntlCache-ywLCPDGw.mjs\";\n//#region src/internal.ts\nfunction getCachedPluralRules(locales) {\n\treturn intlCache.get(\"PluralRules\", locales);\n}\n//#endregion\nexport { getCachedPluralRules };\n\n//# sourceMappingURL=internal.mjs.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ErrorKind = void 0;\nvar ErrorKind;\n(function (ErrorKind) {\n /** Argument is unclosed (e.g. `{0`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n /** Argument is empty (e.g. `{}`). */\n ErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n /** Argument is malformed (e.g. `{foo!}``) */\n ErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n /** Expect an argument type (e.g. `{foo,}`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n /** Unsupported argument type (e.g. `{foo,foo}`) */\n ErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n /** Expect an argument style (e.g. `{foo, number, }`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n /** The number skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n /** The date time skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n ErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n /** Missing select argument options (e.g. `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n /**\n * Expecting a message fragment after the `plural` or `selectordinal` selector\n * (e.g. `{foo, plural, one}`)\n */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n /**\n * Duplicate selectors in `plural` or `selectordinal` argument.\n * (e.g. {foo, plural, one {#} one {#}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n /** Duplicate selectors in `select` argument.\n * (e.g. {foo, select, apple {apple} apple {apple}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n /** Plural or select argument option must have `other` clause. */\n ErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n /** The tag is malformed. (e.g. `<bold!>foo</bold!>) */\n ErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n /** The tag name is invalid. (e.g. `<123>foo</123>`) */\n ErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n /** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */\n ErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n /** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */\n ErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n})(ErrorKind || (exports.ErrorKind = ErrorKind = {}));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SKELETON_TYPE = exports.TYPE = void 0;\nexports.isLiteralElement = isLiteralElement;\nexports.isArgumentElement = isArgumentElement;\nexports.isNumberElement = isNumberElement;\nexports.isDateElement = isDateElement;\nexports.isTimeElement = isTimeElement;\nexports.isSelectElement = isSelectElement;\nexports.isPluralElement = isPluralElement;\nexports.isPoundElement = isPoundElement;\nexports.isTagElement = isTagElement;\nexports.isNumberSkeleton = isNumberSkeleton;\nexports.isDateTimeSkeleton = isDateTimeSkeleton;\nexports.createLiteralElement = createLiteralElement;\nexports.createNumberElement = createNumberElement;\nvar TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n /**\n * XML-like tag\n */\n TYPE[TYPE[\"tag\"] = 8] = \"tag\";\n})(TYPE || (exports.TYPE = TYPE = {}));\nvar SKELETON_TYPE;\n(function (SKELETON_TYPE) {\n SKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n SKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n})(SKELETON_TYPE || (exports.SKELETON_TYPE = SKELETON_TYPE = {}));\n/**\n * Type Guards\n */\nfunction isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nfunction isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nfunction isNumberElement(el) {\n return el.type === TYPE.number;\n}\nfunction isDateElement(el) {\n return el.type === TYPE.date;\n}\nfunction isTimeElement(el) {\n return el.type === TYPE.time;\n}\nfunction isSelectElement(el) {\n return el.type === TYPE.select;\n}\nfunction isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nfunction isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nfunction isTagElement(el) {\n return el.type === TYPE.tag;\n}\nfunction isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);\n}\nfunction isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);\n}\nfunction createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nfunction createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WHITE_SPACE_REGEX = exports.SPACE_SEPARATOR_REGEX = void 0;\n// @generated from regex-gen.ts\nexports.SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nexports.WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseDateTimeSkeleton = parseDateTimeSkeleton;\n/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nfunction parseDateTimeSkeleton(skeleton) {\n var result = {};\n skeleton.replace(DATE_TIME_REGEX, function (match) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n // Year\n case 'y':\n result.year = len === 2 ? '2-digit' : 'numeric';\n break;\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`q/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n break;\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n break;\n case 'D':\n case 'F':\n case 'g':\n throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n case 'e':\n if (len < 4) {\n throw new RangeError('`e..eee` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n case 'c':\n if (len < 4) {\n throw new RangeError('`c..ccc` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n // Period\n case 'a': // AM, PM\n result.hour12 = true;\n break;\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');\n // Hour\n case 'h':\n result.hourCycle = 'h12';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'H':\n result.hourCycle = 'h23';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'K':\n result.hourCycle = 'h11';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'k':\n result.hourCycle = 'h24';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n break;\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n break;\n case 'S':\n case 'A':\n throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n result.timeZoneName = len < 4 ? 'short' : 'long';\n break;\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: milliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');\n }\n return '';\n });\n return result;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WHITE_SPACE_REGEX = void 0;\n// @generated from regex-gen.ts\nexports.WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseNumberSkeletonFromString = parseNumberSkeletonFromString;\nexports.parseNumberSkeleton = parseNumberSkeleton;\nvar tslib_1 = require(\"tslib\");\nvar regex_generated_1 = require(\"./regex.generated\");\nfunction parseNumberSkeletonFromString(skeleton) {\n if (skeleton.length === 0) {\n throw new Error('Number skeleton cannot be empty');\n }\n // Parse the skeleton\n var stringTokens = skeleton\n .split(regex_generated_1.WHITE_SPACE_REGEX)\n .filter(function (x) { return x.length > 0; });\n var tokens = [];\n for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {\n var stringToken = stringTokens_1[_i];\n var stemAndOptions = stringToken.split('/');\n if (stemAndOptions.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n var stem = stemAndOptions[0], options = stemAndOptions.slice(1);\n for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {\n var option = options_1[_a];\n if (option.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n }\n tokens.push({ stem: stem, options: options });\n }\n return tokens;\n}\nfunction icuUnitToEcma(unit) {\n return unit.replace(/^(.*?)-/, '');\n}\nvar FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nvar SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nvar INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nvar CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n var result = {};\n if (str[str.length - 1] === 'r') {\n result.roundingPriority = 'morePrecision';\n }\n else if (str[str.length - 1] === 's') {\n result.roundingPriority = 'lessPrecision';\n }\n str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {\n // @@@ case\n if (typeof g2 !== 'string') {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits = g1.length;\n }\n // @@@+ case\n else if (g2 === '+') {\n result.minimumSignificantDigits = g1.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumSignificantDigits = g1.length;\n }\n // .@@## or .@@@ case\n else {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n return result;\n}\nfunction parseSign(str) {\n switch (str) {\n case 'sign-auto':\n return {\n signDisplay: 'auto',\n };\n case 'sign-accounting':\n case '()':\n return {\n currencySign: 'accounting',\n };\n case 'sign-always':\n case '+!':\n return {\n signDisplay: 'always',\n };\n case 'sign-accounting-always':\n case '()!':\n return {\n signDisplay: 'always',\n currencySign: 'accounting',\n };\n case 'sign-except-zero':\n case '+?':\n return {\n signDisplay: 'exceptZero',\n };\n case 'sign-accounting-except-zero':\n case '()?':\n return {\n signDisplay: 'exceptZero',\n currencySign: 'accounting',\n };\n case 'sign-never':\n case '+_':\n return {\n signDisplay: 'never',\n };\n }\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n // Engineering\n var result;\n if (stem[0] === 'E' && stem[1] === 'E') {\n result = {\n notation: 'engineering',\n };\n stem = stem.slice(2);\n }\n else if (stem[0] === 'E') {\n result = {\n notation: 'scientific',\n };\n stem = stem.slice(1);\n }\n if (result) {\n var signDisplay = stem.slice(0, 2);\n if (signDisplay === '+!') {\n result.signDisplay = 'always';\n stem = stem.slice(2);\n }\n else if (signDisplay === '+?') {\n result.signDisplay = 'exceptZero';\n stem = stem.slice(2);\n }\n if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {\n throw new Error('Malformed concise eng/scientific notation');\n }\n result.minimumIntegerDigits = stem.length;\n }\n return result;\n}\nfunction parseNotationOptions(opt) {\n var result = {};\n var signOpts = parseSign(opt);\n if (signOpts) {\n return signOpts;\n }\n return result;\n}\n/**\n * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n */\nfunction parseNumberSkeleton(tokens) {\n var result = {};\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n switch (token.stem) {\n case 'percent':\n case '%':\n result.style = 'percent';\n continue;\n case '%x100':\n result.style = 'percent';\n result.scale = 100;\n continue;\n case 'currency':\n result.style = 'currency';\n result.currency = token.options[0];\n continue;\n case 'group-off':\n case ',_':\n result.useGrouping = false;\n continue;\n case 'precision-integer':\n case '.':\n result.maximumFractionDigits = 0;\n continue;\n case 'measure-unit':\n case 'unit':\n result.style = 'unit';\n result.unit = icuUnitToEcma(token.options[0]);\n continue;\n case 'compact-short':\n case 'K':\n result.notation = 'compact';\n result.compactDisplay = 'short';\n continue;\n case 'compact-long':\n case 'KK':\n result.notation = 'compact';\n result.compactDisplay = 'long';\n continue;\n case 'scientific':\n result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'engineering':\n result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'notation-simple':\n result.notation = 'standard';\n continue;\n // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h\n case 'unit-width-narrow':\n result.currencyDisplay = 'narrowSymbol';\n result.unitDisplay = 'narrow';\n continue;\n case 'unit-width-short':\n result.currencyDisplay = 'code';\n result.unitDisplay = 'short';\n continue;\n case 'unit-width-full-name':\n result.currencyDisplay = 'name';\n result.unitDisplay = 'long';\n continue;\n case 'unit-width-iso-code':\n result.currencyDisplay = 'symbol';\n continue;\n case 'scale':\n result.scale = parseFloat(token.options[0]);\n continue;\n case 'rounding-mode-floor':\n result.roundingMode = 'floor';\n continue;\n case 'rounding-mode-ceiling':\n result.roundingMode = 'ceil';\n continue;\n case 'rounding-mode-down':\n result.roundingMode = 'trunc';\n continue;\n case 'rounding-mode-up':\n result.roundingMode = 'expand';\n continue;\n case 'rounding-mode-half-even':\n result.roundingMode = 'halfEven';\n continue;\n case 'rounding-mode-half-down':\n result.roundingMode = 'halfTrunc';\n continue;\n case 'rounding-mode-half-up':\n result.roundingMode = 'halfExpand';\n continue;\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n case 'integer-width':\n if (token.options.length > 1) {\n throw new RangeError('integer-width stems only accept a single optional option');\n }\n token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {\n if (g1) {\n result.minimumIntegerDigits = g2.length;\n }\n else if (g3 && g4) {\n throw new Error('We currently do not support maximum integer digits');\n }\n else if (g5) {\n throw new Error('We currently do not support exact integer digits');\n }\n return '';\n });\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n result.minimumIntegerDigits = token.stem.length;\n continue;\n }\n if (FRACTION_PRECISION_REGEX.test(token.stem)) {\n // Precision\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision\n // precision-integer case\n if (token.options.length > 1) {\n throw new RangeError('Fraction-precision stems only accept a single optional option');\n }\n token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {\n // .000* case (before ICU67 it was .000+)\n if (g2 === '*') {\n result.minimumFractionDigits = g1.length;\n }\n // .### case\n else if (g3 && g3[0] === '#') {\n result.maximumFractionDigits = g3.length;\n }\n // .00## case\n else if (g4 && g5) {\n result.minimumFractionDigits = g4.length;\n result.maximumFractionDigits = g4.length + g5.length;\n }\n else {\n result.minimumFractionDigits = g1.length;\n result.maximumFractionDigits = g1.length;\n }\n return '';\n });\n var opt = token.options[0];\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display\n if (opt === 'w') {\n result = tslib_1.__assign(tslib_1.__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });\n }\n else if (opt) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(opt));\n }\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision\n if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(token.stem));\n continue;\n }\n var signOpts = parseSign(token.stem);\n if (signOpts) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), signOpts);\n }\n var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n if (conciseScientificAndEngineeringOpts) {\n result = tslib_1.__assign(tslib_1.__assign({}, result), conciseScientificAndEngineeringOpts);\n }\n }\n return result;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./date-time\"), exports);\ntslib_1.__exportStar(require(\"./number\"), exports);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.timeData = void 0;\n// @generated from time-data-gen.ts\n// prettier-ignore \nexports.timeData = {\n \"001\": [\n \"H\",\n \"h\"\n ],\n \"419\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AD\": [\n \"H\",\n \"hB\"\n ],\n \"AE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"AF\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"AG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AL\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"AM\": [\n \"H\",\n \"hB\"\n ],\n \"AO\": [\n \"H\",\n \"hB\"\n ],\n \"AR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AS\": [\n \"h\",\n \"H\"\n ],\n \"AT\": [\n \"H\",\n \"hB\"\n ],\n \"AU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AW\": [\n \"H\",\n \"hB\"\n ],\n \"AX\": [\n \"H\"\n ],\n \"AZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BD\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"BE\": [\n \"H\",\n \"hB\"\n ],\n \"BF\": [\n \"H\",\n \"hB\"\n ],\n \"BG\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"BI\": [\n \"H\",\n \"h\"\n ],\n \"BJ\": [\n \"H\",\n \"hB\"\n ],\n \"BL\": [\n \"H\",\n \"hB\"\n ],\n \"BM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BN\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"BO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"BQ\": [\n \"H\"\n ],\n \"BR\": [\n \"H\",\n \"hB\"\n ],\n \"BS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BT\": [\n \"h\",\n \"H\"\n ],\n \"BW\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"BY\": [\n \"H\",\n \"h\"\n ],\n \"BZ\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CA\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"CC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CD\": [\n \"hB\",\n \"H\"\n ],\n \"CF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CG\": [\n \"H\",\n \"hB\"\n ],\n \"CH\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"CI\": [\n \"H\",\n \"hB\"\n ],\n \"CK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CL\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CN\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"CO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CP\": [\n \"H\"\n ],\n \"CR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CU\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CV\": [\n \"H\",\n \"hB\"\n ],\n \"CW\": [\n \"H\",\n \"hB\"\n ],\n \"CX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CY\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"CZ\": [\n \"H\"\n ],\n \"DE\": [\n \"H\",\n \"hB\"\n ],\n \"DG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"DJ\": [\n \"h\",\n \"H\"\n ],\n \"DK\": [\n \"H\"\n ],\n \"DM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"DO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"DZ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"EC\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"EE\": [\n \"H\",\n \"hB\"\n ],\n \"EG\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ER\": [\n \"h\",\n \"H\"\n ],\n \"ES\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"ET\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"FI\": [\n \"H\"\n ],\n \"FJ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"FM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FO\": [\n \"H\",\n \"h\"\n ],\n \"FR\": [\n \"H\",\n \"hB\"\n ],\n \"GA\": [\n \"H\",\n \"hB\"\n ],\n \"GB\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GD\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GE\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"GF\": [\n \"H\",\n \"hB\"\n ],\n \"GG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GH\": [\n \"h\",\n \"H\"\n ],\n \"GI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GL\": [\n \"H\",\n \"h\"\n ],\n \"GM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GN\": [\n \"H\",\n \"hB\"\n ],\n \"GP\": [\n \"H\",\n \"hB\"\n ],\n \"GQ\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"GR\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"GT\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"GU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GW\": [\n \"H\",\n \"hB\"\n ],\n \"GY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"HK\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"HN\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"HR\": [\n \"H\",\n \"hB\"\n ],\n \"HU\": [\n \"H\",\n \"h\"\n ],\n \"IC\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ID\": [\n \"H\"\n ],\n \"IE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IL\": [\n \"H\",\n \"hB\"\n ],\n \"IM\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IN\": [\n \"h\",\n \"H\"\n ],\n \"IO\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IQ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"IR\": [\n \"hB\",\n \"H\"\n ],\n \"IS\": [\n \"H\"\n ],\n \"IT\": [\n \"H\",\n \"hB\"\n ],\n \"JE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"JM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"JO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"JP\": [\n \"H\",\n \"K\",\n \"h\"\n ],\n \"KE\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"KG\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KH\": [\n \"hB\",\n \"h\",\n \"H\",\n \"hb\"\n ],\n \"KI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KM\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KN\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KP\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KW\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"KY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KZ\": [\n \"H\",\n \"hB\"\n ],\n \"LA\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"LB\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"LC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LI\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"LK\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"LR\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LS\": [\n \"h\",\n \"H\"\n ],\n \"LT\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"LU\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"LV\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"LY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"MC\": [\n \"H\",\n \"hB\"\n ],\n \"MD\": [\n \"H\",\n \"hB\"\n ],\n \"ME\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"MF\": [\n \"H\",\n \"hB\"\n ],\n \"MG\": [\n \"H\",\n \"h\"\n ],\n \"MH\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ML\": [\n \"H\"\n ],\n \"MM\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"MN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MP\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MQ\": [\n \"H\",\n \"hB\"\n ],\n \"MR\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MS\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MT\": [\n \"H\",\n \"h\"\n ],\n \"MU\": [\n \"H\",\n \"h\"\n ],\n \"MV\": [\n \"H\",\n \"h\"\n ],\n \"MW\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MX\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"MY\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"MZ\": [\n \"H\",\n \"hB\"\n ],\n \"NA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NC\": [\n \"H\",\n \"hB\"\n ],\n \"NE\": [\n \"H\"\n ],\n \"NF\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NI\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NL\": [\n \"H\",\n \"hB\"\n ],\n \"NO\": [\n \"H\",\n \"h\"\n ],\n \"NP\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"NR\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NU\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"OM\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"PG\": [\n \"h\",\n \"H\"\n ],\n \"PH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PK\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"PL\": [\n \"H\",\n \"h\"\n ],\n \"PM\": [\n \"H\",\n \"hB\"\n ],\n \"PN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"PR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PS\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PT\": [\n \"H\",\n \"hB\"\n ],\n \"PW\": [\n \"h\",\n \"H\"\n ],\n \"PY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"QA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"RE\": [\n \"H\",\n \"hB\"\n ],\n \"RO\": [\n \"H\",\n \"hB\"\n ],\n \"RS\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"RU\": [\n \"H\"\n ],\n \"RW\": [\n \"H\",\n \"h\"\n ],\n \"SA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SC\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SD\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SE\": [\n \"H\"\n ],\n \"SG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SH\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SI\": [\n \"H\",\n \"hB\"\n ],\n \"SJ\": [\n \"H\"\n ],\n \"SK\": [\n \"H\"\n ],\n \"SL\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SN\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SO\": [\n \"h\",\n \"H\"\n ],\n \"SR\": [\n \"H\",\n \"hB\"\n ],\n \"SS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ST\": [\n \"H\",\n \"hB\"\n ],\n \"SV\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"SX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"TC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TD\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"TF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"TG\": [\n \"H\",\n \"hB\"\n ],\n \"TH\": [\n \"H\",\n \"h\"\n ],\n \"TJ\": [\n \"H\",\n \"h\"\n ],\n \"TL\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"TM\": [\n \"H\",\n \"h\"\n ],\n \"TN\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"TO\": [\n \"h\",\n \"H\"\n ],\n \"TR\": [\n \"H\",\n \"hB\"\n ],\n \"TT\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TW\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"TZ\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"UG\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"US\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"UY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"UZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"VA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"VC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"VG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VN\": [\n \"H\",\n \"h\"\n ],\n \"VU\": [\n \"h\",\n \"H\"\n ],\n \"WF\": [\n \"H\",\n \"hB\"\n ],\n \"WS\": [\n \"h\",\n \"H\"\n ],\n \"XK\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"YE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"YT\": [\n \"H\",\n \"hB\"\n ],\n \"ZA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ZM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ZW\": [\n \"H\",\n \"h\"\n ],\n \"af-ZA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ar-001\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ca-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"en-001\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-HK\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-IL\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"en-MY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"es-BR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-ES\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-GQ\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"fr-CA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gl-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gu-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"hi-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"it-CH\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"it-IT\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"kn-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"ml-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"mr-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"pa-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"ta-IN\": [\n \"hB\",\n \"h\",\n \"hb\",\n \"H\"\n ],\n \"te-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"zu-ZA\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ]\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getBestPattern = getBestPattern;\nvar time_data_generated_1 = require(\"./time-data.generated\");\n/**\n * Returns the best matching date time pattern if a date time skeleton\n * pattern is provided with a locale. Follows the Unicode specification:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n * @param skeleton date time skeleton pattern that possibly includes j, J or C\n * @param locale\n */\nfunction getBestPattern(skeleton, locale) {\n var skeletonCopy = '';\n for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {\n var patternChar = skeleton.charAt(patternPos);\n if (patternChar === 'j') {\n var extraLength = 0;\n while (patternPos + 1 < skeleton.length &&\n skeleton.charAt(patternPos + 1) === patternChar) {\n extraLength++;\n patternPos++;\n }\n var hourLen = 1 + (extraLength & 1);\n var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n var dayPeriodChar = 'a';\n var hourChar = getDefaultHourSymbolFromLocale(locale);\n if (hourChar == 'H' || hourChar == 'k') {\n dayPeriodLen = 0;\n }\n while (dayPeriodLen-- > 0) {\n skeletonCopy += dayPeriodChar;\n }\n while (hourLen-- > 0) {\n skeletonCopy = hourChar + skeletonCopy;\n }\n }\n else if (patternChar === 'J') {\n skeletonCopy += 'H';\n }\n else {\n skeletonCopy += patternChar;\n }\n }\n return skeletonCopy;\n}\n/**\n * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n * of the given `locale` to the corresponding time pattern.\n * @param locale\n */\nfunction getDefaultHourSymbolFromLocale(locale) {\n var hourCycle = locale.hourCycle;\n if (hourCycle === undefined &&\n // @ts-ignore hourCycle(s) is not identified yet\n locale.hourCycles &&\n // @ts-ignore\n locale.hourCycles.length) {\n // @ts-ignore\n hourCycle = locale.hourCycles[0];\n }\n if (hourCycle) {\n switch (hourCycle) {\n case 'h24':\n return 'k';\n case 'h23':\n return 'H';\n case 'h12':\n return 'h';\n case 'h11':\n return 'K';\n default:\n throw new Error('Invalid hourCycle');\n }\n }\n // TODO: Once hourCycle is fully supported remove the following with data generation\n var languageTag = locale.language;\n var regionTag;\n if (languageTag !== 'root') {\n regionTag = locale.maximize().region;\n }\n var hourCycles = time_data_generated_1.timeData[regionTag || ''] ||\n time_data_generated_1.timeData[languageTag || ''] ||\n time_data_generated_1.timeData[\"\".concat(languageTag, \"-001\")] ||\n time_data_generated_1.timeData['001'];\n return hourCycles[0];\n}\n","\"use strict\";\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Parser = void 0;\nvar tslib_1 = require(\"tslib\");\nvar error_1 = require(\"./error\");\nvar types_1 = require(\"./types\");\nvar regex_generated_1 = require(\"./regex.generated\");\nvar icu_skeleton_parser_1 = require(\"@formatjs/icu-skeleton-parser\");\nvar date_time_pattern_generator_1 = require(\"./date-time-pattern-generator\");\nvar SPACE_SEPARATOR_START_REGEX = new RegExp(\"^\".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, \"*\"));\nvar SPACE_SEPARATOR_END_REGEX = new RegExp(\"\".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, \"*$\"));\nfunction createLocation(start, end) {\n return { start: start, end: end };\n}\n// #region Ponyfills\n// Consolidate these variables up top for easier toggling during debugging\nvar hasNativeStartsWith = !!String.prototype.startsWith && '_a'.startsWith('a', 1);\nvar hasNativeFromCodePoint = !!String.fromCodePoint;\nvar hasNativeFromEntries = !!Object.fromEntries;\nvar hasNativeCodePointAt = !!String.prototype.codePointAt;\nvar hasTrimStart = !!String.prototype.trimStart;\nvar hasTrimEnd = !!String.prototype.trimEnd;\nvar hasNativeIsSafeInteger = !!Number.isSafeInteger;\nvar isSafeInteger = hasNativeIsSafeInteger\n ? Number.isSafeInteger\n : function (n) {\n return (typeof n === 'number' &&\n isFinite(n) &&\n Math.floor(n) === n &&\n Math.abs(n) <= 0x1fffffffffffff);\n };\n// IE11 does not support y and u.\nvar REGEX_SUPPORTS_U_AND_Y = true;\ntry {\n var re = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n /**\n * legacy Edge or Xbox One browser\n * Unicode flag support: supported\n * Pattern_Syntax support: not supported\n * See https://github.com/formatjs/formatjs/issues/2822\n */\n REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';\n}\ncatch (_) {\n REGEX_SUPPORTS_U_AND_Y = false;\n}\nvar startsWith = hasNativeStartsWith\n ? // Native\n function startsWith(s, search, position) {\n return s.startsWith(search, position);\n }\n : // For IE11\n function startsWith(s, search, position) {\n return s.slice(position, position + search.length) === search;\n };\nvar fromCodePoint = hasNativeFromCodePoint\n ? String.fromCodePoint\n : // IE11\n function fromCodePoint() {\n var codePoints = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n codePoints[_i] = arguments[_i];\n }\n var elements = '';\n var length = codePoints.length;\n var i = 0;\n var code;\n while (length > i) {\n code = codePoints[i++];\n if (code > 0x10ffff)\n throw RangeError(code + ' is not a valid code point');\n elements +=\n code < 0x10000\n ? String.fromCharCode(code)\n : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);\n }\n return elements;\n };\nvar fromEntries = \n// native\nhasNativeFromEntries\n ? Object.fromEntries\n : // Ponyfill\n function fromEntries(entries) {\n var obj = {};\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var _a = entries_1[_i], k = _a[0], v = _a[1];\n obj[k] = v;\n }\n return obj;\n };\nvar codePointAt = hasNativeCodePointAt\n ? // Native\n function codePointAt(s, index) {\n return s.codePointAt(index);\n }\n : // IE 11\n function codePointAt(s, index) {\n var size = s.length;\n if (index < 0 || index >= size) {\n return undefined;\n }\n var first = s.charCodeAt(index);\n var second;\n return first < 0xd800 ||\n first > 0xdbff ||\n index + 1 === size ||\n (second = s.charCodeAt(index + 1)) < 0xdc00 ||\n second > 0xdfff\n ? first\n : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;\n };\nvar trimStart = hasTrimStart\n ? // Native\n function trimStart(s) {\n return s.trimStart();\n }\n : // Ponyfill\n function trimStart(s) {\n return s.replace(SPACE_SEPARATOR_START_REGEX, '');\n };\nvar trimEnd = hasTrimEnd\n ? // Native\n function trimEnd(s) {\n return s.trimEnd();\n }\n : // Ponyfill\n function trimEnd(s) {\n return s.replace(SPACE_SEPARATOR_END_REGEX, '');\n };\n// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.\nfunction RE(s, flag) {\n return new RegExp(s, flag);\n}\n// #endregion\nvar matchIdentifierAtIndex;\nif (REGEX_SUPPORTS_U_AND_Y) {\n // Native\n var IDENTIFIER_PREFIX_RE_1 = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var _a;\n IDENTIFIER_PREFIX_RE_1.lastIndex = index;\n var match = IDENTIFIER_PREFIX_RE_1.exec(s);\n return (_a = match[1]) !== null && _a !== void 0 ? _a : '';\n };\n}\nelse {\n // IE11\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var match = [];\n while (true) {\n var c = codePointAt(s, index);\n if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {\n break;\n }\n match.push(c);\n index += c >= 0x10000 ? 2 : 1;\n }\n return fromCodePoint.apply(void 0, match);\n };\n}\nvar Parser = /** @class */ (function () {\n function Parser(message, options) {\n if (options === void 0) { options = {}; }\n this.message = message;\n this.position = { offset: 0, line: 1, column: 1 };\n this.ignoreTag = !!options.ignoreTag;\n this.locale = options.locale;\n this.requiresOtherClause = !!options.requiresOtherClause;\n this.shouldParseSkeletons = !!options.shouldParseSkeletons;\n }\n Parser.prototype.parse = function () {\n if (this.offset() !== 0) {\n throw Error('parser can only be used once');\n }\n return this.parseMessage(0, '', false);\n };\n Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {\n var elements = [];\n while (!this.isEOF()) {\n var char = this.char();\n if (char === 123 /* `{` */) {\n var result = this.parseArgument(nestingLevel, expectingCloseTag);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else if (char === 125 /* `}` */ && nestingLevel > 0) {\n break;\n }\n else if (char === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) {\n var position = this.clonePosition();\n this.bump();\n elements.push({\n type: types_1.TYPE.pound,\n location: createLocation(position, this.clonePosition()),\n });\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n this.peek() === 47 // char code for '/'\n ) {\n if (expectingCloseTag) {\n break;\n }\n else {\n return this.error(error_1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));\n }\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n _isAlpha(this.peek() || 0)) {\n var result = this.parseTag(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else {\n var result = this.parseLiteral(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n }\n return { val: elements, err: null };\n };\n /**\n * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n * [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n * are accepted:\n *\n * ```\n * tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"</\" tagName (whitespace)* \">\"\n * tagName ::= [a-z] (PENChar)*\n * PENChar ::=\n * \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n * ```\n *\n * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n * since other tag-based engines like React allow it\n */\n Parser.prototype.parseTag = function (nestingLevel, parentArgType) {\n var startPosition = this.clonePosition();\n this.bump(); // `<`\n var tagName = this.parseTagName();\n this.bumpSpace();\n if (this.bumpIf('/>')) {\n // Self closing tag\n return {\n val: {\n type: types_1.TYPE.literal,\n value: \"<\".concat(tagName, \"/>\"),\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else if (this.bumpIf('>')) {\n var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n if (childrenResult.err) {\n return childrenResult;\n }\n var children = childrenResult.val;\n // Expecting a close tag\n var endTagStartPosition = this.clonePosition();\n if (this.bumpIf('</')) {\n if (this.isEOF() || !_isAlpha(this.char())) {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n var closingTagNameStartPosition = this.clonePosition();\n var closingTagName = this.parseTagName();\n if (tagName !== closingTagName) {\n return this.error(error_1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (!this.bumpIf('>')) {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n return {\n val: {\n type: types_1.TYPE.tag,\n value: tagName,\n children: children,\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else {\n return this.error(error_1.ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));\n }\n }\n else {\n return this.error(error_1.ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));\n }\n };\n /**\n * This method assumes that the caller has peeked ahead for the first tag character.\n */\n Parser.prototype.parseTagName = function () {\n var startOffset = this.offset();\n this.bump(); // the first tag name character\n while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {\n this.bump();\n }\n return this.message.slice(startOffset, this.offset());\n };\n Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {\n var start = this.clonePosition();\n var value = '';\n while (true) {\n var parseQuoteResult = this.tryParseQuote(parentArgType);\n if (parseQuoteResult) {\n value += parseQuoteResult;\n continue;\n }\n var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n if (parseUnquotedResult) {\n value += parseUnquotedResult;\n continue;\n }\n var parseLeftAngleResult = this.tryParseLeftAngleBracket();\n if (parseLeftAngleResult) {\n value += parseLeftAngleResult;\n continue;\n }\n break;\n }\n var location = createLocation(start, this.clonePosition());\n return {\n val: { type: types_1.TYPE.literal, value: value, location: location },\n err: null,\n };\n };\n Parser.prototype.tryParseLeftAngleBracket = function () {\n if (!this.isEOF() &&\n this.char() === 60 /* `<` */ &&\n (this.ignoreTag ||\n // If at the opening tag or closing tag position, bail.\n !_isAlphaOrSlash(this.peek() || 0))) {\n this.bump(); // `<`\n return '<';\n }\n return null;\n };\n /**\n * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n * a character that requires quoting (that is, \"only where needed\"), and works the same in\n * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n */\n Parser.prototype.tryParseQuote = function (parentArgType) {\n if (this.isEOF() || this.char() !== 39 /* `'` */) {\n return null;\n }\n // Parse escaped char following the apostrophe, or early return if there is no escaped char.\n // Check if is valid escaped character\n switch (this.peek()) {\n case 39 /* `'` */:\n // double quote, should return as a single quote.\n this.bump();\n this.bump();\n return \"'\";\n // '{', '<', '>', '}'\n case 123:\n case 60:\n case 62:\n case 125:\n break;\n case 35: // '#'\n if (parentArgType === 'plural' || parentArgType === 'selectordinal') {\n break;\n }\n return null;\n default:\n return null;\n }\n this.bump(); // apostrophe\n var codePoints = [this.char()]; // escaped char\n this.bump();\n // read chars until the optional closing apostrophe is found\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch === 39 /* `'` */) {\n if (this.peek() === 39 /* `'` */) {\n codePoints.push(39);\n // Bump one more time because we need to skip 2 characters.\n this.bump();\n }\n else {\n // Optional closing apostrophe.\n this.bump();\n break;\n }\n }\n else {\n codePoints.push(ch);\n }\n this.bump();\n }\n return fromCodePoint.apply(void 0, codePoints);\n };\n Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {\n if (this.isEOF()) {\n return null;\n }\n var ch = this.char();\n if (ch === 60 /* `<` */ ||\n ch === 123 /* `{` */ ||\n (ch === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||\n (ch === 125 /* `}` */ && nestingLevel > 0)) {\n return null;\n }\n else {\n this.bump();\n return fromCodePoint(ch);\n }\n };\n Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {\n var openingBracePosition = this.clonePosition();\n this.bump(); // `{`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n if (this.char() === 125 /* `}` */) {\n this.bump();\n return this.error(error_1.ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n // argument name\n var value = this.parseIdentifierIfPossible().value;\n if (!value) {\n return this.error(error_1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n switch (this.char()) {\n // Simple argument: `{name}`\n case 125 /* `}` */: {\n this.bump(); // `}`\n return {\n val: {\n type: types_1.TYPE.argument,\n // value does not include the opening and closing braces.\n value: value,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n err: null,\n };\n }\n // Argument with options: `{name, format, ...}`\n case 44 /* `,` */: {\n this.bump(); // `,`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n }\n default:\n return this.error(error_1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n };\n /**\n * Advance the parser until the end of the identifier, if it is currently on\n * an identifier character. Return an empty string otherwise.\n */\n Parser.prototype.parseIdentifierIfPossible = function () {\n var startingPosition = this.clonePosition();\n var startOffset = this.offset();\n var value = matchIdentifierAtIndex(this.message, startOffset);\n var endOffset = startOffset + value.length;\n this.bumpTo(endOffset);\n var endPosition = this.clonePosition();\n var location = createLocation(startingPosition, endPosition);\n return { value: value, location: location };\n };\n Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {\n var _a;\n // Parse this range:\n // {name, type, style}\n // ^---^\n var typeStartPosition = this.clonePosition();\n var argType = this.parseIdentifierIfPossible().value;\n var typeEndPosition = this.clonePosition();\n switch (argType) {\n case '':\n // Expecting a style string number, date, time, plural, selectordinal, or select.\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n case 'number':\n case 'date':\n case 'time': {\n // Parse this range:\n // {name, number, style}\n // ^-------^\n this.bumpSpace();\n var styleAndLocation = null;\n if (this.bumpIf(',')) {\n this.bumpSpace();\n var styleStartPosition = this.clonePosition();\n var result = this.parseSimpleArgStyleIfPossible();\n if (result.err) {\n return result;\n }\n var style = trimEnd(result.val);\n if (style.length === 0) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var styleLocation = createLocation(styleStartPosition, this.clonePosition());\n styleAndLocation = { style: style, styleLocation: styleLocation };\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_1 = createLocation(openingBracePosition, this.clonePosition());\n // Extract style or skeleton\n if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {\n // Skeleton starts with `::`.\n var skeleton = trimStart(styleAndLocation.style.slice(2));\n if (argType === 'number') {\n var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n if (result.err) {\n return result;\n }\n return {\n val: { type: types_1.TYPE.number, value: value, location: location_1, style: result.val },\n err: null,\n };\n }\n else {\n if (skeleton.length === 0) {\n return this.error(error_1.ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);\n }\n var dateTimePattern = skeleton;\n // Get \"best match\" pattern only if locale is passed, if not, let it\n // pass as-is where `parseDateTimeSkeleton()` will throw an error\n // for unsupported patterns.\n if (this.locale) {\n dateTimePattern = (0, date_time_pattern_generator_1.getBestPattern)(skeleton, this.locale);\n }\n var style = {\n type: types_1.SKELETON_TYPE.dateTime,\n pattern: dateTimePattern,\n location: styleAndLocation.styleLocation,\n parsedOptions: this.shouldParseSkeletons\n ? (0, icu_skeleton_parser_1.parseDateTimeSkeleton)(dateTimePattern)\n : {},\n };\n var type = argType === 'date' ? types_1.TYPE.date : types_1.TYPE.time;\n return {\n val: { type: type, value: value, location: location_1, style: style },\n err: null,\n };\n }\n }\n // Regular style or no style.\n return {\n val: {\n type: argType === 'number'\n ? types_1.TYPE.number\n : argType === 'date'\n ? types_1.TYPE.date\n : types_1.TYPE.time,\n value: value,\n location: location_1,\n style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,\n },\n err: null,\n };\n }\n case 'plural':\n case 'selectordinal':\n case 'select': {\n // Parse this range:\n // {name, plural, options}\n // ^---------^\n var typeEndPosition_1 = this.clonePosition();\n this.bumpSpace();\n if (!this.bumpIf(',')) {\n return this.error(error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, tslib_1.__assign({}, typeEndPosition_1)));\n }\n this.bumpSpace();\n // Parse offset:\n // {name, plural, offset:1, options}\n // ^-----^\n //\n // or the first option:\n //\n // {name, plural, one {...} other {...}}\n // ^--^\n var identifierAndLocation = this.parseIdentifierIfPossible();\n var pluralOffset = 0;\n if (argType !== 'select' && identifierAndLocation.value === 'offset') {\n if (!this.bumpIf(':')) {\n return this.error(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n this.bumpSpace();\n var result = this.tryParseDecimalInteger(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, error_1.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);\n if (result.err) {\n return result;\n }\n // Parse another identifier for option parsing\n this.bumpSpace();\n identifierAndLocation = this.parseIdentifierIfPossible();\n pluralOffset = result.val;\n }\n var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n if (optionsResult.err) {\n return optionsResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_2 = createLocation(openingBracePosition, this.clonePosition());\n if (argType === 'select') {\n return {\n val: {\n type: types_1.TYPE.select,\n value: value,\n options: fromEntries(optionsResult.val),\n location: location_2,\n },\n err: null,\n };\n }\n else {\n return {\n val: {\n type: types_1.TYPE.plural,\n value: value,\n options: fromEntries(optionsResult.val),\n offset: pluralOffset,\n pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',\n location: location_2,\n },\n err: null,\n };\n }\n }\n default:\n return this.error(error_1.ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n }\n };\n Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {\n // Parse: {value, number, ::currency/GBP }\n //\n if (this.isEOF() || this.char() !== 125 /* `}` */) {\n return this.error(error_1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bump(); // `}`\n return { val: true, err: null };\n };\n /**\n * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n */\n Parser.prototype.parseSimpleArgStyleIfPossible = function () {\n var nestedBraces = 0;\n var startPosition = this.clonePosition();\n while (!this.isEOF()) {\n var ch = this.char();\n switch (ch) {\n case 39 /* `'` */: {\n // Treat apostrophe as quoting but include it in the style part.\n // Find the end of the quoted literal text.\n this.bump();\n var apostrophePosition = this.clonePosition();\n if (!this.bumpUntil(\"'\")) {\n return this.error(error_1.ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));\n }\n this.bump();\n break;\n }\n case 123 /* `{` */: {\n nestedBraces += 1;\n this.bump();\n break;\n }\n case 125 /* `}` */: {\n if (nestedBraces > 0) {\n nestedBraces -= 1;\n }\n else {\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n }\n break;\n }\n default:\n this.bump();\n break;\n }\n }\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n };\n Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {\n var tokens = [];\n try {\n tokens = (0, icu_skeleton_parser_1.parseNumberSkeletonFromString)(skeleton);\n }\n catch (e) {\n return this.error(error_1.ErrorKind.INVALID_NUMBER_SKELETON, location);\n }\n return {\n val: {\n type: types_1.SKELETON_TYPE.number,\n tokens: tokens,\n location: location,\n parsedOptions: this.shouldParseSkeletons\n ? (0, icu_skeleton_parser_1.parseNumberSkeleton)(tokens)\n : {},\n },\n err: null,\n };\n };\n /**\n * @param nesting_level The current nesting level of messages.\n * This can be positive when parsing message fragment in select or plural argument options.\n * @param parent_arg_type The parent argument's type.\n * @param parsed_first_identifier If provided, this is the first identifier-like selector of\n * the argument. It is a by-product of a previous parsing attempt.\n * @param expecting_close_tag If true, this message is directly or indirectly nested inside\n * between a pair of opening and closing tags. The nested message will not parse beyond\n * the closing tag boundary.\n */\n Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n var _a;\n var hasOtherClause = false;\n var options = [];\n var parsedSelectors = new Set();\n var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;\n // Parse:\n // one {one apple}\n // ^--^\n while (true) {\n if (selector.length === 0) {\n var startPosition = this.clonePosition();\n if (parentArgType !== 'select' && this.bumpIf('=')) {\n // Try parse `={number}` selector\n var result = this.tryParseDecimalInteger(error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, error_1.ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);\n if (result.err) {\n return result;\n }\n selectorLocation = createLocation(startPosition, this.clonePosition());\n selector = this.message.slice(startPosition.offset, this.offset());\n }\n else {\n break;\n }\n }\n // Duplicate selector clauses\n if (parsedSelectors.has(selector)) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR\n : error_1.ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);\n }\n if (selector === 'other') {\n hasOtherClause = true;\n }\n // Parse:\n // one {one apple}\n // ^----------^\n this.bumpSpace();\n var openingBracePosition = this.clonePosition();\n if (!this.bumpIf('{')) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\n : error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n if (fragmentResult.err) {\n return fragmentResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n options.push([\n selector,\n {\n value: fragmentResult.val,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n ]);\n // Keep track of the existing selectors\n parsedSelectors.add(selector);\n // Prep next selector clause.\n this.bumpSpace();\n (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);\n }\n if (options.length === 0) {\n return this.error(parentArgType === 'select'\n ? error_1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR\n : error_1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));\n }\n if (this.requiresOtherClause && !hasOtherClause) {\n return this.error(error_1.ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n return { val: options, err: null };\n };\n Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {\n var sign = 1;\n var startingPosition = this.clonePosition();\n if (this.bumpIf('+')) {\n }\n else if (this.bumpIf('-')) {\n sign = -1;\n }\n var hasDigits = false;\n var decimal = 0;\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {\n hasDigits = true;\n decimal = decimal * 10 + (ch - 48);\n this.bump();\n }\n else {\n break;\n }\n }\n var location = createLocation(startingPosition, this.clonePosition());\n if (!hasDigits) {\n return this.error(expectNumberError, location);\n }\n decimal *= sign;\n if (!isSafeInteger(decimal)) {\n return this.error(invalidNumberError, location);\n }\n return { val: decimal, err: null };\n };\n Parser.prototype.offset = function () {\n return this.position.offset;\n };\n Parser.prototype.isEOF = function () {\n return this.offset() === this.message.length;\n };\n Parser.prototype.clonePosition = function () {\n // This is much faster than `Object.assign` or spread.\n return {\n offset: this.position.offset,\n line: this.position.line,\n column: this.position.column,\n };\n };\n /**\n * Return the code point at the current position of the parser.\n * Throws if the index is out of bound.\n */\n Parser.prototype.char = function () {\n var offset = this.position.offset;\n if (offset >= this.message.length) {\n throw Error('out of bound');\n }\n var code = codePointAt(this.message, offset);\n if (code === undefined) {\n throw Error(\"Offset \".concat(offset, \" is at invalid UTF-16 code unit boundary\"));\n }\n return code;\n };\n Parser.prototype.error = function (kind, location) {\n return {\n val: null,\n err: {\n kind: kind,\n message: this.message,\n location: location,\n },\n };\n };\n /** Bump the parser to the next UTF-16 code unit. */\n Parser.prototype.bump = function () {\n if (this.isEOF()) {\n return;\n }\n var code = this.char();\n if (code === 10 /* '\\n' */) {\n this.position.line += 1;\n this.position.column = 1;\n this.position.offset += 1;\n }\n else {\n this.position.column += 1;\n // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.\n this.position.offset += code < 0x10000 ? 1 : 2;\n }\n };\n /**\n * If the substring starting at the current position of the parser has\n * the given prefix, then bump the parser to the character immediately\n * following the prefix and return true. Otherwise, don't bump the parser\n * and return false.\n */\n Parser.prototype.bumpIf = function (prefix) {\n if (startsWith(this.message, prefix, this.offset())) {\n for (var i = 0; i < prefix.length; i++) {\n this.bump();\n }\n return true;\n }\n return false;\n };\n /**\n * Bump the parser until the pattern character is found and return `true`.\n * Otherwise bump to the end of the file and return `false`.\n */\n Parser.prototype.bumpUntil = function (pattern) {\n var currentOffset = this.offset();\n var index = this.message.indexOf(pattern, currentOffset);\n if (index >= 0) {\n this.bumpTo(index);\n return true;\n }\n else {\n this.bumpTo(this.message.length);\n return false;\n }\n };\n /**\n * Bump the parser to the target offset.\n * If target offset is beyond the end of the input, bump the parser to the end of the input.\n */\n Parser.prototype.bumpTo = function (targetOffset) {\n if (this.offset() > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" must be greater than or equal to the current offset \").concat(this.offset()));\n }\n targetOffset = Math.min(targetOffset, this.message.length);\n while (true) {\n var offset = this.offset();\n if (offset === targetOffset) {\n break;\n }\n if (offset > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" is at invalid UTF-16 code unit boundary\"));\n }\n this.bump();\n if (this.isEOF()) {\n break;\n }\n }\n };\n /** advance the parser through all whitespace to the next non-whitespace code unit. */\n Parser.prototype.bumpSpace = function () {\n while (!this.isEOF() && _isWhiteSpace(this.char())) {\n this.bump();\n }\n };\n /**\n * Peek at the *next* Unicode codepoint in the input without advancing the parser.\n * If the input has been exhausted, then this returns null.\n */\n Parser.prototype.peek = function () {\n if (this.isEOF()) {\n return null;\n }\n var code = this.char();\n var offset = this.offset();\n var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));\n return nextCode !== null && nextCode !== void 0 ? nextCode : null;\n };\n return Parser;\n}());\nexports.Parser = Parser;\n/**\n * This check if codepoint is alphabet (lower & uppercase)\n * @param codepoint\n * @returns\n */\nfunction _isAlpha(codepoint) {\n return ((codepoint >= 97 && codepoint <= 122) ||\n (codepoint >= 65 && codepoint <= 90));\n}\nfunction _isAlphaOrSlash(codepoint) {\n return _isAlpha(codepoint) || codepoint === 47; /* '/' */\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n return (c === 45 /* '-' */ ||\n c === 46 /* '.' */ ||\n (c >= 48 && c <= 57) /* 0..9 */ ||\n c === 95 /* '_' */ ||\n (c >= 97 && c <= 122) /** a..z */ ||\n (c >= 65 && c <= 90) /* A..Z */ ||\n c == 0xb7 ||\n (c >= 0xc0 && c <= 0xd6) ||\n (c >= 0xd8 && c <= 0xf6) ||\n (c >= 0xf8 && c <= 0x37d) ||\n (c >= 0x37f && c <= 0x1fff) ||\n (c >= 0x200c && c <= 0x200d) ||\n (c >= 0x203f && c <= 0x2040) ||\n (c >= 0x2070 && c <= 0x218f) ||\n (c >= 0x2c00 && c <= 0x2fef) ||\n (c >= 0x3001 && c <= 0xd7ff) ||\n (c >= 0xf900 && c <= 0xfdcf) ||\n (c >= 0xfdf0 && c <= 0xfffd) ||\n (c >= 0x10000 && c <= 0xeffff));\n}\n/**\n * Code point equivalent of regex `\\p{White_Space}`.\n * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isWhiteSpace(c) {\n return ((c >= 0x0009 && c <= 0x000d) ||\n c === 0x0020 ||\n c === 0x0085 ||\n (c >= 0x200e && c <= 0x200f) ||\n c === 0x2028 ||\n c === 0x2029);\n}\n/**\n * Code point equivalent of regex `\\p{Pattern_Syntax}`.\n * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isPatternSyntax(c) {\n return ((c >= 0x0021 && c <= 0x0023) ||\n c === 0x0024 ||\n (c >= 0x0025 && c <= 0x0027) ||\n c === 0x0028 ||\n c === 0x0029 ||\n c === 0x002a ||\n c === 0x002b ||\n c === 0x002c ||\n c === 0x002d ||\n (c >= 0x002e && c <= 0x002f) ||\n (c >= 0x003a && c <= 0x003b) ||\n (c >= 0x003c && c <= 0x003e) ||\n (c >= 0x003f && c <= 0x0040) ||\n c === 0x005b ||\n c === 0x005c ||\n c === 0x005d ||\n c === 0x005e ||\n c === 0x0060 ||\n c === 0x007b ||\n c === 0x007c ||\n c === 0x007d ||\n c === 0x007e ||\n c === 0x00a1 ||\n (c >= 0x00a2 && c <= 0x00a5) ||\n c === 0x00a6 ||\n c === 0x00a7 ||\n c === 0x00a9 ||\n c === 0x00ab ||\n c === 0x00ac ||\n c === 0x00ae ||\n c === 0x00b0 ||\n c === 0x00b1 ||\n c === 0x00b6 ||\n c === 0x00bb ||\n c === 0x00bf ||\n c === 0x00d7 ||\n c === 0x00f7 ||\n (c >= 0x2010 && c <= 0x2015) ||\n (c >= 0x2016 && c <= 0x2017) ||\n c === 0x2018 ||\n c === 0x2019 ||\n c === 0x201a ||\n (c >= 0x201b && c <= 0x201c) ||\n c === 0x201d ||\n c === 0x201e ||\n c === 0x201f ||\n (c >= 0x2020 && c <= 0x2027) ||\n (c >= 0x2030 && c <= 0x2038) ||\n c === 0x2039 ||\n c === 0x203a ||\n (c >= 0x203b && c <= 0x203e) ||\n (c >= 0x2041 && c <= 0x2043) ||\n c === 0x2044 ||\n c === 0x2045 ||\n c === 0x2046 ||\n (c >= 0x2047 && c <= 0x2051) ||\n c === 0x2052 ||\n c === 0x2053 ||\n (c >= 0x2055 && c <= 0x205e) ||\n (c >= 0x2190 && c <= 0x2194) ||\n (c >= 0x2195 && c <= 0x2199) ||\n (c >= 0x219a && c <= 0x219b) ||\n (c >= 0x219c && c <= 0x219f) ||\n c === 0x21a0 ||\n (c >= 0x21a1 && c <= 0x21a2) ||\n c === 0x21a3 ||\n (c >= 0x21a4 && c <= 0x21a5) ||\n c === 0x21a6 ||\n (c >= 0x21a7 && c <= 0x21ad) ||\n c === 0x21ae ||\n (c >= 0x21af && c <= 0x21cd) ||\n (c >= 0x21ce && c <= 0x21cf) ||\n (c >= 0x21d0 && c <= 0x21d1) ||\n c === 0x21d2 ||\n c === 0x21d3 ||\n c === 0x21d4 ||\n (c >= 0x21d5 && c <= 0x21f3) ||\n (c >= 0x21f4 && c <= 0x22ff) ||\n (c >= 0x2300 && c <= 0x2307) ||\n c === 0x2308 ||\n c === 0x2309 ||\n c === 0x230a ||\n c === 0x230b ||\n (c >= 0x230c && c <= 0x231f) ||\n (c >= 0x2320 && c <= 0x2321) ||\n (c >= 0x2322 && c <= 0x2328) ||\n c === 0x2329 ||\n c === 0x232a ||\n (c >= 0x232b && c <= 0x237b) ||\n c === 0x237c ||\n (c >= 0x237d && c <= 0x239a) ||\n (c >= 0x239b && c <= 0x23b3) ||\n (c >= 0x23b4 && c <= 0x23db) ||\n (c >= 0x23dc && c <= 0x23e1) ||\n (c >= 0x23e2 && c <= 0x2426) ||\n (c >= 0x2427 && c <= 0x243f) ||\n (c >= 0x2440 && c <= 0x244a) ||\n (c >= 0x244b && c <= 0x245f) ||\n (c >= 0x2500 && c <= 0x25b6) ||\n c === 0x25b7 ||\n (c >= 0x25b8 && c <= 0x25c0) ||\n c === 0x25c1 ||\n (c >= 0x25c2 && c <= 0x25f7) ||\n (c >= 0x25f8 && c <= 0x25ff) ||\n (c >= 0x2600 && c <= 0x266e) ||\n c === 0x266f ||\n (c >= 0x2670 && c <= 0x2767) ||\n c === 0x2768 ||\n c === 0x2769 ||\n c === 0x276a ||\n c === 0x276b ||\n c === 0x276c ||\n c === 0x276d ||\n c === 0x276e ||\n c === 0x276f ||\n c === 0x2770 ||\n c === 0x2771 ||\n c === 0x2772 ||\n c === 0x2773 ||\n c === 0x2774 ||\n c === 0x2775 ||\n (c >= 0x2794 && c <= 0x27bf) ||\n (c >= 0x27c0 && c <= 0x27c4) ||\n c === 0x27c5 ||\n c === 0x27c6 ||\n (c >= 0x27c7 && c <= 0x27e5) ||\n c === 0x27e6 ||\n c === 0x27e7 ||\n c === 0x27e8 ||\n c === 0x27e9 ||\n c === 0x27ea ||\n c === 0x27eb ||\n c === 0x27ec ||\n c === 0x27ed ||\n c === 0x27ee ||\n c === 0x27ef ||\n (c >= 0x27f0 && c <= 0x27ff) ||\n (c >= 0x2800 && c <= 0x28ff) ||\n (c >= 0x2900 && c <= 0x2982) ||\n c === 0x2983 ||\n c === 0x2984 ||\n c === 0x2985 ||\n c === 0x2986 ||\n c === 0x2987 ||\n c === 0x2988 ||\n c === 0x2989 ||\n c === 0x298a ||\n c === 0x298b ||\n c === 0x298c ||\n c === 0x298d ||\n c === 0x298e ||\n c === 0x298f ||\n c === 0x2990 ||\n c === 0x2991 ||\n c === 0x2992 ||\n c === 0x2993 ||\n c === 0x2994 ||\n c === 0x2995 ||\n c === 0x2996 ||\n c === 0x2997 ||\n c === 0x2998 ||\n (c >= 0x2999 && c <= 0x29d7) ||\n c === 0x29d8 ||\n c === 0x29d9 ||\n c === 0x29da ||\n c === 0x29db ||\n (c >= 0x29dc && c <= 0x29fb) ||\n c === 0x29fc ||\n c === 0x29fd ||\n (c >= 0x29fe && c <= 0x2aff) ||\n (c >= 0x2b00 && c <= 0x2b2f) ||\n (c >= 0x2b30 && c <= 0x2b44) ||\n (c >= 0x2b45 && c <= 0x2b46) ||\n (c >= 0x2b47 && c <= 0x2b4c) ||\n (c >= 0x2b4d && c <= 0x2b73) ||\n (c >= 0x2b74 && c <= 0x2b75) ||\n (c >= 0x2b76 && c <= 0x2b95) ||\n c === 0x2b96 ||\n (c >= 0x2b97 && c <= 0x2bff) ||\n (c >= 0x2e00 && c <= 0x2e01) ||\n c === 0x2e02 ||\n c === 0x2e03 ||\n c === 0x2e04 ||\n c === 0x2e05 ||\n (c >= 0x2e06 && c <= 0x2e08) ||\n c === 0x2e09 ||\n c === 0x2e0a ||\n c === 0x2e0b ||\n c === 0x2e0c ||\n c === 0x2e0d ||\n (c >= 0x2e0e && c <= 0x2e16) ||\n c === 0x2e17 ||\n (c >= 0x2e18 && c <= 0x2e19) ||\n c === 0x2e1a ||\n c === 0x2e1b ||\n c === 0x2e1c ||\n c === 0x2e1d ||\n (c >= 0x2e1e && c <= 0x2e1f) ||\n c === 0x2e20 ||\n c === 0x2e21 ||\n c === 0x2e22 ||\n c === 0x2e23 ||\n c === 0x2e24 ||\n c === 0x2e25 ||\n c === 0x2e26 ||\n c === 0x2e27 ||\n c === 0x2e28 ||\n c === 0x2e29 ||\n (c >= 0x2e2a && c <= 0x2e2e) ||\n c === 0x2e2f ||\n (c >= 0x2e30 && c <= 0x2e39) ||\n (c >= 0x2e3a && c <= 0x2e3b) ||\n (c >= 0x2e3c && c <= 0x2e3f) ||\n c === 0x2e40 ||\n c === 0x2e41 ||\n c === 0x2e42 ||\n (c >= 0x2e43 && c <= 0x2e4f) ||\n (c >= 0x2e50 && c <= 0x2e51) ||\n c === 0x2e52 ||\n (c >= 0x2e53 && c <= 0x2e7f) ||\n (c >= 0x3001 && c <= 0x3003) ||\n c === 0x3008 ||\n c === 0x3009 ||\n c === 0x300a ||\n c === 0x300b ||\n c === 0x300c ||\n c === 0x300d ||\n c === 0x300e ||\n c === 0x300f ||\n c === 0x3010 ||\n c === 0x3011 ||\n (c >= 0x3012 && c <= 0x3013) ||\n c === 0x3014 ||\n c === 0x3015 ||\n c === 0x3016 ||\n c === 0x3017 ||\n c === 0x3018 ||\n c === 0x3019 ||\n c === 0x301a ||\n c === 0x301b ||\n c === 0x301c ||\n c === 0x301d ||\n (c >= 0x301e && c <= 0x301f) ||\n c === 0x3020 ||\n c === 0x3030 ||\n c === 0xfd3e ||\n c === 0xfd3f ||\n (c >= 0xfe45 && c <= 0xfe46));\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hoistSelectors = hoistSelectors;\nexports.isStructurallySame = isStructurallySame;\nvar tslib_1 = require(\"tslib\");\nvar types_1 = require(\"./types\");\nfunction cloneDeep(obj) {\n if (Array.isArray(obj)) {\n // @ts-expect-error meh\n return tslib_1.__spreadArray([], obj.map(cloneDeep), true);\n }\n if (obj !== null && typeof obj === 'object') {\n // @ts-expect-error meh\n return Object.keys(obj).reduce(function (cloned, k) {\n // @ts-expect-error meh\n cloned[k] = cloneDeep(obj[k]);\n return cloned;\n }, {});\n }\n return obj;\n}\nfunction hoistPluralOrSelectElement(ast, el, positionToInject) {\n // pull this out of the ast and move it to the top\n var cloned = cloneDeep(el);\n var options = cloned.options;\n cloned.options = Object.keys(options).reduce(function (all, k) {\n var newValue = hoistSelectors(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], ast.slice(0, positionToInject), true), options[k].value, true), ast.slice(positionToInject + 1), true));\n all[k] = {\n value: newValue,\n };\n return all;\n }, {});\n return cloned;\n}\nfunction isPluralOrSelectElement(el) {\n return (0, types_1.isPluralElement)(el) || (0, types_1.isSelectElement)(el);\n}\nfunction findPluralOrSelectElement(ast) {\n return !!ast.find(function (el) {\n if (isPluralOrSelectElement(el)) {\n return true;\n }\n if ((0, types_1.isTagElement)(el)) {\n return findPluralOrSelectElement(el.children);\n }\n return false;\n });\n}\n/**\n * Hoist all selectors to the beginning of the AST & flatten the\n * resulting options. E.g:\n * \"I have {count, plural, one{a dog} other{many dogs}}\"\n * becomes \"{count, plural, one{I have a dog} other{I have many dogs}}\".\n * If there are multiple selectors, the order of which one is hoisted 1st\n * is non-deterministic.\n * The goal is to provide as many full sentences as possible since fragmented\n * sentences are not translator-friendly\n * @param ast AST\n */\nfunction hoistSelectors(ast) {\n for (var i = 0; i < ast.length; i++) {\n var el = ast[i];\n if (isPluralOrSelectElement(el)) {\n return [hoistPluralOrSelectElement(ast, el, i)];\n }\n if ((0, types_1.isTagElement)(el) && findPluralOrSelectElement([el])) {\n throw new Error('Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option');\n }\n }\n return ast;\n}\n/**\n * Collect all variables in an AST to Record<string, TYPE>\n * @param ast AST to collect variables from\n * @param vars Record of variable name to variable type\n */\nfunction collectVariables(ast, vars) {\n if (vars === void 0) { vars = new Map(); }\n ast.forEach(function (el) {\n if ((0, types_1.isArgumentElement)(el) ||\n (0, types_1.isDateElement)(el) ||\n (0, types_1.isTimeElement)(el) ||\n (0, types_1.isNumberElement)(el)) {\n if (el.value in vars && vars.get(el.value) !== el.type) {\n throw new Error(\"Variable \".concat(el.value, \" has conflicting types\"));\n }\n vars.set(el.value, el.type);\n }\n if ((0, types_1.isPluralElement)(el) || (0, types_1.isSelectElement)(el)) {\n vars.set(el.value, el.type);\n Object.keys(el.options).forEach(function (k) {\n collectVariables(el.options[k].value, vars);\n });\n }\n if ((0, types_1.isTagElement)(el)) {\n vars.set(el.value, el.type);\n collectVariables(el.children, vars);\n }\n });\n}\n/**\n * Check if 2 ASTs are structurally the same. This primarily means that\n * they have the same variables with the same type\n * @param a\n * @param b\n * @returns\n */\nfunction isStructurallySame(a, b) {\n var aVars = new Map();\n var bVars = new Map();\n collectVariables(a, aVars);\n collectVariables(b, bVars);\n if (aVars.size !== bVars.size) {\n return {\n success: false,\n error: new Error(\"Different number of variables: [\".concat(Array.from(aVars.keys()).join(', '), \"] vs [\").concat(Array.from(bVars.keys()).join(', '), \"]\")),\n };\n }\n return Array.from(aVars.entries()).reduce(function (result, _a) {\n var key = _a[0], type = _a[1];\n if (!result.success) {\n return result;\n }\n var bType = bVars.get(key);\n if (bType == null) {\n return {\n success: false,\n error: new Error(\"Missing variable \".concat(key, \" in message\")),\n };\n }\n if (bType !== type) {\n return {\n success: false,\n error: new Error(\"Variable \".concat(key, \" has conflicting types: \").concat(types_1.TYPE[type], \" vs \").concat(types_1.TYPE[bType])),\n };\n }\n return result;\n }, { success: true });\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isStructurallySame = exports._Parser = void 0;\nexports.parse = parse;\nvar tslib_1 = require(\"tslib\");\nvar error_1 = require(\"./error\");\nvar parser_1 = require(\"./parser\");\nvar types_1 = require(\"./types\");\nfunction pruneLocation(els) {\n els.forEach(function (el) {\n delete el.location;\n if ((0, types_1.isSelectElement)(el) || (0, types_1.isPluralElement)(el)) {\n for (var k in el.options) {\n delete el.options[k].location;\n pruneLocation(el.options[k].value);\n }\n }\n else if ((0, types_1.isNumberElement)(el) && (0, types_1.isNumberSkeleton)(el.style)) {\n delete el.style.location;\n }\n else if (((0, types_1.isDateElement)(el) || (0, types_1.isTimeElement)(el)) &&\n (0, types_1.isDateTimeSkeleton)(el.style)) {\n delete el.style.location;\n }\n else if ((0, types_1.isTagElement)(el)) {\n pruneLocation(el.children);\n }\n });\n}\nfunction parse(message, opts) {\n if (opts === void 0) { opts = {}; }\n opts = tslib_1.__assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);\n var result = new parser_1.Parser(message, opts).parse();\n if (result.err) {\n var error = SyntaxError(error_1.ErrorKind[result.err.kind]);\n // @ts-expect-error Assign to error object\n error.location = result.err.location;\n // @ts-expect-error Assign to error object\n error.originalMessage = result.err.message;\n throw error;\n }\n if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {\n pruneLocation(result.val);\n }\n return result.val;\n}\ntslib_1.__exportStar(require(\"./types\"), exports);\n// only for testing\nexports._Parser = parser_1.Parser;\nvar manipulator_1 = require(\"./manipulator\");\nObject.defineProperty(exports, \"isStructurallySame\", { enumerable: true, get: function () { return manipulator_1.isStructurallySame; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.printAST = printAST;\nexports.doPrintAST = doPrintAST;\nexports.printDateTimeSkeleton = printDateTimeSkeleton;\nvar tslib_1 = require(\"tslib\");\nvar types_1 = require(\"./types\");\nfunction printAST(ast) {\n return doPrintAST(ast, false);\n}\nfunction doPrintAST(ast, isInPlural) {\n var printedNodes = ast.map(function (el, i) {\n if ((0, types_1.isLiteralElement)(el)) {\n return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1);\n }\n if ((0, types_1.isArgumentElement)(el)) {\n return printArgumentElement(el);\n }\n if ((0, types_1.isDateElement)(el) || (0, types_1.isTimeElement)(el) || (0, types_1.isNumberElement)(el)) {\n return printSimpleFormatElement(el);\n }\n if ((0, types_1.isPluralElement)(el)) {\n return printPluralElement(el);\n }\n if ((0, types_1.isSelectElement)(el)) {\n return printSelectElement(el);\n }\n if ((0, types_1.isPoundElement)(el)) {\n return '#';\n }\n if ((0, types_1.isTagElement)(el)) {\n return printTagElement(el);\n }\n });\n return printedNodes.join('');\n}\nfunction printTagElement(el) {\n return \"<\".concat(el.value, \">\").concat(printAST(el.children), \"</\").concat(el.value, \">\");\n}\nfunction printEscapedMessage(message) {\n return message.replace(/([{}](?:[\\s\\S]*[{}])?)/, \"'$1'\");\n}\nfunction printLiteralElement(_a, isInPlural, isFirstEl, isLastEl) {\n var value = _a.value;\n var escaped = value;\n // If this literal starts with a ' and its not the 1st node, this means the node before it is non-literal\n // and the `'` needs to be unescaped\n if (!isFirstEl && escaped[0] === \"'\") {\n escaped = \"''\".concat(escaped.slice(1));\n }\n // Same logic but for last el\n if (!isLastEl && escaped[escaped.length - 1] === \"'\") {\n escaped = \"\".concat(escaped.slice(0, escaped.length - 1), \"''\");\n }\n escaped = printEscapedMessage(escaped);\n return isInPlural ? escaped.replace('#', \"'#'\") : escaped;\n}\nfunction printArgumentElement(_a) {\n var value = _a.value;\n return \"{\".concat(value, \"}\");\n}\nfunction printSimpleFormatElement(el) {\n return \"{\".concat(el.value, \", \").concat(types_1.TYPE[el.type]).concat(el.style ? \", \".concat(printArgumentStyle(el.style)) : '', \"}\");\n}\nfunction printNumberSkeletonToken(token) {\n var stem = token.stem, options = token.options;\n return options.length === 0\n ? stem\n : \"\".concat(stem).concat(options.map(function (o) { return \"/\".concat(o); }).join(''));\n}\nfunction printArgumentStyle(style) {\n if (typeof style === 'string') {\n return printEscapedMessage(style);\n }\n else if (style.type === types_1.SKELETON_TYPE.dateTime) {\n return \"::\".concat(printDateTimeSkeleton(style));\n }\n else {\n return \"::\".concat(style.tokens.map(printNumberSkeletonToken).join(' '));\n }\n}\nfunction printDateTimeSkeleton(style) {\n return style.pattern;\n}\nfunction printSelectElement(el) {\n var msg = [\n el.value,\n 'select',\n Object.keys(el.options)\n .map(function (id) { return \"\".concat(id, \"{\").concat(doPrintAST(el.options[id].value, false), \"}\"); })\n .join(' '),\n ].join(',');\n return \"{\".concat(msg, \"}\");\n}\nfunction printPluralElement(el) {\n var type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal';\n var msg = [\n el.value,\n type,\n tslib_1.__spreadArray([\n el.offset ? \"offset:\".concat(el.offset) : ''\n ], Object.keys(el.options).map(function (id) { return \"\".concat(id, \"{\").concat(doPrintAST(el.options[id].value, true), \"}\"); }), true).filter(Boolean)\n .join(' '),\n ].join(',');\n return \"{\".concat(msg, \"}\");\n}\n","import { a as defaultBaseUrl, c as createDiagnosticMessage, d as libraryDefaultLocale, i as isSupportedFileFormatTransform, l as formatDiagnosticErrorDetails, n as encode, o as defaultCacheUrl, r as validateFileFormatTransforms, s as defaultRuntimeApiUrl, t as decode, u as defaultTimeout } from \"./base64-r7YWJYWt.mjs\";\nimport { n as stableStringify, t as isVariable } from \"./isVariable-fAKEB7gF.mjs\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport { getCachedPluralRules } from \"@generaltranslation/format/internal\";\nimport { TYPE, parse } from \"@formatjs/icu-messageformat-parser\";\nimport { TYPE as TYPE$1 } from \"@formatjs/icu-messageformat-parser/types.js\";\nimport { printAST } from \"@formatjs/icu-messageformat-parser/printer.js\";\n//#region src/settings/plurals.ts\nconst pluralForms = [\n\t\"singular\",\n\t\"plural\",\n\t\"dual\",\n\t\"zero\",\n\t\"one\",\n\t\"two\",\n\t\"few\",\n\t\"many\",\n\t\"other\"\n];\nfunction isAcceptedPluralForm(form) {\n\treturn pluralForms.includes(form);\n}\n//#endregion\n//#region src/locales/getPluralForm.ts\n/**\n* Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n*\n* @param {number} n - The number to determine the plural form for.\n* @param {PluralType[]} forms - The allowed plural forms.\n* @returns {PluralType} The determined plural form, or an empty string if none fit.\n*/\nfunction _getPluralForm(n, forms = pluralForms, locales = [\"en\"]) {\n\tconst provisionalBranchName = getCachedPluralRules(locales).select(n);\n\tconst absN = Math.abs(n);\n\tif (absN === 0 && forms.includes(\"zero\")) return \"zero\";\n\tif (absN === 1) {\n\t\tif (forms.includes(\"singular\")) return \"singular\";\n\t\tif (forms.includes(\"one\")) return \"one\";\n\t}\n\tif (provisionalBranchName === \"one\" && forms.includes(\"singular\")) return \"singular\";\n\tif (absN === 2) {\n\t\tif (forms.includes(\"dual\")) return \"dual\";\n\t\tif (forms.includes(\"two\")) return \"two\";\n\t}\n\tif (provisionalBranchName === \"two\" && forms.includes(\"dual\")) return \"dual\";\n\tif (forms.includes(provisionalBranchName)) return provisionalBranchName;\n\tif (provisionalBranchName === \"two\" && forms.includes(\"dual\")) return \"dual\";\n\tif (provisionalBranchName === \"two\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"two\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"few\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"few\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"many\" && forms.includes(\"plural\")) return \"plural\";\n\tif (provisionalBranchName === \"many\" && forms.includes(\"other\")) return \"other\";\n\tif (provisionalBranchName === \"other\" && forms.includes(\"plural\")) return \"plural\";\n\treturn \"\";\n}\n//#endregion\n//#region src/utils/minify.ts\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n\tvariable: \"v\",\n\tnumber: \"n\",\n\tdatetime: \"d\",\n\tcurrency: \"c\",\n\t\"relative-time\": \"rt\"\n};\nfunction minifyVariableType(variableType) {\n\treturn VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];\n}\n//#endregion\n//#region src/derive/utils/traverseIcu.ts\n/**\n* Given an ICU string, traverse the AST and call the visitor function for each element that matches the type T\n* @param icu - The ICU string to traverse\n* @param shouldVisit - A function that returns true if the element should be visited\n* @param visitor - A function that is called for each element that matches the type T\n* @returns The modified AST of the ICU string.\n*\n* @note This function is a heavy operation, use sparingly\n*/\nfunction traverseIcu({ icuString, shouldVisit, visitor, options: { recurseIntoVisited = true, ...otherOptions } }) {\n\tconst ast = parse(icuString, otherOptions);\n\thandleChildren(ast);\n\treturn ast;\n\tfunction handleChildren(children) {\n\t\tchildren.map(handleChild);\n\t}\n\tfunction handleChild(child) {\n\t\tlet visited = false;\n\t\tif (shouldVisit(child)) {\n\t\t\tvisitor(child);\n\t\t\tvisited = true;\n\t\t}\n\t\tif (!visited || recurseIntoVisited) {\n\t\t\tif (child.type === TYPE.select || child.type === TYPE.plural) Object.values(child.options).map((option) => option.value).map(handleChildren);\n\t\t\telse if (child.type === TYPE.tag) handleChildren(child.children);\n\t\t}\n\t}\n}\n//#endregion\n//#region src/derive/utils/constants.ts\nconst VAR_IDENTIFIER = \"_gt_\";\nconst VAR_NAME_IDENTIFIER = \"_gt_var_name\";\n//#endregion\n//#region src/derive/utils/regex.ts\nconst GT_INDEXED_IDENTIFIER_REGEX = new RegExp(`^${VAR_IDENTIFIER}\\\\d+$`);\nconst GT_UNINDEXED_IDENTIFIER_REGEX = new RegExp(`^${VAR_IDENTIFIER}$`);\n//#endregion\n//#region src/derive/utils/traverseHelpers.ts\nfunction isGTIndexedSelectElement(child) {\n\treturn child.type === TYPE$1.select && GT_INDEXED_IDENTIFIER_REGEX.test(child.value) && !!child.options.other && (child.options.other.value.length === 0 || child.options.other.value.length > 0 && child.options.other.value[0]?.type === TYPE$1.literal);\n}\nfunction isGTUnindexedSelectElement(child) {\n\treturn child.type === TYPE$1.select && GT_UNINDEXED_IDENTIFIER_REGEX.test(child.value) && !!child.options.other && (child.options.other.value.length === 0 || child.options.other.value.length > 0 && child.options.other.value[0]?.type === TYPE$1.literal);\n}\n//#endregion\n//#region src/derive/decodeVars.ts\n/**\n* Given an encoded ICU string, interpolate only _gt_ variables that have been marked with declareVar()\n* @example\n* const encodedIcu = \"Hi\" + declareVar(\"Brian\") + \", my name is {name}\"\n* // 'Hi {_gt_, select, other {Brian}}, my name is {name}'\n* decodeVars(encodedIcu)\n* // 'Hi Brian, my name is {name}'\n*/\nfunction decodeVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return icuString;\n\tconst variableLocations = [];\n\tfunction visitor(child) {\n\t\tvariableLocations.push({\n\t\t\tstart: child.location?.start.offset ?? 0,\n\t\t\tend: child.location?.end.offset ?? 0,\n\t\t\tvalue: child.options.other.value.length > 0 ? child.options.other.value[0].value : \"\"\n\t\t});\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: {\n\t\t\trecurseIntoVisited: false,\n\t\t\tcaptureLocation: true\n\t\t}\n\t});\n\tlet previousIndex = 0;\n\tconst outputList = [];\n\tfor (let i = 0; i < variableLocations.length; i++) {\n\t\toutputList.push(icuString.slice(previousIndex, variableLocations[i].start));\n\t\toutputList.push(variableLocations[i].value);\n\t\tpreviousIndex = variableLocations[i].end;\n\t}\n\tif (previousIndex < icuString.length) outputList.push(icuString.slice(previousIndex));\n\treturn outputList.join(\"\");\n}\n//#endregion\n//#region src/derive/utils/sanitizeVar.ts\n/**\n* Sanitizes string by escaping ICU syntax\n*\n* Sanitize arbitrary string so it does not break the following ICU message syntax:\n* {_gt_, select, other {string_here}}\n*\n* Escapes ICU special characters by:\n* 1. Doubling all single quotes (U+0027 ')\n* 2. Adding a single quote before the first special character ({}<>)\n* 3. Adding a single quote after the last special character ({}<>)\n*/\nfunction sanitizeVar(string) {\n\tlet result = string.replace(/'/g, \"''\");\n\tconst specialChars = /[{}<>]/;\n\tconst firstSpecialIndex = result.search(specialChars);\n\tif (firstSpecialIndex === -1) return result;\n\tlet lastSpecialIndex = -1;\n\tfor (let i = result.length - 1; i >= 0; i--) if (specialChars.test(result[i])) {\n\t\tlastSpecialIndex = i;\n\t\tbreak;\n\t}\n\tresult = result.slice(0, firstSpecialIndex) + \"'\" + result.slice(firstSpecialIndex, lastSpecialIndex + 1) + \"'\" + result.slice(lastSpecialIndex + 1);\n\treturn result;\n}\n//#endregion\n//#region src/derive/declareVar.ts\n/**\n* Mark as a non-translatable string. Use within a derive() call to mark content as not derivable (e.g., not possible to statically analyze).\n*\n* @example\n* function nonDerivableFunction() {\n* return Math.random();\n* }\n*\n* function derivableFunction() {\n* if (condition) {\n* return declareVar(nonDerivableFunction())\n* }\n* return 'John Doe';\n* }\n*\n* const gt = useGT();\n* gt(`My name is ${derive(derivableFunction())}`);\n*\n* @param {string | number | boolean | null | undefined} variable - The variable to sanitize.\n* @param {Object} [options] - The options for the sanitization.\n* @param {string} [options.$name] - The name of the variable.\n* @returns {string} The sanitized value.\n*/\nfunction declareVar(variable, options) {\n\tconst variableSection = ` other {${sanitizeVar(String(variable ?? \"\"))}}`;\n\tlet nameSection = \"\";\n\tif (options?.$name) nameSection = ` ${VAR_NAME_IDENTIFIER} {${sanitizeVar(options.$name)}}`;\n\treturn `{${VAR_IDENTIFIER}, select,${variableSection}${nameSection}}`;\n}\n//#endregion\n//#region src/derive/derive.ts\n/**\n* Marks content as derivable by the GT compiler and CLI.\n*\n* Use `derive()` when a translation string or context needs content that is\n* computed from source code, but should still be discovered during extraction\n* instead of treated as a runtime interpolation variable. The CLI attempts to\n* resolve the derivable expression into every possible static value and\n* includes those values in the source content that gets translated.\n*\n* `derive()` returns its argument unchanged at runtime.\n*\n* Run `gt validate` after adding or changing `derive()` calls to verify that\n* each derivable expression can be resolved by the CLI before translating or\n* building.\n*\n* @example\n* ```jsx\n* function getSubject() {\n* return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n* }\n* ...\n* gt(`My name is ${derive(getSubject())}`);\n* ```\n*\n* @param {T extends string | boolean | number | null | undefined} content - Content to derive for translation extraction.\n* @returns {T} The same content, unchanged at runtime.\n*/\nfunction derive(content) {\n\treturn content;\n}\n/**\n* @deprecated Use derive() instead.\n*\n* Marks content as derivable by the GT compiler and CLI.\n*\n* Use `derive()` instead of `declareStatic()` for new code. This alias is kept\n* for backwards compatibility and returns its argument unchanged at runtime.\n*\n* Run `gt validate` after adding or changing derived content to verify that\n* each derivable expression can be resolved by the CLI before translating or\n* building.\n*\n* @example\n* ```jsx\n* function getSubject() {\n* return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n* }\n* ...\n* gt(`My name is ${declareStatic(getSubject())}`);\n* ```\n*\n* @param {T extends string | boolean | number | null | undefined} content - Content to derive for translation extraction.\n* @returns {T} The same content, unchanged at runtime.\n*/\nconst declareStatic = derive;\n//#endregion\n//#region src/derive/indexVars.ts\n/**\n* Given an ICU string adds identifiers to each _gt_ placeholder\n* indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'\n*/\nfunction indexVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return icuString;\n\tconst variableLocations = [];\n\tfunction visitor(child) {\n\t\tvariableLocations.push({\n\t\t\tstart: child.location?.start.offset ?? 0,\n\t\t\tend: child.location?.end.offset ?? 0,\n\t\t\totherStart: child.options.other.location?.start.offset ?? 0,\n\t\t\totherEnd: child.options.other.location?.end.offset ?? 0\n\t\t});\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: {\n\t\t\trecurseIntoVisited: false,\n\t\t\tcaptureLocation: true\n\t\t}\n\t});\n\tconst result = [];\n\tlet current = 0;\n\tfor (let i = 0; i < variableLocations.length; i++) {\n\t\tconst { start, end, otherStart, otherEnd } = variableLocations[i];\n\t\tresult.push(icuString.slice(current, start));\n\t\tresult.push(icuString.slice(start, start + 4 + 1));\n\t\tresult.push(String(i + 1));\n\t\tresult.push(icuString.slice(start + 4 + 1, otherStart));\n\t\tresult.push(\"{}\");\n\t\tresult.push(icuString.slice(otherEnd, end));\n\t\tcurrent = end;\n\t}\n\tresult.push(icuString.slice(current, icuString.length));\n\treturn result.join(\"\");\n}\n//#endregion\n//#region src/derive/extractVars.ts\n/**\n* Given an unindexed ICU string, extracts all the _gt_ variables and an indexed mapping of the variable to the values\n*\n* extractVars('Hello {_gt_, select, other {World}}') => { _gt_1: 'World' }\n*\n* @param {string} icuString - The ICU string to extract variables from.\n* @returns {Record<string, string>} A mapping of the variable to the value.\n*/\nfunction extractVars(icuString) {\n\tif (!icuString.includes(\"_gt_\")) return {};\n\tlet index = 1;\n\tconst variables = {};\n\tfunction visitor(child) {\n\t\tvariables[child.value + index] = child.options.other.value.length ? child.options.other.value[0]?.value : \"\";\n\t\tindex += 1;\n\t}\n\ttraverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTUnindexedSelectElement,\n\t\tvisitor,\n\t\toptions: { recurseIntoVisited: false }\n\t});\n\treturn variables;\n}\n//#endregion\n//#region src/derive/condenseVars.ts\nconst CONTAINS_INDEXED_GT_REGEX = new RegExp(`${VAR_IDENTIFIER}\\\\d+`);\n/**\n* Given an indexed ICU string, condenses any select to an argument\n* Unindexed _gt_ source strings and indexed _gt_# translation strings\n* are mutually exclusive.\n* indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'\n* @param {string} icuString - The ICU string to condense.\n* @returns {string} The condensed ICU string.\n*/\nfunction condenseVars(icuString) {\n\tif (!CONTAINS_INDEXED_GT_REGEX.test(icuString)) return icuString;\n\tfunction visitor(child) {\n\t\tchild.type = TYPE$1.argument;\n\t\tReflect.deleteProperty(child, \"options\");\n\t}\n\treturn printAST(traverseIcu({\n\t\ticuString,\n\t\tshouldVisit: isGTIndexedSelectElement,\n\t\tvisitor,\n\t\toptions: { recurseIntoVisited: false }\n\t}));\n}\n//#endregion\n//#region src/backwards-compatability/typeChecking.ts\n/**\n* Checks if a JSX child is an old variable object format\n* @param child - The JSX child to check.\n* @returns True if the child is an old variable object (has 'key' property)\n*/\nfunction isOldVariableObject(child) {\n\treturn typeof child === \"object\" && child != null && \"key\" in child;\n}\n/**\n* Checks if a JSX child is a new variable object format\n* @param child - The JSX child to check.\n* @returns True if the child is a new variable object (has 'k' property)\n*/\nfunction isNewVariableObject(child) {\n\treturn typeof child === \"object\" && child != null && \"k\" in child;\n}\n/**\n* Checks if a JSX child is an old JSX element format\n* @param child - The JSX child to check.\n* @returns True if the child is an old JSX element (has 'type' and 'props' properties)\n*/\nfunction isOldJsxElement(child) {\n\treturn typeof child === \"object\" && child != null && \"type\" in child && \"props\" in child;\n}\n/**\n* Checks if a JSX child follows the old format (string, old variable object, or old JSX element)\n* @param child - The JSX child to check.\n* @returns True if the child is in the old format.\n*/\nfunction isOldJsxChild(child) {\n\tif (typeof child === \"string\") return true;\n\tif (isOldVariableObject(child)) return true;\n\treturn isOldJsxElement(child);\n}\n/**\n* Checks if JSX children follow the old format\n* @param children - The JSX children to check (can be string, array, or single child)\n* @returns True if all children are in the old format.\n*/\nfunction isOldJsxChildren(children) {\n\tif (typeof children === \"string\") return true;\n\tif (Array.isArray(children)) return !children.some((child) => !isOldJsxChild(child));\n\treturn isOldJsxChild(children);\n}\n//#endregion\n//#region src/backwards-compatability/dataConversion.ts\n/**\n* Convert request data from old format to new format\n*/\nfunction getNewJsxChild(child) {\n\tif (typeof child === \"string\") return child;\n\tif (isOldVariableObject(child)) return getNewVariableObject(child);\n\treturn getNewJsxElement(child);\n}\nfunction getNewJsxChildren(children) {\n\tif (typeof children === \"string\") return children;\n\tif (Array.isArray(children)) return children.map(getNewJsxChild);\n\treturn getNewJsxChild(children);\n}\nfunction getNewJsxElement(element) {\n\tif (typeof element === \"string\") return element;\n\tlet t = void 0;\n\tif (element.type != null) t = element.type;\n\tlet c = void 0;\n\tif (element.props?.children != null) c = getNewJsxChildren(element.props.children);\n\treturn {\n\t\t...t && { t },\n\t\t...c && { c },\n\t\td: getNewGTProp(element.props[\"data-_gt\"]),\n\t\ti: element.props[\"data-_gt\"].id\n\t};\n}\nfunction getNewBranchType(branch) {\n\tif (branch === \"branch\") return \"b\";\n\treturn \"p\";\n}\nfunction getNewVariableType(variable) {\n\tswitch (variable) {\n\t\tcase \"number\": return \"n\";\n\t\tcase \"variable\": return \"v\";\n\t\tcase \"datetime\": return \"d\";\n\t\tcase \"currency\": return \"c\";\n\t\tdefault: return \"v\";\n\t}\n}\nfunction getNewVariableObject(variable) {\n\tlet v = void 0;\n\tif (variable.variable != null) v = getNewVariableType(variable.variable);\n\tlet i = void 0;\n\tif (variable.id != null) i = variable.id;\n\treturn {\n\t\tk: variable.key,\n\t\t...v && { v },\n\t\t...i && { i }\n\t};\n}\nfunction getNewGTProp(dataGT) {\n\tlet b = void 0;\n\tif (dataGT.branches) b = Object.fromEntries(Object.entries(dataGT.branches).map(([key, value]) => [key, getNewJsxChildren(value)]));\n\tlet t;\n\tif (dataGT.transformation) t = getNewBranchType(dataGT.transformation);\n\treturn {\n\t\t...b && { b },\n\t\t...t && { t }\n\t};\n}\n/**\n* Convert response data from current format to old format\n*/\nfunction getOldJsxChild(child) {\n\tif (typeof child === \"string\") return child;\n\tif (isNewVariableObject(child)) return getOldVariableObject(child);\n\treturn getOldJsxElement(child);\n}\nfunction getOldJsxChildren(children) {\n\tif (isOldJsxChildren(children)) return children;\n\tif (typeof children === \"string\") return children;\n\tif (Array.isArray(children)) return children.map(getOldJsxChild);\n\treturn getOldJsxChild(children);\n}\nfunction getOldJsxElement(element) {\n\tconst type = element.t;\n\tlet children = void 0;\n\tif (element.c != null) children = getOldJsxChildren(element.c);\n\tconst dataGT = getOldGTProp(element.d || {}, element.i);\n\treturn {\n\t\ttype,\n\t\tprops: {\n\t\t\tchildren,\n\t\t\t\"data-_gt\": dataGT\n\t\t}\n\t};\n}\nfunction getOldBranchType(branch) {\n\tif (branch === \"b\") return \"branch\";\n\treturn \"plural\";\n}\nfunction getOldVariableType(variable) {\n\tswitch (variable) {\n\t\tcase \"n\": return \"number\";\n\t\tcase \"v\": return \"variable\";\n\t\tcase \"d\": return \"datetime\";\n\t\tcase \"c\": return \"currency\";\n\t\tdefault: return \"variable\";\n\t}\n}\nfunction getOldVariableObject(variable) {\n\tlet v = void 0;\n\tif (variable.v != null) v = getOldVariableType(variable.v);\n\tlet i = void 0;\n\tif (variable.i != null) i = variable.i;\n\treturn {\n\t\tkey: variable.k,\n\t\t...v && { variable: v },\n\t\t...i && { id: i }\n\t};\n}\nfunction getOldGTProp(dataGT, i) {\n\tlet transformation = void 0;\n\tif (dataGT.t != null) transformation = getOldBranchType(dataGT.t);\n\tlet branches = void 0;\n\tif (dataGT.b != null) branches = Object.fromEntries(Object.entries(dataGT.b).map(([key, value]) => [key, getOldJsxChildren(value)]));\n\treturn {\n\t\tid: i,\n\t\t...transformation && { transformation },\n\t\t...branches && { branches }\n\t};\n}\n//#endregion\n//#region src/backwards-compatability/oldHashJsxChildren.ts\n/**\n* Calculates a unique hash for a given string using SHA-256.\n*\n* @param {string} string - The string to be hashed.\n* @returns {string} The resulting hash as a hexadecimal string.\n*/\nfunction oldHashString(string) {\n\treturn bytesToHex(sha256(utf8ToBytes(string)));\n}\n/**\n* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n*\n* @param {any} childrenAsObjects - The children objects to be hashed.\n* @param {string} context - The context for the children.\n* @param {string} id - The ID for the JSX children object.\n* @param {function} hashFunction - Custom hash function.\n* @returns {string} - The unique hash of the children.\n*/\nfunction oldHashJsxChildren({ source, context, id, dataFormat }, hashFunction = oldHashString) {\n\treturn hashFunction(stableStringify({\n\t\tsource: sanitizeJsxChildren(source),\n\t\t...id && { id },\n\t\t...context && { context },\n\t\t...dataFormat && { dataFormat }\n\t}));\n}\nconst sanitizeChild = (child) => {\n\tif (child && typeof child === \"object\") {\n\t\tif (\"props\" in child) {\n\t\t\tconst newChild = {};\n\t\t\tconst dataGt = child?.props?.[\"data-_gt\"];\n\t\t\tif (dataGt?.branches) newChild.branches = Object.fromEntries(Object.entries(dataGt.branches).map(([key, value]) => [key, sanitizeJsxChildren(value)]));\n\t\t\tif (child?.props?.children) newChild.children = sanitizeJsxChildren(child.props.children);\n\t\t\tif (child?.props?.[\"data-_gt\"]?.transformation) newChild.transformation = child.props[\"data-_gt\"].transformation;\n\t\t\treturn newChild;\n\t\t}\n\t\tif (\"key\" in child) return {\n\t\t\tkey: child.key,\n\t\t\t...child.variable && { variable: child.variable }\n\t\t};\n\t}\n\treturn child;\n};\nfunction sanitizeJsxChildren(childrenAsObjects) {\n\treturn Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);\n}\n//#endregion\nexport { VAR_IDENTIFIER, VAR_NAME_IDENTIFIER, condenseVars, createDiagnosticMessage, declareStatic, declareVar, decode, decodeVars, defaultBaseUrl, defaultCacheUrl, defaultRuntimeApiUrl, defaultTimeout, derive, encode, extractVars, formatDiagnosticErrorDetails, getNewBranchType, getNewGTProp, getNewJsxChild, getNewJsxChildren, getNewJsxElement, getNewVariableObject, getNewVariableType, getOldBranchType, getOldGTProp, getOldJsxChild, getOldJsxChildren, getOldJsxElement, getOldVariableObject, getOldVariableType, _getPluralForm as getPluralForm, indexVars, isAcceptedPluralForm, isNewVariableObject, isOldJsxChildren, isOldVariableObject, isSupportedFileFormatTransform, isVariable, libraryDefaultLocale, minifyVariableType, oldHashJsxChildren, oldHashString, pluralForms, validateFileFormatTransforms };\n\n//# sourceMappingURL=internal.mjs.map","import { VariableTransformationSuffix } from 'generaltranslation/types';\nimport { GTTag, VariableProps } from '../types-dir/types';\nimport getVariableName from './getVariableName';\nimport { minifyVariableType } from 'generaltranslation/internal';\n\ntype VariableElementProps = {\n 'data-_gt': GTTag & {\n transformation: 'variable';\n };\n [key: string]: unknown;\n};\n\nexport function isVariableElementProps(\n props: unknown\n): props is VariableElementProps {\n return (\n typeof props === 'object' &&\n !!props &&\n 'data-_gt' in props &&\n typeof props['data-_gt'] === 'object' &&\n !!props['data-_gt'] &&\n 'transformation' in props['data-_gt'] &&\n props['data-_gt']?.transformation === 'variable'\n );\n}\n\nexport default function getVariableProps(\n props: VariableElementProps\n): VariableProps {\n const variableType: VariableTransformationSuffix =\n props['data-_gt']?.variableType || 'variable';\n\n const result: VariableProps = {\n variableName: getVariableName(props, variableType),\n variableType: minifyVariableType(variableType),\n injectionType: props['data-_gt']?.injectionType || 'manual',\n variableValue: (() => {\n if (typeof props.value !== 'undefined') return props.value;\n if (typeof props.date !== 'undefined') return props.date;\n if (typeof props['data-_gt-unformatted-value'] !== 'undefined')\n return props['data-_gt-unformatted-value'];\n if (typeof props.children !== 'undefined') return props.children;\n return undefined;\n })(),\n variableOptions: (() => {\n const variableOptions = {\n ...(typeof props.currency !== 'undefined' && {\n currency: props.currency,\n }),\n ...(typeof props.unit !== 'undefined' && {\n unit: props.unit,\n }),\n ...(typeof props.baseDate !== 'undefined' && {\n baseDate: props.baseDate,\n }),\n ...(typeof props.options !== 'undefined' && props.options),\n };\n if (Object.keys(variableOptions).length) return variableOptions;\n if (typeof props['data-_gt-variable-options'] === 'string')\n return JSON.parse(props['data-_gt-variable-options']);\n return props['data-_gt-variable-options'] || undefined;\n })(),\n };\n\n return result;\n}\n","import {\n getPluralForm,\n isAcceptedPluralForm,\n} from 'generaltranslation/internal';\n\n/**\n * Main function to get the appropriate branch based on the provided number and branches.\n *\n * @param {number} n - The number to determine the branch for.\n * @param {any} branches - The object containing possible branches.\n * @returns {any} The determined branch.\n */\nexport default function getPluralBranch(\n n: number,\n locales: string[],\n branches: Record<string, unknown>\n) {\n let branchName = '';\n let branch = null;\n if (typeof n === 'number' && !branch && branches) {\n const pluralForms = Object.keys(branches).filter(isAcceptedPluralForm);\n branchName = getPluralForm(n, pluralForms, locales);\n }\n if (branchName && !branch) branch = branches[branchName];\n return branch;\n}\n","import { TaggedElement, GTTag } from '../types-dir/types';\n\nexport default function getGTTag(child: TaggedElement): GTTag | null {\n if (child && child.props && child.props['data-_gt']) {\n return child.props['data-_gt'];\n }\n return null;\n}\n","import React, { ReactNode } from 'react';\nimport getVariableProps, {\n isVariableElementProps,\n} from '../variables/_getVariableProps';\nimport { libraryDefaultLocale } from 'generaltranslation/internal';\nimport getPluralBranch from '../branches/plurals/getPluralBranch';\nimport {\n RenderVariable,\n TaggedChild,\n TaggedChildren,\n TaggedElement,\n} from '../types-dir/types';\nimport getGTTag from './getGTTag';\n\nexport default function renderDefaultChildren({\n children,\n defaultLocale = libraryDefaultLocale,\n renderVariable,\n}: {\n children: TaggedChildren;\n defaultLocale: string;\n renderVariable: RenderVariable;\n}): React.ReactNode {\n const handleSingleChildElement = (child: TaggedElement): ReactNode => {\n const generaltranslation = getGTTag(child);\n\n // Variable\n if (isVariableElementProps(child.props)) {\n const { variableType, variableValue, variableOptions, injectionType } =\n getVariableProps(child.props);\n return renderVariable({\n variableType,\n variableValue,\n variableOptions,\n locales: [defaultLocale],\n injectionType,\n });\n }\n\n // Plural\n if (generaltranslation?.transformation === 'plural') {\n const branches = generaltranslation.branches || {};\n if (typeof child.props.n !== 'number') {\n return child.props.children != null\n ? handleChildren(child.props.children)\n : null;\n }\n const resolvedBranch = getPluralBranch(\n child.props.n,\n [defaultLocale],\n branches\n );\n return handleChildren(\n (resolvedBranch !== null\n ? resolvedBranch\n : child.props.children) as TaggedChildren\n );\n }\n\n // Branch\n if (generaltranslation?.transformation === 'branch') {\n const { children, branch } = child.props;\n const branches = generaltranslation.branches || {};\n const branchKey =\n branch == null || branch === '' ? undefined : branch.toString();\n return handleChildren(\n branchKey && branches[branchKey] !== undefined\n ? branches[branchKey]\n : children\n );\n }\n\n // Fragment\n if (generaltranslation?.transformation === 'fragment') {\n return React.createElement(React.Fragment, {\n key: child.props.key,\n children: handleChildren(child.props.children),\n });\n }\n\n // Default\n if (child.props.children) {\n return React.cloneElement(child, {\n ...child.props,\n 'data-_gt': undefined,\n children: handleChildren(child.props.children) as TaggedChildren,\n });\n }\n return React.cloneElement(child, { ...child.props, 'data-_gt': undefined });\n };\n\n const handleSingleChild = (child: TaggedChild): ReactNode => {\n if (React.isValidElement(child)) {\n return handleSingleChildElement(child);\n }\n return child;\n };\n\n const handleChildren = (children: TaggedChildren): ReactNode => {\n return Array.isArray(children)\n ? React.Children.map(children, handleSingleChild)\n : handleSingleChild(children);\n };\n\n return handleChildren(children);\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\n/**\n * @description A function that gets a value from a dictionary, only one level\n * @param dictionary - dictionary to get the value from\n * @param id - id of the value to get\n */\nexport function get(dictionary: Dictionary, id: string | number) {\n if (dictionary == null) {\n throw new Error('Cannot index into an undefined dictionary');\n }\n if (Array.isArray(dictionary)) {\n return dictionary[id as number];\n }\n return dictionary[id as string];\n}\n\n/**\n * @description A function that sets a value in a dictionary\n * @param dictionary - dictionary to set the value in\n * @param id - id of the value to set\n * @param value - value to set\n */\nexport function set(\n dictionary: Dictionary,\n id: string | number,\n value: Dictionary | DictionaryEntry\n) {\n if (Array.isArray(dictionary)) {\n dictionary[id as number] = value;\n } else {\n (dictionary as Record<string, Dictionary | DictionaryEntry>)[id as string] =\n value;\n }\n}\n","import React, { ReactElement, isValidElement, ReactNode } from 'react';\nimport { isAcceptedPluralForm } from 'generaltranslation/internal';\nimport {\n GTTag,\n TaggedChild,\n TaggedChildren,\n TaggedElement,\n TaggedElementProps,\n} from '../types-dir/types';\nimport {\n Transformation,\n TransformationPrefix,\n VariableTransformationSuffix,\n} from 'generaltranslation/types';\n\ntype GTComponentType = {\n _gtt?: Transformation;\n};\n\nexport default function addGTIdentifier(\n children: ReactNode,\n startingIndex: number = 0\n): TaggedChildren {\n // Object to keep track of the current index for GT IDs\n let index = startingIndex;\n\n /**\n * Function to create a GTTag object for a ReactElement\n * @param child - The ReactElement for which the GTTag is created\n * @returns - The GTTag object\n */\n const createGTTag = (child: ReactElement<Record<string, unknown>>): GTTag => {\n const { type, props } = child;\n index += 1;\n const result: GTTag = { id: index, injectionType: 'manual' };\n let transformation: Transformation | undefined;\n try {\n transformation =\n typeof type === 'function' ? (type as GTComponentType)._gtt : undefined;\n } catch {\n /* empty */\n }\n if (transformation) {\n const transformationParts = transformation.split('-');\n // If the component was inserted automatically by the compiler\n if (\n transformationParts[1] === 'automatic' ||\n transformationParts[2] === 'automatic'\n ) {\n result.injectionType = 'automatic';\n }\n\n if (transformationParts[0] === 'translate') {\n // Convert nested <T> to fragments\n // This will nullify translation specific attributes of child, i.e. id, context, etc.\n transformationParts[0] = 'fragment';\n }\n if (transformationParts[0] === 'variable') {\n result.variableType =\n (transformationParts?.[1] as VariableTransformationSuffix) ||\n 'variable';\n }\n if (transformationParts[0] === 'plural') {\n const pluralBranches = Object.entries(props).reduce(\n (acc, [branchName, branch]) => {\n if (isAcceptedPluralForm(branchName)) {\n (acc as Record<string, TaggedChildren>)[branchName] =\n addGTIdentifier(branch as ReactNode, index);\n }\n return acc;\n },\n {} as Record<string, TaggedChildren>\n );\n if (Object.keys(pluralBranches).length)\n result.branches = pluralBranches;\n }\n if (transformationParts[0] === 'branch') {\n const { children: _children, branch: _branch, ...branches } = props;\n // Filter out data-* attributes injected by build tools\n const filteredBranches = Object.fromEntries(\n Object.entries(branches).filter(([key]) => !key.startsWith('data-'))\n );\n const resultBranches = Object.entries(filteredBranches).reduce(\n (acc, [branchName, branch]) => {\n (acc as Record<string, TaggedChildren>)[branchName] =\n addGTIdentifier(branch as ReactNode, index);\n return acc;\n },\n {} as Record<string, TaggedChildren>\n );\n if (Object.keys(resultBranches).length)\n result.branches = resultBranches;\n }\n result.transformation = transformationParts[0] as TransformationPrefix;\n }\n return result;\n };\n\n function handleSingleChildElement(\n child: ReactElement<Record<string, unknown>>\n ): TaggedElement {\n const { props } = child;\n\n // Create new props for the element, including the GT identifier and a key\n const generaltranslation: GTTag = createGTTag(child);\n const newProps: TaggedElementProps = {\n ...props,\n 'data-_gt': generaltranslation,\n };\n if (props.children && !generaltranslation.variableType) {\n newProps.children = handleChildren(props.children as ReactNode);\n }\n if (child.type === React.Fragment) {\n newProps['data-_gt'].transformation = 'fragment';\n }\n return React.cloneElement(child, newProps) as TaggedElement;\n }\n\n function handleSingleChild(child: ReactNode): TaggedChild {\n if (isValidElement(child)) {\n return handleSingleChildElement(\n child as ReactElement<Record<string, unknown>>\n );\n }\n return child;\n }\n\n function handleChildren(children: ReactNode): TaggedChildren {\n if (Array.isArray(children)) {\n return React.Children.map(children, handleSingleChild);\n } else {\n return handleSingleChild(children);\n }\n }\n\n return handleChildren(children);\n}\n","export const PACKAGE_NAME = '@generaltranslation/react-core';\n","import {\n createDiagnosticMessage,\n formatDiagnosticErrorDetails,\n type DiagnosticMessageInput,\n} from 'generaltranslation/internal';\nimport { PACKAGE_NAME } from './constants';\n\ntype ReactCoreDiagnosticInput = Omit<DiagnosticMessageInput, 'source'>;\n\nexport function createReactCoreDiagnostic(\n input: ReactCoreDiagnosticInput\n): string {\n return createDiagnosticMessage({\n source: PACKAGE_NAME,\n ...input,\n });\n}\n\nexport { formatDiagnosticErrorDetails };\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createReactCoreDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { PACKAGE_NAME } from './constants';\n\n// ---- ERRORS ---- //\n\nexport const projectIdMissingError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const devApiKeyProductionError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Production environments cannot use a development API key',\n fix: 'Replace it with a production API key before deploying',\n});\n\nexport const apiKeyInProductionError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'The API key is available to client-side production code',\n fix: 'Move translation credentials to a server-only environment before deploying',\n});\n\nexport const createNoAuthError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation is not configured',\n fix: 'Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly',\n});\n\nexport const createPluralMissingError = (children: unknown) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<Plural> could not choose a plural form for \"${children}\"`,\n fix: 'Pass the required \"n\" option to <Plural>',\n });\n\nexport const createClientSideTDictionaryCollisionError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<T id=\"${id}\"> conflicts with a dictionary entry using the same ID`,\n fix: 'Rename the <T> id or the dictionary key so each translation source has a unique ID',\n });\n\nexport const createClientSideTHydrationError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `<T id=\"${id}\"> is rendering in a client component without a saved translation`,\n why: 'This can cause hydration mismatches',\n fix: 'Use a dictionary with useGT() or push translations from the command line before rendering this component on the client',\n });\n\nexport const dynamicTranslationError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translations could not be loaded',\n wayOut: 'Source content will render as a fallback',\n fix: 'Check your runtime translation configuration and try again',\n});\n\nexport const createGenericRuntimeTranslationError = (\n id: string | undefined,\n hash: string,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: id\n ? `Translation could not be found for id \"${id}\" and hash \"${hash}\"`\n : `Translation could not be found for hash \"${hash}\"`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check that runtime translation is configured',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const runtimeTranslationError = createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Runtime translation could not be completed',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `The message \"${message}\" is missing variables: \"${variables.join('\", \"')}\"`,\n fix: 'Provide values for these variables before rendering the translation',\n });\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName}(\"${string}\")${id ? ` with id \"${id}\"` : ''} could not find a translation`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check your dictionary/runtime translation configuration',\n });\n\nexport const invalidLocalesError = (locales: string[]) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createEmptyIdError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 't.obj() received an empty id',\n fix: 'Pass a non-empty dictionary id',\n });\n\nexport const createSubtreeNotFoundError = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary subtree \"${id}\" could not be found`,\n fix: 'Check that the id matches your dictionary structure',\n });\n\nexport const createDictionaryEntryError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: 'A dictionary entry cannot be injected as a subtree',\n fix: 'Pass a dictionary object instead',\n });\n\nexport const createCannotInjectDictionaryEntryError = () =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened:\n 'A dictionary entry cannot be merged into another dictionary entry',\n fix: 'Pass a dictionary subtree instead',\n });\n\nexport const createInvalidIcuDictionaryEntryError = (id: string | undefined) =>\n createReactCoreDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n fix: 'Fix the ICU message before rendering this translation',\n });\n\n// ---- WARNINGS ---- //\n\nexport const projectIdMissingWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const createNoEntryFoundWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `No valid dictionary entry was found for id \"${id}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `Dictionary entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createNoEntryTranslationWarning = (\n id: string,\n prefixedId: string\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `t(\"${id}\") could not find a translation for dictionary item \"${prefixedId}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Translation hashes do not match',\n reassurance: 'The translation will still render',\n fix: 'Update your translations to the newest version to avoid stale content',\n details: [`expected ${expectedHash}`, `received ${receivedHash}`],\n });\n\nexport const APIKeyMissingWarn = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `${PACKAGE_NAME} Warning: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const runtimeTranslationTimeoutWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'Runtime translation timed out',\n});\n\nexport const createUnsupportedLocaleWarning = (\n validatedLocale: string,\n newLocale: string,\n packageName: string = PACKAGE_NAME\n) => {\n return (\n `${packageName} Warning: \"${newLocale}\" is not a supported locale. ` +\n `Update supported locales in your dashboard or gt.config.json. ` +\n `Falling back to \"${validatedLocale}\".`\n );\n};\n\nexport const dictionaryMissingWarning = createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: 'No dictionary was found',\n fix: 'Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations',\n});\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createReactCoreDiagnostic({\n severity: 'Warning',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n wayOut: 'Source content will render as a fallback',\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\n// Unlikely edge case: A <_T> component was injected outside of a <Derive> boundary. This would be caused by the compiler overeagerly injecting <_T> components.\nexport const warnNestedInternalTComponent = `${PACKAGE_NAME} Warning: A <_T> component was found injected outside of a <Derive> boundary. This may affect translation resolution for this component.`;\n","import { PACKAGE_NAME } from './constants';\n\n/**\n * Invoked when a method that was designated for overriding is invoked by @generaltranslation/react-core.\n * This is an internal library error due to incorrect implementation of a wrapper library.\n * @param methodName\n * @returns Error object\n */\nexport function createInternalUsageError(methodName: string): Error {\n return new Error(\n `${PACKAGE_NAME}: The ${methodName} function was not overridden. This is likely the result of importing directly from \"generaltranslation/react-core\".`\n );\n}\n","import React from 'react';\nimport { TaggedElement, TaggedElementProps } from '../types-dir/types';\nimport { AuthFromEnvParams, AuthFromEnvReturn } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\nexport function isValidTaggedElement(target: unknown): target is TaggedElement {\n return React.isValidElement<TaggedElementProps>(target);\n}\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function readAuthFromEnv(_params: AuthFromEnvParams): AuthFromEnvReturn {\n throw createInternalUsageError('readAuthFromEnv');\n}\n","//#region src/types-dir/jsx/content.ts\n/**\n* Map of data-_gt properties to their corresponding React props\n*/\nconst HTML_CONTENT_PROPS = {\n\tpl: \"placeholder\",\n\tti: \"title\",\n\talt: \"alt\",\n\tarl: \"aria-label\",\n\tarb: \"aria-labelledby\",\n\tard: \"aria-describedby\"\n};\n//#endregion\nexport { HTML_CONTENT_PROPS as t };\n\n//# sourceMappingURL=types-DY1ZTHWr.mjs.map","import getVariableName from '../variables/getVariableName';\nimport { TaggedChild, TaggedChildren, TaggedElement } from '../types-dir/types';\nimport { isValidTaggedElement } from '../utils/utils';\nimport { minifyVariableType } from 'generaltranslation/internal';\nimport {\n GTProp,\n HTML_CONTENT_PROPS,\n HtmlContentPropKeysRecord,\n JsxChild,\n JsxChildren,\n JsxElement,\n Variable,\n} from '@generaltranslation/format/types';\nimport type { Transformation } from 'generaltranslation/types';\n\n/**\n * Gets the tag name of a React element.\n * @param {ReactElement} child - The React element.\n * @returns {string} - The tag name of the React element.\n */\nconst getTagName = (child: TaggedElement): string => {\n if (!child) return '';\n const { type, props } = child;\n if (type && typeof type === 'function') {\n if (\n 'displayName' in type &&\n typeof type.displayName === 'string' &&\n type.displayName\n )\n return type.displayName;\n if ('name' in type && typeof type.name === 'string' && type.name)\n return type.name;\n }\n if (type && typeof type === 'string') return type;\n if (props.href) return 'a';\n if (props['data-_gt']?.id) return `C${props['data-_gt'].id}`;\n return 'function';\n};\nconst createGTProp = (\n transformation: Transformation,\n props: Record<string, unknown>,\n branches?: Record<string, TaggedChildren>\n): GTProp | undefined => {\n // Add translatable HTML content props\n let newGTProp: GTProp = Object.entries(HTML_CONTENT_PROPS).reduce<GTProp>(\n (acc, [minifiedName, fullName]) => {\n const value = props[fullName];\n if (typeof value === 'string') {\n acc[minifiedName as keyof HtmlContentPropKeysRecord] = value;\n }\n return acc;\n },\n {}\n );\n\n // Check if plural\n if (transformation === 'plural' && branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'p' };\n }\n if (transformation === 'branch' && branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'b' };\n }\n\n return Object.keys(newGTProp).length ? newGTProp : undefined;\n};\n\n/**\n * Handles a single child element.\n * @param {TaggedElement} child - The child to handle.\n * @returns {JsxElement | Variable} The minified element.\n */\nconst handleSingleChildElement = (\n child: TaggedElement\n): JsxElement | Variable => {\n const { props } = child;\n const minifiedElement: JsxElement = {\n t: getTagName(child),\n };\n if (props['data-_gt']) {\n // Get generaltranslation props\n const generaltranslation = props['data-_gt'];\n\n // Check if variable\n const transformation = generaltranslation.transformation;\n if (transformation === 'variable') {\n const variableType = generaltranslation.variableType || 'variable';\n const variableName = getVariableName(props, variableType);\n const minifiedVariableType = minifyVariableType(variableType);\n return {\n i: generaltranslation.id,\n k: variableName,\n v: minifiedVariableType,\n };\n }\n\n // Add id\n minifiedElement.i = generaltranslation.id;\n\n // Add GT prop\n minifiedElement.d = createGTProp(\n transformation as Transformation,\n props,\n generaltranslation.branches\n );\n\n // Add translatable HTML content props\n let newGTProp: GTProp = Object.entries(HTML_CONTENT_PROPS).reduce<GTProp>(\n (acc, [minifiedName, fullName]) => {\n const value = props[fullName];\n if (typeof value === 'string') {\n acc[minifiedName as keyof HtmlContentPropKeysRecord] = value;\n }\n return acc;\n },\n {}\n );\n\n // Check if plural\n if (transformation === 'plural' && generaltranslation.branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(generaltranslation.branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'p' };\n }\n if (transformation === 'branch' && generaltranslation.branches) {\n const newBranches: Record<string, JsxChildren> = {};\n Object.entries(generaltranslation.branches).forEach(\n ([key, value]: [string, TaggedChildren]) => {\n newBranches[key] = writeChildrenAsObjects(value);\n }\n );\n newGTProp = { ...newGTProp, b: newBranches, t: 'b' };\n }\n\n minifiedElement.d = Object.keys(newGTProp).length ? newGTProp : undefined;\n }\n if (props.children) {\n minifiedElement.c = writeChildrenAsObjects(props.children);\n }\n return minifiedElement;\n};\n\nconst handleSingleChild = (child: TaggedChild): JsxChild => {\n if (isValidTaggedElement(child)) {\n return handleSingleChildElement(child);\n }\n if (typeof child === 'number') return child.toString();\n return child as JsxChild;\n};\n\n/**\n * Transforms children elements into objects, processing each child recursively if needed.\n * TaggedChildren are transformed into JsxChildren\n * @param {Children} children - The children to process.\n * @returns {object} The processed children as objects.\n */\nexport default function writeChildrenAsObjects(\n children: TaggedChildren\n): JsxChildren {\n const result = Array.isArray(children)\n ? children.map(handleSingleChild)\n : handleSingleChild(children);\n return result;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get } from './indexDict';\n\nexport function isValidDictionaryEntry(\n value: unknown\n): value is DictionaryEntry {\n if (typeof value === 'string') {\n return true;\n }\n\n if (Array.isArray(value)) {\n if (typeof value?.[0] !== 'string') {\n return false;\n }\n const provisionalMetadata = value?.[1];\n if (typeof provisionalMetadata === 'undefined') return true;\n if (provisionalMetadata && typeof provisionalMetadata === 'object')\n return true;\n }\n\n return false;\n}\n\nexport function getDictionaryEntry<T extends Dictionary>(\n dictionary: T,\n id: string\n): Dictionary | DictionaryEntry | undefined {\n let current: Dictionary | DictionaryEntry = dictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n if (typeof current !== 'object' && !Array.isArray(current)) {\n return undefined;\n }\n current = get(current as Dictionary, key);\n }\n return current;\n}\n","import { DictionaryEntry, MetaEntry } from '../types-dir/types';\n\nexport default function getEntryAndMetadata(value: DictionaryEntry): {\n entry: string;\n metadata?: MetaEntry;\n} {\n if (Array.isArray(value)) {\n if (value.length === 1) {\n return { entry: value[0] };\n }\n if (value.length === 2) {\n return { entry: value[0], metadata: value[1] as MetaEntry };\n }\n }\n return { entry: value };\n}\n","import React, { ReactNode } from 'react';\nimport {\n TaggedChildren,\n TaggedElement,\n TranslatedChildren,\n RenderVariable,\n TranslatedElement,\n VariableProps,\n} from '../types-dir/types';\nimport getVariableProps, {\n isVariableElementProps,\n} from '../variables/_getVariableProps';\nimport renderDefaultChildren from './renderDefaultChildren';\nimport { isVariable, libraryDefaultLocale } from 'generaltranslation/internal';\nimport getPluralBranch from '../branches/plurals/getPluralBranch';\nimport {\n HTML_CONTENT_PROPS,\n HtmlContentPropValuesRecord,\n} from '@generaltranslation/format/types';\nimport getGTTag from './getGTTag';\n\nfunction renderTranslatedElement({\n sourceElement,\n targetElement,\n locales = [libraryDefaultLocale],\n renderVariable,\n}: {\n sourceElement: TaggedElement;\n targetElement: TranslatedElement;\n locales: string[];\n renderVariable: RenderVariable;\n}): React.ReactNode {\n // Get props and generaltranslation\n const { props: sourceProps } = sourceElement;\n const sourceGT = sourceProps['data-_gt'];\n const transformation = sourceGT?.transformation;\n\n // Get translated props\n const unprocessedTargetGT = targetElement.d;\n const translatedProps: HtmlContentPropValuesRecord = {};\n if (unprocessedTargetGT) {\n Object.entries(HTML_CONTENT_PROPS).forEach(([minifiedName, fullName]) => {\n if (\n unprocessedTargetGT[minifiedName as keyof typeof HTML_CONTENT_PROPS]\n ) {\n translatedProps[fullName] = unprocessedTargetGT[\n minifiedName as keyof typeof HTML_CONTENT_PROPS\n ] as string;\n }\n });\n }\n\n // plural (choose a branch)\n if (transformation === 'plural') {\n const n = sourceElement.props.n;\n if (typeof n !== 'number') {\n return renderDefaultChildren({\n children: sourceElement,\n defaultLocale: locales[0],\n renderVariable,\n });\n }\n const sourceBranches = sourceGT.branches || {};\n const resolvedSourceBranch = getPluralBranch(n, locales, sourceBranches);\n const sourceBranch =\n resolvedSourceBranch !== null\n ? resolvedSourceBranch\n : sourceElement.props.children;\n const targetBranches = targetElement.d?.b || {};\n const resolvedTargetBranch = getPluralBranch(n, locales, targetBranches);\n const targetBranch =\n resolvedTargetBranch !== null ? resolvedTargetBranch : targetElement.c;\n return renderTranslatedChildren({\n source: sourceBranch as TaggedChildren,\n target: targetBranch as TranslatedChildren,\n locales,\n renderVariable,\n });\n }\n\n // branch (choose a branch)\n if (transformation === 'branch') {\n const { branch, children } = sourceProps;\n const branchKey =\n branch == null || branch === '' ? undefined : branch.toString();\n const sourceBranches = sourceGT.branches || {};\n const targetBranches = targetElement.d?.b || {};\n const sourceBranch =\n branchKey && sourceBranches[branchKey] !== undefined\n ? sourceBranches[branchKey]\n : children;\n const targetBranch =\n branchKey && targetBranches[branchKey] !== undefined\n ? targetBranches[branchKey]\n : targetElement.c;\n return renderTranslatedChildren({\n source: sourceBranch as TaggedChildren,\n target: targetBranch as TranslatedChildren,\n locales,\n renderVariable,\n });\n }\n\n // fragment (create a valid fragment)\n if (transformation === 'fragment' && targetElement.c) {\n return React.createElement(React.Fragment, {\n key: sourceElement.props.key,\n children: renderTranslatedChildren({\n source: sourceProps.children as TaggedChildren,\n target: targetElement.c,\n locales,\n renderVariable,\n }) as TaggedChildren,\n });\n }\n\n // other\n if (sourceProps?.children && targetElement?.c) {\n return React.cloneElement(sourceElement, {\n ...sourceProps,\n ...translatedProps,\n 'data-_gt': undefined,\n children: renderTranslatedChildren({\n source: sourceProps.children as TaggedChildren,\n target: targetElement.c,\n locales,\n renderVariable,\n }) as TaggedChildren,\n });\n }\n\n // fallback\n return renderDefaultChildren({\n children: sourceElement,\n defaultLocale: locales[0],\n renderVariable,\n });\n}\n\nexport default function renderTranslatedChildren({\n source,\n target,\n locales = [libraryDefaultLocale],\n renderVariable,\n}: {\n source: TaggedChildren;\n target: TranslatedChildren;\n locales: string[];\n renderVariable: RenderVariable;\n}): ReactNode {\n // Most straightforward case, return a valid React node\n if ((target === null || typeof target === 'undefined') && source)\n return renderDefaultChildren({\n children: source,\n defaultLocale: locales[0],\n renderVariable,\n });\n if (typeof target === 'string') return target;\n\n // Convert source to an array in case target has multiple children where source only has one\n if (Array.isArray(target) && !Array.isArray(source) && source)\n source = [source];\n\n // Multiple children\n if (Array.isArray(source) && Array.isArray(target)) {\n // Track the variables\n const variables: Record<string, VariableProps['variableValue']> = {};\n const variablesOptions: Record<string, VariableProps['variableOptions']> =\n {};\n const variableInjectionTypes: Record<\n string,\n VariableProps['injectionType']\n > = {};\n\n // Extract source elements\n // Extract variable props\n // Filter out variable elements\n const sourceElements: TaggedElement[] = source.filter(\n (sourceChild): sourceChild is TaggedElement => {\n if (React.isValidElement(sourceChild)) {\n if (isVariableElementProps(sourceChild.props)) {\n const {\n variableName,\n variableValue,\n variableOptions,\n injectionType,\n } = getVariableProps(sourceChild.props);\n variables[variableName] = variableValue;\n variablesOptions[variableName] = variableOptions;\n variableInjectionTypes[variableName] = injectionType;\n } else {\n return true;\n }\n }\n return false;\n }\n );\n\n // TODO: pre-index these to avoid O(n/2) lookups\n const findMatchingSourceElement = (\n targetElement: TranslatedElement\n ): TaggedElement | undefined => {\n return (\n sourceElements.find((sourceChild): sourceChild is TaggedElement => {\n const generaltranslation = getGTTag(sourceChild);\n if (typeof generaltranslation?.id !== 'undefined') {\n const sourceId = generaltranslation.id;\n const targetId = targetElement.i;\n return sourceId === targetId;\n }\n return false;\n }) || sourceElements.shift()\n ); // assumes fixed order, not recommended\n };\n\n // map target to source\n return target.map((targetChild, index) => {\n if (typeof targetChild === 'string')\n return (\n <React.Fragment key={`string_${index}`}>{targetChild}</React.Fragment>\n );\n\n // Render variable\n if (isVariable(targetChild)) {\n return (\n <React.Fragment key={`var_${index}`}>\n {renderVariable({\n variableType: targetChild.v || 'v',\n variableValue: variables[targetChild.k],\n variableOptions: variablesOptions[targetChild.k],\n locales,\n injectionType: variableInjectionTypes[targetChild.k] || 'manual',\n })}\n </React.Fragment>\n );\n }\n\n // Render element (targetChild is a TranslatedElement)\n const matchingSourceElement = findMatchingSourceElement(\n targetChild as TranslatedElement\n );\n if (!matchingSourceElement) return null;\n return (\n <React.Fragment key={`element_${index}`}>\n {renderTranslatedElement({\n sourceElement: matchingSourceElement,\n targetElement: targetChild,\n locales,\n renderVariable,\n })}\n </React.Fragment>\n );\n });\n }\n\n // Single child\n if (target && typeof target === 'object' && !Array.isArray(target)) {\n const targetType: 'variable' | 'element' = isVariable(target)\n ? 'variable'\n : 'element';\n\n if (React.isValidElement(source)) {\n if (targetType === 'element') {\n return renderTranslatedElement({\n sourceElement: source,\n targetElement: target as TranslatedElement,\n locales,\n renderVariable,\n });\n }\n\n // Render variable\n if (isVariableElementProps(source.props)) {\n const { variableValue, variableOptions, variableType, injectionType } =\n getVariableProps(source.props);\n return renderVariable({\n variableType,\n variableValue,\n variableOptions,\n locales,\n injectionType,\n });\n }\n }\n }\n\n // fallback\n return renderDefaultChildren({\n children: source,\n defaultLocale: locales[0],\n renderVariable,\n });\n}\n","import { RenderMethod } from '../types-dir/types';\n\n// Apply an 8 second timeout for non dev/testing environments\nexport const getDefaultRenderSettings = (\n environment: 'development' | 'production' | 'test' = 'production'\n): {\n method: RenderMethod;\n timeout: number;\n} => ({\n method: 'default',\n timeout: environment === 'development' ? 8000 : 12000,\n});\n","import React from 'react';\n/**\n * renderSkeleton is a function that handles the rendering behavior for the skeleton loading method.\n * It replaces all content with empty strings\n * @returns an empty string\n */\nexport default function renderSkeleton(): React.ReactNode {\n return '';\n}\n","/**\n * Cookie name for tracking the referrer locale\n */\nexport const defaultLocaleCookieName = 'generaltranslation.locale';\n/**\n * Cookie name for tracking the user's selected region\n */\nexport const defaultRegionCookieName = 'generaltranslation.region';\n/**\n * Cookie name for persisting the enableI18n feature flag\n * \"true\" or \"false\"\n */\nexport const defaultEnableI18nCookieName = 'generaltranslation.enable-i18n';\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\n\n/**\n * Type guard function that checks if a value is a DictionaryEntry\n * @param value - The value to check\n * @returns true if the value is a DictionaryEntry, false otherwise\n */\nexport function isDictionaryEntry(\n value: Dictionary | DictionaryEntry | undefined\n): value is DictionaryEntry {\n if (value === undefined) {\n return false;\n }\n\n // Check if it's a string (Entry)\n if (typeof value === 'string') {\n return true;\n }\n\n // Check if it's an array\n if (Array.isArray(value)) {\n // Must have 1 or 2 elements\n if (value.length !== 1 && value.length !== 2) {\n return false;\n }\n\n // First element must be a string (Entry)\n if (typeof value[0] !== 'string') {\n return false;\n }\n\n // If there's a second element, it must be an object (MetaEntry)\n if (\n value.length === 2 &&\n (typeof value[1] !== 'object' ||\n value[1] === null ||\n (!('$context' in value[1]) &&\n !('$maxChars' in value[1]) &&\n !('$_hash' in value[1])))\n ) {\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\nconst isPrimitiveOrArray = (value: unknown): boolean =>\n typeof value === 'string' || Array.isArray(value);\n\nconst isObjectDictionary = (value: unknown): boolean =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport default function mergeDictionaries(\n defaultLocaleDictionary: Dictionary,\n localeDictionary: Dictionary\n): Dictionary {\n if (Array.isArray(defaultLocaleDictionary)) {\n return defaultLocaleDictionary.map((value, key) => {\n // Merge Dictionary Entry\n if (isDictionaryEntry(value)) {\n return (localeDictionary as (Dictionary | DictionaryEntry)[])[key];\n }\n // Merge Dictionary\n return mergeDictionaries(\n value as Dictionary,\n (localeDictionary as (Dictionary | DictionaryEntry)[])[\n key\n ] as Dictionary\n );\n });\n }\n // Merge primitive and array values\n const mergedDictionary: Dictionary = {\n ...Object.fromEntries(\n Object.entries(defaultLocaleDictionary).filter(([, value]) =>\n isPrimitiveOrArray(value)\n )\n ),\n ...Object.fromEntries(\n Object.entries(localeDictionary).filter(([, value]) =>\n isPrimitiveOrArray(value)\n )\n ),\n };\n\n // Get nested dictionaries\n const defaultDictionaryKeys = Object.entries(defaultLocaleDictionary)\n .filter(([, value]) => isObjectDictionary(value))\n .map(([key]) => key);\n\n const localeDictionaryKeys = Object.entries(localeDictionary)\n .filter(([, value]) => isObjectDictionary(value))\n .map(([key]) => key);\n\n // Merge nested dictionaries recursively\n const allKeys = new Set([...defaultDictionaryKeys, ...localeDictionaryKeys]);\n for (const key of allKeys) {\n mergedDictionary[key] = mergeDictionaries(\n (get(defaultLocaleDictionary, key) || {}) as Dictionary,\n (get(localeDictionary, key) || {}) as Dictionary\n );\n }\n\n return mergedDictionary;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { get, set } from './indexDict';\n\nexport function getSubtree<T extends Dictionary>({\n dictionary,\n id,\n}: {\n dictionary: T;\n id: string;\n}): Dictionary | DictionaryEntry | undefined {\n if (id === '') {\n return dictionary;\n }\n\n let current: Dictionary | DictionaryEntry = dictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n current = get(current as Dictionary, key);\n }\n return current;\n}\n\n/**\n * @description A function that gets a subtree from a dictionary\n * @param dictionary - new dictionary to get the subtree from\n * @param id - id of the subtree to get\n * @param sourceDictionary - source dictionary to model off of\n * @returns\n */\nexport function getSubtreeWithCreation<T extends Dictionary>({\n dictionary,\n id,\n sourceDictionary,\n}: {\n dictionary: T;\n id: string;\n sourceDictionary: T;\n}): Dictionary | DictionaryEntry | undefined {\n if (id === '') {\n return dictionary;\n }\n\n let current: Dictionary | DictionaryEntry = dictionary;\n const sourceCurrent: Dictionary | DictionaryEntry = sourceDictionary;\n const dictionaryPath = id.split('.');\n for (const key of dictionaryPath) {\n if (get(current as Dictionary, key) === undefined) {\n // We know this wont be type Dictionary because we should have already checked for that\n if (Array.isArray(get(sourceCurrent as Dictionary, key))) {\n set(current as Dictionary, key, [] as Dictionary);\n } else {\n set(current as Dictionary, key, {} as Dictionary);\n }\n }\n current = get(current as Dictionary, key);\n }\n return current;\n}\n","import {\n Dictionary,\n DictionaryEntry,\n TranslatedChildren,\n} from '../types-dir/types';\nimport { get, set } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\nconst DANGEROUS_KEYS = ['constructor', 'prototype', '__proto__'];\nfunction isDangerousKey(key: string): boolean {\n if (DANGEROUS_KEYS.includes(key)) {\n return true;\n }\n return false;\n}\n\n/**\n * @description Injects an entry into a translations object\n * @param translations - The translations object to inject the entry into\n * @param entry - The entry to inject\n * @param hash - The hash of the entry\n * @param sourceDictionary - The source dictionary to model the new dictionary after\n */\nexport function injectEntry(\n dictionaryEntry: DictionaryEntry,\n dictionary: Dictionary | DictionaryEntry,\n id: string,\n sourceDictionary: Dictionary | DictionaryEntry\n) {\n // If the dictionary is a DictionaryEntry, return it\n if (isDictionaryEntry(dictionary)) {\n return dictionaryEntry;\n }\n\n // Iterate over all but last key\n const keys = id.split('.');\n keys.forEach((key) => {\n if (isDangerousKey(key)) {\n throw new Error(`Invalid key: ${key}`);\n }\n });\n dictionary ||= {};\n for (const key of keys.slice(0, -1)) {\n // Create new value if it doesn't exist\n if (get(dictionary, key) == null) {\n set(\n dictionary,\n key,\n Array.isArray(get(sourceDictionary as Dictionary, key))\n ? []\n : ({} as Dictionary)\n );\n }\n // Iterate\n dictionary = get(dictionary, key) as Dictionary;\n sourceDictionary = get(sourceDictionary as Dictionary, key) as Dictionary;\n }\n // Inject the entry into the last key\n const lastKey = keys[keys.length - 1];\n set(dictionary, lastKey, dictionaryEntry);\n}\n\n/**\n * @description Merge results into a dictionary\n * @param dictionary - The dictionary to merge the results into\n * @param results - The results to merge into the dictionary\n * @param sourceDictionary - The source dictionary to model the new dictionary after\n * @returns The merged dictionary\n */\nexport function mergeResultsIntoDictionary(\n dictionary: Dictionary,\n results: [string, TranslatedChildren][],\n sourceDictionary: Dictionary\n): Dictionary {\n results.forEach(([id, result]) => {\n injectEntry(result as string, dictionary, id, sourceDictionary);\n });\n return dictionary;\n}\n","import { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport { set } from './indexDict';\n\n/**\n * @description Iterate over tree and remove metadata leaving just the entry\n */\nexport function stripMetadataFromEntries(dictionary: Dictionary): Dictionary {\n let result: Dictionary = {};\n if (Array.isArray(dictionary)) {\n result = [];\n }\n Object.entries(dictionary).forEach(([key, value]) => {\n if (isDictionaryEntry(value)) {\n const { entry } = getEntryAndMetadata(value);\n set(result, key, entry);\n } else {\n set(result, key, stripMetadataFromEntries(value));\n }\n });\n return result;\n}\n","import { n as stableStringify, t as isVariable } from \"./isVariable-fAKEB7gF.mjs\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, utf8ToBytes } from \"@noble/hashes/utils.js\";\n//#region src/id/hashSource.ts\n/**\n* Calculates a unique hash for a given string using SHA-256.\n*\n* First 16 characters of hash, hex encoded.\n*\n* @param {string} string - The string to be hashed.\n* @returns {string} The resulting hash as a hexadecimal string.\n*/\nfunction hashString(string) {\n\treturn bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n/**\n* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n*\n* @param {any} childrenAsObjects - The children objects to be hashed.\n* @param {string} [context] - The context for the children.\n* @param {string} [id] - The ID for the JSX children object.\n* @param {number} [maxChars] - The maxChars limit for the JSX children object.\n* @param {string} [dataFormat] - The data format of the sources.\n* @param {function} [hashFunction] - Custom hash function.\n* @returns {string} - The unique hash of the children.\n*/\nfunction hashSource({ source, context, id, maxChars, dataFormat }, hashFunction = hashString) {\n\tlet sanitizedSource;\n\tif (dataFormat === \"JSX\") sanitizedSource = sanitizeJsxChildren(source);\n\telse sanitizedSource = source;\n\treturn hashFunction(stableStringify({\n\t\tsource: sanitizedSource,\n\t\t...id && { id },\n\t\t...context && { context },\n\t\t...maxChars != null && { maxChars: Math.abs(maxChars) },\n\t\t...dataFormat && { dataFormat }\n\t}));\n}\n/**\n* Sanitizes a child object by removing the data-_gt attribute and its branches.\n*\n* @param child - The child object to sanitize.\n* @returns The sanitized child object.\n*\n*/\nconst sanitizeChild = (child) => {\n\tif (child && typeof child === \"object\") {\n\t\tconst newChild = {};\n\t\tif (\"c\" in child && child.c) newChild.c = sanitizeJsxChildren(child.c);\n\t\tif (\"d\" in child) {\n\t\t\tconst generaltranslation = child?.d;\n\t\t\tif (generaltranslation?.b) newChild.b = Object.fromEntries(Object.entries(generaltranslation.b).map(([key, value]) => [key, sanitizeJsxChildren(value)]));\n\t\t\tif (generaltranslation?.t) newChild.t = generaltranslation.t;\n\t\t}\n\t\tif (isVariable(child)) return {\n\t\t\tk: child.k,\n\t\t\t...child.v && { v: child.v }\n\t\t};\n\t\treturn newChild;\n\t}\n\treturn child;\n};\nfunction sanitizeJsxChildren(childrenAsObjects) {\n\treturn Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);\n}\n//#endregion\n//#region src/id/hashTemplate.ts\nfunction hashTemplate(template, hashFunction = hashString) {\n\treturn hashFunction(stableStringify(template));\n}\n//#endregion\nexport { hashSource as n, hashString as r, hashTemplate as t };\n\n//# sourceMappingURL=id-DEaFhGqX.mjs.map","import { hashSource } from 'generaltranslation/id';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { set } from './indexDict';\nimport { indexVars } from 'generaltranslation/internal';\n\n/**\n * @description Given a dictionary, adds hashes to all dictionary entries\n * @param dictionary - The dictionary to add hashes to\n * @param id - The starting point of dictionary (if subtree)\n */\nexport function injectHashes(\n dictionary: Dictionary,\n id: string = ''\n): { dictionary: Dictionary; updateDictionary: boolean } {\n let updateDictionary = false;\n Object.entries(dictionary).forEach(([key, value]) => {\n const wholeId = id ? `${id}.${key}` : key;\n if (isDictionaryEntry(value)) {\n // eslint-disable-next-line prefer-const\n let { entry, metadata } = getEntryAndMetadata(value);\n if (!metadata?.$_hash) {\n metadata ||= {};\n metadata.$_hash = hashSource({\n source: indexVars(entry),\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: Math.abs(metadata.$maxChars),\n }),\n id: wholeId,\n dataFormat: 'ICU',\n });\n set(dictionary, key, [entry, metadata]);\n updateDictionary = true;\n }\n } else {\n const { updateDictionary: updateFlag } = injectHashes(value, wholeId);\n updateDictionary = updateDictionary || updateFlag;\n }\n });\n return { dictionary, updateDictionary };\n}\n","import { Dictionary, Translations } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { injectEntry } from './injectEntry';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Injects translations into a dictionary\n * @param dictionary - The dictionary to inject translations into\n * @param translationsDictionary - The translations to inject into the dictionary\n * @param translations - The translations to inject into the dictionary\n * @param id - The id of the dictionary to inject translations into\n */\nexport function injectTranslations(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n translations: Translations,\n missingTranslations: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[],\n prefixToRemove: string = ''\n): { dictionary: Dictionary; updateDictionary: boolean } {\n let updateDictionary = false;\n const prefixToRemoveArray = prefixToRemove ? prefixToRemove.split('.') : [];\n missingTranslations.forEach(({ metadata }) => {\n const { $_hash, $id } = metadata;\n\n const id =\n prefixToRemoveArray.length > 0\n ? $id.split('.').slice(prefixToRemoveArray.length).join('.')\n : $id;\n\n // Look up in translations object\n const translationEntry = getDictionaryEntry(translationsDictionary, id);\n // Look up in translations dictionary\n let dictTransEntry = undefined;\n if (isDictionaryEntry(translationEntry))\n dictTransEntry = getEntryAndMetadata(translationEntry).entry;\n // Fall back to what was already in the translations dictionary\n const value = translations[$_hash] || dictTransEntry;\n if (!value) {\n return;\n }\n\n injectEntry(value as string, translationsDictionary, id, dictionary);\n updateDictionary = true;\n });\n return {\n dictionary: translationsDictionary as Dictionary,\n updateDictionary,\n };\n}\n","import { Dictionary } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { injectEntry } from './injectEntry';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Injects fallbacks into a dictionary\n * @param dictionary - The dictionary to inject translations into\n * @param translationsDictionary - The translations to inject into the dictionary\n * @param translations - The translations to inject into the dictionary\n * @param id - The id of the dictionary to inject translations into\n */\nexport function injectFallbacks(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n missingTranslations: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[],\n prefixToRemove: string = ''\n) {\n const prefixToRemoveArray = prefixToRemove ? prefixToRemove.split('.') : [];\n missingTranslations.forEach(({ source, metadata }) => {\n const { $id } = metadata;\n\n const id =\n prefixToRemoveArray.length > 0\n ? $id.split('.').slice(prefixToRemoveArray.length).join('.')\n : $id;\n\n // Look up in translations object\n const translationEntry = getDictionaryEntry(translationsDictionary, id);\n // Look up in translations dictionary\n let dictTransEntry = undefined;\n if (isDictionaryEntry(translationEntry))\n dictTransEntry = getEntryAndMetadata(translationEntry).entry;\n // Fall back to source\n const value = dictTransEntry || source;\n\n injectEntry(value as string, translationsDictionary, id, dictionary);\n });\n return translationsDictionary;\n}\n","import { Dictionary, DictionaryEntry } from '../types-dir/types';\nimport { getDictionaryEntry } from './getDictionaryEntry';\nimport { getSubtree } from './getSubtree';\nimport { get, set } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\nimport mergeDictionaries from './mergeDictionaries';\nimport {\n createDictionaryEntryError,\n createCannotInjectDictionaryEntryError,\n createSubtreeNotFoundError,\n} from '../errors-dir/createErrors';\n\n/**\n * @description Given a subtree and a dictionary, injects the subtree into the dictionary at the given id\n * @param dictionary - The dictionary to inject the subtree into\n * @param subtree - The subtree to inject into the dictionary\n * @param id - The id of the subtree to inject into the dictionary\n */\nexport function injectAndMerge(\n dictionary: Dictionary,\n subtree: Dictionary,\n id: string\n) {\n const dictionarySubtree = getSubtree({ dictionary, id });\n if (!dictionarySubtree) {\n throw new Error(createSubtreeNotFoundError(id));\n }\n if (isDictionaryEntry(dictionarySubtree)) {\n throw new Error(createDictionaryEntryError());\n }\n const mergedSubtree = mergeDictionaries(\n dictionarySubtree as Dictionary,\n subtree\n );\n // Inject the merged subtree into the dictionary\n return injectSubtree(dictionary, mergedSubtree, id);\n}\n\nfunction injectSubtree(\n dictionary: Dictionary,\n subtree: Dictionary,\n id: string\n) {\n const dictionarySubtree = getDictionaryEntry(dictionary, id);\n if (!dictionarySubtree) {\n throw new Error(createSubtreeNotFoundError(id));\n }\n if (isDictionaryEntry(dictionarySubtree)) {\n throw new Error(createCannotInjectDictionaryEntryError());\n }\n const ids = id.split('.');\n const shortenedId = ids.slice(0, -1);\n const lastId = ids[ids.length - 1];\n let current: Dictionary | DictionaryEntry = dictionary;\n shortenedId.forEach((id) => {\n current = get(current as Dictionary, id);\n });\n set(current as Dictionary, lastId, subtree);\n return dictionary;\n}\n","import { Dictionary } from '../types-dir/types';\nimport getEntryAndMetadata from './getEntryAndMetadata';\nimport { get } from './indexDict';\nimport { isDictionaryEntry } from './isDictionaryEntry';\n\n/**\n * @description Collects all untranslated entries from a dictionary\n * @param dictionary - The dictionary to collect untranslated entries from\n * @param translationsDictionary - The translated dictionary to compare against\n * @param id - The id of the dictionary to collect untranslated entries from\n * @returns An array of untranslated entries\n */\nexport function collectUntranslatedEntries(\n dictionary: Dictionary,\n translationsDictionary: Dictionary,\n id: string = ''\n): {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n}[] {\n const untranslatedEntries: {\n source: string;\n metadata: {\n $id: string;\n $context?: string;\n $maxChars?: number;\n $_hash: string;\n };\n }[] = [];\n Object.entries(dictionary).forEach(([key, value]) => {\n const wholeId = id ? `${id}.${key}` : key;\n if (isDictionaryEntry(value)) {\n const { entry, metadata } = getEntryAndMetadata(value);\n\n if (!get(translationsDictionary, key)) {\n untranslatedEntries.push({\n source: entry,\n metadata: {\n $id: wholeId,\n $context: metadata?.$context,\n $maxChars: metadata?.$maxChars,\n $_hash: metadata?.$_hash || '',\n },\n });\n }\n } else {\n untranslatedEntries.push(\n ...collectUntranslatedEntries(\n value,\n (get(translationsDictionary, key) ||\n (Array.isArray(value) ? [] : {})) as Dictionary,\n wholeId\n )\n );\n }\n });\n return untranslatedEntries;\n}\n","import { VAR_IDENTIFIER, condenseVars, decode, extractVars } from \"generaltranslation/internal\";\nimport { formatCutoff, formatMessage } from \"@generaltranslation/format\";\n//#region src/logs/logger.ts\nvar logger_default = {\n\twarn(message) {\n\t\tconsole.warn(message);\n\t},\n\terror(message) {\n\t\tconsole.error(message);\n\t},\n\tinfo(message) {\n\t\tconsole.info(message);\n\t},\n\tdebug(message) {\n\t\tconsole.debug(message);\n\t}\n};\n//#endregion\n//#region src/utils/extractVariables.ts\n/**\n* Given an object of options, returns an object with no gt-related options\n*\n* TODO: next major version, this should extract any sugar syntax options\n* TODO: next major version, options should be Record<string, string>\n*/\nfunction extractVariables(options) {\n\treturn Object.fromEntries(Object.entries(options).filter(([key]) => key !== \"$id\" && key !== \"$context\" && key !== \"$maxChars\" && key !== \"$hash\" && key !== \"$_hash\" && key !== \"$_source\" && key !== \"$_fallback\" && key !== \"$format\" && key !== \"$_locales\" && key !== \"$locale\"));\n}\n//#endregion\n//#region src/translation-functions/utils/messages.ts\nconst createInterpolationFailureMessage = (message) => `String interpolation failed for message: \"${message}\".`;\n//#endregion\n//#region src/translation-functions/utils/formatMessage.ts\n/**\n* Given an encoded message and variables, formats the message.\n* On error, the original encoded message is returned with a warning.\n* @param encodedMsg\n* @param variables\n* @returns\n*/\nfunction formatMessage$1(encodedMsg, variables, locales, dataFormat) {\n\ttry {\n\t\treturn formatMessage(encodedMsg, {\n\t\t\tvariables,\n\t\t\tlocales,\n\t\t\tdataFormat\n\t\t});\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(encodedMsg));\n\t\treturn encodedMsg;\n\t}\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateIcuMessage.ts\n/**\n* Applies string interpolation and cutoff formatting. Fallsback to the original message if interpolation fails.\n* @param {string} message - The message to interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns {string} - The interpolated message.\n*/\nfunction interpolateIcuMessage(encodedMsg, options) {\n\tif (!encodedMsg) return encodedMsg;\n\tconst source = options.$_fallback;\n\tconst variables = extractVariables(options);\n\ttry {\n\t\tconst declaredVars = extractVars(source || \"\");\n\t\treturn formatCutoff(formatMessage$1(Object.keys(declaredVars).length ? condenseVars(encodedMsg) : encodedMsg, {\n\t\t\t...variables,\n\t\t\t...declaredVars,\n\t\t\t[VAR_IDENTIFIER]: \"other\"\n\t\t}, options.$locale ?? options.$_locales, options.$format), { maxChars: options.$maxChars });\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(encodedMsg));\n\t\tif (options.$_fallback != null) return interpolateIcuMessage(options.$_fallback, {\n\t\t\t...options,\n\t\t\t$_fallback: void 0\n\t\t});\n\t\treturn formatCutoff(encodedMsg, { maxChars: options.$maxChars });\n\t}\n}\n//#endregion\n//#region src/translation-functions/msg/decodeOptions.ts\n/**\n* Decodes the options from an encoded message.\n* @param encodedMsg The message to decode.\n* @returns The decoded options.\n*/\nfunction decodeOptions(encodedMsg) {\n\tif (encodedMsg.lastIndexOf(\":\") === -1) return null;\n\tconst optionsEncoding = encodedMsg.slice(encodedMsg.lastIndexOf(\":\") + 1);\n\ttry {\n\t\treturn JSON.parse(decode(optionsEncoding));\n\t} catch {\n\t\treturn null;\n\t}\n}\n//#endregion\n//#region src/translation-functions/utils/isEncodedTranslationOptions.ts\n/**\n* Given a decoded options object, validate that includes required decoded options\n* These required options are added by msg() during the encoding process.\n*/\nfunction isEncodedTranslationOptions(decodedOptions) {\n\treturn !!(decodedOptions.$_hash && decodedOptions.$_source);\n}\n//#endregion\nexport { extractVariables as a, createInterpolationFailureMessage as i, decodeOptions as n, logger_default as o, interpolateIcuMessage as r, isEncodedTranslationOptions as t };\n\n//# sourceMappingURL=isEncodedTranslationOptions-BOwWa_-J.mjs.map","import { o as logger_default, r as interpolateIcuMessage } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\nimport { createDiagnosticMessage, defaultCacheUrl, defaultRuntimeApiUrl, indexVars, libraryDefaultLocale } from \"generaltranslation/internal\";\nimport { LocaleConfig, formatCutoff, isValidLocale, resolveCanonicalLocale, standardizeLocale } from \"@generaltranslation/format\";\nimport { GT } from \"generaltranslation\";\nimport { hashSource } from \"generaltranslation/id\";\n//#region src/i18n-manager/validation/publishValidationResults.ts\n/**\n* Throw errors if there are any errors and log warnings if there are any warnings\n* @param {ValidationResult[]} results - The results to print\n* @param {string} [prefix] - The prefix to add to the results\n* @param {boolean} [throwOnError] - Whether to throw an error if there are any errors\n*\n* TODO: dedupe messages\n* TODO: logging system\n*/\nfunction publishValidationResults(results, prefix = \"\", throwOnError = true) {\n\tresults.forEach((result) => {\n\t\tswitch (result.type) {\n\t\t\tcase \"error\":\n\t\t\t\tlogger_default.error(prefix + result.message);\n\t\t\t\tbreak;\n\t\t\tcase \"warning\":\n\t\t\t\tlogger_default.warn(prefix + result.message);\n\t\t\t\tbreak;\n\t\t}\n\t});\n\tif (throwOnError && results.some((result) => result.type === \"error\")) throw new Error(\"Validation errors occurred\");\n}\n//#endregion\n//#region src/i18n-manager/utils/getLoadTranslationsType.ts\n/**\n* Based on the configurtion return the load translations type\n*\n* cacheUrl = null means disabled\n*/\nfunction getLoadTranslationsType(config) {\n\tif (config.loadTranslations) return \"custom\";\n\telse if (config.cacheUrl) return \"remote\";\n\telse if ((config.cacheUrl === void 0 || config.cacheUrl === defaultCacheUrl) && config.projectId) return \"gt-remote\";\n\telse return \"disabled\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateLoadTranslations.ts\n/**\n* Load translation configuration\n*\n* Types of load translations:\n* - GT_REMOTE: use the default remote store URL {@link defaultCacheUrl}\n* - REMOTE: use a custom remote store URL\n* - CUSTOM: use a custom translations loader\n* - DISABLED: no translations loading\n*\n* Requirements:\n* - REMOTE:\n* - GT_REMOTE:\n* - projectId is needed\n* - CUSTOM:\n* - loadTranslations is needed\n* - DISABLED:\n* - no requirements\n*/\nfunction validateLoadTranslations(params) {\n\tconst results = [];\n\tconst { projectId, loadTranslations } = params;\n\tswitch (getLoadTranslationsType(params)) {\n\t\tcase \"remote\":\n\t\tcase \"gt-remote\":\n\t\t\tif (!projectId) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Loading translations from a remote store needs a projectId\",\n\t\t\t\t\tfix: \"Add projectId to the I18nManager config or disable remote translation loading\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tif (!loadTranslations) results.push({\n\t\t\t\ttype: \"error\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Custom translation loading needs loadTranslations\",\n\t\t\t\t\tfix: \"Provide a loadTranslations function or disable custom translation loading\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"disabled\": break;\n\t}\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/utils/getTranslationApiType.ts\n/**\n* Based on the configurtion return the runtime translation type\n* @param params - The parameters to validate\n* @returns The runtime translation type\n*/\nfunction getTranslationApiType(params) {\n\tconst usesDefaultRuntimeUrl = params.runtimeUrl === void 0 || params.runtimeUrl === defaultRuntimeApiUrl;\n\tif (usesDefaultRuntimeUrl && params.projectId && (params.devApiKey || params.apiKey)) return \"gt\";\n\telse if (params.runtimeUrl && !usesDefaultRuntimeUrl) return \"custom\";\n\telse return \"disabled\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateTranslationApi.ts\n/**\n* Validate the translation API configuration\n* @param params - The parameters to validate\n* @returns The validation results\n*\n* Types of translation API:\n* - GT: use the default runtime API URL {@link defaultRuntimeApiUrl}\n* - CUSTOM: use a custom runtime API URL\n* - DISABLED: no runtime API translation\n*\n* Requirements:\n* - CUSTOM:\n* - GT:\n* - projectId is needed\n* - devApiKey or apiKey is needed\n* - DISABLED:\n* - no requirements\n*\n* TODO: reject dev api key in production\n*/\nfunction validateTranslationApi(params) {\n\tconst results = [];\n\tswitch (getTranslationApiType(params)) {\n\t\tcase \"custom\":\n\t\tcase \"gt\":\n\t\t\tif (!params.projectId) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Runtime translation needs a projectId\",\n\t\t\t\t\tfix: \"Add projectId to the I18nManager config or disable runtime translation\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tif (!params.devApiKey && !params.apiKey) results.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\t\twhatHappened: \"Runtime translation needs devApiKey or apiKey\",\n\t\t\t\t\tfix: \"Add credentials to the I18nManager config or disable runtime translation\"\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"disabled\": break;\n\t}\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/utils/getGTServicesEnabled.ts\n/**\n* Returns true if GT services are enabled\n* @param config - The configuration\n* @returns True if GT services are enabled\n*/\nfunction getGTServicesEnabled(config) {\n\treturn getLoadTranslationsType(config) === \"gt-remote\" || getTranslationApiType(config) === \"gt\";\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateLocales.ts\n/**\n* Validate the locales configuration\n* @param params - The parameters to validate\n* @returns The validation results\n*\n* Only apply if using GT services\n*/\nfunction validateLocales(params) {\n\tconst results = [];\n\tif (!getGTServicesEnabled(params)) return results;\n\tconst { defaultLocale, locales, customMapping } = params;\n\tnew Set([...defaultLocale ? [defaultLocale] : [], ...locales || []]).forEach((locale) => {\n\t\tif (!isValidLocale(locale, customMapping)) results.push({\n\t\t\ttype: \"error\",\n\t\t\tmessage: createDiagnosticMessage({\n\t\t\t\twhatHappened: `Locale \"${locale}\" is not valid`,\n\t\t\t\tfix: \"Use a valid BCP 47 locale code or add a custom mapping\"\n\t\t\t})\n\t\t});\n\t});\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/validation/config-validation/validateDictionary.ts\n/**\n* Dictionary configuration\n*\n* Requirements:\n* - loadDictionary requires dictionary so the default locale always has a source dictionary\n*/\nfunction validateDictionary(params) {\n\tconst results = [];\n\tif (params.loadDictionary && !params.dictionary) results.push({\n\t\ttype: \"error\",\n\t\tmessage: createDiagnosticMessage({\n\t\t\twhatHappened: \"loadDictionary needs a source dictionary\",\n\t\t\tfix: \"Provide dictionary so the default locale has source content\"\n\t\t})\n\t});\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/validation/validateConfig.ts\n/**\n* Validate the configuration\n* @param config - The configuration to validate\n* @returns The validation results\n*/\nfunction validateConfig(config) {\n\tconst results = [];\n\tresults.push(...validateLoadTranslations(config));\n\tresults.push(...validateTranslationApi(config));\n\tresults.push(...validateLocales(config));\n\tresults.push(...validateDictionary(config));\n\treturn results;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/createTranslateMany.ts\n/**\n* Create a translate many function\n* @param locale - The locale\n* @returns The translate many function\n*/\nfunction createTranslateManyFactory(gtInstance, timeout, metadata = {}) {\n\treturn (locale) => (sources) => gtInstance.translateMany(sources, {\n\t\t...metadata,\n\t\ttargetLocale: locale\n\t}, timeout);\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/createRemoteTranslationLoader.ts\n/**\n* Creates a translations loader function that loads translations from a remote store (CDN or other)\n* @param params - The parameters for the createRemoteTranslationLoader function\n* @returns A translations loader function\n*\n* TODO: validate projectId, cacheUrl, _versionId, _branchId\n*/\nfunction createRemoteTranslationLoader(params) {\n\tconst unlocalizedUrl = generateUrl(params);\n\tconst loader = async (locale) => {\n\t\tlocale = resolveCanonicalLocale(locale, params.customMapping);\n\t\tconst url = unlocalizedUrl.replace(\"[locale]\", locale);\n\t\tconst response = await fetch(url);\n\t\tif (!response.ok) throw new Error(`Failed to load translations from ${url}`);\n\t\treturn await response.json();\n\t};\n\treturn loader;\n}\n/**\n* Generate a URL for a translations file\n*/\nfunction generateUrl(params) {\n\tconst { cacheUrl = defaultCacheUrl, projectId, _versionId, _branchId } = params;\n\tconst versionIdSegment = _versionId ? `/${_versionId}` : \"\";\n\tconst branchIdQuery = _branchId ? `?branchId=${_branchId}` : \"\";\n\treturn `${cacheUrl}/${projectId}/[locale]` + versionIdSegment + branchIdQuery;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/createFallbackTranslationLoader.ts\n/**\n* Creates a fallback translations loader function that loads translations from a fallback source\n* @returns A translations loader function\n*/\nfunction createFallbackTranslationLoader() {\n\tconst loader = async (_locale) => {\n\t\treturn {};\n\t};\n\treturn loader;\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/translations-loaders/routeCreateTranslationLoader.ts\n/**\n* Creates a translation loader function that loads translations from a remote store (CDN or other)\n* @param params - The parameters for the createTranslationLoader function\n* @param params.type - The type of translation loader to create\n* @param params.remoteTranslationLoaderParams - The parameters for the remote translation loader\n* @param params.loadTranslations - The custom translations loader function\n* @returns A translation loader function\n*/\nfunction routeCreateTranslationLoader({ type, remoteTranslationLoaderParams, loadTranslations }) {\n\tif (type === \"disabled\") logger_default.warn(\"I18nManager: No translation loader found. No translations will be loaded.\");\n\tconst { cacheUrl, projectId, _versionId, _branchId, customMapping } = remoteTranslationLoaderParams;\n\tswitch (type) {\n\t\tcase \"remote\":\n\t\tcase \"gt-remote\": return createRemoteTranslationLoader({\n\t\t\tcacheUrl,\n\t\t\tprojectId: projectId || \"\",\n\t\t\t_versionId,\n\t\t\t_branchId,\n\t\t\tcustomMapping\n\t\t});\n\t\tcase \"custom\": return loadTranslations;\n\t\tcase \"disabled\": return createFallbackTranslationLoader();\n\t}\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/dictionary-helpers.ts\nfunction getDictionaryPath(id) {\n\tconst path = id ? id.split(\".\") : [];\n\tfor (const segment of path) assertSafeDictionaryPathSegment(segment, id);\n\treturn path;\n}\nfunction assertSafeDictionaryPathSegment(segment, path) {\n\tif (segment === \"__proto__\" || segment === \"constructor\" || segment === \"prototype\") throw new Error(`Dictionary path \"${path}\" contains an unsafe segment`);\n}\nfunction isDictionaryObject(value) {\n\treturn typeof value === \"object\" && value != null && !Array.isArray(value);\n}\nfunction cloneDictionaryValue(value) {\n\tif (value === void 0 || typeof value === \"string\") return value;\n\treturn structuredClone(value);\n}\nfunction getDictionaryValueAtPath(dictionary, path) {\n\tlet current = dictionary;\n\tfor (const segment of getDictionaryPath(path)) {\n\t\tif (!isDictionaryObject(current)) return;\n\t\tcurrent = current[segment];\n\t}\n\treturn current;\n}\nfunction setDictionaryValueAtPath(dictionary, path, value) {\n\tconst segments = getDictionaryPath(path);\n\tif (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);\n\tif (segments.length === 0) {\n\t\tif (isDictionaryObject(value)) replaceDictionary(dictionary, value);\n\t\treturn;\n\t}\n\tlet current = dictionary;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst next = current[segment];\n\t\tif (!isDictionaryObject(next)) current[segment] = {};\n\t\tcurrent = current[segment];\n\t}\n\tconst leafSegment = segments[segments.length - 1];\n\tcurrent[leafSegment] = value;\n}\nfunction getDictionaryEntry(value) {\n\tif (!isDictionaryLeafNode(value)) return;\n\treturn {\n\t\tentry: Array.isArray(value) ? value[0] : value,\n\t\toptions: Array.isArray(value) ? value[1] ?? {} : {}\n\t};\n}\nfunction getDictionaryValue(value) {\n\tif (Object.keys(value.options).length === 0) return value.entry;\n\treturn [value.entry, value.options];\n}\nfunction resolveDictionaryLookupOptions(options) {\n\tconst { $format, context, ...rest } = options;\n\treturn {\n\t\t...rest,\n\t\t$format: isStringFormat($format) ? $format : \"ICU\",\n\t\t...rest.$context === void 0 && typeof context === \"string\" && { $context: context }\n\t};\n}\nfunction isDictionaryLeafNode(value) {\n\tif (typeof value === \"string\") return true;\n\tif (!Array.isArray(value) || typeof value[0] !== \"string\") return false;\n\tif (value.length === 1) return true;\n\treturn value.length === 2 && isDictionaryOptions(value[1]);\n}\nfunction isDictionaryOptions(value) {\n\tif (typeof value !== \"object\" || value == null || Array.isArray(value)) return false;\n\tconst options = value;\n\treturn (options.$context === void 0 || typeof options.$context === \"string\") && (options.$format === void 0 || isStringFormat(options.$format)) && (options.$maxChars === void 0 || typeof options.$maxChars === \"number\") && (options.context === void 0 || typeof options.context === \"string\");\n}\nfunction isStringFormat(value) {\n\treturn value === \"ICU\" || value === \"I18NEXT\" || value === \"STRING\";\n}\nfunction replaceDictionary(target, source) {\n\tfor (const key of Object.keys(target)) delete target[key];\n\tfor (const key of Object.keys(source)) target[key] = source[key];\n}\nfunction assertSafeDictionaryObject(dictionary, parentPath = \"\") {\n\tfor (const [key, value] of Object.entries(dictionary)) {\n\t\tconst path = parentPath ? `${parentPath}.${key}` : key;\n\t\tassertSafeDictionaryPathSegment(key, path);\n\t\tif (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);\n\t}\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/DictionarySourceNotFoundError.ts\nvar DictionarySourceNotFoundError = class extends Error {\n\tconstructor(id) {\n\t\tsuper(`I18nManager: source dictionary entry ${id} is not defined`);\n\t\tthis.name = \"DictionarySourceNotFoundError\";\n\t}\n};\n//#endregion\n//#region src/i18n-manager/translations-manager/utils/materialize-dictionary.ts\n/**\n* Builds the dictionary value for a requested path by combining existing target\n* translations with runtime translations of any source leaves that are missing.\n*/\nasync function materializeDictionaryValue({ key, sourceValue, targetValue, translateEntry }) {\n\tif (getDictionaryEntry(targetValue) !== void 0) return cloneDictionaryValue(targetValue);\n\tif (isDictionaryObject(targetValue) && !isDictionaryObject(sourceValue)) return cloneDictionaryValue(targetValue);\n\tconst sourceEntry = getDictionaryEntry(sourceValue);\n\tif (sourceEntry !== void 0) return await translateEntry(key, sourceEntry);\n\tif (!isDictionaryObject(sourceValue)) throw new DictionarySourceNotFoundError(key);\n\tconst targetDictionary = isDictionaryObject(targetValue) ? targetValue : {};\n\tconst keys = new Set([...Object.keys(sourceValue), ...Object.keys(targetDictionary)]);\n\tconst entries = await Promise.all(Array.from(keys).map(async (childKey) => {\n\t\tconst childPath = key ? `${key}.${childKey}` : childKey;\n\t\tassertSafeDictionaryPathSegment(childKey, childPath);\n\t\tconst childSource = sourceValue[childKey];\n\t\tif (childSource === void 0) return [childKey, cloneDictionaryValue(targetDictionary[childKey])];\n\t\treturn [childKey, await materializeDictionaryValue({\n\t\t\tkey: childPath,\n\t\t\tsourceValue: childSource,\n\t\t\ttargetValue: targetDictionary[childKey],\n\t\t\ttranslateEntry\n\t\t})];\n\t}));\n\treturn Object.fromEntries(entries);\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/DictionaryCache.ts\nfunction cloneDictionaryEntry(entry) {\n\treturn {\n\t\tentry: entry.entry,\n\t\toptions: structuredClone(entry.options)\n\t};\n}\nvar DictionaryCache = class {\n\tconstructor({ init, lifecycle = {}, runtimeTranslate }) {\n\t\tthis.pendingTranslations = /* @__PURE__ */ new Map();\n\t\tthis.pendingMaterializations = /* @__PURE__ */ new Map();\n\t\tthis.cache = structuredClone(init);\n\t\tthis.runtimeTranslate = runtimeTranslate;\n\t\tthis.lifecycle = lifecycle;\n\t}\n\tgetEntry(key) {\n\t\tconst value = getDictionaryValueAtPath(this.cache, key);\n\t\tconst entry = getDictionaryEntry(value);\n\t\tif (entry === void 0) return;\n\t\tconst outputEntry = cloneDictionaryEntry(entry);\n\t\tthis.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: value,\n\t\t\toutputValue: outputEntry\n\t\t});\n\t\treturn outputEntry;\n\t}\n\tgetValue(key) {\n\t\tconst value = getDictionaryValueAtPath(this.cache, key);\n\t\tif (value === void 0) return;\n\t\tconst outputValue = cloneDictionaryValue(value);\n\t\tthis.lifecycle.onDictionaryObjectCacheHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: value,\n\t\t\toutputValue\n\t\t});\n\t\treturn outputValue;\n\t}\n\tsetValue(key, value) {\n\t\tsetDictionaryValueAtPath(this.cache, key, cloneDictionaryValue(value));\n\t}\n\tgetInternalCache() {\n\t\treturn cloneDictionaryValue(this.cache);\n\t}\n\tasync materializeValue(key, sourceValue, targetValue = getDictionaryValueAtPath(this.cache, key)) {\n\t\tlet materializationPromise = this.pendingMaterializations.get(key);\n\t\tif (!materializationPromise) {\n\t\t\tmaterializationPromise = materializeDictionaryValue({\n\t\t\t\tkey,\n\t\t\t\tsourceValue,\n\t\t\t\ttargetValue,\n\t\t\t\ttranslateEntry: async (entryKey, sourceEntry) => getDictionaryValue(await this.materializeEntry(entryKey, sourceEntry))\n\t\t\t}).then((value) => {\n\t\t\t\tthis.setValue(key, value);\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tthis.pendingMaterializations.set(key, materializationPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn await materializationPromise;\n\t\t} finally {\n\t\t\tthis.pendingMaterializations.delete(key);\n\t\t}\n\t}\n\tasync materializeEntry(key, sourceEntry) {\n\t\tlet translationPromise = this.pendingTranslations.get(key);\n\t\tif (!translationPromise) {\n\t\t\ttranslationPromise = this.runtimeTranslate(key, sourceEntry).then((value) => {\n\t\t\t\tsetDictionaryValueAtPath(this.cache, key, value);\n\t\t\t\tconst entry = getDictionaryEntry(value);\n\t\t\t\tif (entry === void 0) throw new Error(\"DictionaryCache materializeEntry did not return a DictionaryEntry\");\n\t\t\t\tthis.lifecycle.onMiss?.({\n\t\t\t\t\tinputKey: key,\n\t\t\t\t\tcacheKey: key,\n\t\t\t\t\tcacheValue: value,\n\t\t\t\t\toutputValue: cloneDictionaryEntry(entry)\n\t\t\t\t});\n\t\t\t\treturn cloneDictionaryEntry(entry);\n\t\t\t});\n\t\t\tthis.pendingTranslations.set(key, translationPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn cloneDictionaryEntry(await translationPromise);\n\t\t} finally {\n\t\t\tthis.pendingTranslations.delete(key);\n\t\t}\n\t}\n};\n//#endregion\n//#region src/i18n-manager/translations-manager/ResourceCache.ts\nvar ResourceCache = class {\n\tconstructor({ load, lifecycle = {}, ttl }) {\n\t\tthis.cache = /* @__PURE__ */ new Map();\n\t\tthis.pendingLoads = /* @__PURE__ */ new Map();\n\t\tthis.loadResource = load;\n\t\tthis.lifecycle = lifecycle;\n\t\tthis.ttl = ttl === null ? -1 : ttl ?? 6e4;\n\t}\n\tget(key) {\n\t\tconst entry = this.cache.get(key);\n\t\tif (!entry || this.isExpired(entry)) return;\n\t\tthis.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey: key,\n\t\t\tcacheValue: entry,\n\t\t\toutputValue: entry.value\n\t\t});\n\t\treturn entry.value;\n\t}\n\tset(key, value, { expiresAt = this.getExpiresAt() } = {}) {\n\t\tthis.cache.set(key, {\n\t\t\texpiresAt,\n\t\t\tvalue\n\t\t});\n\t}\n\tasync getOrLoad(key) {\n\t\treturn this.get(key) ?? await this.load(key);\n\t}\n\tasync load(key) {\n\t\tlet loadPromise = this.pendingLoads.get(key);\n\t\tif (!loadPromise) {\n\t\t\tloadPromise = this.loadResource(key).then((value) => {\n\t\t\t\tconst entry = {\n\t\t\t\t\texpiresAt: this.getExpiresAt(),\n\t\t\t\t\tvalue\n\t\t\t\t};\n\t\t\t\tthis.cache.set(key, entry);\n\t\t\t\tthis.lifecycle.onMiss?.({\n\t\t\t\t\tinputKey: key,\n\t\t\t\t\tcacheKey: key,\n\t\t\t\t\tcacheValue: entry,\n\t\t\t\t\toutputValue: entry.value\n\t\t\t\t});\n\t\t\t\treturn entry;\n\t\t\t});\n\t\t\tthis.pendingLoads.set(key, loadPromise);\n\t\t}\n\t\ttry {\n\t\t\treturn (await loadPromise).value;\n\t\t} finally {\n\t\t\tthis.pendingLoads.delete(key);\n\t\t}\n\t}\n\tgetExpiresAt() {\n\t\treturn this.ttl < 0 ? this.ttl : Date.now() + this.ttl;\n\t}\n\tisExpired(entry) {\n\t\treturn entry.expiresAt > 0 && entry.expiresAt < Date.now();\n\t}\n};\n//#endregion\n//#region src/utils/hashMessage.ts\n/**\n* Hash a message string\n*/\nfunction hashMessage(message, options) {\n\tconst metadataOptions = options;\n\tif (metadataOptions.$_hash != null) return metadataOptions.$_hash;\n\treturn hashSource({\n\t\tsource: options.$format === \"ICU\" ? indexVars(message) : message,\n\t\t...metadataOptions.$context && { context: metadataOptions.$context },\n\t\t...metadataOptions.$id && { id: metadataOptions.$id },\n\t\t...metadataOptions.$maxChars != null && { maxChars: Math.abs(metadataOptions.$maxChars) },\n\t\tdataFormat: options.$format\n\t});\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/TranslationsCache.ts\nconst DEFAULT_BATCH_CONFIG = {\n\tmaxConcurrentRequests: 100,\n\tmaxBatchSize: 25,\n\tbatchInterval: 50\n};\nfunction getPositiveValue(value, defaultValue) {\n\tif (value === void 0 || !Number.isFinite(value) || value <= 0) return defaultValue;\n\treturn value;\n}\nfunction getPositiveInteger(value, defaultValue) {\n\tif (value === void 0 || !Number.isFinite(value)) return defaultValue;\n\tconst integer = Math.trunc(value);\n\treturn integer > 0 ? integer : defaultValue;\n}\nfunction normalizeBatchConfig(batchConfig) {\n\treturn {\n\t\tmaxConcurrentRequests: getPositiveInteger(batchConfig?.maxConcurrentRequests, DEFAULT_BATCH_CONFIG.maxConcurrentRequests),\n\t\tmaxBatchSize: getPositiveInteger(batchConfig?.maxBatchSize, DEFAULT_BATCH_CONFIG.maxBatchSize),\n\t\tbatchInterval: getPositiveValue(batchConfig?.batchInterval, DEFAULT_BATCH_CONFIG.batchInterval)\n\t};\n}\n/**\n* A cache for a single locale's translations\n*\n* Principles:\n* - This class is language agnostic, and should never store the locale code as a parameter.\n* Locale logic is handled at the LocalesCache level. Use a callback function that has the\n* locale parameter embedded if you wish to use the locale code.\n*/\nvar TranslationsCache = class {\n\t/**\n\t* Constructor\n\t* @param {Object} params - The parameters for the cache\n\t* @param {Record<Hash, TranslationValue>} params.init - The initial cache\n\t* @param {Function} params.fallback - Get the fallback value for a cache miss\n\t*/\n\tconstructor({ init, translateMany, lifecycle = {}, batchConfig }) {\n\t\tthis.pendingTranslations = /* @__PURE__ */ new Map();\n\t\tthis.queue = [];\n\t\tthis.batchTimer = null;\n\t\tthis.activeRequests = 0;\n\t\tthis.cache = structuredClone(init);\n\t\tthis.translateMany = translateMany;\n\t\tthis.batchConfig = normalizeBatchConfig(batchConfig);\n\t\tthis.lifecycle = lifecycle;\n\t}\n\t/**\n\t* Get the translation value for a given key\n\t* @param key - The translation key\n\t* @returns The translation value\n\t*/\n\tget(key) {\n\t\tconst cacheKey = this.getCacheKey(key);\n\t\tconst value = this.cache[cacheKey];\n\t\tif (value != null) this.lifecycle.onHit?.({\n\t\t\tinputKey: key,\n\t\t\tcacheKey,\n\t\t\tcacheValue: value,\n\t\t\toutputValue: value\n\t\t});\n\t\treturn value;\n\t}\n\t/**\n\t* Miss the cache\n\t* @param key - The translation key\n\t* @returns The translation value\n\t*/\n\tasync miss(key) {\n\t\tconst cacheKey = this.getCacheKey(key);\n\t\tlet translationPromise = this.pendingTranslations.get(cacheKey);\n\t\tif (!translationPromise) {\n\t\t\ttranslationPromise = this.translate(key);\n\t\t\tthis.pendingTranslations.set(cacheKey, translationPromise);\n\t\t}\n\t\ttry {\n\t\t\tconst value = await translationPromise;\n\t\t\tif (value != null) this.lifecycle.onMiss?.({\n\t\t\t\tinputKey: key,\n\t\t\t\tcacheKey,\n\t\t\t\tcacheValue: value,\n\t\t\t\toutputValue: value\n\t\t\t});\n\t\t\treturn value;\n\t\t} finally {\n\t\t\tthis.pendingTranslations.delete(cacheKey);\n\t\t}\n\t}\n\tgetInternalCache() {\n\t\treturn structuredClone(this.cache);\n\t}\n\tgetCacheKey(key) {\n\t\treturn hashMessage(key.message, key.options);\n\t}\n\ttranslate(key) {\n\t\tconst translationPromise = this.enqueueTranslation(key);\n\t\tif (this.queue.length >= this.batchConfig.maxBatchSize) this.flushNow();\n\t\telse this.scheduleBatch();\n\t\treturn translationPromise;\n\t}\n\tflushNow() {\n\t\tif (this.batchTimer) {\n\t\t\tclearTimeout(this.batchTimer);\n\t\t\tthis.batchTimer = null;\n\t\t}\n\t\tthis.drainQueue();\n\t}\n\tscheduleBatch() {\n\t\tif (this.batchTimer) return;\n\t\tthis.batchTimer = setTimeout(() => {\n\t\t\tthis.batchTimer = null;\n\t\t\tthis.drainQueue();\n\t\t}, this.batchConfig.batchInterval);\n\t}\n\tdrainQueue() {\n\t\twhile (this.queue.length > 0 && this.activeRequests < this.batchConfig.maxConcurrentRequests) {\n\t\t\tconst batch = this.queue.splice(0, this.batchConfig.maxBatchSize);\n\t\t\tthis.sendBatchRequest(batch);\n\t\t}\n\t\tif (this.queue.length > 0) this.scheduleBatch();\n\t}\n\tenqueueTranslation(key) {\n\t\tconst hash = this.getCacheKey(key);\n\t\tconst options = key.options;\n\t\tconst metadataOptions = options;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.queue.push({\n\t\t\t\tkey: hash,\n\t\t\t\tsource: key.message,\n\t\t\t\tmetadata: {\n\t\t\t\t\thash,\n\t\t\t\t\t...metadataOptions.$context && { context: metadataOptions.$context },\n\t\t\t\t\t...metadataOptions.$id && { id: metadataOptions.$id },\n\t\t\t\t\t...metadataOptions.$maxChars != null && { maxChars: Math.abs(metadataOptions.$maxChars) },\n\t\t\t\t\tdataFormat: options.$format\n\t\t\t\t},\n\t\t\t\tresolve: (value) => resolve(value),\n\t\t\t\treject\n\t\t\t});\n\t\t});\n\t}\n\tasync sendBatchRequest(batch) {\n\t\tthis.activeRequests++;\n\t\tconst requests = convertBatchToTranslateManyParams(batch);\n\t\tconst response = await this.sendBatchRequestWithErrorHandling(batch, requests);\n\t\tif (response) this.handleTranslationResponse(batch, response);\n\t\tthis.activeRequests--;\n\t}\n\tasync sendBatchRequestWithErrorHandling(batch, requests) {\n\t\ttry {\n\t\t\treturn await this.translateMany(requests);\n\t\t} catch (error) {\n\t\t\tfor (const entry of batch) entry.reject(error);\n\t\t\treturn;\n\t\t}\n\t}\n\thandleTranslationResponse(batch, response) {\n\t\tfor (const entry of batch) {\n\t\t\tconst { key } = entry;\n\t\t\tconst result = response[key];\n\t\t\tif (result && result.success) {\n\t\t\t\tconst translation = result.translation;\n\t\t\t\tthis.cache[key] = translation;\n\t\t\t\tentry.resolve(translation);\n\t\t\t} else entry.reject(result?.error);\n\t\t}\n\t}\n};\n/**\n* Convert a TranslationKey to a TranslateManyEntry\n*/\nfunction convertBatchToTranslateManyParams(batch) {\n\treturn batch.reduce((acc, entry) => {\n\t\tacc[entry.key] = {\n\t\t\tsource: entry.source,\n\t\t\tmetadata: entry.metadata\n\t\t};\n\t\treturn acc;\n\t}, {});\n}\n//#endregion\n//#region src/i18n-manager/translations-manager/LocalesCache.ts\nvar LocalesCache = class {\n\tconstructor({ ttl, batchConfig, defaultLocale, dictionary = {}, loadTranslations, loadDictionary, createTranslateMany, translateDictionaryEntry, lifecycle }) {\n\t\tthis.translations = new ResourceCache({\n\t\t\tttl,\n\t\t\tload: async (locale) => new TranslationsCache({\n\t\t\t\tinit: await loadTranslations(locale),\n\t\t\t\tlifecycle: createTranslationsCacheLifecycle(locale, lifecycle),\n\t\t\t\ttranslateMany: createTranslateMany(locale),\n\t\t\t\tbatchConfig\n\t\t\t}),\n\t\t\tlifecycle: {\n\t\t\t\tonHit: lifecycle.onLocalesCacheHit,\n\t\t\t\tonMiss: lifecycle.onLocalesCacheMiss\n\t\t\t}\n\t\t});\n\t\tthis.dictionaries = new ResourceCache({\n\t\t\tttl,\n\t\t\tload: async (locale) => createDictionaryCache({\n\t\t\t\tlocale,\n\t\t\t\tdictionary: await loadDictionary(locale),\n\t\t\t\ttranslate: translateDictionaryEntry,\n\t\t\t\tlifecycle\n\t\t\t}),\n\t\t\tlifecycle: {\n\t\t\t\tonHit: lifecycle.onLocalesDictionaryCacheHit,\n\t\t\t\tonMiss: lifecycle.onLocalesDictionaryCacheMiss\n\t\t\t}\n\t\t});\n\t\tthis.dictionaries.set(defaultLocale, createDictionaryCache({\n\t\t\tlocale: defaultLocale,\n\t\t\tdictionary,\n\t\t\ttranslate: translateDictionaryEntry,\n\t\t\tlifecycle\n\t\t}), { expiresAt: -1 });\n\t}\n\tgetTranslations(locale) {\n\t\treturn this.translations.get(locale);\n\t}\n\tgetOrLoadTranslations(locale) {\n\t\treturn this.translations.getOrLoad(locale);\n\t}\n\tgetDictionary(locale) {\n\t\treturn this.dictionaries.get(locale);\n\t}\n\tgetOrLoadDictionary(locale) {\n\t\treturn this.dictionaries.getOrLoad(locale);\n\t}\n};\nfunction createTranslationsCacheLifecycle(locale, lifecycle) {\n\treturn {\n\t\tonHit: withLocale(locale, lifecycle.onTranslationsCacheHit),\n\t\tonMiss: withLocale(locale, lifecycle.onTranslationsCacheMiss)\n\t};\n}\nfunction createDictionaryCache({ locale, dictionary, translate, lifecycle }) {\n\tconst { onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit } = lifecycle;\n\treturn new DictionaryCache({\n\t\tinit: dictionary,\n\t\truntimeTranslate: (key, sourceEntry) => translate(locale, key, sourceEntry),\n\t\tlifecycle: {\n\t\t\tonHit: withLocale(locale, onDictionaryCacheHit),\n\t\t\tonMiss: withLocale(locale, onDictionaryCacheMiss),\n\t\t\tonDictionaryObjectCacheHit: withLocale(locale, onDictionaryObjectCacheHit)\n\t\t}\n\t});\n}\nfunction withLocale(locale, callback) {\n\treturn callback ? (params) => callback({\n\t\tlocale,\n\t\t...params\n\t}) : void 0;\n}\n//#endregion\n//#region src/i18n-manager/event-subscription/types.ts\nconst LOCALES_CACHE_HIT_EVENT_NAME = \"locales-cache-hit\";\nconst LOCALES_CACHE_MISS_EVENT_NAME = \"locales-cache-miss\";\nconst TRANSLATIONS_CACHE_HIT_EVENT_NAME = \"translations-cache-hit\";\nconst TRANSLATIONS_CACHE_MISS_EVENT_NAME = \"translations-cache-miss\";\nconst LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME = \"locales-dictionary-cache-hit\";\nconst LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME = \"locales-dictionary-cache-miss\";\nconst DICTIONARY_CACHE_HIT_EVENT_NAME = \"dictionary-cache-hit\";\nconst DICTIONARY_CACHE_MISS_EVENT_NAME = \"dictionary-cache-miss\";\nconst DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME = \"dictionary-object-cache-hit\";\n//#endregion\n//#region src/i18n-manager/lifecycle-hooks/createLifecycleCallbacks.ts\n/**\n* Maps consumer-facing lifecycle callbacks to internal locales cache lifecycle callbacks.\n* The consumer API exposes simplified params (locale, hash, value) while the internal\n* API uses the full cache lifecycle params (inputKey, cacheKey, cacheValue, outputValue).\n*\n* @deprecated - move to subscription api instead\n*/\nfunction createLifecycleCallbacks(emit, hasListeners = () => true) {\n\treturn {\n\t\tonLocalesCacheHit: (params) => {\n\t\t\tif (!hasListeners(\"locales-cache-hit\")) return;\n\t\t\temit(LOCALES_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\ttranslations: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonLocalesCacheMiss: (params) => {\n\t\t\tif (!hasListeners(\"locales-cache-miss\")) return;\n\t\t\temit(LOCALES_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\ttranslations: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonTranslationsCacheHit: (params) => {\n\t\t\temit(TRANSLATIONS_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\thash: params.cacheKey,\n\t\t\t\ttranslation: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonTranslationsCacheMiss: (params) => {\n\t\t\temit(TRANSLATIONS_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\thash: params.cacheKey,\n\t\t\t\ttranslation: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonLocalesDictionaryCacheHit: (params) => {\n\t\t\tif (!hasListeners(\"locales-dictionary-cache-hit\")) return;\n\t\t\temit(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\tdictionary: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonLocalesDictionaryCacheMiss: (params) => {\n\t\t\tif (!hasListeners(\"locales-dictionary-cache-miss\")) return;\n\t\t\temit(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.inputKey,\n\t\t\t\tdictionary: params.outputValue.getInternalCache()\n\t\t\t});\n\t\t},\n\t\tonDictionaryCacheHit: (params) => {\n\t\t\temit(DICTIONARY_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryEntry: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonDictionaryCacheMiss: (params) => {\n\t\t\temit(DICTIONARY_CACHE_MISS_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryEntry: params.outputValue\n\t\t\t});\n\t\t},\n\t\tonDictionaryObjectCacheHit: (params) => {\n\t\t\temit(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, {\n\t\t\t\tlocale: params.locale,\n\t\t\t\tid: params.cacheKey,\n\t\t\t\tdictionaryValue: params.outputValue\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/i18n-manager/event-subscription/EventEmitter.ts\n/**\n* Base class for event emitters\n*/\nvar EventEmitter = class {\n\tconstructor() {\n\t\tthis.listeners = {};\n\t}\n\tgetOrCreateListeners(eventName) {\n\t\tif (!this.listeners[eventName]) this.listeners[eventName] = /* @__PURE__ */ new Set();\n\t\treturn this.listeners[eventName];\n\t}\n\t/**\n\t* Subscribe to an event, returns an unsubscribe function\n\t*/\n\tsubscribe(eventName, listener) {\n\t\tconst set = this.getOrCreateListeners(eventName);\n\t\tset.add(listener);\n\t\treturn () => {\n\t\t\tset.delete(listener);\n\t\t};\n\t}\n\t/**\n\t* Emit an event\n\t*/\n\temit(eventName, event) {\n\t\tthis.listeners[eventName]?.forEach((subscriber) => subscriber(event));\n\t}\n\thasListeners(eventName) {\n\t\treturn (this.listeners[eventName]?.size ?? 0) > 0;\n\t}\n};\n//#endregion\n//#region src/i18n-manager/lifecycle-hooks/subscribeLifecycleCallbacks.ts\n/**\n* Subscribes to the lifecycle callbacks and emits the events to the event emitter\n* @deprecated - move to subscription api instead\n*\n* NOTE: we do not have to worry about unsubscribe here as this is a deprecated api\n* and is only used internally\n*/\nfunction subscribeLifecycleCallbacks({ onLocalesCacheHit, onLocalesCacheMiss, onTranslationsCacheHit, onTranslationsCacheMiss, onLocalesDictionaryCacheHit, onLocalesDictionaryCacheMiss, onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit }, subscribe) {\n\tif (onLocalesCacheHit) subscribe(LOCALES_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonLocalesCacheHit({\n\t\t\t...event,\n\t\t\tvalue: event.translations\n\t\t});\n\t});\n\tif (onLocalesCacheMiss) subscribe(LOCALES_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonLocalesCacheMiss({\n\t\t\t...event,\n\t\t\tvalue: event.translations\n\t\t});\n\t});\n\tif (onTranslationsCacheHit) subscribe(TRANSLATIONS_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonTranslationsCacheHit({\n\t\t\t...event,\n\t\t\tvalue: event.translation\n\t\t});\n\t});\n\tif (onTranslationsCacheMiss) subscribe(TRANSLATIONS_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonTranslationsCacheMiss({\n\t\t\t...event,\n\t\t\tvalue: event.translation\n\t\t});\n\t});\n\tif (onLocalesDictionaryCacheHit) subscribe(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonLocalesDictionaryCacheHit(event);\n\t});\n\tif (onLocalesDictionaryCacheMiss) subscribe(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonLocalesDictionaryCacheMiss(event);\n\t});\n\tif (onDictionaryCacheHit) subscribe(DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonDictionaryCacheHit(event);\n\t});\n\tif (onDictionaryCacheMiss) subscribe(DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {\n\t\tonDictionaryCacheMiss(event);\n\t});\n\tif (onDictionaryObjectCacheHit) subscribe(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, (event) => {\n\t\tonDictionaryObjectCacheHit(event);\n\t});\n}\n//#endregion\n//#region src/i18n-manager/I18nManager.ts\n/**\n* Default translation timeout in milliseconds for a runtime translation request\n*/\nconst DEFAULT_TRANSLATION_TIMEOUT = 12e3;\n/**\n* Class for managing translation functionality\n* @template TranslationValue - The type of the translation that will be cached\n*/\nvar I18nManager = class extends EventEmitter {\n\t/**\n\t* Creates an instance of I18nManager.\n\t* TODO: resolve gtConfig from just file path\n\t* @param params - The parameters for the I18nManager constructor\n\t* @param params.config - The configuration for the I18nManager\n\t*/\n\tconstructor(params) {\n\t\tsuper();\n\t\tthis.resolveTranslationSync = (locale, message, options) => {\n\t\t\treturn this.lookupTranslation(locale, message, options);\n\t\t};\n\t\tpublishValidationResults(validateConfig(params), \"I18nManager: \");\n\t\tthis.config = standardizeConfig(params);\n\t\tthis.localeConfig = new LocaleConfig({\n\t\t\tdefaultLocale: this.config.defaultLocale,\n\t\t\tlocales: this.config.locales,\n\t\t\tcustomMapping: this.config.customMapping\n\t\t});\n\t\tconst loadTranslations = routeCreateTranslationLoader({\n\t\t\tloadTranslations: params.loadTranslations,\n\t\t\ttype: getLoadTranslationsType(params),\n\t\t\tremoteTranslationLoaderParams: {\n\t\t\t\tcacheUrl: params.cacheUrl,\n\t\t\t\tprojectId: params.projectId,\n\t\t\t\t_versionId: params._versionId,\n\t\t\t\t_branchId: params._branchId,\n\t\t\t\tcustomMapping: params.customMapping\n\t\t\t}\n\t\t});\n\t\tconst loadDictionary = params.loadDictionary ?? (() => Promise.resolve({}));\n\t\tconst runtimeTranslationTimeout = this.config.runtimeTranslation?.timeout ?? DEFAULT_TRANSLATION_TIMEOUT;\n\t\tconst runtimeTranslationMetadata = this.config.runtimeTranslation?.metadata ?? {};\n\t\tconst createTranslateMany = createTranslateManyFactory(this.getGTClassClean(), runtimeTranslationTimeout, runtimeTranslationMetadata);\n\t\tsubscribeLifecycleCallbacks(params.lifecycle ?? {}, (...args) => this.subscribe(...args));\n\t\tconst lifecycle = createLifecycleCallbacks((...args) => this.emit(...args), (eventName) => this.hasListeners(eventName));\n\t\tthis.localesCache = new LocalesCache({\n\t\t\tdefaultLocale: this.config.defaultLocale,\n\t\t\tdictionary: params.dictionary,\n\t\t\tloadTranslations,\n\t\t\tloadDictionary,\n\t\t\tcreateTranslateMany,\n\t\t\ttranslateDictionaryEntry: (locale, id, sourceEntry) => this.translateDictionaryEntry(locale, id, sourceEntry),\n\t\t\tttl: this.config.cacheExpiryTime,\n\t\t\tbatchConfig: this.config.batchConfig,\n\t\t\tlifecycle\n\t\t});\n\t}\n\t/**\n\t* Subscribes to a change in a translation entry (eg a runtime translation)\n\t* @param listener - The subscriber function\n\t* @param locale - The locale of the translation entry\n\t* @param hash - The hash of the translation entry\n\t* @returns An unsubscribe function\n\t*\n\t* Pair this with {@link lookupTranslation} to get the translation entry\n\t*/\n\tsubscribeToTranslationsCacheMiss(listener, locale, hash) {\n\t\treturn this.subscribe(TRANSLATIONS_CACHE_MISS_EVENT_NAME, (event) => {\n\t\t\tif (event.locale !== locale || event.hash !== hash) return;\n\t\t\tlistener(event);\n\t\t});\n\t}\n\t/**\n\t* Get the default locale\n\t*/\n\tgetDefaultLocale() {\n\t\treturn this.config.defaultLocale;\n\t}\n\t/**\n\t* Get the locales\n\t*/\n\tgetLocales() {\n\t\treturn this.config.locales;\n\t}\n\t/**\n\t* Get the custom locale mapping\n\t*/\n\tgetCustomMapping() {\n\t\treturn this.config.customMapping;\n\t}\n\t/**\n\t* Get the version ID\n\t*/\n\tgetVersionId() {\n\t\treturn this.config._versionId;\n\t}\n\t/**\n\t* Get a gt class instance\n\t* @param locale - The locale to bind to the GT instance. When omitted, the GT instance is locale agnostic.\n\t* TODO: keep a cache to avoid creating new instances unnecessarily\n\t*/\n\tgetGTClass(locale) {\n\t\treturn this.getGTClassClean(locale ? this.resolveLocale(locale) : void 0);\n\t}\n\t/**\n\t* Is translation enabled?\n\t*/\n\tisTranslationEnabled() {\n\t\treturn this.config.enableI18n;\n\t}\n\t/**\n\t* Get the translation loader function\n\t* @deprecated wrap a cb around loadTranslations instead\n\t*/\n\tgetTranslationLoader() {\n\t\treturn (locale) => this.loadTranslations(locale);\n\t}\n\t/**\n\t* Loads in translations for a given locale\n\t* Edge case usage: access the translations object directly\n\t*/\n\tasync loadTranslations(locale) {\n\t\ttry {\n\t\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!translationLocale) return {};\n\t\t\treturn (await this.localesCache.getOrLoadTranslations(translationLocale)).getInternalCache();\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Loads in the dictionary for a given locale\n\t* Edge case usage: access the dictionary object directly\n\t*/\n\tasync loadDictionary(locale) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getDefaultDictionaryCache()?.getInternalCache() ?? {};\n\t\t\treturn (await this.localesCache.getOrLoadDictionary(dictionaryLocale)).getInternalCache();\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry\n\t*/\n\tlookupDictionary(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveDictionaryCacheLocale(locale);\n\t\t\treturn this.localesCache.getDictionary(dictionaryLocale)?.getEntry(id);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry or subtree\n\t*/\n\tlookupDictionaryObj(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveDictionaryCacheLocale(locale);\n\t\t\treturn this.localesCache.getDictionary(dictionaryLocale)?.getValue(id);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupDictionaryWithFallback(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getSourceDictionaryEntry(id);\n\t\t\tconst dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);\n\t\t\tlet dictionaryEntry = dictionaryCache.getEntry(id);\n\t\t\tif (dictionaryEntry === void 0) dictionaryEntry = await dictionaryCache.materializeEntry(id, this.getSourceDictionaryEntry(id));\n\t\t\treturn dictionaryEntry;\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a dictionary entry or subtree\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupDictionaryObjWithFallback(locale, id) {\n\t\ttry {\n\t\t\tconst dictionaryLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!dictionaryLocale) return this.getSourceDictionaryObject(id);\n\t\t\tconst dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);\n\t\t\tconst targetObject = dictionaryCache.getValue(id);\n\t\t\tconst sourceObject = this.getSourceDictionaryObject(id, { throwOnMissing: false });\n\t\t\tif (sourceObject === void 0) {\n\t\t\t\tif (targetObject !== void 0) return targetObject;\n\t\t\t\tthrow new DictionarySourceNotFoundError(id);\n\t\t\t}\n\t\t\treturn await dictionaryCache.materializeValue(id, sourceObject, targetObject);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\tasync translateDictionaryEntry(locale, id, sourceEntry) {\n\t\tconst translation = await this.lookupTranslationWithFallbackResolved(locale, sourceEntry.entry, resolveDictionaryLookupOptions(sourceEntry.options));\n\t\tif (typeof translation !== \"string\") throw new Error(`Dictionary entry \"${id}\" could not be translated into a string. Check the source entry and translation loader output.`);\n\t\treturn translation;\n\t}\n\tgetSourceDictionaryEntry(id) {\n\t\tconst sourceEntry = this.getDefaultDictionaryCache()?.getEntry(id);\n\t\tif (sourceEntry === void 0) throw new DictionarySourceNotFoundError(id);\n\t\treturn sourceEntry;\n\t}\n\tgetSourceDictionaryObject(id, { throwOnMissing = true } = {}) {\n\t\tconst sourceObject = this.getDefaultDictionaryCache()?.getValue(id);\n\t\tif (sourceObject === void 0 && throwOnMissing) throw new DictionarySourceNotFoundError(id);\n\t\treturn sourceObject;\n\t}\n\tgetDefaultDictionaryCache() {\n\t\treturn this.localesCache.getDictionary(this.config.defaultLocale);\n\t}\n\tresolveDictionaryCacheLocale(locale) {\n\t\treturn this.resolveCacheLocale(locale) ?? this.config.defaultLocale;\n\t}\n\t/**\n\t* Just lookup a translation\n\t*/\n\tlookupTranslation(locale, message, options) {\n\t\ttry {\n\t\t\tconst { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);\n\t\t\tif (!translationLocale) return message;\n\t\t\tconst txCache = this.localesCache.getTranslations(translationLocale);\n\t\t\tif (!txCache) return void 0;\n\t\t\treturn txCache.get({\n\t\t\t\tmessage,\n\t\t\t\toptions: lookupOptions\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Look up a translation\n\t* If it's not found, use the fallback (runtime translate)\n\t*/\n\tasync lookupTranslationWithFallback(locale, message, options) {\n\t\ttry {\n\t\t\treturn await this.lookupTranslationWithFallbackResolved(locale, message, options);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn;\n\t\t}\n\t}\n\t/**\n\t* Saves a current lookup translation function immune to expiry\n\t* Useful for operations involving lookup callbacks like useGT()\n\t* @param locale - The locale to get the lookup translation for\n\t* @param prefetchEntries - Any entries we want to prefetch during the async period\n\t* @returns A lookup translation function\n\t*\n\t* @important prefetchEntries must all be the same locale\n\t*/\n\tasync getLookupTranslation(locale, prefetchEntries = []) {\n\t\ttry {\n\t\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\t\tif (!translationLocale) return (message) => message;\n\t\t\tconst resolvedPrefetchEntries = resolvePrefetchEntriesByLocale(prefetchEntries, translationLocale, (entryLocale) => this.resolveCacheLocale(entryLocale) ?? this.resolveLocale(entryLocale));\n\t\t\tif (resolvedPrefetchEntries.length !== prefetchEntries.length) logger_default.warn(`I18nManager: getLookupTranslation(): prefetchEntries must all be the same locale, ignoring all entries that are not for ${translationLocale}`);\n\t\t\tconst txCache = await this.localesCache.getOrLoadTranslations(translationLocale);\n\t\t\tawait Promise.all(resolvedPrefetchEntries.filter((entry) => txCache.get(entry) == null).map((entry) => txCache.miss(entry)));\n\t\t\treturn (message, options = {}) => {\n\t\t\t\treturn txCache.get({\n\t\t\t\t\tmessage,\n\t\t\t\t\toptions: this.resolveLookupOptions(options)\n\t\t\t\t});\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn (message) => message;\n\t\t}\n\t}\n\t/**\n\t* Get the translations\n\t* @deprecated use loadTranslations instead\n\t*/\n\tasync getTranslations(locale) {\n\t\ttry {\n\t\t\treturn this.loadTranslations(locale);\n\t\t} catch (error) {\n\t\t\tthis.handleError(error);\n\t\t\treturn {};\n\t\t}\n\t}\n\t/**\n\t* Get translation for a given locale and message\n\t*\n\t* @param {string} locale - The locale to get the translation for\n\t* @returns A function that resolves the translations for a given message and options synchronously\n\t*\n\t* Note: we can assume that the translation is a string because we are passing a string\n\t*\n\t* @deprecated use getLookupTranslation instead\n\t*/\n\tasync getTranslationResolver(locale) {\n\t\treturn this.getLookupTranslation(locale);\n\t}\n\t/**\n\t* Returns true if translation is required\n\t* @param {string} locale - The user's locale\n\t* @returns {boolean} True if translation is required, otherwise false\n\t*/\n\trequiresTranslation(locale) {\n\t\tconst defaultLocale = this.getDefaultLocale();\n\t\tconst locales = this.getLocales();\n\t\treturn this.isTranslationEnabled() && this.localeConfig.requiresTranslation(locale, defaultLocale, locales);\n\t}\n\t/**\n\t* Returns true if dialect translation is required\n\t* @param {string} locale - The user's locale\n\t* @returns {boolean} True if dialect translation is required, otherwise false\n\t*/\n\trequiresDialectTranslation(locale) {\n\t\tconst defaultLocale = this.getDefaultLocale();\n\t\treturn this.requiresTranslation(locale) && this.localeConfig.isSameLanguage(defaultLocale, locale);\n\t}\n\t/**\n\t* Handle errors\n\t* Soft error in production, throw in development\n\t*/\n\thandleError(error) {\n\t\tif (error instanceof DictionarySourceNotFoundError) throw error;\n\t\tswitch (this.config.environment) {\n\t\t\tcase \"development\": throw error;\n\t\t\tdefault:\n\t\t\t\tlogger_default.error(\"I18nManager: \" + error);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tresolveLocale(locale) {\n\t\tconst resolvedLocale = this.localeConfig.determineLocale(locale);\n\t\tif (!this.localeConfig.isValidLocale(locale) || !resolvedLocale) throw new Error(`Locale \"${locale}\" is not valid. Use a valid BCP 47 locale code or add a custom mapping.`);\n\t\treturn resolvedLocale;\n\t}\n\t/**\n\t* Resolve the locale key used to load/read locale caches.\n\t* Returns undefined when the requested locale can use source content.\n\t*/\n\tresolveCacheLocale(locale) {\n\t\tconst resolvedLocale = this.resolveLocale(locale);\n\t\tif (this.requiresTranslation(resolvedLocale)) return resolvedLocale;\n\t\tconst aliasLocale = this.localeConfig.resolveAliasLocale(standardizeLocale(locale));\n\t\tif (this.requiresTranslation(aliasLocale)) return aliasLocale;\n\t}\n\tresolveLookupParams(locale, options) {\n\t\tconst translationLocale = this.resolveCacheLocale(locale);\n\t\treturn {\n\t\t\ttranslationLocale,\n\t\t\toptions: translationLocale ? this.resolveLookupOptions(options, translationLocale) : options\n\t\t};\n\t}\n\tresolveLookupOptions(options = {}, translationLocale) {\n\t\tif (!options.$locale) return options;\n\t\treturn {\n\t\t\t...options,\n\t\t\t$locale: translationLocale ?? this.resolveCacheLocale(options.$locale) ?? this.resolveLocale(options.$locale)\n\t\t};\n\t}\n\tasync lookupTranslationWithFallbackResolved(locale, message, options) {\n\t\tconst { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);\n\t\tif (!translationLocale) return message;\n\t\tconst txCache = await this.localesCache.getOrLoadTranslations(translationLocale);\n\t\tlet translation = txCache.get({\n\t\t\tmessage,\n\t\t\toptions: lookupOptions\n\t\t});\n\t\tif (translation == null) translation = await txCache.miss({\n\t\t\tmessage,\n\t\t\toptions: lookupOptions\n\t\t});\n\t\treturn translation;\n\t}\n\t/**\n\t* A helper function to create a gt class that is locale agnostic\n\t* This is helpful for when our getLocale function is bound to a\n\t* specific context\n\t*/\n\tgetGTClassClean(locale) {\n\t\treturn new GT({\n\t\t\tsourceLocale: this.config.defaultLocale,\n\t\t\ttargetLocale: locale,\n\t\t\tlocales: Array.from(new Set(this.config.locales.map((locale) => this.localeConfig.resolveCanonicalLocale(locale)))),\n\t\t\tcustomMapping: this.config.customMapping,\n\t\t\tprojectId: this.config.projectId,\n\t\t\tbaseUrl: this.config.runtimeUrl || void 0,\n\t\t\tapiKey: this.config.apiKey,\n\t\t\tdevApiKey: this.config.devApiKey\n\t\t});\n\t}\n};\n/**\n* Standardize the config\n* @param config - The config to standardize\n* @returns The standardized config\n*/\nfunction standardizeConfig(config) {\n\tconst gtServicesEnabled = getGTServicesEnabled(config);\n\tconst dedupedLocales = dedupeLocales({\n\t\tdefaultLocale: config.defaultLocale || libraryDefaultLocale,\n\t\tlocales: config.locales || [libraryDefaultLocale],\n\t\tcustomMapping: config.customMapping\n\t});\n\treturn {\n\t\tenvironment: config.environment || \"production\",\n\t\tenableI18n: config.enableI18n !== void 0 ? config.enableI18n : true,\n\t\tprojectId: config.projectId,\n\t\tdevApiKey: config.devApiKey,\n\t\tapiKey: config.apiKey,\n\t\truntimeUrl: config.runtimeUrl,\n\t\tcacheExpiryTime: config.cacheExpiryTime,\n\t\tbatchConfig: config.batchConfig,\n\t\truntimeTranslation: config.runtimeTranslation,\n\t\t_versionId: config._versionId,\n\t\t...gtServicesEnabled ? standardizeLocales(dedupedLocales) : dedupedLocales\n\t};\n}\n/**\n* Dedupe locales and add defaultLocale\n*/\nfunction dedupeLocales({ defaultLocale, locales, customMapping }) {\n\treturn {\n\t\tdefaultLocale,\n\t\tlocales: Array.from(new Set([defaultLocale, ...locales])),\n\t\tcustomMapping: customMapping || {}\n\t};\n}\n/**\n* Standardize all locales in config\n* Only apply if using GT services\n*/\nfunction standardizeLocales(config) {\n\treturn {\n\t\tdefaultLocale: standardizeLocale(config.defaultLocale),\n\t\tlocales: config.locales.map((locale) => {\n\t\t\tif (typeof config.customMapping?.[locale] === \"string\" ? config.customMapping?.[locale] : config.customMapping?.[locale]?.code) return locale;\n\t\t\telse return standardizeLocale(locale);\n\t\t}),\n\t\tcustomMapping: Object.fromEntries(Object.entries(config.customMapping || {}).map(([key, value]) => [key, typeof value === \"string\" ? standardizeLocale(value) : {\n\t\t\t...value,\n\t\t\t...value.code ? { code: standardizeLocale(value.code) } : {}\n\t\t}]))\n\t};\n}\n/**\n* Resolve prefetch entry locales and keep entries matching the active locale.\n* @template TranslationType - The type of the translation\n* @param {PrefetchEntry<TranslationType>[]} prefetchEntries - The prefetch entries to filter\n* @param {string} locale - The locale to filter by\n* @returns {PrefetchEntry<TranslationType>[]} The filtered prefetch entries\n*/\nfunction resolvePrefetchEntriesByLocale(prefetchEntries, locale, resolveLocale) {\n\treturn prefetchEntries.flatMap((entry) => {\n\t\tconst entryLocale = entry.options.$locale;\n\t\tif (entryLocale == null) return [entry];\n\t\ttry {\n\t\t\tconst resolvedLocale = resolveLocale(entryLocale);\n\t\t\tif (resolvedLocale !== locale) return [];\n\t\t\treturn [{\n\t\t\t\tmessage: entry.message,\n\t\t\t\toptions: {\n\t\t\t\t\t...entry.options,\n\t\t\t\t\t$locale: resolvedLocale\n\t\t\t\t}\n\t\t\t}];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t});\n}\n//#endregion\n//#region src/i18n-manager/singleton-operations.ts\nlet i18nManager = void 0;\nlet fallbackDefaultLocale = libraryDefaultLocale;\nconst fallbackConditionStore = { getLocale: () => fallbackDefaultLocale };\nlet conditionStore = fallbackConditionStore;\n/**\n* Get the singleton instance of I18nManager\n* @returns The singleton instance of I18nManager\n* @template U - The type of the translation that will be cached\n*/\nfunction getI18nManager() {\n\tif (!i18nManager) {\n\t\tlogger_default.warn(\"getI18nManager(): I18nManager was not initialized. Falling back to the default locale until initializeGT() configures translations.\");\n\t\ti18nManager = new I18nManager({\n\t\t\tdefaultLocale: libraryDefaultLocale,\n\t\t\tlocales: [libraryDefaultLocale]\n\t\t});\n\t}\n\treturn i18nManager;\n}\n/**\n* Resolve the current locale from the configured runtime condition source.\n*/\nfunction getCurrentLocale() {\n\treturn conditionStore.getLocale();\n}\n/**\n* Configure the runtime condition source.\n*/\nfunction setConditionStore(nextConditionStore) {\n\tconditionStore = nextConditionStore;\n}\n/**\n* Reset the runtime condition source to the active manager's default-locale fallback.\n*/\nfunction resetConditionStore() {\n\tconditionStore = fallbackConditionStore;\n}\n/**\n* Configure the singleton instance of I18nManager\n* @param config - The configuration for the I18nManager\n*\n* Wrapper libraries will export a configure function that will call this function.\n*/\nfunction setI18nManager(i18nManagerInstance) {\n\ti18nManager = i18nManagerInstance;\n\tfallbackDefaultLocale = i18nManagerInstance.getDefaultLocale();\n\tresetConditionStore();\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateStringMessage.ts\n/**\n* String interpolation function\n*/\nfunction interpolateStringMessage(encodedMsg, options) {\n\treturn formatCutoff(encodedMsg, {\n\t\tlocales: options.$locale ?? options.$_locales,\n\t\tmaxChars: options.$maxChars\n\t});\n}\n//#endregion\n//#region src/translation-functions/utils/interpolation/interpolateMessage.ts\n/**\n* Interpolation router function for all {@link StringFormat} types\n*/\nfunction interpolateMessage({ source, target, options, sourceLocale }) {\n\tif (target != null) return routeInterpolation(target, {\n\t\t$_fallback: source,\n\t\t...options\n\t});\n\treturn routeInterpolation(source, getSourceOptions(options, sourceLocale));\n}\n/**\n* Route to appropriate formatting function\n*/\nfunction routeInterpolation(content, options) {\n\tswitch (options.$format ?? \"STRING\") {\n\t\tcase \"ICU\": return interpolateIcuMessage(content, options);\n\t\tcase \"I18NEXT\":\n\t\tcase \"STRING\": return interpolateStringMessage(content, options);\n\t\tdefault: return content;\n\t}\n}\nfunction getSourceOptions(options, sourceLocale) {\n\tif (!sourceLocale) return options;\n\treturn {\n\t\t...options,\n\t\t$locale: sourceLocale\n\t};\n}\n//#endregion\n//#region src/translation-functions/internal/helpers.ts\n/**\n* Just do a simple lookup of the translation\n*/\nfunction resolveJsx(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"JSX\");\n\treturn i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions);\n}\n/**\n* Lookup translation, fallback to source\n*/\nfunction resolveJsxWithFallback(locale, content, options = {}) {\n\treturn resolveJsx(locale, content, options) ?? content;\n}\n/**\n* Lookup translation\n* fallback to runtime translate\n* Fallback to source\n*/\nasync function resolveJsxWithRuntimeFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"JSX\");\n\treturn await i18nManager.lookupTranslationWithFallback(lookupOptions.$locale, content, lookupOptions) ?? content;\n}\n/**\n* Just do a simple lookup of the translation\n* And interpolate\n*/\nfunction resolveStringContent(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\tconst translation = i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions);\n\tif (translation == null) return void 0;\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: translation,\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Lookup translation, fallback to source\n*/\nfunction resolveStringContentWithFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: i18nManager.lookupTranslation(lookupOptions.$locale, content, lookupOptions),\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Lookup translation\n* fallback to runtime translate\n* Fallback to source\n*/\nasync function resolveStringContentWithRuntimeFallback(locale, content, options = {}) {\n\tconst i18nManager = getI18nManager();\n\tconst lookupOptions = createLookupOptions(locale, options, \"STRING\");\n\treturn interpolateMessage({\n\t\tsource: content,\n\t\ttarget: await i18nManager.lookupTranslationWithFallback(lookupOptions.$locale, content, lookupOptions),\n\t\toptions: lookupOptions,\n\t\tsourceLocale: i18nManager.getDefaultLocale()\n\t});\n}\n/**\n* Add the default format to caller-provided lookup options.\n*/\nfunction createLookupOptions(locale, options, defaultFormat) {\n\treturn {\n\t\t...options,\n\t\t$format: options.$format ?? defaultFormat,\n\t\t$locale: locale\n\t};\n}\n//#endregion\n//#region src/helpers/locale.ts\n/**\n* Get the current locale\n* @returns The current locale\n*\n* @example\n* const locale = getLocale();\n* console.log(locale); // 'en-US'\n*/\nfunction getLocale() {\n\treturn getCurrentLocale();\n}\n/**\n* Get the configured locales\n* @returns The configured locales\n*\n* @example\n* const locales = getLocales();\n* console.log(locales); // ['en-US', 'es-ES']\n*/\nfunction getLocales() {\n\treturn getI18nManager().getLocales();\n}\n/**\n* Get the default locale\n* @returns The default locale\n*\n* @example\n* const defaultLocale = getDefaultLocale();\n* console.log(defaultLocale); // 'en-US'\n*/\nfunction getDefaultLocale() {\n\treturn getI18nManager().getDefaultLocale();\n}\n/**\n* Get the locale properties\n* @param {string} [locale] - The locale to get the properties for. When not provided, uses the current locale.\n* @returns The locale properties\n*\n* @example\n* const localeProperties = getLocaleProperties();\n*\n* @example\n* const localeProperties = getLocaleProperties('en-US');\n*/\nfunction getLocaleProperties(locale = getCurrentLocale()) {\n\treturn getI18nManager().getGTClass().getLocaleProperties(locale);\n}\n//#endregion\n//#region src/helpers/versionId.ts\n/**\n* Get the version ID for the current source\n* @returns The version ID, if set\n*\n* @example\n* const versionId = getVersionId();\n* console.log(versionId); // 'abc123'\n*/\nfunction getVersionId() {\n\treturn getI18nManager().getVersionId();\n}\n//#endregion\nexport { hashMessage as C, resolveDictionaryLookupOptions as E, TRANSLATIONS_CACHE_MISS_EVENT_NAME as S, isDictionaryObject as T, setI18nManager as _, getLocales as a, LOCALES_CACHE_MISS_EVENT_NAME as b, resolveJsxWithFallback as c, resolveStringContentWithFallback as d, resolveStringContentWithRuntimeFallback as f, setConditionStore as g, getI18nManager as h, getLocaleProperties as i, resolveJsxWithRuntimeFallback as l, getCurrentLocale as m, getDefaultLocale as n, createLookupOptions as o, interpolateMessage as p, getLocale as r, resolveJsx as s, getVersionId as t, resolveStringContent as u, I18nManager as v, getDictionaryEntry as w, LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME as x, DICTIONARY_CACHE_MISS_EVENT_NAME as y };\n\n//# sourceMappingURL=versionId-BTjLA0FZ.mjs.map","import { n as decodeOptions, r as interpolateIcuMessage, t as isEncodedTranslationOptions } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\n//#region src/translation-functions/msg/decodeMsg.ts\nfunction decodeMsg(encodedMsg) {\n\tif (typeof encodedMsg === \"string\" && encodedMsg.lastIndexOf(\":\") !== -1) return encodedMsg.slice(0, encodedMsg.lastIndexOf(\":\"));\n\treturn encodedMsg;\n}\n//#endregion\n//#region src/translation-functions/fallbacks/gtFallback.ts\n/**\n* A fallback function for the gt() function that decodes and interpolates.\n* @param {string | null | undefined} message - The ICU formatted message to interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns - The decoded and interpolated message.\n*\n* @note This function is useful as a placeholder when for incrementally migrating to the m() function.\n* @example\n* // A backwards compatible translation function\n* function getMessage(gt: GTFunctionType = gtFallback) {\n* return gt('Hello, world!');\n* }\n*\n* // Here i18n has been implemented\n* function WithTranslation() {\n* const gt = useGT();\n* return <>{getMessage(gt)}</>;\n* }\n*\n*\n* // i18n has not yet been implemented yet\n* function WithoutTranslations() {\n* return <>{getMessage()}</>;\n* }\n*/\nconst gtFallback = (message, options = {}) => {\n\treturn interpolateIcuMessage(message, options);\n};\n//#endregion\n//#region src/translation-functions/fallbacks/mFallback.ts\n/**\n* A fallback function for the m() function that decodes and interpolates.\n* @param {string | null | undefined} encodedMsg - The encoded message to decode and interpolate.\n* @param {InlineTranslationOptions} options - The options to interpolate.\n* @returns - The decoded and interpolated message.\n*\n* @note This function is useful as a placeholder when for incrementally migrating to the m() function.\n* @example\n* // A backwards compatible translation function\n* function getMessage(m: MFunctionType = mFallback) {\n* return m(msg('Hello, world!'));\n* }\n*\n* // Here i18n has been implemented\n* function WithTranslation() {\n* const m = useMessages();\n* return <>{getMessage(m)}</>;\n* }\n*\n*\n* // i18n has not yet been implemented yet\n* function WithoutTranslations() {\n* return <>{getMessage()}</>;\n* }\n*/\nconst mFallback = (encodedMsg, options = {}) => {\n\tif (!encodedMsg) return encodedMsg;\n\tif (isEncodedTranslationOptions(decodeOptions(encodedMsg) ?? {})) return decodeMsg(encodedMsg);\n\treturn interpolateIcuMessage(encodedMsg, options);\n};\n//#endregion\nexport { gtFallback as n, decodeMsg as r, mFallback as t };\n\n//# sourceMappingURL=mFallback-pqVm9wDk.mjs.map","import { a as extractVariables, i as createInterpolationFailureMessage, n as decodeOptions, o as logger_default } from \"./isEncodedTranslationOptions-BOwWa_-J.mjs\";\nimport { C as hashMessage, a as getLocales, d as resolveStringContentWithFallback, i as getLocaleProperties, m as getCurrentLocale, n as getDefaultLocale, r as getLocale, t as getVersionId } from \"./versionId-BTjLA0FZ.mjs\";\nimport { n as gtFallback, r as decodeMsg, t as mFallback } from \"./mFallback-pqVm9wDk.mjs\";\nimport { VAR_IDENTIFIER, declareStatic, declareVar, decodeVars, derive, encode, libraryDefaultLocale } from \"generaltranslation/internal\";\nimport { formatMessage } from \"@generaltranslation/format\";\n//#region src/translation-functions/t.ts\n/**\n* Translate a message\n* @param {string} message - The message to translate.\n* @param options - The options for the translation.\n* @returns The translated message.\n*/\nfunction t(message, options = {}) {\n\treturn resolveStringContentWithFallback(options.$locale ?? getCurrentLocale(), message, {\n\t\t$format: \"ICU\",\n\t\t...options\n\t});\n}\n//#endregion\n//#region src/translation-functions/msg/msg.ts\nfunction msg(message, options) {\n\tif (typeof message !== \"string\") {\n\t\tif (!options) return message;\n\t\treturn message.map((m, i) => msg(m, {\n\t\t\t...options,\n\t\t\t...options.$id && { $id: `${options.$id}.${i}` }\n\t\t}));\n\t}\n\tif (!options) return message;\n\tconst variables = extractVariables(options);\n\tlet interpolatedString = message;\n\ttry {\n\t\tinterpolatedString = formatMessage(message, {\n\t\t\tlocales: [libraryDefaultLocale],\n\t\t\tvariables: {\n\t\t\t\t...variables,\n\t\t\t\t[VAR_IDENTIFIER]: \"other\"\n\t\t\t}\n\t\t});\n\t} catch {\n\t\tlogger_default.warn(createInterpolationFailureMessage(message));\n\t\treturn message;\n\t}\n\tconst $_source = message;\n\tconst $_hash = options.$_hash || hashMessage(message, {\n\t\t$format: \"ICU\",\n\t\t...options\n\t});\n\tconst encodedOptions = {\n\t\t...options,\n\t\t$_source,\n\t\t$_hash\n\t};\n\tconst optionsEncoding = encode(JSON.stringify(encodedOptions));\n\treturn `${interpolatedString}:${optionsEncoding}`;\n}\n//#endregion\nexport { declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocale, getLocaleProperties, getLocales, getVersionId, gtFallback, mFallback, msg, t };\n\n//# sourceMappingURL=index.mjs.map","import React from 'react';\n\n/**\n * Marks JSX children as derivable by the GT compiler and CLI.\n *\n * Use `<Derive>` inside translated JSX when child content is computed from\n * source code, but should still be discovered during extraction instead of\n * treated as a runtime interpolation variable. The CLI attempts to resolve the\n * derivable children into every possible static value and includes those values\n * in the source content that gets translated.\n *\n * `<Derive>` renders its children unchanged at runtime.\n *\n * Run `gt validate` after adding or changing `<Derive>` usage to verify that\n * each derivable expression can be resolved by the CLI before translating or\n * building.\n *\n * @example\n * ```jsx\n * function getSubject() {\n * return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n * }\n * ...\n * <T>\n * <Derive>\n * {getSubject()}\n * </Derive>\n * is going to school today.\n * </T>\n * ```\n *\n * @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.\n * @returns {T} The same children, unchanged at runtime.\n */\nfunction Derive<T extends React.ReactNode>({ children }: { children: T }): T {\n return children;\n}\n\n/**\n * @deprecated Use `<Derive>` instead.\n *\n * Marks JSX children as derivable by the GT compiler and CLI.\n *\n * Use `<Derive>` instead of `<Static>` for new code. This alias is kept for\n * backwards compatibility and renders its children unchanged at runtime.\n *\n * Run `gt validate` after adding or changing derived JSX content to verify that\n * each derivable expression can be resolved by the CLI before translating or\n * building.\n *\n * @example\n * ```jsx\n * function getSubject() {\n * return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n * }\n * ...\n * <T>\n * <Static>\n * {getSubject()}\n * </Static>\n * is going to school today.\n * </T>\n * ```\n *\n * @param {T extends React.ReactNode} children - JSX content to derive for translation extraction.\n * @returns {T} The same children, unchanged at runtime.\n */\nfunction Static<T extends React.ReactNode>(props: { children: T }): T {\n return Derive(props);\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nDerive._gtt = 'derive';\nStatic._gtt = 'derive';\n\nexport { Derive, Static };\n","import { createContext, useContext } from 'react';\nimport { GTContextType } from '../types-dir/context';\n\nexport const GTContext = createContext<GTContextType | undefined>(undefined);\n\nexport default function useGTContext(\n errorString = 'useGTContext() must be used within a <GTProvider>!'\n): GTContextType {\n const context = useContext(GTContext);\n if (typeof context === 'undefined') {\n throw new Error(errorString);\n }\n return context;\n}\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<Num>` component renders a formatted number string, allowing customization of the name, default value, and formatting options.\n * It formats the number according to the current locale and optionally passed formatting options.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <Num\n * options={{ style: \"decimal\", maximumFractionDigits: 2 }}\n * >\n * 1000\n * </Num>\n * ```\n *\n * @param {number | string | null | undefined} children - Content to render inside the number component.\n * @param {string[]} [locales] - Optional locales to use for number formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.\n * @returns {React.JSX.Element} The formatted number component.\n */\nfunction Num({\n children,\n locales,\n options = {},\n}: {\n children: number | string | null | undefined;\n name?: string;\n locales?: string[];\n options?: Intl.NumberFormatOptions; // Optional options for the number formatting\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n\n let renderedValue: string | number =\n typeof children === 'string' ? parseFloat(children) : children;\n if (typeof renderedValue === 'number') {\n if (!locales) {\n locales ||= [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n // Using Intl.NumberFormat for consistent number formatting\n renderedValue = gt.formatNum(renderedValue, { locales, ...options });\n }\n return <>{renderedValue}</>;\n}\n/** @internal _gtt - The GT transformation for the component. */\nNum._gtt = 'variable-number';\n\nexport default Num;\n","import React from 'react';\n\n/**\n * The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.\n * If `children` is provided, it will be used; otherwise, the `value` is rendered.\n *\n * @example Inline usage:\n * ```jsx\n * function MyComponent() {\n * const name = 'Archie';\n * return (\n * <T>\n * <p>\n * Hello, <Var> {name} </Var>!\n * </p>\n * </T>\n * );\n * }\n * ```\n *\n *\n * @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.\n * @returns {JSX.Element} The rendered variable component with either `children` or `value`.\n */\nfunction Var({\n children,\n}: {\n children?: unknown;\n name?: string;\n}): React.JSX.Element | null {\n return <>{children}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nVar._gtt = 'variable-variable';\n\nexport default Var;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <Currency currency=\"USD\">\n * 1000\n * </Currency>\n * ```\n *\n * @param {number | string | null | undefined} children - Content to render inside the currency component.\n * @param {string} [currency=\"USD\"] - The currency type (e.g., USD, EUR, etc.).\n * @param {string[]} [locales] - Optional locales to use for currency formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options to customize how the currency is displayed.\n * @returns {JSX.Element} The formatted currency component.\n */\nfunction Currency({\n children,\n currency = 'USD',\n locales,\n options = {},\n}: {\n children: number | string | null | undefined;\n currency?: string;\n name?: string;\n locales?: string[];\n options?: Intl.NumberFormatOptions;\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n let renderedValue: string | number =\n typeof children === 'string' ? parseFloat(children) : children;\n if (typeof renderedValue === 'number') {\n if (!locales) {\n locales ||= [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n // Format the value using Intl.NumberFormat\n renderedValue = gt.formatCurrency(renderedValue, currency, {\n locales,\n ...options,\n });\n }\n\n return <>{renderedValue}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nCurrency._gtt = 'variable-currency';\n\nexport default Currency;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.\n * It utilizes the current locale and optional format settings to display the date.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * <DateTime>\n * {new Date()}\n * </DateTime>\n * ```\n *\n * @param {Date} children - Content to render inside the date component.\n * @param {string[]} [locales] - Optional locales to use for date formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.\n * @returns {JSX.Element} The formatted date or time component.\n */\nfunction DateTime({\n children,\n locales,\n options = {},\n}: {\n children: Date | null | undefined;\n name?: string;\n locales?: string[];\n options?: Intl.DateTimeFormatOptions; // Optional formatting options for the date\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n if (children == null) return null;\n const gt = context?.gt || new GT();\n\n if (!locales) {\n locales = [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n const result = gt\n .formatDateTime(children, { locales, ...options })\n .replace(/[\\u200F\\u202B\\u202E]/g, '');\n\n // Note: This component may cause hydration errors when the output differs\n // between server and client (e.g., different timezones or locales).\n // We cannot use suppressHydrationWarning because this is a purely logical\n // component that returns a text fragment, not a DOM element.\n return <>{result}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nDateTime._gtt = 'variable-datetime';\n\nexport default DateTime;\n","import React, { useContext } from 'react';\nimport { GT } from 'generaltranslation';\nimport { GTContext } from '../provider/GTContext';\n\n/**\n * The `<RelativeTime>` component renders a localized relative time string\n * (e.g., \"2 hours ago\", \"in 3 days\") using `Intl.RelativeTimeFormat`.\n * Must be used inside a `<GTProvider>`.\n *\n * @example\n * ```jsx\n * // Auto-select unit from a Date\n * <RelativeTime date={someDate} />\n * // → \"2 hours ago\"\n * ```\n *\n * @example\n * ```jsx\n * // Explicit value and unit\n * <RelativeTime value={-1} unit=\"day\" />\n * // → \"yesterday\"\n * ```\n *\n * @param {Date} [date] - A date to compute relative time from now. Mutually exclusive with `value`/`unit`.\n * @param {number} [value] - Explicit numeric value for relative time. Requires `unit`.\n * @param {Intl.RelativeTimeFormatUnit} [unit] - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year'). Required when using `value`.\n * @param {string} [name] - Optional name for the variable, used by the GT CLI for additional context during extraction.\n * @param {string[]} [locales] - Optional locales for formatting. If wrapped in a `<GTProvider>`, the user's locale is used.\n * @param {Intl.RelativeTimeFormatOptions} [options={}] - Optional formatting options following `Intl.RelativeTimeFormatOptions`.\n * @returns {JSX.Element | null} The formatted relative time string.\n */\nfunction RelativeTime({\n date,\n children,\n value,\n unit,\n baseDate,\n locales,\n options = {},\n}: {\n date?: Date | null | undefined;\n children?: Date | null | undefined;\n /** Used by the GT CLI for additional context during extraction. */\n name?: string;\n value?: number;\n unit?: Intl.RelativeTimeFormatUnit;\n /** Base date for computing relative time. Defaults to `new Date()` at render time. Required for hydration safety. */\n baseDate?: Date;\n locales?: string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): React.JSX.Element | null {\n const context = useContext(GTContext);\n const gt = context?.gt || new GT();\n\n if (!locales) {\n locales = [];\n if (context?.locale) locales.push(context.locale);\n if (context?.defaultLocale) locales.push(context.defaultLocale);\n }\n\n // Resolve the date from either `date` prop or `children` (for backwards compat)\n const resolvedDate = date ?? children;\n\n if (process.env.NODE_ENV === 'development' && value !== undefined && !unit) {\n // eslint-disable-next-line no-console\n console.warn(\n '<RelativeTime>: `value` was provided without `unit`. The `value` prop will be ignored.'\n );\n }\n\n let result: string;\n\n if (value !== undefined && unit) {\n // Explicit value + unit mode\n result = gt.formatRelativeTime(value, unit, {\n locales,\n numeric: options.numeric,\n style: options.style,\n localeMatcher: options.localeMatcher,\n });\n } else if (resolvedDate != null) {\n // Auto-select unit from Date\n result = gt.formatRelativeTimeFromDate(resolvedDate, {\n locales,\n baseDate: baseDate ?? new Date(),\n numeric: options.numeric,\n style: options.style,\n localeMatcher: options.localeMatcher,\n });\n } else {\n return null;\n }\n\n // Note: This component may cause hydration errors when the output differs\n // between server and client (e.g., relative time changing between render passes).\n // We cannot use suppressHydrationWarning because this is a purely logical\n // component that returns a text fragment, not a DOM element.\n return <>{result}</>;\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nRelativeTime._gtt = 'variable-relative-time';\n\nexport default RelativeTime;\n","import Num from '../variables/Num';\nimport Var from '../variables/Var';\nimport Currency from '../variables/Currency';\nimport DateTime from '../variables/DateTime';\nimport RelativeTime from '../variables/RelativeTime';\nimport { RelativeTimeFormatOptions, RenderVariable } from '../types-dir/types';\n\nconst renderVariable: RenderVariable = ({\n variableType,\n variableValue,\n variableOptions,\n}) => {\n if (variableType === 'n') {\n const numOptions = variableOptions as Intl.NumberFormatOptions | undefined;\n const numValue =\n typeof variableValue === 'string' || typeof variableValue === 'number'\n ? variableValue\n : variableValue == null\n ? variableValue\n : undefined;\n return <Num options={numOptions}>{numValue}</Num>;\n } else if (variableType === 'd') {\n const dateTimeOptions = variableOptions as\n | Intl.DateTimeFormatOptions\n | undefined;\n const dateValue = variableValue instanceof Date ? variableValue : undefined;\n return <DateTime options={dateTimeOptions}>{dateValue}</DateTime>;\n } else if (variableType === 'c') {\n const currencyOptions = variableOptions as\n | Intl.NumberFormatOptions\n | undefined;\n const currencyValue =\n typeof variableValue === 'string' || typeof variableValue === 'number'\n ? variableValue\n : variableValue == null\n ? variableValue\n : undefined;\n return <Currency options={currencyOptions}>{currencyValue}</Currency>;\n } else if (variableType === 'rt') {\n // RelativeTime supports two modes:\n // 1. value + unit (e.g., value=-3, unit=\"hour\") — explicit relative time\n // 2. date (Date object) — auto-select unit from date difference\n const relativeTimeOptions = variableOptions as\n | RelativeTimeFormatOptions\n | undefined;\n if (typeof variableValue === 'number' && relativeTimeOptions?.unit) {\n return (\n <RelativeTime\n value={variableValue}\n unit={relativeTimeOptions.unit}\n baseDate={relativeTimeOptions?.baseDate}\n options={relativeTimeOptions}\n />\n );\n }\n const dateValue =\n variableValue instanceof Date\n ? variableValue\n : typeof variableValue === 'string' || typeof variableValue === 'number'\n ? new Date(variableValue)\n : undefined;\n return (\n <RelativeTime\n date={dateValue && !isNaN(dateValue.getTime()) ? dateValue : undefined}\n baseDate={relativeTimeOptions?.baseDate}\n options={relativeTimeOptions}\n />\n );\n }\n return <Var>{variableValue}</Var>;\n};\nexport default renderVariable;\n","// dangerouslyUseable.ts\n// A tiny Suspense-compatible cache for client-created promises.\n// Works with React 19's `use()` and <Suspense/>, but is *not* officially supported.\n// Caveats: dev-only behavior/warnings may change across React minors.\n\nexport type CacheKey =\n | string\n | number\n | symbol\n | ReadonlyArray<unknown>\n | Readonly<Record<string, unknown>>;\n\ntype Status = 'pending' | 'fulfilled' | 'rejected';\n\nexport type Thenable<T> = Promise<T> & {\n status?: Status;\n value?: T;\n reason?: unknown;\n};\n\ntype Cell<T> = {\n thenable: Thenable<T>;\n createdAt: number;\n expiresAt: number; // ms epoch\n};\n\nexport type UseableOptions = {\n /** How long to keep a resolved/rejected promise before it’s eligible for GC. Default: Infinity */\n ttl?: number;\n /** Provide your own Map if you want scoping or SSR hydration games. */\n cache?: Map<string, Cell<unknown>>;\n};\n\nconst DEFAULT_TTL = Number.POSITIVE_INFINITY;\nconst REGISTRY_KEY = '__DANGEROUS_USE_REGISTRY__';\n\ntype GlobalRegistry = typeof globalThis & {\n [REGISTRY_KEY]?: Map<string, Cell<unknown>>;\n};\n\n// Module-scoped cache; you can pass your own via options.\nconst registryGlobal = globalThis as GlobalRegistry;\nconst globalRegistry: Map<string, Cell<unknown>> = registryGlobal[\n REGISTRY_KEY\n] ?? (registryGlobal[REGISTRY_KEY] = new Map());\n\n/** Stable-ish stringify for keys. */\nfunction stableStringify(x: unknown, seen = new WeakSet<object>()): string {\n const t = typeof x;\n if (x == null || t === 'number' || t === 'boolean' || t === 'bigint')\n return String(x);\n if (t === 'string') return JSON.stringify(x);\n if (t === 'symbol') return `:sym(${(x as symbol).description ?? ''})`;\n if (t === 'function') return `:fn(${(x as Function).name || 'anon'})`;\n if (Array.isArray(x))\n return `[${x.map((v) => stableStringify(v, seen)).join(',')}]`;\n if (t === 'object') {\n const obj = x as Record<string, unknown>;\n if (seen.has(obj)) return ':circular';\n seen.add(obj);\n const keys = Object.keys(obj).sort();\n const body = keys\n .map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`)\n .join(',');\n seen.delete(obj);\n return `{${body}}`;\n }\n return String(x);\n}\n\nfunction keyToString(key: CacheKey): string {\n if (\n typeof key === 'string' ||\n typeof key === 'number' ||\n typeof key === 'symbol'\n ) {\n return String(key);\n }\n return stableStringify(key);\n}\n\n/** Mark a native promise with status/value/reason and return it as a Thenable. */\nfunction instrument<T>(p: Promise<T>): Thenable<T> {\n const t = p as Thenable<T>;\n if (t.status == null) {\n t.status = 'pending';\n p.then(\n (v) => {\n t.status = 'fulfilled';\n t.value = v;\n },\n (e) => {\n t.status = 'rejected';\n t.reason = e;\n }\n );\n }\n return t;\n}\n\n/**\n * Create or load a cached thenable for use() *even if* it's created during render.\n * On first call (per key), invokes `create()`, instruments the promise,\n * caches it, and returns the same thenable instance forever (or until invalidated / TTL elapses).\n */\nexport function useable<T>(\n key: CacheKey,\n create: () => Promise<T>,\n opts?: UseableOptions\n): Thenable<T> {\n const registry = opts?.cache ?? globalRegistry;\n const now = Date.now();\n const ttl = opts?.ttl ?? DEFAULT_TTL;\n const k = keyToString(key);\n\n const hit = registry.get(k);\n if (hit && hit.expiresAt > now) return hit.thenable as Thenable<T>;\n\n // Miss (or expired): create once and cache\n const base = create();\n const thenable = instrument(base);\n const cell: Cell<T> = {\n thenable,\n createdAt: now,\n expiresAt: now + ttl,\n };\n registry.set(k, cell);\n\n if (ttl !== Infinity) {\n // Optional post-set cleanup: once settled, schedule removal after TTL.\n const cleanup = () => {\n const latest = registry.get(k);\n if (latest && latest.thenable === thenable) {\n setTimeout(\n () => {\n const stillLatest = registry.get(k);\n if (stillLatest && stillLatest.thenable === thenable) {\n registry.delete(k);\n }\n },\n Math.max(0, ttl)\n );\n }\n };\n thenable.then(cleanup, cleanup);\n }\n\n return thenable;\n}\n\n/** Kick off work early without reading. */\nexport function preload<T>(\n key: CacheKey,\n create: () => Promise<T>,\n opts?: UseableOptions\n): void {\n void useable(key, create, opts);\n}\n\n/** Invalidate a key; the next call will recreate the promise. */\nexport function invalidate(key: CacheKey, opts?: UseableOptions): void {\n const registry = opts?.cache ?? globalRegistry;\n registry.delete(keyToString(key));\n}\n\n/** If resolved, synchronously read the cached value without suspending. */\nexport function peek<T>(key: CacheKey, opts?: UseableOptions): T | undefined {\n const registry = opts?.cache ?? globalRegistry;\n const cell = registry.get(keyToString(key));\n const t = cell?.thenable as Thenable<T> | undefined;\n return t?.status === 'fulfilled' ? t.value : undefined;\n}\n\n/**\n * ⚠️ DEV-ONLY: Mute React’s \"uncached promise\" console warning.\n * You should NOT need this if you use `useable()` correctly, but… you asked for risky.\n */\nexport function muteReactUncachedPromiseWarning(enable = true): void {\n if (typeof window === 'undefined') return; // only patch in browser\n const CONSOLE_FLAG = '__DANGEROUS_MUTE_REACT_UNCACHED_PROMISE__';\n const pattern = /A component was suspended by an uncached promise/i;\n const patchedConsole = console as Console & Record<string, unknown>;\n if (enable) {\n if (!patchedConsole[CONSOLE_FLAG]) {\n const originalError = console.error.bind(console);\n patchedConsole[CONSOLE_FLAG] = true;\n console.error = (...args: unknown[]) => {\n if (typeof args[0] === 'string' && pattern.test(args[0])) return;\n originalError(...args);\n };\n }\n } else if (patchedConsole[CONSOLE_FLAG]) {\n // There is no safe way to restore the original without storing it;\n // If you need toggling, store and restore explicitly.\n }\n}\n","// The code in this file is adapted from gt-next's React 18/19 compatibility shim.\n// It avoids statically importing `use` from React so bundlers don't attempt\n// to resolve a non-existent named export in React 18.\n\nimport * as React from 'react';\n\n// `use` is only officially available in React 19. Some environments (e.g. Next)\n// vendor it earlier, but plain React 18 does not export it.\n// Use an opaque property access to prevent bundlers from rewriting\n// this into a static named import.\nlet reactUse: typeof React.use | undefined;\ntry {\n // Indirect property access via Function constructor avoids static analysis.\n const getProp = Function('o', 'k', 'return o[k]') as (\n o: unknown,\n k: string\n ) => unknown;\n reactUse = getProp(React as unknown, 'use') as typeof React.use | undefined;\n} catch {\n // ignore\n}\n\nexport default reactUse;\n","import React, { Suspense } from 'react';\nimport renderDefaultChildren from '../rendering/renderDefaultChildren';\nimport { addGTIdentifier, writeChildrenAsObjects } from '../internal';\nimport useGTContext from '../provider/GTContext';\nimport renderTranslatedChildren from '../rendering/renderTranslatedChildren';\nimport { useMemo } from 'react';\nimport renderVariable from '../rendering/renderVariable';\nimport { hashSource } from 'generaltranslation/id';\nimport renderSkeleton from '../rendering/renderSkeleton';\nimport { TranslatedChildren } from '../types-dir/types';\nimport { useable } from '../promises/dangerouslyUsable';\nimport reactUse from '../utils/use';\n\n/**\n * Build-time translation component that renders its children in the user's given locale.\n *\n * @example\n * ```jsx\n * // Basic usage:\n * <T id=\"welcome_message\">\n * Hello, <Var>{name}</Var>!\n * </T>\n * ```\n *\n * @example\n * ```jsx\n * // Translating a plural\n * <T id=\"item_count\">\n * <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>\n * You have <Num children={n}/> items.\n * </Plural>\n * </T>\n * ```\n *\n * @param {React.ReactNode} children - The content to be translated or displayed.\n * @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.\n * @param {any} [context] - Additional context for translation key generation.\n *\n * @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.\n *\n * @throws {Error} If a plural translation is requested but the `n` option is not provided.\n */\nfunction T({\n children,\n id,\n context,\n _hash,\n ...options\n}: {\n children: React.ReactNode;\n id?: string;\n context?: string;\n _hash?: string;\n $id?: string;\n $context?: string;\n $maxChars?: number;\n [key: string]: unknown;\n}): React.JSX.Element | undefined {\n if (!children) return undefined;\n\n // Compatibility with different options\n id = id ?? options?.$id;\n context = context ?? options?.$context;\n const maxChars =\n typeof options?.$maxChars === 'number' ? options.$maxChars : undefined;\n\n const {\n translations,\n translationRequired,\n developmentApiEnabled,\n dialectTranslationRequired,\n registerJsxForTranslation,\n renderSettings,\n locale,\n defaultLocale,\n } = useGTContext(`<T> used on the client-side outside of <GTProvider>`);\n\n const taggedChildren = useMemo(() => addGTIdentifier(children), [children]);\n\n // ----- FETCH TRANSLATION ----- //\n\n // Dependency flag to avoid recalculating hash whenever translation object changes\n\n let translationEntry: TranslatedChildren | null | undefined;\n\n if (id) {\n translationEntry = translations?.[id];\n }\n\n if (typeof translationEntry === 'undefined' && _hash) {\n translationEntry = translations?.[_hash];\n }\n\n // Calculate necessary info for fetching translation / generating translation\n const [childrenAsObjects, hash] = useMemo(() => {\n // skip hashing:\n if (\n !translationRequired || // Translation not required\n translationEntry // Translation already exists under the id\n ) {\n return [undefined, ''];\n }\n // calculate hash\n const childrenAsObjects = writeChildrenAsObjects(taggedChildren);\n const hash: string = hashSource({\n source: childrenAsObjects,\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(id && { id }),\n dataFormat: 'JSX',\n });\n return [childrenAsObjects, hash];\n }, [\n taggedChildren,\n context,\n id,\n maxChars,\n translationRequired,\n translationEntry,\n ]);\n\n // get translation entry on hash\n if (typeof translationEntry === 'undefined') {\n translationEntry = translations?.[hash];\n }\n\n // ----- RENDER METHODS ----- //\n\n // for default/fallback rendering\n const renderDefault = () => {\n return renderDefaultChildren({\n children: taggedChildren,\n defaultLocale,\n renderVariable,\n });\n };\n\n const renderTranslation = (target: TranslatedChildren) => {\n return renderTranslatedChildren({\n source: taggedChildren,\n target,\n locales: [locale, defaultLocale],\n renderVariable,\n });\n };\n\n // ----- RENDER BEHAVIOR ----- //\n\n // Fallback if:\n if (\n !translationRequired || // no translation required\n // !translationEnabled || // translation not enabled\n (translations && !translationEntry && !developmentApiEnabled) || // cache miss and dev runtime translation disabled (production)\n translationEntry === null // error fetching translation\n ) {\n return <>{renderDefault()}</>;\n }\n\n if (translationEntry) {\n return (\n <Suspense fallback={renderTranslation(translationEntry)}>\n {renderTranslation(translationEntry)}\n </Suspense>\n );\n }\n\n const getTranslationPromise = async () => {\n if (\n !developmentApiEnabled || // runtime translation disabled\n !locale // locale not loaded\n ) {\n return renderDefault();\n }\n if (translationEntry) return renderTranslation(translationEntry);\n try {\n const translatedChildren = await registerJsxForTranslation({\n source: childrenAsObjects,\n targetLocale: locale,\n metadata: {\n id,\n hash,\n context,\n ...(maxChars != null && { maxChars }),\n },\n });\n if (!translatedChildren) return renderDefault();\n return renderTranslation(translatedChildren);\n } catch (error) {\n console.warn(error);\n return renderDefault();\n }\n };\n\n if (reactUse) {\n const resolvedTranslation = reactUse(\n useable(\n [\n 'getTranslationPromise', // prefix key\n developmentApiEnabled,\n JSON.stringify(childrenAsObjects),\n locale,\n id,\n hash,\n context,\n maxChars,\n ],\n () => getTranslationPromise()\n )\n );\n return (\n <Suspense fallback={resolvedTranslation}>{resolvedTranslation}</Suspense>\n );\n }\n\n let loadingFallback;\n if (renderSettings.method === 'skeleton') {\n loadingFallback = renderSkeleton();\n } else if (renderSettings.method === 'replace') {\n loadingFallback = renderDefault();\n } else {\n // default\n loadingFallback = dialectTranslationRequired\n ? renderDefault()\n : renderSkeleton();\n }\n\n return (\n <Suspense fallback={loadingFallback}>{getTranslationPromise()}</Suspense>\n );\n}\n/** @internal _gtt - The GT transformation for the component. */\nT._gtt = 'translate-client';\n\nexport default T;\n","import useGTContext from '../../provider/GTContext';\nimport { _Messages, Translations } from '../../types-dir/types';\nimport { useable } from '../../promises/dangerouslyUsable';\nimport { useCallback } from 'react';\nimport reactUse from '../../utils/use';\n\n/**\n * Gets the translation function `gt` provided by `<GTProvider>`.\n *\n * @returns {Function} A translation function that accepts an ICU message format string and returns the translation of that string.\n *\n * @example\n * const gt = useGT();\n * console.log(gt('To be or not to be...'));\n *\n * @example\n * const gt = useGT();\n * gt('My name is {customName}', { customName: \"Brian\", id: 'my-name', context: 'a proper noun' } )\n */\nexport default function useGT(_messages?: _Messages) {\n const {\n developmentApiEnabled,\n translationRequired,\n _preloadMessages,\n _filterMessagesForPreload,\n _gtFunction,\n locale,\n } = useGTContext(\n `useGT(): No context provided. You're trying to get the gt() function from the useGT() hook, which can be called within a <GTProvider>.`\n );\n\n let preloadedTranslations: Translations | undefined;\n if (_messages && reactUse && developmentApiEnabled && translationRequired) {\n const untranslatedMessages = _filterMessagesForPreload(_messages);\n if (untranslatedMessages.length > 0) {\n preloadedTranslations = reactUse(\n useable(\n [\n '_preloadMessages', // prefix key\n locale, // should change on locale\n JSON.stringify(untranslatedMessages), // should change when messages change\n ],\n () => _preloadMessages(untranslatedMessages)\n )\n );\n }\n }\n\n function _gt(\n string: string,\n options: Record<string, unknown> & {\n $id?: string;\n $context?: string;\n $maxChars?: number;\n $_hash?: string;\n } = {}\n ): string {\n return _gtFunction(string, options, preloadedTranslations);\n }\n\n /**\n * @param {string} message\n * @param {InlineTranslationOptions} options Interpolated variables and translation context.\n * @param {string} [options.$context] - Additional context for the translation.\n * @param {string} [options.$id] - Optional identifier for the translation string.\n * @param {number} [options.$maxChars] - Maximum number of characters for the translated message.\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @returns The translated version of content\n *\n * @example\n * gt('Hello, world!'); // Translates 'Hello, world!'\n *\n * @example\n * // With a context and a custom identifier:\n * gt('My name is {name}', { name: \"John\", $context: 'name is a proper noun' } )); // Translates 'My name is {name}' and replaces {name} with 'John'\n */\n const gt = useCallback(_gt, [preloadedTranslations, _gtFunction]);\n\n return gt;\n}\n","import useGTContext from '../../provider/GTContext';\n\n/**\n * Gets the dictionary access function `t` provided by `<GTProvider>`.\n *\n * @param {string} [id] - Optional prefix to prepend to the translation keys.\n * @returns {Function} A translation function that accepts a key string and returns the translated value.\n *\n * @example\n * const t = useTranslations('user');\n * console.log(t('name')); // Translates item 'user.name'\n *\n * const t = useTranslations();\n * console.log(t('hello')); // Translates item 'hello'\n */\nexport default function useTranslations(id?: string): ((\n id: string,\n options?: Record<string, unknown>\n) => string) & {\n obj: (id: string, options?: Record<string, unknown>) => unknown | undefined;\n} {\n // Create a prefix for translation keys if an id is provided\n const getId = (suffix: string) => {\n return id ? `${id}.${suffix}` : suffix;\n };\n\n // Get the translation context\n const { _dictionaryFunction, _dictionaryObjFunction } = useGTContext(\n `useTranslations('${id}'): No context provided. You're trying to get the t() function on the client, which can only be done inside a <GTProvider>.`\n );\n\n /**\n * @description A function that translates a dictionary entry based on its `id` and options.\n * @param {string} id The identifier of the dictionary entry to translate.\n * @param {DictionaryTranslationOptions} options for translating strings.\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @param {number} [options.$maxChars] - Maximum number of characters for the translated message.\n * @returns The translated version of the dictionary entry.\n *\n * @example\n * t('greetings.greeting1'); // Translates item in dictionary under greetings.greeting1\n *\n * @example\n * // dictionary entry\n * {\n * greetings: {\n * greeting2: \"Hello, {name}!\"\n * greeting3: [\"Hi, {name}!\", { $context: 'an informal greeting' }]\n * }\n * }\n *\n * // Translates item in dictionary under greetings.greeting2 and replaces {name} with 'John'\n * t('greetings.greeting2', { name: 'John' });\n *\n * // Translates item in dictionary under greetings.greeting3 and replaces {name} with 'John'\n * t('greetings.greeting3', { name: 'John' });\n */\n function t(id: string, options: Record<string, unknown> = {}): string {\n const prefixedId = getId(id);\n return _dictionaryFunction(prefixedId, options);\n }\n\n function obj(\n id: string,\n options: Record<string, unknown> = {}\n ): unknown | undefined {\n const prefixedId = getId(id);\n return _dictionaryObjFunction(id, prefixedId, options);\n }\n\n t.obj = obj;\n\n return t;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the application's default locale from the `<GTProvider>` context.\n *\n * If no default locale is passed to the `<GTProvider>`, it defaults to providing 'en'.\n *\n * @returns {string} The application's default locale, e.g., 'en-US'.\n *\n * @example\n * const locale = useDefaultLocale();\n * console.log(locale); // 'en-US'\n */\nexport default function useDefaultLocale(): string {\n return useGTContext(\n 'useDefaultLocale(): Unable to access default locale outside of a <GTProvider>'\n ).defaultLocale;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the user's locale from the `<GTProvider>` context.\n *\n * @returns {string} The user's locale, e.g., 'en-US'.\n *\n * @example\n * const locale = useLocale();\n * console.log(locale); // 'en-US'\n */\nexport default function useLocale(): string {\n return useGTContext(\n \"useLocale(): Unable to access user's locale outside of a <GTProvider>\"\n ).locale;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the version ID from the `<GTProvider>` context.\n *\n * @returns {string | undefined} The version ID for the current source, if set.\n *\n * @example\n * const versionId = useVersionId();\n * console.log(versionId); // 'abc123'\n */\nexport default function useVersionId(): string | undefined {\n return useGTContext(\n 'useVersionId(): Unable to access version ID outside of a <GTProvider>'\n )._versionId;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * A React hook that retrieves the user's currently selected region from the `<GTProvider>` context.\n *\n * Returns the `region` value as a string (e.g., `\"US\"`, `\"CA\"`) or `undefined` if no region has been set.\n *\n * @returns {string | undefined} The currently active region code, or `undefined` if not set.\n *\n * @example\n * ```tsx\n * const region = useRegion();\n *\n * if (!region) {\n * console.log(\"No region set yet\");\n * } else {\n * console.log(`Current region: ${region}`);\n * }\n * ```\n */\nexport default function useRegion(): string | undefined {\n return useGTContext(\n \"useRegion(): Unable to access user's region outside of a <GTProvider>\"\n ).region;\n}\n","import * as React from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n dynamicTranslationError,\n createGenericRuntimeTranslationError,\n runtimeTranslationTimeoutWarning,\n} from '../../errors-dir/createErrors';\nimport {\n RenderMethod,\n TranslatedChildren,\n Translations,\n} from '../../types-dir/types';\nimport {\n TranslateIcuCallback,\n TranslateChildrenCallback,\n} from '../../types-dir/runtime';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport {\n maxConcurrentRequests,\n maxBatchSize,\n batchInterval,\n} from '../config/defaultProps';\nimport { GT } from 'generaltranslation';\nimport type { TranslateManyEntry } from 'generaltranslation/types';\n\ntype TranslationRequestMetadata = {\n hash: string;\n id?: string;\n context?: string;\n maxChars?: number;\n [attr: string]: unknown;\n};\n\ntype TranslationRequestQueueItem =\n | {\n dataFormat: 'ICU';\n source: string;\n metadata: TranslationRequestMetadata;\n resolve: (value: TranslatedChildren) => void;\n reject: (error: unknown) => void; // kept for API compatibility (unused after change)\n }\n | {\n dataFormat: 'JSX';\n source: JsxChildren;\n metadata: TranslationRequestMetadata;\n resolve: (value: TranslatedChildren) => void;\n reject: (error: unknown) => void; // kept for API compatibility (unused after change)\n };\n\nexport default function useRuntimeTranslation({\n gt,\n locale,\n versionId: _versionId, // kept for API compatibility (not used)\n defaultLocale,\n runtimeUrl,\n renderSettings,\n setTranslations,\n environment,\n ...additionalMetadata\n}: {\n gt: GT;\n locale: string;\n versionId?: string;\n defaultLocale?: string;\n runtimeUrl?: string | null;\n renderSettings: {\n method: RenderMethod;\n timeout?: number;\n };\n environment: 'development' | 'production' | 'test';\n setTranslations: React.Dispatch<React.SetStateAction<Translations | null>>;\n [key: string]: unknown;\n}): {\n registerIcuForTranslation: TranslateIcuCallback;\n registerJsxForTranslation: TranslateChildrenCallback;\n developmentApiEnabled: boolean;\n} {\n // ------ EARLY RETURN IF DISABLED ----- //\n const developmentApiEnabled =\n !!gt.projectId &&\n !!runtimeUrl &&\n !!gt.devApiKey &&\n environment === 'development';\n\n if (!developmentApiEnabled) {\n const disabledError = (fn: string) =>\n Promise.reject(\n new Error(`${fn}() failed because translation is disabled`)\n );\n return {\n developmentApiEnabled,\n registerIcuForTranslation: () =>\n disabledError('registerIcuForTranslation'),\n registerJsxForTranslation: () =>\n disabledError('registerJsxForTranslation'),\n };\n }\n\n // ---------- CONFIG SNAPSHOT (stable via ref, updated each render) ---------- //\n const cfgRef = useRef({\n gt,\n locale,\n baseMetadata: {\n ...additionalMetadata,\n projectId: gt.projectId,\n sourceLocale: defaultLocale,\n },\n timeout: renderSettings.timeout,\n });\n cfgRef.current.gt = gt;\n cfgRef.current.locale = locale;\n cfgRef.current.baseMetadata = {\n ...additionalMetadata,\n projectId: gt.projectId,\n sourceLocale: defaultLocale,\n };\n cfgRef.current.timeout = renderSettings.timeout;\n\n // ---------- LIFECYCLE & STAGING (avoid setState before mount) ---------- //\n const mountedRef = useRef(false);\n const stagedResultsRef = useRef<Translations | null>(null);\n const [flushTick, setFlushTick] = useState(0);\n\n const mergeIntoTranslations = useCallback(\n (delta: Translations) => {\n setTranslations((prev) => {\n const keys = Object.keys(delta);\n if (keys.length === 0) return prev;\n const next = prev ? { ...prev } : {};\n let changed = false;\n for (const k of keys) {\n const nv = delta[k];\n const pv = prev?.[k];\n if (!Object.is(pv, nv)) {\n next[k] = nv;\n changed = true;\n }\n }\n return changed ? next : prev;\n });\n },\n [setTranslations]\n );\n\n const stageAndRequestFlush = useCallback((delta: Translations) => {\n stagedResultsRef.current = {\n ...stagedResultsRef.current,\n ...delta,\n };\n // Only trigger a state change after mount; before mount, we'll flush on mount.\n if (mountedRef.current) setFlushTick((t) => t + 1);\n }, []);\n\n // Mount/unmount: mark mounted and flush anything staged pre-mount.\n useEffect(() => {\n mountedRef.current = true;\n if (stagedResultsRef.current) {\n const staged = stagedResultsRef.current;\n stagedResultsRef.current = null;\n mergeIntoTranslations(staged);\n }\n return () => {\n mountedRef.current = false;\n };\n }, [mergeIntoTranslations]);\n\n // Perform the actual setTranslations in an effect (runs post-commit).\n useEffect(() => {\n if (!mountedRef.current) return;\n const staged = stagedResultsRef.current;\n if (staged) {\n stagedResultsRef.current = null;\n mergeIntoTranslations(staged);\n }\n }, [flushTick, mergeIntoTranslations]);\n\n // ---------- REQUEST/QUEUE STATE ---------- //\n const activeRequestsRef = useRef(0);\n const requestQueueRef = useRef<Map<string, TranslationRequestQueueItem>>(\n new Map()\n );\n const pendingRequestQueueRef = useRef<\n Map<string, Promise<TranslatedChildren>>\n >(new Map());\n\n // ---------- BATCH SENDER (no state writes here) ---------- //\n const sendBatchRequest = useCallback(\n async (\n batch: Map<string, TranslationRequestQueueItem>\n ): Promise<Translations> => {\n if (batch.size === 0) return {};\n activeRequestsRef.current += 1;\n\n const { gt, locale, baseMetadata, timeout } = cfgRef.current;\n const requests = Array.from(batch.values());\n const newTranslations: Translations = {};\n const resultsMap = new Map<string, TranslatedChildren | null>();\n\n try {\n const requestsRecord: Record<string, TranslateManyEntry> = {};\n for (const req of requests) {\n const { source, metadata } = req;\n requestsRecord[metadata.hash] = {\n source,\n metadata: { ...metadata, dataFormat: req.dataFormat },\n };\n }\n\n const results = await gt.translateMany(\n requestsRecord,\n {\n ...baseMetadata,\n targetLocale: locale,\n },\n timeout\n );\n\n for (const req of requests) {\n const { hash, id } = req.metadata;\n const result = results[hash];\n if (result && result.success) {\n const value = result.translation;\n newTranslations[hash] = value;\n resultsMap.set(hash, value);\n } else if (result && result.error) {\n console.warn(\n createGenericRuntimeTranslationError(\n id,\n hash,\n result.error || 'An upstream error occurred.'\n )\n );\n newTranslations[hash] = null;\n resultsMap.set(hash, null);\n } else {\n console.warn(\n createGenericRuntimeTranslationError(\n id,\n hash,\n 'Unknown response format'\n ),\n result\n );\n newTranslations[hash] = null;\n resultsMap.set(hash, null);\n }\n }\n } catch (e: unknown) {\n if (\n typeof e === 'object' &&\n e !== null &&\n 'name' in e &&\n e.name === 'AbortError'\n ) {\n console.warn(runtimeTranslationTimeoutWarning);\n } else {\n console.warn(dynamicTranslationError, e);\n }\n // Mark every request in this batch as null, and warn.\n requests.forEach((r) => {\n newTranslations[r.metadata.hash] = null;\n resultsMap.set(r.metadata.hash, null);\n });\n } finally {\n activeRequestsRef.current -= 1;\n // Resolve the promises for this batch (never reject).\n requests.forEach((r) => {\n const res = resultsMap.get(r.metadata.hash);\n if (res === undefined) {\n console.warn(\n `No translation result for ${r.metadata.hash}; resolving as null.`\n );\n r.resolve(null as unknown as TranslatedChildren);\n } else {\n r.resolve(res as TranslatedChildren);\n }\n });\n }\n\n return newTranslations;\n },\n []\n );\n\n // ---------- TIMER-DRIVEN FLUSHER (no polling effect) ---------- //\n const flushTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const tickRef = useRef<() => Promise<void>>(async () => {});\n\n const stageAndScheduleNext = useCallback(\n (batchResult: Translations) => {\n // Stage results and request the commit effect to run\n stageAndRequestFlush(batchResult);\n\n // If more work remains, schedule another flush cycle\n if (requestQueueRef.current.size > 0) {\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n }\n },\n [stageAndRequestFlush]\n );\n\n const installTick = useCallback(() => {\n tickRef.current = async () => {\n // Respect concurrency cap\n if (activeRequestsRef.current >= maxConcurrentRequests) {\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n return;\n }\n\n const q = requestQueueRef.current;\n if (q.size === 0) return;\n\n const batchEntries = Array.from(q.entries()).slice(\n 0,\n Math.min(maxBatchSize, q.size)\n );\n const batch = new Map(batchEntries);\n batchEntries.forEach(([k]) => q.delete(k));\n\n const batchResult = await sendBatchRequest(batch);\n stageAndScheduleNext(batchResult);\n };\n }, [sendBatchRequest, stageAndScheduleNext]);\n\n const scheduleFlush = useCallback(\n (immediate = false) => {\n installTick();\n if (immediate) {\n if (flushTimerRef.current) {\n clearTimeout(flushTimerRef.current);\n flushTimerRef.current = null;\n }\n void tickRef.current(); // Safe pre-mount: will only stage results\n return;\n }\n if (flushTimerRef.current) return; // already armed\n flushTimerRef.current = setTimeout(() => {\n flushTimerRef.current = null;\n void tickRef.current();\n }, batchInterval);\n },\n [installTick]\n );\n\n // ---------- REGISTRATION (returns Promises for Suspense) ---------- //\n const createRegistration = useCallback(\n <T extends 'ICU' | 'JSX'>(dataFormat: T) =>\n (params: {\n source: T extends 'ICU' ? string : JsxChildren | undefined;\n targetLocale: string;\n metadata: TranslationRequestMetadata;\n }): Promise<TranslatedChildren> => {\n const key = `${params.metadata.hash}:${params.targetLocale}`;\n\n const existing = pendingRequestQueueRef.current.get(key);\n if (existing) return existing;\n\n const p = new Promise<TranslatedChildren>((resolve /*, reject */) => {\n const item: TranslationRequestQueueItem =\n dataFormat === 'JSX'\n ? {\n dataFormat: 'JSX',\n source: params.source as JsxChildren,\n metadata: {\n ...params.metadata,\n ...(params.metadata.maxChars != null && {\n maxChars: Math.abs(params.metadata.maxChars),\n }),\n },\n resolve,\n reject: () => {}, // no-op; we no longer reject\n }\n : {\n dataFormat: 'ICU',\n source: params.source as string,\n metadata: {\n ...params.metadata,\n ...(params.metadata.maxChars != null && {\n maxChars: Math.abs(params.metadata.maxChars),\n }),\n },\n resolve,\n reject: () => {}, // no-op; we no longer reject\n };\n\n requestQueueRef.current.set(key, item);\n\n const canFlushNow =\n requestQueueRef.current.size >= maxBatchSize &&\n activeRequestsRef.current < maxConcurrentRequests;\n\n // Kick the scheduler; immediate is safe (no state writes pre-mount)\n scheduleFlush(canFlushNow);\n }).finally(() => {\n pendingRequestQueueRef.current.delete(key);\n });\n\n pendingRequestQueueRef.current.set(key, p);\n return p;\n },\n [scheduleFlush]\n );\n\n const registerIcuForTranslation = useMemo(\n () => createRegistration('ICU'),\n [createRegistration]\n );\n const registerJsxForTranslation = useMemo(\n () => createRegistration('JSX'),\n [createRegistration]\n );\n\n // Cleanup any stray timer on unmount (does not drive batching)\n useEffect(() => {\n return () => {\n if (flushTimerRef.current) clearTimeout(flushTimerRef.current);\n };\n }, []);\n\n return {\n developmentApiEnabled,\n registerIcuForTranslation,\n registerJsxForTranslation,\n };\n}\n","import { hashSource } from 'generaltranslation/id';\nimport {\n InlineTranslationOptions,\n Translations,\n _Messages,\n _Message,\n} from '../../../types-dir/types';\nimport type { StringFormat } from '@generaltranslation/format/types';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport { GT } from 'generaltranslation';\nimport {\n createStringRenderError,\n createStringRenderWarning,\n createStringTranslationError,\n} from '../../../errors-dir/createErrors';\nimport { decodeMsg, decodeOptions } from '../../../messages/messages';\nimport {\n extractVars,\n condenseVars,\n indexVars,\n VAR_IDENTIFIER,\n} from 'generaltranslation/internal';\n\ntype MReturnType<T> = T extends string ? string : T;\n\ntype RenderMessageParams = {\n message: string;\n variables: Record<string, unknown> | undefined;\n locales: string[];\n fallback?: string;\n id?: string;\n maxChars?: number;\n format?: StringFormat;\n};\n\nexport default function useCreateInternalUseGTFunction({\n gt,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment,\n}: {\n gt: GT;\n translations: Translations | null;\n locale: string;\n defaultLocale: string;\n translationRequired: boolean;\n developmentApiEnabled: boolean;\n registerIcuForTranslation: TranslateIcuCallback;\n environment: 'development' | 'production' | 'test';\n}): {\n _gtFunction: (\n message: string,\n options?: InlineTranslationOptions,\n preloadedTranslations?: Translations\n ) => string;\n _mFunction: <T extends string | null | undefined>(\n message: T,\n options?: Record<string, unknown>,\n preloadedTranslations?: Translations\n ) => T extends string ? string : T;\n _filterMessagesForPreload: (_messages: _Messages) => _Messages;\n _preloadMessages: (_messages: _Messages) => Promise<Translations>;\n} {\n // --------- HELPER FUNCTIONS ------- //\n\n /**\n * @description Format message and fallback:\n * (1) format message\n * (2) format fallback\n * (3)\n * - PRODUCTION: return fallback (unformatted)\n * - DEVELOPMENT: throw error\n */\n function renderMessageHelper({\n message,\n variables,\n locales,\n fallback,\n id,\n maxChars,\n format,\n }: RenderMessageParams) {\n try {\n // (1) Try to format message\n const declaredVars = extractVars(fallback || '');\n const formattedMessage = gt.formatMessage(\n Object.keys(declaredVars).length ? condenseVars(message) : message,\n {\n locales,\n variables: {\n ...variables,\n ...declaredVars,\n [VAR_IDENTIFIER]: 'other',\n },\n dataFormat: format,\n }\n );\n // Apply cutoff formatting\n const cutoffMessage = gt.formatCutoff(formattedMessage, { maxChars });\n return cutoffMessage;\n } catch (error) {\n if (environment === 'production') {\n console.warn(createStringRenderWarning(message, id, error));\n } else {\n // (3) If no fallback, throw error (non-prod)\n if (!fallback) {\n throw new Error(createStringRenderError(message, id, error));\n }\n\n console.error(createStringRenderError(message, id, error));\n }\n\n // (2) If format fails, format fallback\n if (fallback) {\n return renderMessageHelper({\n message: fallback,\n locales,\n variables,\n id,\n maxChars,\n });\n }\n\n // (3) Fallback to original message (unformatted)\n const cutoffMessage = gt.formatCutoff(message, { maxChars });\n return cutoffMessage; // fallback to original message (unformatted)\n }\n }\n\n function initializeGT(\n message: string,\n options: Record<string, unknown> & {\n $context?: string;\n $maxChars?: number;\n $id?: string;\n $_hash?: string;\n } = {}\n ) {\n if (!message || typeof message !== 'string') return null;\n\n const {\n $id: id,\n $context: context,\n $maxChars: maxChars,\n $_hash: _hash,\n $format: rawFormat,\n ...variables\n } = options;\n const format =\n typeof rawFormat === 'string' ? (rawFormat as StringFormat) : undefined;\n\n // Update renderContent to use actual variables\n const renderMessage = (\n msg: string,\n locales: string[],\n fallback?: string\n ) => {\n return renderMessageHelper({\n message: msg,\n locales,\n variables,\n id,\n fallback,\n maxChars,\n format,\n });\n };\n\n // Calculate hash\n const calculateHash = () =>\n hashSource({\n source: indexVars(message),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n ...(id && { id }),\n dataFormat: format || 'ICU',\n });\n\n return {\n id,\n context,\n maxChars,\n _hash,\n variables,\n calculateHash,\n renderMessage,\n };\n }\n\n function getTranslationData(\n calculateHash: () => string,\n id?: string,\n _hash?: string\n ) {\n let translationEntry;\n let hash = ''; // empty string because 1) it has to be a string but 2) we don't always need to calculate it\n if (id) {\n translationEntry = translations?.[id];\n }\n if (_hash && typeof translationEntry === 'undefined') {\n hash = _hash;\n translationEntry = translations?.[_hash];\n }\n // Use calculated hash to index\n if (typeof translationEntry === 'undefined') {\n hash = calculateHash();\n translationEntry = translations?.[hash];\n }\n return {\n translationEntry,\n hash,\n };\n }\n\n const _filterMessagesForPreload = (_messages: _Messages): _Messages => {\n const result = [];\n for (const { message, ...options } of _messages) {\n const init = initializeGT(message, options);\n if (!init) continue;\n const { id, _hash, calculateHash } = init;\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n if (!translationEntry) {\n result.push({ message, ...options, $_hash: hash });\n }\n }\n return result;\n };\n\n const _preloadMessages = async (_messages: _Messages) => {\n const preloadedTranslations: Translations = {};\n const preload = async ({ message, ...options }: _Message) => {\n // Setup\n const init = initializeGT(message, options);\n if (!init) return;\n const { id, context, maxChars, _hash, calculateHash } = init;\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n // Return if no translation needed\n if (translationEntry) {\n preloadedTranslations[hash] = translationEntry;\n }\n // Await the creation of the translation\n // Should update the translations object\n preloadedTranslations[hash] = await registerIcuForTranslation({\n source: indexVars(message),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(id && { id }),\n ...(maxChars != null && { maxChars }),\n hash,\n },\n });\n };\n await Promise.all(_messages.map(preload));\n return preloadedTranslations;\n };\n\n const _gtFunction = (\n message: string,\n options: InlineTranslationOptions = {},\n preloadedTranslations: Translations | undefined\n ) => {\n // ----- SET UP ----- //\n const init = initializeGT(message, options);\n if (!init) return '';\n const { id, context, maxChars, _hash, calculateHash, renderMessage } = init;\n\n // ----- EARLY RETURN IF TRANSLATION NOT REQUIRED ----- //\n // Check: translation required\n if (!translationRequired) return renderMessage(message, [defaultLocale]);\n\n // ----- GET TRANSLATION ----- //\n\n const { translationEntry, hash } = getTranslationData(\n calculateHash,\n id,\n _hash\n );\n\n // ----- RENDER TRANSLATION ----- //\n\n if (translationEntry === null) {\n return renderMessage(message, [defaultLocale]);\n }\n\n // If a translation already exists\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n message\n );\n }\n\n if (typeof preloadedTranslations?.[hash] !== 'undefined') {\n if (preloadedTranslations?.[hash]) {\n return renderMessage(\n preloadedTranslations?.[hash] as string,\n [locale, defaultLocale],\n message\n );\n }\n return renderMessage(message, [defaultLocale]);\n }\n\n if (!developmentApiEnabled) {\n console.warn(createStringTranslationError(message, id, 'gt'));\n return renderMessage(message, [defaultLocale]);\n }\n\n registerIcuForTranslation({\n source: indexVars(message),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(id && { id }),\n ...(maxChars != null && { maxChars }),\n hash: hash || '',\n },\n });\n\n return renderMessage(message, [defaultLocale]);\n };\n\n const _mFunction = <T extends string | null | undefined>(\n encodedMsg: T,\n options: Record<string, unknown> = {},\n preloadedTranslations: Translations | undefined\n ): T extends string ? string : T => {\n // Return if message is not a string\n if (!encodedMsg) return encodedMsg as MReturnType<T>;\n\n const decodedOptions = decodeOptions(encodedMsg);\n if (!decodedOptions || !decodedOptions.$_hash || !decodedOptions.$_source) {\n return _gtFunction(\n encodedMsg,\n options,\n preloadedTranslations\n ) as MReturnType<T>;\n }\n\n // Disaggregate options and construct render function\n\n const {\n $_hash,\n $_source,\n $context: context,\n $hash: _$hash,\n $id: _$id,\n $maxChars: maxChars,\n $format: format,\n ...decodedVariables\n } = decodedOptions;\n\n const renderMessage = (\n msg: string,\n locales: string[],\n fallback?: string\n ) => {\n return renderMessageHelper({\n message: msg,\n locales,\n variables: decodedVariables,\n fallback,\n maxChars,\n format,\n });\n };\n\n // Return if default locale\n if (!translationRequired)\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n\n // Check translation entry\n const translationEntry = translations?.[decodedOptions.$_hash];\n\n // Check translations\n if (translationEntry === null) {\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n // If a translation already exists\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n $_source\n ) as MReturnType<T>;\n }\n\n if (!developmentApiEnabled) {\n console.warn(\n createStringTranslationError($_source, decodeMsg(encodedMsg), 'm')\n );\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n if (typeof preloadedTranslations?.[$_hash] !== 'undefined') {\n if (preloadedTranslations?.[$_hash]) {\n return renderMessage(\n preloadedTranslations?.[$_hash] as string,\n [locale, defaultLocale],\n $_source\n ) as MReturnType<T>;\n }\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n }\n\n registerIcuForTranslation({\n source: indexVars($_source),\n targetLocale: locale,\n metadata: {\n ...(context && { context }),\n ...(maxChars != null && { maxChars }),\n hash: $_hash,\n },\n });\n\n return renderMessage($_source, [defaultLocale]) as MReturnType<T>;\n };\n\n return {\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n };\n}\n","import { useCallback } from 'react';\nimport {\n Dictionary,\n DictionaryTranslationOptions,\n Translations,\n} from '../../../types-dir/types';\nimport {\n getDictionaryEntry,\n isValidDictionaryEntry,\n} from '../../../dictionaries/getDictionaryEntry';\nimport getEntryAndMetadata from '../../../dictionaries/getEntryAndMetadata';\nimport {\n createInvalidDictionaryEntryWarning,\n createInvalidIcuDictionaryEntryError,\n createInvalidIcuDictionaryEntryWarning,\n createNoEntryFoundWarning,\n} from '../../../errors-dir/createErrors';\nimport { hashSource } from 'generaltranslation/id';\nimport { GT } from 'generaltranslation';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport {\n extractVars,\n indexVars,\n VAR_IDENTIFIER,\n condenseVars,\n} from 'generaltranslation/internal';\nimport type { StringFormat } from '@generaltranslation/format/types';\n\nexport default function useCreateInternalUseTranslationsFunction(\n gt: GT,\n dictionary: Dictionary | undefined,\n dictionaryTranslations: Dictionary | undefined,\n translations: Translations | null,\n locale: string,\n defaultLocale: string,\n translationRequired: boolean,\n dialectTranslationRequired: boolean,\n developmentApiEnabled: boolean,\n registerIcuForTranslation: TranslateIcuCallback,\n environment: 'development' | 'production' | 'test'\n) {\n return useCallback(\n (id: string, options: DictionaryTranslationOptions = {}): string => {\n // Check: dictionary exists\n if (!dictionary) {\n return '';\n }\n\n // Get entry\n const value = getDictionaryEntry(dictionary, id);\n\n // Check: no entry found\n if (!value) {\n console.warn(createNoEntryFoundWarning(id));\n return '';\n }\n\n // Check: invalid entry\n if (!isValidDictionaryEntry(value)) {\n console.warn(createInvalidDictionaryEntryWarning(id));\n return '';\n }\n\n // Get entry and metadata\n const { entry, metadata } = getEntryAndMetadata(value);\n\n // ----- SET UP ----- //\n\n // Check: reject invalid content\n if (!entry || typeof entry !== 'string') return '';\n\n // Extract format from options\n const { $format: format, ...variableOptions } =\n options as DictionaryTranslationOptions & { $format?: StringFormat };\n const maxChars =\n metadata?.$maxChars ??\n (typeof options.$maxChars === 'number' ? options.$maxChars : undefined);\n\n // Render method\n const renderMessage = (\n message: string,\n locales: string[],\n fallback?: string\n ) => {\n try {\n // (1) Try to format message\n const declaredVars = extractVars(fallback || '');\n const formattedMessage = gt.formatMessage(\n Object.keys(declaredVars).length ? condenseVars(message) : message,\n {\n locales,\n variables: {\n ...variableOptions,\n ...declaredVars,\n [VAR_IDENTIFIER]: 'other',\n },\n dataFormat: format,\n }\n );\n const cutoffMessage = gt.formatCutoff(formattedMessage, {\n maxChars,\n });\n return cutoffMessage;\n } catch (error) {\n if (environment === 'production') {\n console.warn(\n createInvalidIcuDictionaryEntryWarning(id),\n 'Error: ',\n error\n );\n } else {\n // (3) If no fallback, throw error (non-prod)\n if (!fallback)\n throw new Error(\n `${createInvalidIcuDictionaryEntryError(id)} Error: ${error}`\n );\n\n console.error(\n createInvalidIcuDictionaryEntryError(id),\n 'Error: ',\n error\n );\n }\n\n // (2) If format fails, format fallback\n if (fallback) {\n return renderMessage(fallback, locales);\n }\n\n // (3) Fallback to original message (unformatted)\n const cutoffMessage = gt.formatCutoff(message, {\n maxChars,\n });\n return cutoffMessage; // fallback to original message (unformatted)}\n }\n };\n\n // Check: translation not required\n if (!translationRequired) return renderMessage(entry, [defaultLocale]);\n\n // ----- CHECK DICTIONARY TRANSLATIONS ----- //\n const dictionaryTranslation = getDictionaryEntry(\n dictionaryTranslations || {},\n id\n );\n if (\n dictionaryTranslation &&\n isValidDictionaryEntry(dictionaryTranslation)\n ) {\n const { entry } = getEntryAndMetadata(dictionaryTranslation);\n return renderMessage(entry, [locale, defaultLocale]);\n }\n\n // ----- CHECK TRANSLATIONS ----- //\n\n let translationEntry = translations?.[id];\n let hash = '';\n const getHash = () =>\n hashSource({\n source: indexVars(entry),\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: Math.abs(metadata.$maxChars),\n }),\n id,\n dataFormat: 'ICU',\n });\n if (!translationEntry) {\n hash = getHash();\n translationEntry = translations?.[hash];\n }\n\n // Check translation successful\n if (translationEntry) {\n return renderMessage(\n translationEntry as string,\n [locale, defaultLocale],\n entry\n );\n }\n\n if (translationEntry === null) {\n return renderMessage(entry, [defaultLocale]);\n }\n\n // Check if runtime translation is enabled\n if (!developmentApiEnabled) {\n return renderMessage(entry, [defaultLocale]);\n }\n\n // ----- TRANSLATE ON DEMAND ----- //\n // development only\n\n // Translate Content\n registerIcuForTranslation({\n source: indexVars(entry),\n targetLocale: locale,\n metadata: {\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: metadata.$maxChars,\n }),\n id,\n hash: hash || getHash(),\n },\n });\n\n // renderSettings.method must be ignored because t() is synchronous &\n // t() should never return an empty string because functions reason about strings based on falsiness\n return renderMessage(entry, [defaultLocale]);\n },\n [\n dictionary,\n dictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n dialectTranslationRequired,\n ]\n );\n}\n","import { useMemo } from 'react';\nimport {\n requiresTranslation,\n isSameLanguage,\n isValidLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n invalidCanonicalLocalesError,\n invalidLocalesError,\n} from '../../../errors-dir/createErrors';\nimport { UseDetermineLocaleParams, UseDetermineLocaleReturn } from './types';\n\nexport function useLocaleState({\n _locale,\n defaultLocale,\n locales: _locales,\n ssr,\n localeCookieName,\n customMapping,\n useDetermineLocale,\n enableI18n,\n reloadOnLocaleUpdate,\n}: {\n _locale: string;\n defaultLocale: string;\n locales: string[];\n ssr: boolean;\n localeCookieName: string;\n customMapping?: CustomMapping;\n enableI18n: boolean;\n useDetermineLocale: (\n params: UseDetermineLocaleParams\n ) => UseDetermineLocaleReturn;\n reloadOnLocaleUpdate?: boolean;\n}) {\n // Locale standardization\n const locales = useMemo(() => {\n return Array.from(\n new Set([defaultLocale, ...(enableI18n ? _locales : [])])\n );\n }, [defaultLocale, _locales, enableI18n]);\n\n const [locale, setLocale] = useDetermineLocale({\n locale: _locale,\n defaultLocale,\n locales,\n ssr,\n localeCookieName,\n customMapping,\n enableI18n,\n reloadOnLocaleUpdate,\n });\n\n const [translationRequired, dialectTranslationRequired] = useMemo(() => {\n // User locale is not default locale or equivalent\n const translationRequired = requiresTranslation(\n defaultLocale,\n locale,\n locales,\n customMapping\n );\n\n // User locale is not default locale but is a dialect of the same language\n const dialectTranslationRequired =\n translationRequired && isSameLanguage(defaultLocale, locale);\n\n // Check: invalid locale\n if (!customMapping) {\n const invalidLocales: string[] = [];\n locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (customMapping) {\n const invalidCanonicalLocales: string[] = [];\n locales.forEach((locale) => {\n if (!isValidLocale(locale, customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n return [translationRequired, dialectTranslationRequired];\n }, [defaultLocale, locale, locales]);\n\n return {\n locale, // the user's locale\n setLocale, // set the user's locale\n locales, // available locales\n translationRequired, // whether translation is required, e.g. \"en\" -> \"fr\"\n dialectTranslationRequired, // whether dialect translation is required, e.g. \"en-US\" to \"en-GB\"\n };\n}\n","import { useEffect } from 'react';\nimport {\n apiKeyInProductionError,\n APIKeyMissingWarn,\n projectIdMissingWarning,\n} from '../../errors-dir/createErrors';\nimport {\n defaultCacheUrl,\n defaultRuntimeApiUrl,\n} from 'generaltranslation/internal';\nimport { createUnsupportedLocalesWarning } from '../../errors-dir/createErrors';\nimport { getSupportedLocale } from '@generaltranslation/supported-locales';\n\nexport function useErrorChecks({\n devApiKey,\n projectId,\n runtimeUrl,\n loadTranslationsType,\n cacheUrl,\n locales,\n environment,\n}: {\n devApiKey?: string;\n projectId: string;\n runtimeUrl: string | null;\n loadTranslationsType: string;\n cacheUrl: string | null;\n locales: string[];\n environment: 'development' | 'production' | 'test';\n}) {\n useEffect(() => {\n // Check: no devApiKey in production\n if (environment === 'production' && devApiKey) {\n throw new Error(apiKeyInProductionError);\n }\n\n // Check: projectId missing while using cache/runtime in dev\n if (\n loadTranslationsType !== 'custom' &&\n (cacheUrl || runtimeUrl) &&\n !projectId &&\n environment === 'development'\n ) {\n console.warn(projectIdMissingWarning);\n }\n\n // Check: An API key is required for runtime translation\n if (\n projectId && // must have projectId for this check to matter anyways\n runtimeUrl &&\n loadTranslationsType !== 'custom' && // this usually conincides with not using runtime tx\n !devApiKey &&\n environment === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (\n runtimeUrl === defaultRuntimeApiUrl ||\n (cacheUrl === defaultCacheUrl && loadTranslationsType === 'default')\n ) {\n const warningLocales = locales.filter(\n (locale) => !getSupportedLocale(locale)\n );\n if (warningLocales.length) {\n console.warn(createUnsupportedLocalesWarning(warningLocales));\n }\n }\n }, [\n devApiKey,\n loadTranslationsType,\n cacheUrl,\n runtimeUrl,\n projectId,\n locales,\n ]);\n}\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport { dictionaryMissingWarning } from '../errors-dir/createErrors';\nimport { CustomLoader, Dictionary } from '../types-dir/types';\n\nexport default async function loadDictionaryHelper(\n locale: string,\n loadDictionary: CustomLoader\n): Promise<Dictionary | undefined> {\n const locales = Array.from(\n new Set([locale, getLocaleProperties(locale).languageCode])\n );\n for (const currentLocale of locales) {\n try {\n const result = await loadDictionary(currentLocale);\n if (result) {\n return result as Dictionary;\n }\n } catch {\n /* empty */\n }\n }\n // eslint-disable-next-line no-console\n console.warn(dictionaryMissingWarning);\n\n return undefined;\n}\n","import { useEffect, useState } from 'react';\nimport { CustomLoader } from '../../types-dir/types';\nimport { Dictionary } from '../../types-dir/types';\nimport loadDictionaryHelper from '../../dictionaries/loadDictionaryHelper';\n\nexport function useLoadDictionary({\n _dictionary,\n _dictionaryTranslations = {},\n loadDictionary,\n locale,\n defaultLocale,\n}: {\n _dictionary: Dictionary | undefined;\n _dictionaryTranslations: Dictionary | undefined;\n loadDictionary: CustomLoader | undefined;\n locale: string;\n defaultLocale: string;\n}) {\n const [dictionary, setDictionary] = useState<Dictionary | undefined>(\n _dictionary\n );\n const [dictionaryTranslations, setDictionaryTranslations] = useState<\n Dictionary | undefined\n >(_dictionaryTranslations);\n\n // Resolve dictionary when not provided, but using custom dictionary loader\n useEffect(() => {\n // Early return if dictionary is provided or not loading translation dictionary\n if (!loadDictionary) return;\n\n let storeResults = true;\n\n (async () => {\n // Load dictionary for default locale\n const defaultLocaleDictionary =\n (await loadDictionaryHelper(defaultLocale, loadDictionary)) || {};\n\n // Load dictionary for locale\n const localeDictionary =\n (await loadDictionaryHelper(locale, loadDictionary)) || {};\n\n // // Merge dictionaries\n // const mergedDictionary = mergeDictionaries(\n // defaultLocaleDictionary,\n // localeDictionary\n // );\n\n // Update dictionary\n if (storeResults) {\n setDictionary(defaultLocaleDictionary || {});\n }\n\n // Update dictionary translations\n if (storeResults) {\n setDictionaryTranslations(localeDictionary || {});\n }\n })();\n\n // cancel load if a dep changes\n return () => {\n storeResults = false;\n };\n }, [loadDictionary, locale, defaultLocale]);\n return {\n dictionary,\n setDictionary,\n dictionaryTranslations,\n setDictionaryTranslations,\n };\n}\n","import { GT } from 'generaltranslation';\n\nexport default async function fetchTranslations({\n cacheUrl,\n projectId,\n locale,\n versionId,\n gt,\n}: {\n cacheUrl: string;\n projectId: string;\n locale: string;\n versionId?: string;\n gt: GT;\n}) {\n if (!projectId || !cacheUrl || !locale) return {};\n locale = gt.resolveCanonicalLocale(locale);\n const response = await fetch(\n versionId\n ? `${cacheUrl}/${projectId}/${locale}/${versionId}`\n : `${cacheUrl}/${projectId}/${locale}`\n ); // fetch from cache\n const result = await response.json();\n return result;\n}\n","import { customLoadTranslationsError } from '../../errors-dir/createErrors';\nimport fetchTranslations from '../../utils/fetchTranslations';\nimport { CustomLoader, Translations } from '../../types-dir/types';\nimport { useEffect, useRef, useState } from 'react';\nimport { GT } from 'generaltranslation';\nimport { defaultCacheUrl } from 'generaltranslation/internal';\n\nexport function useLoadTranslations({\n _translations,\n translationRequired,\n loadTranslationsType,\n loadTranslations,\n locale,\n cacheUrl,\n projectId,\n _versionId,\n gt,\n}: {\n _translations: Translations | null;\n translationRequired: boolean;\n loadTranslationsType: string;\n loadTranslations?: CustomLoader;\n locale: string;\n cacheUrl: string | null;\n projectId: string;\n _versionId?: string;\n gt: GT;\n}) {\n /** Key for translation tracking:\n * Cache Loading -> translations = null\n * Cache Fail (for locale) -> translations = {}\n * Cache Fail (for hash) -> translations[hash] = undefined\n */\n\n /**\n * Initialize translations\n */\n function initializeTranslations() {\n if (_translations) {\n return _translations;\n } else if (translationRequired && loadTranslationsType !== 'disabled') {\n return null;\n } else {\n // No need to load translations ever\n return {};\n }\n }\n\n const [translations, setTranslations] = useState<Translations | null>(\n initializeTranslations()\n );\n\n /**\n * Reset translations if locale changes (null to trigger a new cache fetch)\n * Should never run on mount\n *\n * TODO: its possible that this adds an unnecessary re-render, perhaps the request could be embeded directly in this useEffect instead?\n */\n const didMount = useRef(false);\n useEffect(() => {\n // Reset should never run on mount\n if (!didMount.current) {\n didMount.current = true;\n return;\n }\n\n setTranslations(\n translationRequired && loadTranslationsType !== 'disabled' ? null : {}\n );\n }, [locale, loadTranslationsType]);\n\n /**\n * Update translations\n */\n useEffect(() => {\n // Early return if no need to translate\n if (\n translations ||\n !translationRequired ||\n loadTranslationsType === 'disabled'\n ) {\n return;\n }\n\n // Fetch translations\n let storeResults = true;\n (async () => {\n let result;\n switch (loadTranslationsType) {\n case 'custom':\n // check is redundant, but makes ts happy\n if (loadTranslations) {\n try {\n result = await loadTranslations(locale);\n } catch (error) {\n console.error(customLoadTranslationsError(locale), error);\n }\n }\n break;\n case 'default':\n try {\n result = await fetchTranslations({\n cacheUrl: cacheUrl || defaultCacheUrl,\n projectId,\n locale,\n versionId: _versionId,\n gt,\n });\n } catch (error) {\n console.error(error);\n }\n break;\n }\n\n // fallback to empty object if failed or disabled\n if (!result) {\n result = {};\n }\n\n // Record results\n if (storeResults) {\n setTranslations(result); // not classified as a translation error, because we can still fetch from API\n }\n })();\n\n // Cancel fetch if a dep changes\n return () => {\n storeResults = false;\n };\n }, [\n translations,\n translationRequired,\n loadTranslationsType,\n cacheUrl,\n projectId,\n locale,\n _versionId,\n gt,\n ]);\n\n return {\n translations,\n setTranslations,\n };\n}\n","import { useCallback } from 'react';\nimport { TranslateIcuCallback } from '../../../types-dir/runtime';\nimport {\n Dictionary,\n DictionaryEntry,\n DictionaryTranslationOptions,\n TranslatedChildren,\n Translations,\n} from '../../../types-dir/types';\nimport {\n createEmptyIdError,\n createNoEntryFoundWarning,\n} from '../../../errors-dir/createErrors';\nimport {\n getSubtree,\n getSubtreeWithCreation,\n} from '../../../dictionaries/getSubtree';\nimport { isDictionaryEntry } from '../../../dictionaries/isDictionaryEntry';\nimport { stripMetadataFromEntries } from '../../../dictionaries/stripMetadataFromEntries';\nimport mergeDictionaries from '../../../dictionaries/mergeDictionaries';\nimport { mergeResultsIntoDictionary } from '../../../dictionaries/injectEntry';\nimport { injectHashes } from '../../../dictionaries/injectHashes';\nimport { collectUntranslatedEntries } from '../../../dictionaries/collectUntranslatedEntries';\nimport { injectTranslations } from '../../../dictionaries/injectTranslations';\nimport { injectFallbacks } from '../../../dictionaries/injectFallbacks';\nimport { injectAndMerge } from '../../../dictionaries/injectAndMerge';\nimport { indexVars } from 'generaltranslation/internal';\n\nexport function useCreateInternalUseTranslationsObjFunction(\n dictionary: Dictionary,\n dictionaryTranslations: Dictionary,\n setDictionary: Function,\n setDictionaryTranslations: Function,\n translations: Translations | null,\n locale: string,\n defaultLocale: string,\n translationRequired: boolean,\n dialectTranslationRequired: boolean,\n developmentApiEnabled: boolean,\n registerIcuForTranslation: TranslateIcuCallback,\n gtFunction: (id: string, options: DictionaryTranslationOptions) => string\n) {\n return useCallback(\n (\n id: string,\n idWithParent: string,\n options: DictionaryTranslationOptions = {}\n ): Dictionary | DictionaryEntry | undefined => {\n if (idWithParent === '') {\n throw new Error(createEmptyIdError());\n }\n // (1) Get subtree\n const subtree = getSubtree({\n dictionary,\n id: idWithParent,\n });\n // Check: no subtree found\n if (!subtree) {\n console.warn(createNoEntryFoundWarning(idWithParent));\n return {};\n }\n // Check: if subTreeTranslation is a dictionaryEntry\n if (isDictionaryEntry(subtree)) {\n return gtFunction(id, options);\n }\n // Check: if is default locale\n if (!translationRequired) {\n // remove metadata from entries\n return stripMetadataFromEntries(subtree);\n }\n const translatedSubtree = getSubtreeWithCreation({\n dictionary: dictionaryTranslations,\n id: idWithParent,\n sourceDictionary: dictionaryTranslations,\n });\n\n // (2) Calculate subtreeWithHashes, dictionaryTranslationsWithTranslations, translatedSubtreeWithFallbacks, and untranslatedEntries\n // Note: the following four operations can technically be combined into one traversal, but this\n // strategy is much more readable and much easier to test/debug\n // Inject hashes into subtree\n const { dictionary: subtreeWithHashes, updateDictionary } = injectHashes(\n structuredClone(subtree) as Dictionary,\n idWithParent\n );\n // Collect untranslated entries\n const untranslatedEntries = collectUntranslatedEntries(\n subtreeWithHashes as Dictionary,\n translatedSubtree as Dictionary,\n idWithParent\n );\n // Inject translations into translation subtree\n const {\n dictionary: dictionaryTranslationsWithTranslations,\n updateDictionary: updateDictionaryTranslations,\n } = injectTranslations(\n subtreeWithHashes as Dictionary,\n structuredClone(translatedSubtree) as Dictionary,\n translations || {},\n untranslatedEntries,\n idWithParent\n );\n // Inject fallbacks into translation subtree\n const translatedSubtreeWithFallbacks = injectFallbacks(\n subtreeWithHashes as Dictionary,\n structuredClone(dictionaryTranslationsWithTranslations) as Dictionary,\n untranslatedEntries,\n idWithParent\n );\n\n // (3) For each untranslated entry, translate it\n if (developmentApiEnabled) {\n Promise.allSettled(\n untranslatedEntries.map(\n async (\n untranslatedEntry\n ): Promise<[string, TranslatedChildren]> => {\n const { source, metadata } = untranslatedEntry;\n const id = metadata?.$id;\n return [\n id,\n await registerIcuForTranslation({\n source: indexVars(source),\n targetLocale: locale,\n metadata: {\n ...(metadata?.$context && { context: metadata.$context }),\n ...(metadata?.$maxChars != null && {\n maxChars: metadata.$maxChars,\n }),\n id,\n hash: metadata?.$_hash,\n },\n }),\n ];\n }\n )\n ).then((settledResults) => {\n // Filter out only successful promises and extract their values\n const successfulResults: [string, TranslatedChildren][] =\n settledResults\n .filter(\n (\n result\n ): result is PromiseFulfilledResult<\n [string, TranslatedChildren]\n > => result.status === 'fulfilled'\n )\n .map((result) => result.value);\n // Only proceed if we have successful results\n if (successfulResults.length > 0) {\n // Merge the results into the dictionaryTranslations object\n setDictionaryTranslations((prev: Dictionary) =>\n mergeResultsIntoDictionary(prev, successfulResults, dictionary)\n );\n }\n });\n }\n\n // (4) Update the dictionaryTranslations object and dictionary\n // inject translatedSubtreeWithFallbacks and new subtree objects\n // Need the setTimeout to avoid render-phase updates\n if (updateDictionary) {\n setTimeout(() => {\n setDictionary((prev: Dictionary) =>\n injectAndMerge(prev, subtreeWithHashes, idWithParent)\n );\n }, 0);\n }\n if (updateDictionaryTranslations) {\n setTimeout(() => {\n setDictionaryTranslations((prev: Dictionary) =>\n mergeDictionaries(prev, dictionaryTranslationsWithTranslations)\n );\n }, 0);\n }\n\n // (5) Copy the dictionaryTranslations object\n return structuredClone(translatedSubtreeWithFallbacks);\n },\n [\n dictionary,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n dictionaryTranslations,\n ]\n );\n}\n","import { useState } from 'react';\nimport { UseEnableI18nParams, UseEnableI18nReturn } from './types';\n\n// Fallback behavior for useEnableI18n\nexport function useEnableI18n({\n enableI18n: _enableI18n,\n}: UseEnableI18nParams): UseEnableI18nReturn {\n const [enableI18n] = useState(_enableI18n);\n return { enableI18n };\n}\n","import { createInternalUsageError } from '../../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function isSSREnabled(): boolean {\n throw createInternalUsageError('isSSREnabled');\n}\n","import { createInternalUsageError } from '../../../errors-dir/internalErrors';\nimport { UseDetermineLocaleParams, UseDetermineLocaleReturn } from './types';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function useDetermineLocale(\n _params: UseDetermineLocaleParams\n): UseDetermineLocaleReturn {\n throw createInternalUsageError('useDetermineLocale');\n}\n","import { createInternalUsageError } from '../../errors-dir/internalErrors';\nimport { UseRegionStateParams, UseRegionStateReturn } from './types';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport function useRegionState(\n _params: UseRegionStateParams\n): UseRegionStateReturn {\n throw createInternalUsageError('useRegionState');\n}\n","import { Suspense, useMemo } from 'react';\nimport { GTContext } from './GTContext';\nimport {\n defaultCacheUrl,\n defaultRuntimeApiUrl,\n libraryDefaultLocale,\n} from 'generaltranslation/internal';\nimport useRuntimeTranslation from './hooks/useRuntimeTranslation';\nimport { getDefaultRenderSettings } from '../rendering/getDefaultRenderSettings';\nimport useCreateInternalUseGTFunction from './hooks/translation/useCreateInternalUseGTFunction';\nimport useCreateInternalUseTranslationsFunction from './hooks/translation/useCreateInternalUseTranslationsFunction';\nimport {\n defaultLocaleCookieName,\n defaultRegionCookieName,\n defaultEnableI18nCookieName,\n} from '../utils/cookies';\nimport { InternalGTProviderProps } from '../types-dir/config';\nimport { useLocaleState } from './hooks/locales/useLocaleState';\nimport { useErrorChecks } from './hooks/useErrorChecks';\nimport { resolveAliasLocale } from '@generaltranslation/format';\nimport { GT } from 'generaltranslation';\nimport { useLoadDictionary } from './hooks/useLoadDictionary';\nimport { useLoadTranslations } from './hooks/useLoadTranslations';\nimport { useCreateInternalUseTranslationsObjFunction } from './hooks/translation/useCreateInternalUseTranslationsObjFunction';\nimport { useEnableI18n as _useEnableI18n } from './hooks/useEnableI18n';\n\n// Deprecated functions, will be removed in a future version\nimport { readAuthFromEnv as _readAuthFromEnv } from '../utils/utils';\nimport { isSSREnabled } from './helpers/isSSREnabled';\nimport { useDetermineLocale as _useDetermineLocale } from './hooks/locales/useDetermineLocale';\nimport { useRegionState as _useRegionState } from './hooks/useRegionState';\n\nexport default function GTProvider({\n children,\n config,\n environment = 'production',\n projectId: _projectId = config?.projectId || '',\n devApiKey: _devApiKey = config?.devApiKey || '',\n _versionId = config?._versionId,\n dictionary: _dictionary = {},\n locales = config?.locales || [],\n defaultLocale = config?.defaultLocale || libraryDefaultLocale,\n cacheUrl = config?.cacheUrl || defaultCacheUrl,\n runtimeUrl = config?.runtimeUrl || defaultRuntimeApiUrl,\n renderSettings = config?.renderSettings ||\n getDefaultRenderSettings(environment),\n ssr = config?.ssr || isSSREnabled(),\n localeCookieName = config?.localeCookieName || defaultLocaleCookieName,\n locale: _locale = '',\n region: _region,\n loadDictionary,\n loadTranslations,\n fallback = undefined,\n translations: _translations = null,\n customMapping = config?.customMapping,\n enableI18n: _enableI18n = config?.enableI18n !== undefined\n ? config.enableI18n\n : true,\n enableI18nLoaded,\n reloadOnLocaleUpdate,\n useEnableI18n = _useEnableI18n,\n readAuthFromEnv = _readAuthFromEnv,\n useDetermineLocale = _useDetermineLocale,\n useRegionState = _useRegionState,\n ...metadata\n}: InternalGTProviderProps) {\n // ---------- PROPS ---------- //\n if (_locale) {\n _locale = resolveAliasLocale(_locale, customMapping);\n }\n\n // Read env to get projectId and API key\n const { projectId, devApiKey } = readAuthFromEnv({\n projectId: _projectId,\n devApiKey: _devApiKey,\n });\n\n // Enable I18n feature flags\n const { enableI18n } = useEnableI18n({\n enableI18n: _enableI18n,\n enableI18nLoaded,\n enableI18nCookieName: defaultEnableI18nCookieName,\n ssr,\n });\n\n // Get locale data including\n // locale - the user's locale\n // setLocale - function to set the user's locale\n // locales - approved locales for the project\n // translationRequired - whether translation is required\n // dialectTranslationRequired - whether dialect translation (e.g. en-US -> en-GB) is required\n const {\n locale,\n setLocale,\n locales: approvedLocales,\n translationRequired,\n dialectTranslationRequired,\n } = useLocaleState({\n _locale,\n defaultLocale,\n locales,\n ssr,\n localeCookieName,\n customMapping,\n useDetermineLocale,\n enableI18n,\n reloadOnLocaleUpdate,\n });\n\n // Define the region instance\n const { region, setRegion } = useRegionState({\n _region,\n ssr,\n regionCookieName: defaultRegionCookieName,\n });\n\n // Define the GT instance\n // Used for custom mapping and as a driver for the runtime translation\n const gt = useMemo(\n () =>\n new GT({\n devApiKey,\n sourceLocale: defaultLocale,\n targetLocale: locale,\n projectId,\n baseUrl: runtimeUrl || undefined,\n customMapping,\n }),\n [devApiKey, defaultLocale, projectId, runtimeUrl, customMapping]\n );\n\n // Determine the type of translation loading\n // custom - custom loading function provided\n // default - using GT provided cache\n // disabled - no translation loading\n const loadTranslationsType = useMemo(() => {\n return (\n (loadTranslations && 'custom') ||\n (cacheUrl && projectId && 'default') ||\n 'disabled'\n );\n }, [loadTranslations, cacheUrl, projectId]);\n\n // ---------- LOAD DICTIONARY ---------- //\n\n const {\n dictionary,\n setDictionary,\n dictionaryTranslations,\n setDictionaryTranslations,\n } = useLoadDictionary({\n _dictionary,\n _dictionaryTranslations: {},\n loadDictionary,\n locale,\n defaultLocale,\n });\n\n // ---------- ERROR AND WARNING CHECKS ---------- //\n\n useErrorChecks({\n devApiKey,\n projectId,\n runtimeUrl,\n loadTranslationsType,\n cacheUrl,\n locales,\n environment,\n });\n\n // ---------- TRANSLATION STATE ---------- //\n\n const { translations, setTranslations } = useLoadTranslations({\n _translations,\n translationRequired,\n loadTranslationsType,\n loadTranslations,\n locale,\n cacheUrl,\n projectId,\n _versionId,\n gt,\n });\n\n // ------- RUNTIME TRANSLATION ----- //\n\n const {\n registerIcuForTranslation,\n registerJsxForTranslation,\n developmentApiEnabled,\n } = useRuntimeTranslation({\n gt,\n locale,\n versionId: _versionId,\n defaultLocale,\n runtimeUrl,\n renderSettings,\n setTranslations,\n environment,\n ...metadata,\n });\n\n // ---------- USE GT ---------- //\n\n const {\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n } = useCreateInternalUseGTFunction({\n gt,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment,\n });\n\n // ---------- USE DICT ---------- //\n\n const _dictionaryFunction = useCreateInternalUseTranslationsFunction(\n gt,\n dictionary,\n dictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n environment\n );\n\n const _dictionaryObjFunction = useCreateInternalUseTranslationsObjFunction(\n dictionary || {},\n dictionaryTranslations || {},\n setDictionary,\n setDictionaryTranslations,\n translations,\n locale,\n defaultLocale,\n translationRequired,\n dialectTranslationRequired,\n developmentApiEnabled,\n registerIcuForTranslation,\n _dictionaryFunction\n );\n\n // ----- RETURN ----- //\n\n const display = !!((!translationRequired || translations) && locale);\n\n // hang until cache response, then render translations or loading state (when waiting on API response)\n return (\n <GTContext.Provider\n value={{\n gt,\n registerIcuForTranslation,\n registerJsxForTranslation,\n _gtFunction,\n _mFunction,\n _filterMessagesForPreload,\n _preloadMessages,\n _dictionaryFunction,\n _dictionaryObjFunction,\n developmentApiEnabled,\n locale,\n locales: approvedLocales,\n setLocale,\n defaultLocale,\n region,\n setRegion,\n translations,\n translationRequired,\n dialectTranslationRequired,\n projectId,\n renderSettings,\n _versionId,\n }}\n >\n <Suspense fallback={fallback}>{display ? children : fallback}</Suspense>\n </GTContext.Provider>\n );\n}\n","import { useContext } from 'react';\nimport { getPluralBranch } from '../../internal';\nimport { createPluralMissingError } from '../../errors-dir/createErrors';\nimport { libraryDefaultLocale } from 'generaltranslation/internal';\nimport { GTContext } from '../../provider/GTContext';\n\n/**\n * The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).\n * It determines which content to display by matching the value of `n` to the appropriate pluralization branch,\n * based on the current locale or a default locale. If no matching plural branch is found, the component renders\n * the fallback `children` content.\n *\n * @example\n * ```jsx\n * <Plural\n * n={1}\n * one=\"There is 1 item\"\n * other=\"There are {n} items\"\n * />\n * ```\n * In this example, if `n` is 1, it renders `\"There is 1 item\"`. If `n` is a different number, it renders\n * `\"There are {n} items\"`.\n *\n * @param {any} [children] - Fallback content to render if no matching plural branch is found.\n * @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.\n * @param {string} [locales] - Optional parameter, the locale to use for pluralization format. If not provided and wrapped\n * in <GTProvider> will automatically populate this value as user's current locale. If not provided and not wrapped in\n * <GTProvider>, will use the library default locale (en-US).\n * @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular\n * and `other` for plural forms, but it may vary depending on the locale.\n * @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.\n * @throws {Error} If `n` is not provided or not a valid number.\n */\nfunction Plural({\n children,\n n,\n locales,\n ...branches\n}: {\n children?: React.ReactNode;\n n?: number;\n locales?: string;\n [key: string]: unknown;\n}): React.JSX.Element {\n const context = useContext(GTContext);\n let defaultLocale;\n if (context) {\n locales ||= context.locale;\n defaultLocale ||= context.defaultLocale;\n }\n const providerLocales = [\n ...(locales ? [locales] : []),\n defaultLocale || libraryDefaultLocale,\n ];\n if (typeof n !== 'number')\n throw new Error(createPluralMissingError(children));\n return <>{getPluralBranch(n, providerLocales, branches) || children}</>;\n}\n\nPlural._gtt = 'plural';\n\nexport default Plural;\n","/**\n * The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.\n * It allows for flexible content switching based on the `branch` prop and an object of possible branches (`...branches`).\n * If the specified `branch` is present in the `branches` object, it renders the content of that branch.\n * If the `branch` is not found, it renders the provided `children` as fallback content.\n *\n * @example\n * ```jsx\n * <Branch\n * branch=\"summary\"\n * summary={<p>This is a summary</p>}\n * details={<p>Details here</p>}\n * >\n * <p>Fallback content</p>\n * </Branch>\n * ```\n * If the `branch` prop is set to `\"summary\"`, it will render `<p>This is a summary</p>`. If the `branch` is not set or does not match any keys in the branches object, it renders the fallback content `<p>Fallback content</p>`.\n *\n * @param {any} [children] - Fallback content to render if no matching branch is found.\n * @param {any} [name=\"branch\"] - Optional name for the component, used for metadata or tracking purposes.\n * @param {string} [branch] - The name of the branch to render. The component looks for this key in the `...branches` object.\n * @param {...{[key: string]: any}} [branches] - A spread object containing possible branches as keys and their corresponding content as values.\n * @returns {React.JSX.Element} The rendered branch or fallback content.\n */\nfunction Branch({\n children,\n branch,\n ...branches\n}: {\n children?: unknown;\n branch?: string | number | boolean;\n [key: string]: unknown;\n}): React.JSX.Element {\n branch = branch?.toString();\n // ignore data-* attributes\n if (typeof branch === 'string' && branch.startsWith('data-')) {\n branch = undefined;\n }\n const renderedBranch =\n branch && typeof branches[branch] !== 'undefined'\n ? branches[branch]\n : children;\n return <>{renderedBranch}</>;\n}\n/** @internal _gtt - The GT transformation for the component. */\nBranch._gtt = 'branch';\nexport default Branch;\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the user's list of supported locales from the `<GTProvider>` context.\n *\n * @returns {string[]} The user's locales, e.g., ['en-US', 'fr', 'jp'].\n *\n * @example\n * const locales = useLocales();\n * console.log(locale); // ['en-US', 'fr', 'jp]\n */\nexport default function useLocales(): string[] {\n return useGTContext(\n 'useLocales(): Unable to access configured locales outside of a <GTProvider>'\n ).locales;\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Sets the user's locale in the `<GTProvider>` context.\n * If the locale passed is not supported, will fallback on current locale and then defaultLocale if necessary.\n * @note Unless a locale has explicitly been passed to the `<GTProvider>`, this will override the user's browser preferences. The locale passed to `<GTProvider>` will always take priority.\n *\n * @returns {(locale: string) => void} A function that sets the user's locale.\n *\n * @example\n * setLocale('en-US');\n */\nexport default function useSetLocale(): (locale: string) => void {\n const { setLocale } = useGTContext(\n \"setLocale(): Unable to access user's locale outside of a <GTProvider>\"\n );\n return setLocale;\n}\n","import React from 'react';\nimport { LocaleSelectorProps } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport default function LocaleSelector(\n _props: LocaleSelectorProps\n): React.JSX.Element | null {\n throw createInternalUsageError('LocaleSelector');\n}\n","import { useCallback, useMemo } from 'react';\nimport useGTContext from '../provider/GTContext';\n\n/**\n *\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {(locale: string) => void} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport default function useLocaleSelector(locales?: string[]) {\n // Retrieve the locale, locales, and setLocale function\n const { locales: contextLocales, locale, setLocale, gt } = useGTContext();\n\n // sort\n const sortedLocales = useMemo(() => {\n if (!contextLocales || contextLocales.length === 0) {\n return [];\n }\n const collator = new Intl.Collator();\n return [...contextLocales].sort((a, b) =>\n collator.compare(\n gt.getLocaleProperties(a).nativeNameWithRegionCode,\n gt.getLocaleProperties(b).nativeNameWithRegionCode\n )\n );\n }, [contextLocales, gt]);\n\n // create getLocaleProperties callback\n const getLocalePropertiesCallback = useCallback(\n (locale: string) => {\n return gt.getLocaleProperties(locale);\n },\n [gt]\n );\n\n return {\n locale,\n locales: locales ? locales : sortedLocales,\n setLocale,\n getLocaleProperties: getLocalePropertiesCallback,\n };\n}\n","import React from 'react';\nimport { RegionSelectorProps } from './types';\nimport { createInternalUsageError } from '../errors-dir/internalErrors';\n\n/**\n * @deprecated - this function is to always be overridden by a wrapper react package\n */\nexport default function RegionSelector<Regions extends string[]>(\n _props: RegionSelectorProps<Regions>\n): React.JSX.Element | null {\n throw createInternalUsageError('RegionSelector');\n}\n","import type { LocaleProperties } from '@generaltranslation/format/types';\nimport useGTContext from '../provider/GTContext';\n\n/**\n * Returns the configured GT class instance.\n *\n * @returns {GT} The configured GT class instance.\n *\n * @example\n * const gt = useGTClass();\n * console.log(gt.getLocaleProperties('en-US'));\n */\nexport function useGTClass() {\n return useGTContext(\n 'useGTClass(): Unable to access configured GT class instance outside of a <GTProvider>'\n ).gt;\n}\n\n/**\n * Returns the locale properties for the given locale.\n *\n * @param {string} locale - The locale to get the properties for.\n * @returns {LocaleProperties} The locale properties for the given locale.\n *\n * @example\n * const localeProperties = useLocaleProperties('en-US');\n * console.log(localeProperties);\n */\nexport function useLocaleProperties(locale: string): LocaleProperties {\n const gt = useGTClass();\n return gt.getLocaleProperties(locale);\n}\n","import { useMemo } from 'react';\nimport useGTContext from '../provider/GTContext';\nimport { getLocaleProperties } from '@generaltranslation/format';\n\ntype RegionData = {\n code: string;\n name: string;\n emoji: string;\n locale: string;\n};\n\n/**\n * React hook for managing region selection logic in applications supporting multiple regions.\n *\n * This hook provides the necessary data and handlers to implement a region selector UI component.\n * It returns the current region, a list of available regions, region metadata, and functions to update the region or associated locale.\n *\n * ### Parameters\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object.<string, string|{name?: string, emoji?: string, locale?: string}>} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * ### Returns\n * @returns {{\n * region: string | undefined,\n * setRegion: (region: string) => void,\n * regions: string[],\n * regionData: Map<string, { code: string, name: string, emoji: string, locale: string }>,\n * locale: string,\n * setLocale: (locale: string) => void\n * }} An object containing:\n * - `region`: The currently selected region code.\n * - `setRegion`: Function to update the selected region.\n * - `regions`: Array of available region codes.\n * - `regionData`: Map of region codes to their display data (name, emoji, locale).\n * - `locale`: The current locale.\n * - `setLocale`: Function to update the locale.\n *\n * ### Example\n * ```tsx\n * const {\n * region,\n * setRegion,\n * regions,\n * regionData,\n * locale,\n * setLocale\n * } = useRegionSelector({\n * customMapping: { US: { name: \"United States\", emoji: \"🇺🇸\" } }\n * });\n *\n * return (\n * <select value={region} onChange={e => setRegion(e.target.value)}>\n * {regions.map(r => (\n * <option key={r} value={r}>\n * {regionData.get(r)?.name}\n * </option>\n * ))}\n * </select>\n * );\n * ```\n */\nexport function useRegionSelector(\n {\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion = true,\n sortRegionsAlphabetically = true,\n }: {\n regions?: string[];\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n } = {\n prioritizeCurrentLocaleRegion: true,\n sortRegionsAlphabetically: true,\n }\n) {\n // Retrieve the locale, locales, and setLocale function\n const { locales, locale, setLocale, gt, region, setRegion } = useGTContext();\n const { regionCode: localeRegion } = gt.getLocaleProperties(locale);\n\n const [\n regions, // ordered list of ISO 3166 region codes\n regionData, // map of ISO 3166 region codes to region display data, potentially not ordered\n ] = useMemo<[string[], Map<string, RegionData>]>(() => {\n const regionToLocaleMap = new Map(\n locales.map((l) => {\n const lp = getLocaleProperties(l, locale, gt.customMapping); // has to be directly called so sourceLocale can be in the user's current locale\n return [lp.regionCode, lp];\n })\n );\n\n const regions = _regions\n ? [..._regions]\n : Array.from(regionToLocaleMap?.keys() || [localeRegion]);\n\n const regionData = new Map<string, RegionData>(\n regions.map((r: string) => {\n return [\n r,\n {\n locale: regionToLocaleMap?.get(r)?.code || locale,\n ...gt.getRegionProperties(r),\n ...(typeof customMapping?.[r] === 'string'\n ? { name: customMapping?.[r] }\n : customMapping?.[r]),\n },\n ];\n })\n );\n\n if (sortRegionsAlphabetically) {\n regions.sort((a, b) =>\n new Intl.Collator().compare(\n regionData.get(a)!.name,\n regionData.get(b)!.name\n )\n );\n }\n\n if (prioritizeCurrentLocaleRegion) {\n const localeRegionIndex = regions.indexOf(localeRegion);\n if (localeRegionIndex > 0) {\n // 0 because no action is needed if it's already at the start\n regions.splice(localeRegionIndex, 1);\n regions.unshift(localeRegion);\n }\n }\n\n return [regions, regionData];\n }, [_regions, region, locale, locales, gt]);\n\n return {\n region,\n setRegion,\n regions,\n regionData,\n locales,\n locale,\n localeRegion,\n setLocale,\n };\n}\n","import useGTContext from '../provider/GTContext';\n\n/**\n * Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.\n *\n * If no locale is provided, the direction for the current user's locale is returned.\n *\n * @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.\n * @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.\n *\n * @example\n * const dir = useLocaleDirection(); // e.g., 'ltr'\n * const arabicDir = useLocaleDirection('ar'); // 'rtl'\n */\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const { gt } = useGTContext(\n 'useLocaleDirection(): Unable to access configured GT class instance outside of a <GTProvider>'\n );\n return gt.getLocaleDirection(locale);\n}\n","import useGTContext from '../../provider/GTContext';\nimport { _Messages, Translations } from '../../types-dir/types';\nimport { useable } from '../../promises/dangerouslyUsable';\nimport { MFunctionType } from '../../types-dir/types';\nimport { useCallback } from 'react';\nimport reactUse from '../../utils/use';\n\n/**\n * Gets the message decoding and translation function `m` provided by `<GTProvider>`.\n *\n * @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.\n *\n * @example\n * const encodedMessage = msg(\"Hello, world\")\n * const m = useMessages();\n * m(encodedMessage) // returns \"Hello, world\" translated\n *\n * @example\n * const encodedMessage = msg(\"My name is {name}\", { name: \"Brian\" });\n * const m = useMessages();\n * m(encodedMessage) // returns \"My name is Brian\" translated\n */\nexport default function useMessages(_messages?: _Messages): MFunctionType {\n const {\n developmentApiEnabled,\n translationRequired,\n _preloadMessages,\n _filterMessagesForPreload,\n _mFunction,\n locale,\n } = useGTContext(\n `useMessages(): No context provided. You're trying to get the m() function from the useMessages() hook, which can be called within a <GTProvider>.`\n );\n\n let preloadedTranslations: Translations | undefined;\n if (_messages && reactUse && developmentApiEnabled && translationRequired) {\n const untranslatedMessages = _filterMessagesForPreload(_messages);\n if (untranslatedMessages.length > 0) {\n preloadedTranslations = reactUse(\n useable(\n [\n '_preloadMessages', // prefix key\n locale, // should change on locale\n JSON.stringify(untranslatedMessages), // should change when messages change\n ],\n () => _preloadMessages(untranslatedMessages)\n )\n );\n }\n }\n\n function _m<T extends string | null | undefined>(\n encodedMsg: T,\n options: Record<string, unknown> = {}\n ): T extends string ? string : T {\n return _mFunction(encodedMsg, options, preloadedTranslations);\n }\n\n /**\n * @param {string} encodedMsg - The encoded message string, typically created by the `msg()` utility.\n * @param {InlineTranslationOptions} options\n * @param {StringFormat} [options.$format] - The data format for the message (e.g., 'ICU', 'STRING'). Defaults to 'ICU'.\n * @returns A translation\n *\n * @example\n * const example = msg(\"Hello, world\")\n * const m = useMessages()\n * m(example); // Translates 'Hello, world!'\n *\n * @example\n * // With a context and a custom identifier:\n * const example2 = msg(\"My name is name\", { name: \"John\", $context: \"name is a proper noun\" })\n * const m = useMessages()\n * m(example2); // Translates 'My name is John' in context\n */\n const m = useCallback(_m, [preloadedTranslations, _mFunction]);\n\n return m;\n}\n"],"x_google_ignoreList":[3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"mappings":"mqCAAA,MAAM,EAAuB,CAC3B,SAAU,QACV,OAAQ,IACR,SAAU,OACV,SAAU,OACV,gBAAiB,OAClB,CAID,SAAwB,GACtB,EAAiC,EAAE,CACnC,EACQ,CAIR,OAHI,OAAO,EAAM,MAAS,SAAiB,EAAM,KAG1C,OAFkB,EAAqB,IAAiB,QAEf,GADlC,EAAM,aACsC,KCZ5D,SAAS,GAAe,EAAM,CAC7B,IAAM,EAAU,EAAK,MAAM,CAE3B,OADK,EACE,UAAU,KAAK,EAAQ,CAAG,EAAU,GAAG,EAAQ,GADjC,GAGtB,SAAS,EAAc,EAAM,CAC5B,IAAM,EAAU,EAAK,MAAM,CACvB,EAAM,EAAQ,OAClB,KAAO,EAAM,GAAG,CACf,IAAM,EAAO,EAAQ,EAAM,GAC3B,GAAI,IAAS,KAAO,IAAS,KAAO,IAAS,IAAK,MAClD,IAED,OAAO,EAAQ,MAAM,EAAG,EAAI,CAE7B,SAAS,GAAmB,EAAM,CACjC,OAAO,EAAK,QAAQ,cAAgB,GAAU,EAAM,aAAa,CAAC,CAEnE,SAAS,GAAc,EAAS,CAC/B,GAAI,CAAC,EAAS,MAAO,GACrB,IAAM,EAAa,MAAM,QAAQ,EAAQ,CAAG,EAAQ,KAAK,KAAK,CAAG,EAEjE,OADK,EAAW,MAAM,CACf,GAAe,YAAY,IAAa,CADhB,GAGhC,SAAS,EAA6B,EAAO,CACxC,MAAS,KACb,OAAO,OAAO,EAAM,CAErB,SAAS,GAAwB,CAAE,SAAQ,WAAU,eAAc,cAAa,MAAK,MAAK,SAAQ,UAAS,WAAW,CACrH,IAAM,EAAS,EAAS,EAAW,GAAG,E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,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,KACA,KACA,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,GAAM,CACF,IACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACA,KACA,IACH,CACD,GAAM,CACF,IACA,KACH,CACD,GAAM,CACF,IACA,IACA,KACA,KACH,CACD,GAAM,CACF,IACA,KACA,IACA,KACH,CACD,GAAM,CACF,IACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,SAAU,CACN,IACA,KACA,KACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,SAAU,CACN,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,KACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,IACA,IACA,KACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,KACA,IACA,IACH,CACD,QAAS,CACL,KACA,IACA,KACA,IACH,CACD,QAAS,CACL,KACA,IACA,IACH,CACD,QAAS,CACL,IACA,KACA,KACA,IACH,CACJ,cC14CD,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,GAAM,CAAC,CAC7D,EAAQ,eAAiB,EACzB,IAAI,EAAA,IAAA,CAQJ,SAAS,EAAe,EAAU,EAAQ,CAEtC,IAAK,IADD,EAAe,GACV,EAAa,EAAG,EAAa,EAAS,OAAQ,IAAc,CACjE,IAAI,EAAc,EAAS,OAAO,EAAW,CAC7C,GAAI,IAAgB,IAAK,CAErB,IADA,IAAI,EAAc,EACX,EAAa,EAAI,EAAS,QAC7B,EAAS,OAAO,EAAa,EAAE,GAAK,GACpC,IACA,IAEJ,IAAI,EAAU,GAAK,EAAc,GAC7B,EAAe,EAAc,EA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BACA,SACA,gBACD,CAAC,CAIF,GAAe,CACb,aACA,YACA,aACA,wBACA,WACA,UACA,cACD,CAAC,CAIF,GAAM,CAAE,eAAc,oBAAoB,GAAoB,CAC5D,gBACA,sBACA,wBACA,mBACA,SACA,WACA,YACA,aACA,KACD,CAAC,CAII,CACJ,6BACA,6BACA,0BACE,GAAsB,CACxB,KACA,SACA,UAAW,EACX,gBACA,aACA,iBACA,mBACA,cACA,GAAG,GACJ,CAAC,CAII,CACJ,eACA,cACA,6BACA,qBACE,GAA+B,CACjC,KACA,eACA,SACA,gBACA,sBACA,yBACA,6BACA,cACD,CAAC,CAII,GAAsB,GAC1B,EACA,GACA,GACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,EACD,CAEK,EAAyB,GAC7B,IAAc,EAAE,CAChB,IAA0B,EAAE,CAC5B,GACA,GACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACD,CAIK,GAAU,CAAC,GAAG,CAAC,GAAuB,IAAiB,GAG7D,OACE,EAAC,EAAU,SAAX,CACE,MAAO,CACL,KACA,6BACA,6BACA,eACA,cACA,6BACA,oBACA,uBACA,yBACA,yBACA,SACA,QAAS,GACT,aACA,gBACA,UACA,aACA,eACA,sBACA,8BACA,YACA,iBACA,aACD,UAED,EAAC,EAAD,CAAoB,oBAAW,GAAU,EAAW,EAAoB,CAAA,CACrD,CAAA,CC3PzB,SAAS,GAAO,CACd,WACA,IACA,UACA,GAAG,GAMiB,CACpB,IAAM,EAAU,EAAW,EAAU,CACjC,EACA,IACF,IAAY,EAAQ,OACpB,IAAkB,EAAQ,eAE5B,IAAM,EAAkB,CACtB,GAAI,EAAU,CAAC,EAAQ,CAAG,EAAE,CAC5B,GAAA,KACD,CACD,GAAI,OAAO,GAAM,SACf,MAAU,MAAM,GAAyB,EAAS,CAAC,CACrD,OAAO,EAAA,EAAA,CAAA,SAAG,GAAgB,EAAG,EAAiB,EAAS,EAAI,EAAY,CAAA,CAGzE,GAAO,KAAO,SCnCd,SAAS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