{"version":3,"sources":["../src/index.ts","../src/internal/constants.ts","../src/internal/utils.ts","../src/internal/serialization.ts","../src/Item.ts","../src/internal/parser.ts","../src/plurals.ts","../src/parse.ts","../src/stringify.ts","../src/headers.ts","../src/references.ts","../src/catalog.ts","../src/icu/parser.ts","../src/icu/compile.ts","../src/messageId.ts","../src/internal/codegen.ts","../src/compile.ts","../src/comments.ts","../src/icu/conversion.ts","../src/icu/utils.ts"],"sourcesContent":["// Core API\nexport { parsePo, createPoFile } from \"./parse\"\nexport { stringifyPo } from \"./stringify\"\nexport { createItem, stringifyItem } from \"./Item\"\n\n// Header utilities\nexport { createDefaultHeaders, formatPoDate, getPluralFormsHeader } from \"./headers\"\n\n// Reference utilities\nexport {\n  parseReference,\n  formatReference,\n  parseReferences,\n  formatReferences,\n  createReference,\n  normalizeFilePath\n} from \"./references\"\n\n// Catalog utilities\nexport { catalogToItems, itemsToCatalog, mergeCatalogs } from \"./catalog\"\n\n// Compilation\nexport { compileCatalog, generateCompiledCode } from \"./compile\"\n\n// Message ID generation\nexport { generateMessageId, generateMessageIdSync, generateMessageIds } from \"./messageId\"\n\n// Plural utilities\nexport { parsePluralForms, getPluralCategories, getPluralCount, getPluralFunction } from \"./plurals\"\n\n// Comment utilities\nexport { splitMultilineComments } from \"./comments\"\n\n// ICU MessageFormat utilities\nexport {\n  // Parsing\n  parseIcu,\n  IcuParser,\n  IcuSyntaxError,\n  extractVariables,\n  extractVariableInfo,\n  validateIcu,\n  compareVariables,\n  hasPlural,\n  hasSelect,\n  hasSelectOrdinal,\n  hasIcuSyntax,\n  // Conversion (Gettext ↔ ICU)\n  gettextToIcu,\n  isPluralItem,\n  normalizeItemToIcu,\n  normalizeToIcu,\n  icuToGettextSource,\n  // Compilation\n  compileIcu,\n  createIcuCompiler\n} from \"./icu/index\"\n\n// Serialization utilities\nexport { DEFAULT_SERIALIZE_OPTIONS, foldLine, formatKeyword } from \"./internal/serialization\"\n\n// Low-level parsing utilities\nexport { escapeString, unescapeString, extractString } from \"./internal/utils\"\nexport { splitHeaderAndBody, parseHeaders, parseItems } from \"./internal/parser\"\n\n// Code generation utilities (for build tools)\nexport {\n  extractPluralVariable,\n  safeVarName,\n  sanitizeStyle,\n  escapeTemplateString,\n  escapeComment,\n  getNumberOptionsForStyle,\n  generatePluralFunctionCode,\n  generateFormatterDeclarations,\n  createCodeGenContext,\n  generateNodesCode,\n  generateNodeCode\n} from \"./internal/codegen\"\n\n// Types\nexport type {\n  Headers,\n  ParsedPluralForms,\n  PoFile,\n  PoItem,\n  CreateItemOptions,\n  SerializeOptions,\n  ParserState\n} from \"./types\"\n\n// Internal types (for advanced use cases)\nexport type { CodeGenContext, MessageCodeResult } from \"./internal/codegen\"\n\nexport type { CreateHeadersOptions } from \"./headers\"\nexport type { SourceReference, FormatReferenceOptions } from \"./references\"\nexport type { Catalog, CatalogEntry, CatalogToItemsOptions, ItemsToCatalogOptions } from \"./catalog\"\nexport type { CompileCatalogOptions, CompiledCatalog, GenerateCodeOptions } from \"./compile\"\nexport type { GenerateIdsOptions } from \"./messageId\"\n\n// ICU MessageFormat types\nexport type {\n  // Conversion types\n  GettextToIcuOptions,\n  NormalizeToIcuOptions,\n  IcuToGettextOptions,\n  // Style types\n  IcuDurationStyle,\n  IcuAgoStyle,\n  // Parser types\n  IcuNode,\n  IcuLiteralNode,\n  IcuArgumentNode,\n  IcuNumberNode,\n  IcuDateNode,\n  IcuTimeNode,\n  IcuListNode,\n  IcuDurationNode,\n  IcuAgoNode,\n  IcuNameNode,\n  IcuSelectNode,\n  IcuPluralNode,\n  IcuPoundNode,\n  IcuTagNode,\n  IcuPluralOption,\n  IcuSelectOption,\n  IcuLocation,\n  IcuPosition,\n  IcuParserOptions,\n  IcuParseError,\n  IcuParseResult,\n  IcuVariable,\n  IcuValidationResult,\n  IcuVariableComparison,\n  // Compile types\n  CompileIcuOptions,\n  CompiledMessageFunction,\n  MessageValues,\n  MessageResult\n} from \"./icu/index\"\n","import type { Headers } from \"../types\"\n\n// =============================================================================\n// Pre-compiled regex patterns for parser performance\n// =============================================================================\n\n/** Matches reference comments: #: */\nexport const RE_REFERENCE = /^#:/\n\n/** Matches flag comments: #, */\nexport const RE_FLAGS = /^#,/\n\n/** Matches translator comments: # or #  */\nexport const RE_COMMENT = /^#($|\\s+)/\n\n/** Matches extracted comments: #. */\nexport const RE_EXTRACTED = /^#\\./\n\n/** Matches obsolete markers: #~ */\nexport const RE_OBSOLETE = /^#~/\n\n/** Matches msgid_plural keyword */\nexport const RE_MSGID_PLURAL = /^msgid_plural/\n\n/** Matches msgid keyword */\nexport const RE_MSGID = /^msgid/\n\n/** Matches msgstr keyword with optional plural index */\nexport const RE_MSGSTR = /^msgstr/\n\n/** Extracts plural index from msgstr[n] */\nexport const RE_MSGSTR_INDEX = /^msgstr\\[(\\d+)\\]/\n\n/** Matches msgctxt keyword */\nexport const RE_MSGCTXT = /^msgctxt/\n\n/** Matches header msgid \"\" line */\nexport const RE_HEADER_MSGID = /msgid\\s+\"[^\"]/\n\n/** Matches quoted header line */\nexport const RE_QUOTED_LINE = /^\"/\n\n/** Matches header line without trailing \\n */\nexport const RE_HEADER_CONTINUATION = /^\".*\"$/\n\n/** Matches header line with trailing \\n */\nexport const RE_HEADER_COMPLETE = /^\".*\\\\n\"$/\n\n/** Matches escape sequences for unescaping */\nexport const RE_UNESCAPE = /\\\\([abtnvfr'\"\\\\?]|([0-7]{1,3})|x([0-9a-fA-F]{2}))/g\n\n/** Matches characters that need escaping */\n// eslint-disable-next-line no-control-regex\nexport const RE_ESCAPE = /[\\x07\\b\\t\\v\\f\\r\"\\\\]/g\n\n// =============================================================================\n// Default headers\n// =============================================================================\n\n/**\n * Default headers for a new PO file\n */\nexport const DEFAULT_HEADERS: Headers = {\n  \"Project-Id-Version\": \"\",\n  \"Report-Msgid-Bugs-To\": \"\",\n  \"POT-Creation-Date\": \"\",\n  \"PO-Revision-Date\": \"\",\n  \"Last-Translator\": \"\",\n  Language: \"\",\n  \"Language-Team\": \"\",\n  \"Content-Type\": \"\",\n  \"Content-Transfer-Encoding\": \"\",\n  \"Plural-Forms\": \"\"\n}\n\n/**\n * Map of special characters to their escape sequences (for serialization)\n */\nexport const ESCAPE_MAP: Record<string, string> = {\n  \"\\x07\": \"\\\\a\",\n  \"\\b\": \"\\\\b\",\n  \"\\t\": \"\\\\t\",\n  \"\\v\": \"\\\\v\",\n  \"\\f\": \"\\\\f\",\n  \"\\r\": \"\\\\r\",\n  '\"': '\\\\\"',\n  \"\\\\\": \"\\\\\\\\\"\n}\n\n/**\n * Map of escape sequences to their actual characters (for parsing)\n */\nexport const UNESCAPE_MAP: Record<string, string> = {\n  a: \"\\x07\",\n  b: \"\\b\",\n  t: \"\\t\",\n  n: \"\\n\",\n  v: \"\\v\",\n  f: \"\\f\",\n  r: \"\\r\"\n}\n","import { ESCAPE_MAP, UNESCAPE_MAP, RE_ESCAPE, RE_UNESCAPE } from \"./constants\"\n\n/** Pre-compiled regex for fast-path escape check */\n// eslint-disable-next-line no-control-regex\nconst RE_NEEDS_ESCAPE = /[\\x07\\b\\t\\v\\f\\r\"\\\\]/\n\n/**\n * Escapes special characters in a string for PO file format.\n * Handles bell, backspace, tab, vertical tab, form feed, carriage return,\n * double quotes, and backslashes.\n */\nexport function escapeString(str: string): string {\n  // Fast path: check if any escapable characters exist\n  // Common case: most strings don't need escaping\n  if (!RE_NEEDS_ESCAPE.test(str)) {\n    return str\n  }\n\n  // ESCAPE_MAP now contains all mappings including \" and \\\n  return str.replace(RE_ESCAPE, (match) => ESCAPE_MAP[match] ?? match)\n}\n\n/**\n * Unescapes C-style escape sequences in a string.\n * Handles: \\a \\b \\t \\n \\v \\f \\r \\' \\\" \\\\ \\? and octal/hex escapes.\n * Octal escapes can be 1-3 digits (e.g., \\0, \\77, \\123).\n */\nexport function unescapeString(str: string): string {\n  // Fast path: no backslash means no escape sequences\n  if (!str.includes(\"\\\\\")) {\n    return str\n  }\n\n  return str.replace(\n    RE_UNESCAPE,\n    (_, esc: string, oct: string | undefined, hex: string | undefined) => {\n      if (oct) {\n        return String.fromCharCode(parseInt(oct, 8))\n      }\n      if (hex) {\n        return String.fromCharCode(parseInt(hex, 16))\n      }\n      return UNESCAPE_MAP[esc] ?? esc\n    }\n  )\n}\n\n/**\n * Extracts the string value from a PO line.\n * Removes the keyword prefix and surrounding quotes, then unescapes.\n */\nexport function extractString(line: string): string {\n  // Find first and last quote positions (faster than regex)\n  const firstQuote = line.indexOf('\"')\n  if (firstQuote === -1) {\n    return \"\"\n  }\n\n  const lastQuote = line.lastIndexOf('\"')\n  if (lastQuote <= firstQuote) {\n    return \"\"\n  }\n\n  const str = line.substring(firstQuote + 1, lastQuote)\n  return unescapeString(str)\n}\n","import type { SerializeOptions } from \"../types\"\nimport { escapeString } from \"./utils\"\n\n/** Default serialization options */\nexport const DEFAULT_SERIALIZE_OPTIONS: Required<SerializeOptions> = {\n  foldLength: 80,\n  compactMultiline: true\n}\n\n/**\n * Folds a string into multiple lines at word boundaries.\n *\n * @param text - The text to fold (already escaped)\n * @param maxLength - Maximum line length\n * @returns Array of folded line segments\n */\nexport function foldLine(text: string, maxLength: number): string[] {\n  if (text.length <= maxLength) {\n    return [text]\n  }\n\n  const lines: string[] = []\n  let start = 0\n\n  while (start < text.length) {\n    const remaining = text.length - start\n    if (remaining <= maxLength) {\n      lines.push(text.substring(start))\n      break\n    }\n\n    const breakAt = findBreakPointAt(text, start, maxLength)\n    lines.push(text.substring(start, breakAt))\n    start = breakAt\n  }\n\n  return lines\n}\n\n/** Finds a good break point for line folding starting at offset */\nfunction findBreakPointAt(text: string, start: number, maxLength: number): number {\n  const end = start + maxLength\n\n  // Look for a space to break at\n  for (let i = end; i > start; i--) {\n    if (text[i] === \" \") {\n      return i + 1 // Include the space in the current line\n    }\n  }\n\n  // No space found, break at maxLength but avoid breaking escape sequences\n  if (text[end - 1] === \"\\\\\") {\n    return end - 1\n  }\n\n  return end\n}\n\n/** Escapes parts and adds \\n back to represent line breaks */\nfunction escapeAndJoinParts(parts: string[]): string[] {\n  const len = parts.length\n  const escaped: string[] = new Array<string>(len)\n\n  // Escape and add \\n in a single pass\n  for (let i = 0; i < len; i++) {\n    const part = escapeString(parts[i] ?? \"\")\n    // Add \\n to all parts except the last\n    escaped[i] = i < len - 1 ? part + \"\\\\n\" : part\n  }\n\n  return escaped\n}\n\n/** Applies line folding to escaped parts */\nfunction applyFolding(\n  escapedParts: string[],\n  foldLength: number,\n  keywordPrefixLength: number,\n  hasMultipleLines: boolean\n): string[] {\n  if (foldLength <= 0) {\n    return escapedParts\n  }\n\n  const firstLineMax = foldLength - keywordPrefixLength - 2 // -2 for quotes\n  const otherLineMax = foldLength - 2 // -2 for quotes\n  const allSegments: string[] = []\n\n  for (let i = 0; i < escapedParts.length; i++) {\n    const part = escapedParts[i] ?? \"\"\n    const maxLen = i === 0 && !hasMultipleLines ? firstLineMax : otherLineMax\n    const folded = foldLine(part, maxLen)\n    // Avoid spread operator for better performance\n    for (const segment of folded) {\n      allSegments.push(segment)\n    }\n  }\n\n  return allSegments\n}\n\n/** Builds output lines in compact or traditional format */\nfunction buildOutputLines(\n  segments: string[],\n  keywordPrefix: string,\n  useCompactFormat: boolean\n): string[] {\n  const lines: string[] = []\n\n  if (useCompactFormat) {\n    lines.push(`${keywordPrefix}\"${segments[0] ?? \"\"}\"`)\n    for (let i = 1; i < segments.length; i++) {\n      lines.push(`\"${segments[i] ?? \"\"}\"`)\n    }\n  } else {\n    lines.push(`${keywordPrefix}\"\"`)\n    for (const segment of segments) {\n      lines.push(`\"${segment}\"`)\n    }\n  }\n\n  return lines\n}\n\n/**\n * Formats a keyword and text into PO file lines.\n *\n * Handles:\n * 1. Multiline strings (containing \\n characters)\n * 2. Long strings that need folding (when foldLength > 0)\n * 3. Compact vs traditional GNU gettext format\n *\n * @param keyword - The PO keyword (msgid, msgstr, etc.)\n * @param text - The text value\n * @param index - Optional plural index\n * @param options - Serialization options\n */\n// eslint-disable-next-line complexity -- optimized for performance\nexport function formatKeyword(\n  keyword: string,\n  text: string,\n  index?: number,\n  options: SerializeOptions = {}\n): string[] {\n  const {\n    foldLength = DEFAULT_SERIALIZE_OPTIONS.foldLength,\n    compactMultiline = DEFAULT_SERIALIZE_OPTIONS.compactMultiline\n  } = options\n\n  // Build keyword prefix (e.g., \"msgstr[0] \")\n  const keywordPrefix = index !== undefined ? keyword + \"[\" + String(index) + \"] \" : keyword + \" \"\n\n  // Fast path: simple single-line string without newlines\n  // This is the most common case and avoids split/map/fold overhead\n  if (!text.includes(\"\\n\")) {\n    const escaped = escapeString(text)\n    const fullLine = keywordPrefix + '\"' + escaped + '\"'\n\n    // If it fits in one line (or folding disabled), return directly\n    if (foldLength <= 0 || fullLine.length <= foldLength) {\n      return [fullLine]\n    }\n  }\n\n  // Full path for multiline or long strings\n  const parts = text.split(\"\\n\")\n  const hasMultipleLines = parts.length > 1\n  const firstPartIsEmpty = parts[0] === \"\"\n\n  // Escape parts and add \\n markers\n  const escapedParts = escapeAndJoinParts(parts)\n\n  // Apply folding if enabled\n  const segments = applyFolding(escapedParts, foldLength, keywordPrefix.length, hasMultipleLines)\n\n  // Determine format: single line, compact multiline, or traditional\n  const isSingleLine = segments.length === 1 && !hasMultipleLines\n  if (isSingleLine) {\n    return [keywordPrefix + '\"' + (segments[0] ?? \"\") + '\"']\n  }\n\n  // Use compact format only if enabled AND first part has content\n  const useCompactFormat = compactMultiline && !firstPartIsEmpty\n  return buildOutputLines(segments, keywordPrefix, useCompactFormat)\n}\n","import type { CreateItemOptions, PoItem, SerializeOptions } from \"./types\"\nimport { formatKeyword, DEFAULT_SERIALIZE_OPTIONS } from \"./internal/serialization\"\nimport { escapeString } from \"./internal/utils\"\n\n/**\n * Creates a new translation item with default values.\n */\nexport function createItem(options?: CreateItemOptions): PoItem {\n  const npluralsValue = options?.nplurals\n  const npluralsNumber = Number(npluralsValue)\n\n  return {\n    msgid: \"\",\n    msgctxt: null,\n    references: [],\n    msgid_plural: null,\n    msgstr: [],\n    comments: [],\n    extractedComments: [],\n    flags: {},\n    metadata: {},\n    obsolete: false,\n    nplurals: isNaN(npluralsNumber) ? 2 : npluralsNumber\n  }\n}\n\n/**\n * Serializes an item to PO file format.\n *\n * @param item - The translation item to serialize\n * @param options - Serialization options for controlling output format\n */\n// eslint-disable-next-line complexity -- optimized for performance\nexport function stringifyItem(item: PoItem, options?: SerializeOptions): string {\n  const lines: string[] = []\n  const obsoletePrefix = item.obsolete ? \"#~ \" : \"\"\n\n  // Comments (order: translator, extracted, metadata, references, flags)\n  // Cast to allow undefined - handles incomplete items created manually\n  const comments = item.comments as string[] | undefined\n  const extractedComments = item.extractedComments as string[] | undefined\n  const metadata = item.metadata as Record<string, string> | undefined\n  const references = item.references as string[] | undefined\n  const flags = item.flags as Record<string, boolean> | undefined\n\n  for (const c of comments ?? []) {\n    lines.push(c ? \"# \" + c : \"#\")\n  }\n  for (const c of extractedComments ?? []) {\n    lines.push(c ? \"#. \" + c : \"#.\")\n  }\n  for (const key in metadata ?? {}) {\n    const value = metadata?.[key]\n    if (value !== undefined) {\n      lines.push(\"#@ \" + key + \": \" + value)\n    }\n  }\n  for (const ref of references ?? []) {\n    lines.push(\"#: \" + ref)\n  }\n\n  // Collect active flags without creating intermediate arrays\n  let flagStr = \"\"\n  for (const flag in flags ?? {}) {\n    if (flags?.[flag]) {\n      flagStr += (flagStr ? \",\" : \"\") + flag\n    }\n  }\n  if (flagStr) {\n    lines.push(\"#, \" + flagStr)\n  }\n\n  // Message fields\n  if (item.msgctxt != null) {\n    appendKeyword(lines, \"msgctxt\", item.msgctxt, obsoletePrefix, options)\n  }\n\n  appendKeyword(lines, \"msgid\", item.msgid, obsoletePrefix, options)\n\n  if (item.msgid_plural != null) {\n    appendKeyword(lines, \"msgid_plural\", item.msgid_plural, obsoletePrefix, options)\n  }\n\n  appendMsgstr(lines, item, obsoletePrefix, options)\n\n  return lines.join(\"\\n\")\n}\n\n/** Appends a single keyword line to the output */\nfunction appendKeyword(\n  lines: string[],\n  keyword: string,\n  text: string,\n  prefix: string,\n  options?: SerializeOptions\n): void {\n  const formatted = formatKeyword(keyword, text, undefined, options)\n  lines.push(prefix + formatted.join(\"\\n\" + prefix))\n}\n\n/** Appends msgstr line(s) to the output, handling plurals */\nfunction appendMsgstr(\n  lines: string[],\n  item: PoItem,\n  prefix: string,\n  options?: SerializeOptions\n): void {\n  const hasPlural = item.msgid_plural != null\n  const msgstr = (item.msgstr as string[] | undefined) ?? []\n  const msgstrLen = msgstr.length\n\n  if (msgstrLen > 1) {\n    appendMultipleMsgstr(lines, msgstr, prefix, options)\n  } else if (hasPlural && (msgstrLen === 0 || !msgstr[0])) {\n    appendEmptyMsgstr(lines, (item.nplurals as number | undefined) ?? 2, prefix)\n  } else {\n    appendSingleMsgstr(lines, item, hasPlural, prefix, options)\n  }\n}\n\n/** Handles multiple msgstr entries (plurals with translations) */\nfunction appendMultipleMsgstr(\n  lines: string[],\n  msgstr: string[],\n  prefix: string,\n  options?: SerializeOptions\n): void {\n  const foldLength = options?.foldLength ?? DEFAULT_SERIALIZE_OPTIONS.foldLength\n  // 'msgstr[N] \"' = 10 chars + closing '\"' = 11, plus safety margin = 12\n  const MSGSTR_PREFIX_LENGTH = 12\n  const maxLen = foldLength > 0 ? foldLength - MSGSTR_PREFIX_LENGTH : Infinity\n  const len = msgstr.length\n\n  // Try fast path: build all lines in one pass, bail to slow path if needed\n  for (let i = 0; i < len; i++) {\n    const text = msgstr[i] ?? \"\"\n\n    // Check if we need the slow path (newlines or too long)\n    if (text.length > maxLen || text.includes(\"\\n\")) {\n      // Slow path: use formatKeyword for remaining entries\n      appendMsgstrSlow(lines, msgstr, i, prefix, options)\n      return\n    }\n\n    // Fast path: direct string construction\n    lines.push(prefix + \"msgstr[\" + String(i) + '] \"' + escapeString(text) + '\"')\n  }\n}\n\n/** Slow path for msgstr with complex content (starting from index) */\nfunction appendMsgstrSlow(\n  lines: string[],\n  msgstr: string[],\n  startIndex: number,\n  prefix: string,\n  options?: SerializeOptions\n): void {\n  for (let i = startIndex; i < msgstr.length; i++) {\n    const formatted = formatKeyword(\"msgstr\", msgstr[i] ?? \"\", i, options)\n    lines.push(prefix + formatted.join(\"\\n\" + prefix))\n  }\n}\n\n/** Handles single msgstr (possibly with index 0 for plurals) */\nfunction appendSingleMsgstr(\n  lines: string[],\n  item: PoItem,\n  hasPlural: boolean,\n  prefix: string,\n  options?: SerializeOptions\n): void {\n  const index = hasPlural ? 0 : undefined\n  const msgstr = (item.msgstr as string[] | undefined) ?? []\n  const text = msgstr.length === 1 ? (msgstr[0] ?? \"\") : msgstr.join(\"\")\n  const formatted = formatKeyword(\"msgstr\", text, index, options)\n  lines.push(prefix + formatted.join(\"\\n\" + prefix))\n}\n\n/** Appends empty msgstr[n] lines for untranslated plurals */\nfunction appendEmptyMsgstr(lines: string[], nplurals: number, prefix: string): void {\n  for (let i = 0; i < nplurals; i++) {\n    lines.push(prefix + \"msgstr[\" + String(i) + '] \"\"')\n  }\n}\n","import type { ParserState, PoFile, PoItem } from \"../types\"\nimport { createItem } from \"../Item\"\nimport { extractString } from \"./utils\"\nimport { RE_HEADER_MSGID, RE_HEADER_CONTINUATION, RE_HEADER_COMPLETE } from \"./constants\"\n\n/**\n * Splits PO file content into header section and body lines.\n */\nexport function splitHeaderAndBody(data: string): {\n  headerSection: string\n  bodyLines: string[]\n} {\n  const sections = data.split(\"\\n\\n\")\n  const headerParts: string[] = []\n  let foundHeaderMsgid = false\n\n  // Collect sections until we find one with 'msgid \"\"'\n  while (sections[0]) {\n    if (foundHeaderMsgid) {\n      break\n    }\n\n    if (RE_HEADER_MSGID.test(sections[0])) {\n      // Found first real msgid, add dummy header marker\n      headerParts.push('msgid \"\"')\n      foundHeaderMsgid = true\n    } else {\n      const shifted = sections.shift()\n      if (shifted !== undefined) {\n        headerParts.push(shifted)\n        if (shifted.includes('msgid \"\"')) {\n          foundHeaderMsgid = true\n        }\n      }\n    }\n  }\n\n  // Flatten remaining sections into lines without intermediate join\n  const bodyLines: string[] = []\n  for (const section of sections) {\n    const lines = section.split(\"\\n\")\n    for (const line of lines) {\n      bodyLines.push(line)\n    }\n  }\n\n  return {\n    headerSection: headerParts.join(\"\\n\"),\n    bodyLines\n  }\n}\n\n/**\n * Parses the header section and populates the PO file.\n */\nexport function parseHeaders(headerSection: string, po: PoFile): void {\n  const lines = mergeMultilineHeaders(headerSection.split(\"\\n\"))\n\n  for (const line of lines) {\n    if (line.startsWith(\"#.\")) {\n      po.extractedComments.push(line.slice(2).trim())\n    } else if (line.startsWith(\"#\")) {\n      po.comments.push(line.slice(1).trim())\n    } else if (line.startsWith('\"')) {\n      parseHeaderLine(line, po)\n    }\n  }\n}\n\n/**\n * Merges continuation lines for multi-line header values.\n *\n * In PO files, header values can span multiple lines if they don't end with \\n.\n * This function joins them back together.\n *\n * @example\n * Input:  ['\"Content-Type: text/plain; \"', '\"charset=UTF-8\\\\n\"']\n * Output: ['\"Content-Type: text/plain; charset=UTF-8\\\\n\"']\n */\nfunction mergeMultilineHeaders(lines: string[]): string[] {\n  const result: string[] = []\n  let pendingMerge = false\n\n  for (let line of lines) {\n    if (pendingMerge && result.length > 0) {\n      const prev = result.pop()\n      if (prev !== undefined) {\n        line = prev.slice(0, -1) + line.slice(1)\n      }\n      pendingMerge = false\n    }\n\n    if (RE_HEADER_CONTINUATION.test(line) && !RE_HEADER_COMPLETE.test(line)) {\n      pendingMerge = true\n    }\n\n    result.push(line)\n  }\n\n  return result\n}\n\n/**\n * Parses a single header line like \"Content-Type: text/plain\\n\"\n */\nfunction parseHeaderLine(line: string, po: PoFile): void {\n  // Line format: \"Header-Name: value\\n\" - extract content between quotes\n  const trimmed = line.trim()\n  // Skip opening quote, remove trailing \\n\" (3 chars: \\, n, \")\n  const endOffset = trimmed.endsWith('\\\\n\"') ? 3 : 1\n  const cleaned = trimmed.substring(1, trimmed.length - endOffset)\n\n  const colonIndex = cleaned.indexOf(\":\")\n  if (colonIndex === -1) {\n    return\n  }\n\n  const name = cleaned.substring(0, colonIndex).trim()\n  const value = cleaned.substring(colonIndex + 1).trim()\n\n  po.headers[name] = value\n  po.headerOrder.push(name)\n}\n\n/**\n * Parses item lines and populates the PO file.\n */\nexport function parseItems(lines: string[], po: PoFile, nplurals: string | undefined): void {\n  const state: ParserState = {\n    item: createItem({ nplurals }),\n    context: null,\n    plural: 0,\n    obsoleteCount: 0,\n    noCommentLineCount: 0\n  }\n\n  for (const rawLine of lines) {\n    let line = rawLine.trim()\n\n    // Handle obsolete markers inline to avoid object allocation\n    if (line.startsWith(\"#~\")) {\n      line = line.substring(2).trim()\n      state.obsoleteCount++\n    }\n\n    parseLine(line, state, po, nplurals)\n  }\n\n  // Finish last item\n  finishItem(state, po, nplurals)\n}\n\n/**\n * Parses a single line and updates parser state.\n *\n * Dispatches based on first character for O(1) line type detection:\n * - '\"': Continuation of previous multiline string\n * - '#': Comment line (#, #:, #,, #.)\n * - 'm': Keyword line (msgid, msgstr, msgctxt, msgid_plural)\n */\nfunction parseLine(\n  line: string,\n  state: ParserState,\n  po: PoFile,\n  nplurals: string | undefined\n): void {\n  if (line.length === 0) {\n    return\n  }\n\n  const firstChar = line[0]\n\n  if (firstChar === '\"') {\n    appendMultilineValue(line, state)\n    return\n  }\n\n  if (firstChar === \"#\") {\n    parseCommentLine(line, state, po, nplurals)\n    return\n  }\n\n  if (firstChar === \"m\") {\n    parseKeywordLine(line, state, po, nplurals)\n  }\n}\n\n/**\n * Parses comment lines (#: #, # #. #@)\n * Assumes line starts with '#' (checked by caller).\n */\nfunction parseCommentLine(\n  line: string,\n  state: ParserState,\n  po: PoFile,\n  nplurals: string | undefined\n): void {\n  const secondChar = line[1]\n\n  if (secondChar === \":\") {\n    // Reference comment: #:\n    finishItem(state, po, nplurals)\n    state.item.references.push(line.slice(2).trim())\n  } else if (secondChar === \",\") {\n    // Flags comment: #,\n    finishItem(state, po, nplurals)\n    parseFlags(line, state.item)\n  } else if (secondChar === \".\") {\n    // Extracted comment: #.\n    finishItem(state, po, nplurals)\n    state.item.extractedComments.push(line.slice(2).trim())\n  } else if (secondChar === \"@\") {\n    // Metadata comment: #@ key: value\n    finishItem(state, po, nplurals)\n    parseMetadata(line, state.item)\n  } else if (secondChar === undefined || secondChar === \" \") {\n    // Translator comment: # or #<space>\n    finishItem(state, po, nplurals)\n    state.item.comments.push(line.slice(1).trim())\n  }\n}\n\n/**\n * Parses keyword lines (msgid, msgstr, msgctxt, msgid_plural).\n *\n * Handles plural forms via bracket syntax: msgstr[0], msgstr[1], etc.\n * The plural index is parsed inline for efficiency (avoiding regex).\n *\n * Note: msgid_plural checked before msgid (longer prefix match first).\n */\nfunction parseKeywordLine(\n  line: string,\n  state: ParserState,\n  po: PoFile,\n  nplurals: string | undefined\n): void {\n  if (line.startsWith(\"msgid_plural\")) {\n    state.item.msgid_plural = extractString(line)\n    state.context = \"msgid_plural\"\n    state.noCommentLineCount++\n  } else if (line.startsWith(\"msgid\")) {\n    finishItem(state, po, nplurals)\n    state.item.msgid = extractString(line)\n    state.context = \"msgid\"\n    state.noCommentLineCount++\n  } else if (line.startsWith(\"msgstr\")) {\n    // Parse plural index from msgstr[N] - bracket at position 6\n    if (line[6] === \"[\") {\n      const closeBracket = line.indexOf(\"]\", 7)\n      state.plural = closeBracket > 7 ? parseInt(line.substring(7, closeBracket), 10) : 0\n    } else {\n      state.plural = 0\n    }\n    state.item.msgstr[state.plural] = extractString(line)\n    state.context = \"msgstr\"\n    state.noCommentLineCount++\n  } else if (line.startsWith(\"msgctxt\")) {\n    finishItem(state, po, nplurals)\n    state.item.msgctxt = extractString(line)\n    state.context = \"msgctxt\"\n    state.noCommentLineCount++\n  }\n}\n\n/**\n * Parses flag line and adds flags to item.\n */\nfunction parseFlags(line: string, item: PoItem): void {\n  const flags = line.slice(2).trim().split(\",\")\n  for (const flag of flags) {\n    item.flags[flag.trim()] = true\n  }\n}\n\n/**\n * Parses metadata comment line (#@ key: value) and adds to item.\n */\nfunction parseMetadata(line: string, item: PoItem): void {\n  const content = line.slice(2).trim()\n  const colonIndex = content.indexOf(\":\")\n  if (colonIndex === -1) {\n    return\n  }\n  const key = content.substring(0, colonIndex).trim()\n  const value = content.substring(colonIndex + 1).trim()\n  if (key) {\n    item.metadata[key] = value\n  }\n}\n\n/**\n * Appends a continuation line to the current context.\n */\nfunction appendMultilineValue(line: string, state: ParserState): void {\n  state.noCommentLineCount++\n  const value = extractString(line)\n\n  switch (state.context) {\n    case \"msgstr\":\n      state.item.msgstr[state.plural] = (state.item.msgstr[state.plural] ?? \"\") + value\n      break\n    case \"msgid\":\n      state.item.msgid += value\n      break\n    case \"msgid_plural\":\n      state.item.msgid_plural = (state.item.msgid_plural ?? \"\") + value\n      break\n    case \"msgctxt\":\n      state.item.msgctxt = (state.item.msgctxt ?? \"\") + value\n      break\n  }\n}\n\n/**\n * Finishes the current item and prepares for the next one.\n */\nfunction finishItem(state: ParserState, po: PoFile, nplurals: string | undefined): void {\n  if (state.item.msgid.length === 0) {\n    return\n  }\n\n  if (state.obsoleteCount >= state.noCommentLineCount) {\n    state.item.obsolete = true\n  }\n\n  po.items.push(state.item)\n\n  // Reset state for next item\n  state.item = createItem({ nplurals })\n  state.context = null\n  state.plural = 0\n  state.obsoleteCount = 0\n  state.noCommentLineCount = 0\n}\n","/**\n * CLDR Plural Categories and Locale Mappings\n *\n * Uses native Intl.PluralRules for plural selection.\n *\n * @see https://cldr.unicode.org/index/cldr-spec/plural-rules\n * @see https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html\n */\n\nimport type { ParsedPluralForms } from \"./types\"\n\n/**\n * Parses the Plural-Forms header value from a PO file.\n * Example: \"nplurals=2; plural=(n != 1);\"\n *\n * Note: The plural expression is a legacy Gettext format.\n * For runtime plural selection, use `getPluralFunction(locale)` instead.\n */\nexport function parsePluralForms(pluralFormsString: string | undefined): ParsedPluralForms {\n  const parts = (pluralFormsString ?? \"\").split(\";\")\n  const results: Record<string, string> = {}\n\n  for (const part of parts) {\n    const trimmed = part.trim()\n    const eqIndex = trimmed.indexOf(\"=\")\n    if (eqIndex > 0) {\n      const key = trimmed.substring(0, eqIndex).trim()\n      const value = trimmed.substring(eqIndex + 1).trim()\n      results[key] = value\n    }\n  }\n\n  return {\n    nplurals: results.nplurals,\n    plural: results.plural\n  }\n}\n\n/**\n * Cache for Intl.PluralRules instances.\n */\nconst pluralRulesCache = new Map<string, Intl.PluralRules>()\n\n/**\n * Normalizes locale string for Intl APIs.\n * Converts underscores to hyphens (pt_BR → pt-BR).\n */\nfunction normalizeLocale(locale: string): string {\n  return locale.replace(/_/g, \"-\")\n}\n\n/**\n * Gets or creates a cached Intl.PluralRules instance.\n */\nfunction getPluralRules(locale: string): Intl.PluralRules {\n  const normalized = normalizeLocale(locale)\n  let pr = pluralRulesCache.get(normalized)\n  if (!pr) {\n    pr = new Intl.PluralRules(normalized)\n    pluralRulesCache.set(normalized, pr)\n  }\n  return pr\n}\n\n/**\n * Canonical CLDR category order.\n * Intl.PluralRules returns categories in varying orders across ICU versions.\n * We normalize to this order for consistent behavior.\n */\nconst CLDR_CATEGORY_ORDER: Record<string, number> = {\n  zero: 0,\n  one: 1,\n  two: 2,\n  few: 3,\n  many: 4,\n  other: 5\n}\n\n/**\n * Cache for sorted plural categories per locale.\n */\nconst categoriesCache = new Map<string, readonly string[]>()\n\n/**\n * Returns the CLDR plural categories for a locale.\n * Uses native Intl.PluralRules for accurate, up-to-date CLDR data.\n * Categories are sorted in canonical CLDR order for consistency across ICU versions.\n *\n * @example\n * getPluralCategories(\"de\")  // → [\"one\", \"other\"]\n * getPluralCategories(\"pl\")  // → [\"one\", \"few\", \"many\", \"other\"]\n * getPluralCategories(\"ar\")  // → [\"zero\", \"one\", \"two\", \"few\", \"many\", \"other\"]\n */\nexport function getPluralCategories(locale: string): readonly string[] {\n  const normalized = normalizeLocale(locale)\n  let categories = categoriesCache.get(normalized)\n  if (!categories) {\n    const raw = getPluralRules(locale).resolvedOptions().pluralCategories\n    categories = [...raw].sort(\n      (a, b) => (CLDR_CATEGORY_ORDER[a] ?? 99) - (CLDR_CATEGORY_ORDER[b] ?? 99)\n    )\n    categoriesCache.set(normalized, categories)\n  }\n  return categories\n}\n\n/**\n * Returns the number of plural forms for a locale.\n *\n * @example\n * getPluralCount(\"de\")  // → 2\n * getPluralCount(\"pl\")  // → 4\n * getPluralCount(\"ar\")  // → 6\n */\nexport function getPluralCount(locale: string): number {\n  return getPluralCategories(locale).length\n}\n\n/**\n * Returns the plural selector function for a locale.\n * Uses native Intl.PluralRules for CLDR-compliant selection.\n *\n * @example\n * const selectPlural = getPluralFunction(\"de\")\n * selectPlural(1)  // → 0 (one)\n * selectPlural(5)  // → 1 (other)\n */\nexport function getPluralFunction(locale: string): (n: number) => number {\n  const pr = getPluralRules(locale)\n  const categories = getPluralCategories(locale)\n\n  return (n: number): number => {\n    const category = pr.select(n)\n    const index = categories.indexOf(category)\n    return index >= 0 ? index : categories.length - 1\n  }\n}\n","import type { PoFile } from \"./types\"\nimport { DEFAULT_HEADERS } from \"./internal/constants\"\nimport { splitHeaderAndBody, parseHeaders, parseItems } from \"./internal/parser\"\nimport { parsePluralForms } from \"./plurals\"\n\n/**\n * Creates a new empty PO file structure with default headers.\n */\nexport function createPoFile(): PoFile {\n  return {\n    comments: [],\n    extractedComments: [],\n    headers: { ...DEFAULT_HEADERS },\n    headerOrder: [],\n    items: []\n  }\n}\n\n/**\n * Parses a PO file string into a PoFile structure.\n */\nexport function parsePo(data: string): PoFile {\n  // Normalize line endings (Windows CRLF to Unix LF)\n  if (data.includes(\"\\r\\n\")) {\n    data = data.replaceAll(\"\\r\\n\", \"\\n\")\n  }\n\n  const po = createPoFile()\n  const { headerSection, bodyLines } = splitHeaderAndBody(data)\n\n  // Parse headers\n  parseHeaders(headerSection, po)\n\n  // Parse items\n  const nplurals = parsePluralForms(po.headers[\"Plural-Forms\"]).nplurals\n  parseItems(bodyLines, po, nplurals)\n\n  return po\n}\n","import type { Headers, PoFile, SerializeOptions } from \"./types\"\nimport { stringifyItem } from \"./Item\"\n\n/** Appends file-level comments to lines array */\nfunction appendFileComments(lines: string[], po: Partial<PoFile>): void {\n  for (const comment of po.comments ?? []) {\n    lines.push(comment ? \"# \" + comment : \"#\")\n  }\n  for (const comment of po.extractedComments ?? []) {\n    lines.push(comment ? \"#. \" + comment : \"#.\")\n  }\n}\n\n/** Appends header section to lines array */\nfunction appendHeaders(lines: string[], po: Partial<PoFile>): void {\n  lines.push('msgid \"\"')\n  lines.push('msgstr \"\"')\n\n  const headers = po.headers ?? {}\n  const orderedKeys = getOrderedHeaderKeys({\n    headers,\n    headerOrder: po.headerOrder ?? []\n  })\n  for (const key of orderedKeys) {\n    lines.push(`\"${key}: ${headers[key] ?? \"\"}\\\\n\"`)\n  }\n  lines.push(\"\")\n}\n\n/**\n * Serializes a PoFile structure to a string.\n *\n * Accepts partial input - missing fields default to empty arrays/objects.\n *\n * @param po - The PO file structure to serialize (can be partial)\n * @param options - Serialization options for controlling output format\n *\n * @example\n * // Default: compact format, 80 char fold length (Crowdin-compatible)\n * const output = stringifyPo(po)\n *\n * @example\n * // Partial input - only headers and items required\n * const output = stringifyPo({ headers: myHeaders, items: myItems })\n *\n * @example\n * // GNU gettext traditional format\n * const output = stringifyPo(po, { compactMultiline: false })\n *\n * @example\n * // No line folding\n * const output = stringifyPo(po, { foldLength: 0 })\n */\nexport function stringifyPo(po: Partial<PoFile>, options?: SerializeOptions): string {\n  const lines: string[] = []\n\n  appendFileComments(lines, po)\n  appendHeaders(lines, po)\n\n  for (const item of po.items ?? []) {\n    lines.push(stringifyItem(item, options))\n    lines.push(\"\")\n  }\n\n  return lines.join(\"\\n\")\n}\n\n/** Returns header keys in the correct order */\nfunction getOrderedHeaderKeys(po: { headers: Partial<Headers>; headerOrder: string[] }): string[] {\n  const result: string[] = []\n  const seen = new Set<string>()\n\n  // First, add keys from headerOrder that still exist\n  for (const key of po.headerOrder) {\n    if (key in po.headers) {\n      result.push(key)\n      seen.add(key)\n    }\n  }\n\n  // Then add any new keys not in headerOrder\n  for (const key of Object.keys(po.headers)) {\n    if (!seen.has(key)) {\n      result.push(key)\n    }\n  }\n\n  return result\n}\n","/**\n * Default headers helper for creating PO files.\n */\n\nimport { getPluralCount } from \"./plurals\"\nimport type { Headers } from \"./types\"\n\n/**\n * Options for creating default PO file headers.\n */\nexport interface CreateHeadersOptions {\n  /**\n   * Target language code (e.g., \"de\", \"fr\", \"en-US\")\n   */\n  language?: string\n\n  /**\n   * Generator tool name\n   * @default \"pofile-ts\"\n   */\n  generator?: string\n\n  /**\n   * Project name and version\n   * @default \"\"\n   */\n  projectIdVersion?: string\n\n  /**\n   * Email for reporting msgid bugs\n   * @default \"\"\n   */\n  reportBugsTo?: string\n\n  /**\n   * Translator name and email\n   * @default \"\"\n   */\n  lastTranslator?: string\n\n  /**\n   * Translation team name\n   * @default \"\"\n   */\n  languageTeam?: string\n\n  /**\n   * Plural forms expression (e.g., \"nplurals=2; plural=(n != 1);\")\n   * If not provided but language is set, auto-generates from CLDR.\n   * Set to `false` to explicitly omit the header.\n   */\n  pluralForms?: string | false\n\n  /**\n   * Custom headers to add or override\n   */\n  custom?: Record<string, string>\n}\n\n/**\n * Formats a date in PO file format: \"YYYY-MM-DD HH:MM+ZZZZ\"\n *\n * @example\n * formatPoDate(new Date(\"2025-12-11T14:30:00+01:00\"))\n * // → \"2025-12-11 14:30+0100\"\n */\nexport function formatPoDate(date: Date): string {\n  const pad = (n: number) => n.toString().padStart(2, \"0\")\n\n  const year = date.getFullYear()\n  const month = pad(date.getMonth() + 1)\n  const day = pad(date.getDate())\n  const hours = pad(date.getHours())\n  const minutes = pad(date.getMinutes())\n\n  const offset = -date.getTimezoneOffset()\n  const sign = offset >= 0 ? \"+\" : \"-\"\n  const offsetHours = pad(Math.floor(Math.abs(offset) / 60))\n  const offsetMins = pad(Math.abs(offset) % 60)\n\n  return `${year}-${month}-${day} ${hours}:${minutes}${sign}${offsetHours}${offsetMins}`\n}\n\n/** Builds the base headers object */\nfunction buildBaseHeaders(options: CreateHeadersOptions, now: string): Partial<Headers> {\n  return {\n    \"Project-Id-Version\": options.projectIdVersion ?? \"\",\n    \"Report-Msgid-Bugs-To\": options.reportBugsTo ?? \"\",\n    \"POT-Creation-Date\": now,\n    \"PO-Revision-Date\": now,\n    \"Last-Translator\": options.lastTranslator ?? \"\",\n    Language: options.language ?? \"\",\n    \"Language-Team\": options.languageTeam ?? \"\",\n    \"MIME-Version\": \"1.0\",\n    \"Content-Type\": \"text/plain; charset=utf-8\",\n    \"Content-Transfer-Encoding\": \"8bit\",\n    \"X-Generator\": options.generator ?? \"pofile-ts\"\n  }\n}\n\n/**\n * Generates a Plural-Forms header string for a locale.\n *\n * Uses CLDR data via Intl.PluralRules to determine nplurals.\n * The plural expression is a simple fallback - for accurate runtime\n * plural selection, use `getPluralFunction(locale)` instead.\n *\n * @example\n * getPluralFormsHeader(\"de\")  // → \"nplurals=2; plural=(n != 1);\"\n * getPluralFormsHeader(\"pl\")  // → \"nplurals=4; plural=(n != 1);\"\n * getPluralFormsHeader(\"ar\")  // → \"nplurals=6; plural=(n != 1);\"\n */\nexport function getPluralFormsHeader(language: string): string {\n  const nplurals = getPluralCount(language)\n  // Simple expression that works for 1-2 forms\n  // For 3+ forms, tools should use their own CLDR data\n  const plural = nplurals === 1 ? \"0\" : \"(n != 1)\"\n  return `nplurals=${nplurals}; plural=${plural};`\n}\n\n/**\n * Creates default PO file headers with sensible defaults.\n *\n * If `language` is provided and `pluralForms` is not explicitly set,\n * automatically generates Plural-Forms from CLDR data.\n *\n * @example\n * const headers = createDefaultHeaders({\n *   language: \"de\",\n *   generator: \"my-tool\",\n * })\n * // → includes \"Plural-Forms: nplurals=2; plural=(n != 1);\"\n */\nexport function createDefaultHeaders(options: CreateHeadersOptions = {}): Partial<Headers> {\n  const now = formatPoDate(new Date())\n  const headers = buildBaseHeaders(options, now)\n\n  // Handle Plural-Forms: explicit string, auto-generate, or omit\n  if (typeof options.pluralForms === \"string\") {\n    headers[\"Plural-Forms\"] = options.pluralForms\n  } else if (options.pluralForms !== false && options.language) {\n    headers[\"Plural-Forms\"] = getPluralFormsHeader(options.language)\n  }\n\n  // Apply custom headers (can override defaults)\n  return { ...headers, ...options.custom }\n}\n","/**\n * Utilities for parsing and formatting PO file references.\n *\n * References in PO files use the format: file:line\n * Example: \"src/App.tsx:42\"\n */\n\n/** Pre-compiled regex for backslash replacement */\nconst BACKSLASH_REGEX = /\\\\/g\n\n/**\n * A parsed source reference.\n */\nexport interface SourceReference {\n  /** File path (always uses forward slashes) */\n  file: string\n  /** Line number (optional) */\n  line?: number\n}\n\n/**\n * Options for formatting references.\n */\nexport interface FormatReferenceOptions {\n  /**\n   * Include line numbers in the output.\n   * @default true\n   */\n  includeLineNumbers?: boolean\n}\n\n/**\n * Parses a PO file reference string into its components.\n *\n * Parses from right to find the line number, handling edge cases like\n * colons in file paths.\n *\n * @throws Error if the reference format is invalid\n *\n * @example\n * parseReference(\"src/App.tsx:42\")\n * // → { file: \"src/App.tsx\", line: 42 }\n *\n * parseReference(\"src/App.tsx\")\n * // → { file: \"src/App.tsx\" }\n */\nexport function parseReference(reference: string): SourceReference {\n  const trimmed = reference.trim()\n\n  if (!trimmed) {\n    throw new Error(\"Reference cannot be empty\")\n  }\n\n  // Find the last colon\n  const lastColonIndex = trimmed.lastIndexOf(\":\")\n\n  // No colon or colon at start (could be Windows drive letter like C:\\)\n  if (lastColonIndex === -1 || lastColonIndex === 0) {\n    return { file: normalizeFilePath(trimmed) }\n  }\n\n  // Check if what follows the colon is a valid line number\n  const afterColon = trimmed.slice(lastColonIndex + 1)\n  const lineNumber = parseInt(afterColon, 10)\n\n  // If it's a valid positive integer, treat it as a line number\n  if (!isNaN(lineNumber) && lineNumber > 0 && String(lineNumber) === afterColon) {\n    const file = trimmed.slice(0, lastColonIndex)\n\n    if (!file) {\n      throw new Error(`Invalid reference format: \"${reference}\"`)\n    }\n\n    return {\n      file: normalizeFilePath(file),\n      line: lineNumber\n    }\n  }\n\n  // Not a valid line number, treat entire string as file path\n  return { file: normalizeFilePath(trimmed) }\n}\n\n/**\n * Formats a source reference back to a string.\n *\n * @example\n * formatReference({ file: \"src/App.tsx\", line: 42 })\n * // → \"src/App.tsx:42\"\n *\n * formatReference({ file: \"src/App.tsx\" })\n * // → \"src/App.tsx\"\n *\n * formatReference({ file: \"src/App.tsx\", line: 42 }, { includeLineNumbers: false })\n * // → \"src/App.tsx\"\n */\nexport function formatReference(\n  ref: SourceReference,\n  options: FormatReferenceOptions = {}\n): string {\n  const { includeLineNumbers = true } = options\n  const file = normalizeFilePath(ref.file)\n\n  if (includeLineNumbers && ref.line !== undefined && ref.line > 0) {\n    return `${file}:${ref.line}`\n  }\n\n  return file\n}\n\n/**\n * Normalizes a file path to use forward slashes (Unix-style).\n *\n * Always converts backslashes to forward slashes, regardless of platform.\n * This ensures consistent output in PO files.\n *\n * @example\n * normalizeFilePath(\"src\\\\components\\\\App.tsx\")\n * // → \"src/components/App.tsx\"\n */\nexport function normalizeFilePath(filePath: string): string {\n  return filePath.replace(BACKSLASH_REGEX, \"/\")\n}\n\n/**\n * Checks if a file path is absolute.\n */\nfunction isAbsolutePath(filePath: string): boolean {\n  // Unix absolute path\n  if (filePath.startsWith(\"/\")) {\n    return true\n  }\n  // Windows absolute path (e.g., C:\\, D:\\)\n  if (/^[A-Za-z]:[/\\\\]/.test(filePath)) {\n    return true\n  }\n  return false\n}\n\n/**\n * Parses multiple references from a single string.\n *\n * References can be separated by spaces or commas.\n *\n * @throws Error if any reference format is invalid\n *\n * @example\n * parseReferences(\"src/App.tsx:42 src/utils.ts:10\")\n * // → [{ file: \"src/App.tsx\", line: 42 }, { file: \"src/utils.ts\", line: 10 }]\n */\nexport function parseReferences(references: string): SourceReference[] {\n  if (!references.trim()) {\n    return []\n  }\n\n  // Split by whitespace\n  const parts = references.trim().split(/\\s+/)\n\n  return parts.map((part) => parseReference(part))\n}\n\n/**\n * Formats multiple references to a string.\n *\n * @example\n * formatReferences([\n *   { file: \"src/App.tsx\", line: 42 },\n *   { file: \"src/utils.ts\", line: 10 }\n * ])\n * // → \"src/App.tsx:42 src/utils.ts:10\"\n */\nexport function formatReferences(\n  refs: SourceReference[],\n  options: FormatReferenceOptions = {}\n): string {\n  return refs.map((ref) => formatReference(ref, options)).join(\" \")\n}\n\n/**\n * Creates a reference from a file path and optional line number.\n *\n * Validates that the path is relative and normalizes it.\n *\n * @throws Error if the path is absolute\n *\n * @example\n * createReference(\"src/App.tsx\", 42)\n * // → { file: \"src/App.tsx\", line: 42 }\n */\nexport function createReference(file: string, line?: number): SourceReference {\n  const normalized = normalizeFilePath(file)\n\n  if (isAbsolutePath(normalized)) {\n    throw new Error(`Reference paths must be relative, got absolute path: \"${file}\"`)\n  }\n\n  if (line !== undefined && (line < 1 || !Number.isInteger(line))) {\n    throw new Error(`Line number must be a positive integer, got: ${line}`)\n  }\n\n  return {\n    file: normalized,\n    line\n  }\n}\n","/**\n * Catalog conversion helpers for working with simple key-value formats.\n *\n * Provides utilities to convert between a simple catalog format and PO items.\n */\n\nimport type { PoItem } from \"./types\"\nimport { createItem } from \"./Item\"\nimport { parseReference, formatReference, type SourceReference } from \"./references\"\n\n/** Checks if an object has any own properties (faster than Object.keys().length) */\nfunction hasOwnProperties(obj: object): boolean {\n  for (const _ in obj) {\n    return true\n  }\n  return false\n}\n\n/**\n * A single entry in the catalog.\n */\nexport interface CatalogEntry {\n  /**\n   * The source message (msgid content).\n   * Used when the catalog key is a generated ID rather than the source text.\n   */\n  message?: string\n\n  /**\n   * The translated string(s).\n   * Use an array for plural forms: [singular, plural, ...]\n   * Optional for extraction workflows where translations don't exist yet.\n   */\n  translation?: string | string[]\n\n  /**\n   * Source string for plural forms (msgid_plural).\n   * Required when translation is an array.\n   */\n  pluralSource?: string\n\n  /**\n   * Message context for disambiguation (msgctxt).\n   */\n  context?: string\n\n  /**\n   * Translator comments.\n   */\n  comments?: string[]\n\n  /**\n   * Extracted comments (from source code).\n   */\n  extractedComments?: string[]\n\n  /**\n   * Source file references.\n   */\n  origins?: SourceReference[]\n\n  /**\n   * Whether this entry is obsolete.\n   */\n  obsolete?: boolean\n\n  /**\n   * Flags like \"fuzzy\".\n   */\n  flags?: Record<string, boolean>\n}\n\n/**\n * A catalog is a record of message IDs to their entries.\n */\nexport type Catalog = Record<string, CatalogEntry>\n\n/**\n * Options for converting catalog to items.\n */\nexport interface CatalogToItemsOptions {\n  /**\n   * Include source references in the output.\n   * @default true\n   */\n  includeOrigins?: boolean\n\n  /**\n   * Include line numbers in references.\n   * @default true\n   */\n  includeLineNumbers?: boolean\n\n  /**\n   * Number of plural forms for the target language.\n   * @default 2\n   */\n  nplurals?: number\n}\n\n/**\n * Options for converting items to catalog.\n */\nexport interface ItemsToCatalogOptions {\n  /**\n   * Use msgid as the catalog key (true) or use a custom key generator (false).\n   * @default true\n   */\n  useMsgidAsKey?: boolean\n\n  /**\n   * Custom function to generate catalog keys from items.\n   * Only used when useMsgidAsKey is false.\n   */\n  keyGenerator?: (item: PoItem) => string\n\n  /**\n   * Include origins in the catalog entries.\n   * @default true\n   */\n  includeOrigins?: boolean\n}\n\n/** Applies translation to an item */\nfunction applyTranslation(item: PoItem, entry: CatalogEntry): void {\n  if (entry.translation === undefined) {\n    // No translation yet (extraction workflow)\n    item.msgstr = entry.pluralSource ? [\"\", \"\"] : [\"\"]\n    if (entry.pluralSource) {\n      item.msgid_plural = entry.pluralSource\n    }\n  } else if (Array.isArray(entry.translation)) {\n    item.msgstr = entry.translation\n    if (entry.pluralSource) {\n      item.msgid_plural = entry.pluralSource\n    }\n  } else {\n    item.msgstr = [entry.translation]\n  }\n}\n\n/** Applies optional fields from entry to item */\nfunction applyOptionalFields(\n  item: PoItem,\n  entry: CatalogEntry,\n  options: { includeOrigins: boolean; includeLineNumbers: boolean }\n): void {\n  if (entry.context) {\n    item.msgctxt = entry.context\n  }\n  if (entry.comments) {\n    item.comments = entry.comments\n  }\n  if (entry.extractedComments) {\n    item.extractedComments = entry.extractedComments\n  }\n  if (options.includeOrigins && entry.origins) {\n    item.references = entry.origins.map((ref) =>\n      formatReference(ref, { includeLineNumbers: options.includeLineNumbers })\n    )\n  }\n  if (entry.obsolete) {\n    item.obsolete = true\n  }\n  if (entry.flags) {\n    item.flags = { ...entry.flags }\n  }\n}\n\n/**\n * Converts a catalog to PO items.\n *\n * @example\n * const items = catalogToItems({\n *   \"Hello\": { translation: \"Hallo\" },\n *   \"greeting\": {\n *     message: \"Hello {name}\",\n *     translation: \"Hallo {name}\",\n *     context: \"informal\"\n *   },\n *   \"{count} item\": {\n *     translation: [\"{count} Element\", \"{count} Elemente\"],\n *     pluralSource: \"{count} items\"\n *   }\n * })\n */\nexport function catalogToItems(catalog: Catalog, options: CatalogToItemsOptions = {}): PoItem[] {\n  const { includeOrigins = true, includeLineNumbers = true, nplurals = 2 } = options\n\n  return Object.entries(catalog).map(([key, entry]) => {\n    const item = createItem({ nplurals })\n    item.msgid = entry.message ?? key\n    applyTranslation(item, entry)\n    applyOptionalFields(item, entry, { includeOrigins, includeLineNumbers })\n    return item\n  })\n}\n\n/** Gets the catalog key for an item */\nfunction getCatalogKey(\n  item: PoItem,\n  useMsgidAsKey: boolean,\n  keyGenerator?: (item: PoItem) => string\n): string {\n  if (useMsgidAsKey) {\n    return item.msgid\n  }\n  if (keyGenerator) {\n    return keyGenerator(item)\n  }\n  return item.msgid\n}\n\n/** Adds message field if key differs from msgid */\nfunction addMessageField(\n  entry: CatalogEntry,\n  item: PoItem,\n  key: string,\n  useMsgidAsKey: boolean\n): void {\n  if (!useMsgidAsKey && item.msgid !== key) {\n    entry.message = item.msgid\n  }\n  if (item.msgid_plural) {\n    entry.pluralSource = item.msgid_plural\n  }\n  if (item.msgctxt) {\n    entry.context = item.msgctxt\n  }\n}\n\n/** Adds comments fields to entry if non-empty (handles incomplete items) */\nfunction addCommentsFields(entry: CatalogEntry, item: PoItem): void {\n  const comments = item.comments as string[] | undefined\n  const extractedComments = item.extractedComments as string[] | undefined\n  if (comments && comments.length > 0) {\n    entry.comments = comments\n  }\n  if (extractedComments && extractedComments.length > 0) {\n    entry.extractedComments = extractedComments\n  }\n}\n\n/** Adds metadata fields to an entry (handles incomplete items gracefully) */\nfunction addMetadataFields(entry: CatalogEntry, item: PoItem, includeOrigins: boolean): void {\n  addCommentsFields(entry, item)\n\n  const references = item.references as string[] | undefined\n  if (includeOrigins && references && references.length > 0) {\n    entry.origins = references.map((ref) => parseReference(ref))\n  }\n\n  if (item.obsolete) {\n    entry.obsolete = true\n  }\n\n  const flags = item.flags as Record<string, boolean> | undefined\n  if (flags && hasOwnProperties(flags)) {\n    entry.flags = { ...flags }\n  }\n}\n\n/**\n * Converts PO items to a catalog.\n *\n * @example\n * const catalog = itemsToCatalog(items)\n * // → { \"Hello\": { translation: \"Hallo\", ... } }\n */\nexport function itemsToCatalog(items: PoItem[], options: ItemsToCatalogOptions = {}): Catalog {\n  const { useMsgidAsKey = true, keyGenerator, includeOrigins = true } = options\n  const catalog: Catalog = {}\n\n  for (const item of items) {\n    if (!item.msgid) {\n      continue\n    }\n\n    const key = getCatalogKey(item, useMsgidAsKey, keyGenerator)\n    const msgstr = item.msgstr as string[] | undefined\n    const entry: CatalogEntry = {\n      translation: item.msgid_plural ? (msgstr ?? []) : (msgstr?.[0] ?? \"\")\n    }\n\n    addMessageField(entry, item, key, useMsgidAsKey)\n    addMetadataFields(entry, item, includeOrigins)\n    catalog[key] = entry\n  }\n\n  return catalog\n}\n\n/**\n * Merges two catalogs, with the second catalog taking precedence.\n *\n * Useful for merging extracted messages with existing translations.\n *\n * @example\n * const merged = mergeCatalogs(existingCatalog, newCatalog)\n */\nexport function mergeCatalogs(base: Catalog, updates: Catalog): Catalog {\n  const merged: Catalog = {}\n\n  // Copy base entries\n  for (const [key, entry] of Object.entries(base)) {\n    merged[key] = { ...entry }\n  }\n\n  // Merge updates\n  for (const [key, update] of Object.entries(updates)) {\n    const existing = merged[key]\n    if (existing) {\n      // Merge with existing entry\n      merged[key] = {\n        ...existing,\n        ...update,\n        // Merge arrays instead of replacing\n        comments: update.comments ?? existing.comments,\n        extractedComments: update.extractedComments ?? existing.extractedComments,\n        origins: update.origins ?? existing.origins,\n        flags: { ...existing.flags, ...update.flags }\n      }\n    } else {\n      merged[key] = { ...update }\n    }\n  }\n\n  return merged\n}\n","/**\n * ICU MessageFormat v1 Parser.\n *\n * A minimal, zero-dependency parser for ICU MessageFormat strings.\n * Optimized for small bundle size (~3kb gzipped).\n *\n * Supported syntax:\n * - Simple arguments: {name}\n * - Formatted: {n, number}, {d, date, short}, {t, time, medium}\n * - Skeletons: {n, number, ::currency/EUR} (as opaque string)\n * - Plural: {n, plural, offset:1 =0 {...} one {...} other {...}}\n * - Select: {gender, select, male {...} female {...} other {...}}\n * - Selectordinal: {n, selectordinal, one {#st} two {#nd} ...}\n * - Tags: <b>bold</b>, <0>numbered</0>\n * - Escaping: '' → literal ', '{text}' → literal text\n *\n * Extended format types (pofile-ts extensions):\n * - List: {items, list}, {items, list, disjunction}\n * - Duration: {d, duration}, {d, duration, short}\n * - Ago: {n, ago, day}, {n, ago, hour short}\n * - Name: {code, name, language}, {code, name, region}\n *\n * Trade-offs for bundle size / complexity:\n * - Modern JS only (no IE11 polyfills)\n * - No location tracking (typical messages are single-line anyway)\n * - Styles/skeletons stored as opaque strings (runtime handles interpretation)\n * - Quoting only escapes ICU special chars ({, }, <, >, #), not arbitrary text\n *\n * @see https://unicode-org.github.io/icu/userguide/format_parse/messages/\n */\n\nimport type {\n  IcuNode,\n  IcuLiteralNode,\n  IcuNumberNode,\n  IcuDateNode,\n  IcuTimeNode,\n  IcuListNode,\n  IcuDurationNode,\n  IcuAgoNode,\n  IcuNameNode,\n  IcuSelectNode,\n  IcuPluralNode,\n  IcuTagNode,\n  IcuPluralOption,\n  IcuSelectOption,\n  IcuParserOptions,\n  IcuParseResult\n} from \"./types\"\n\n// Character classification helpers (clearer than inline regex)\n// Accept undefined for safe indexed access (returns false for undefined)\nfunction isWhitespace(ch: string | undefined): ch is string {\n  return ch === \" \" || ch === \"\\t\" || ch === \"\\n\" || ch === \"\\r\"\n}\n\nfunction isAlpha(ch: string | undefined): ch is string {\n  return ch != null && ((ch >= \"A\" && ch <= \"Z\") || (ch >= \"a\" && ch <= \"z\"))\n}\n\nfunction isDigit(ch: string | undefined): ch is string {\n  return ch != null && ch >= \"0\" && ch <= \"9\"\n}\n\nfunction isIdentifierChar(ch: string | undefined): ch is string {\n  // Everything except: whitespace, {, }, #, <, >, comma, :\n  return (\n    ch != null &&\n    ch > \" \" &&\n    ch !== \"{\" &&\n    ch !== \"}\" &&\n    ch !== \"#\" &&\n    ch !== \"<\" &&\n    ch !== \">\" &&\n    ch !== \",\" &&\n    ch !== \":\"\n  )\n}\n\nfunction isTagChar(ch: string | undefined): boolean {\n  if (ch == null) {\n    return false\n  }\n  return isAlpha(ch) || isDigit(ch) || ch === \"-\" || ch === \".\" || ch === \":\" || ch === \"_\"\n}\n\n/**\n * Parent argument type for context-sensitive parsing.\n * Used to determine if # (pound) is valid and how to handle it.\n * - \"plural\" | \"selectordinal\": # substitutes the plural value\n * - \"none\": # is treated as literal text\n */\ntype ParentArgType = \"plural\" | \"selectordinal\" | \"none\"\n\n/**\n * ICU syntax error thrown during parsing.\n */\nexport class IcuSyntaxError extends Error {\n  constructor(\n    message: string,\n    public readonly offset: number\n  ) {\n    super(`ICU syntax error at position ${offset}: ${message}`)\n    this.name = \"IcuSyntaxError\"\n  }\n}\n\n/**\n * ICU MessageFormat Parser.\n */\nexport class IcuParser {\n  private pos = 0\n  private readonly msg: string\n  private readonly ignoreTag: boolean\n  private readonly requiresOther: boolean\n\n  constructor(message: string, options: IcuParserOptions = {}) {\n    this.msg = message\n    this.ignoreTag = options.ignoreTag ?? false\n    this.requiresOther = options.requiresOtherClause ?? true\n  }\n\n  parse(): IcuNode[] {\n    const result = this.parseMessage(0, \"none\")\n    if (this.pos < this.msg.length) {\n      this.error(\"Unexpected character\")\n    }\n    return result\n  }\n\n  // eslint-disable-next-line complexity -- parser dispatch logic\n  private parseMessage(depth: number, parentArg: ParentArgType): IcuNode[] {\n    const nodes: IcuNode[] = []\n    const inPlural = parentArg === \"plural\" || parentArg === \"selectordinal\"\n\n    while (this.pos < this.msg.length) {\n      const ch = this.msg[this.pos]\n\n      if (ch === \"{\") {\n        nodes.push(this.parseArgument(depth))\n      } else if (ch === \"}\" && depth > 0) {\n        break\n      } else if (ch === \"#\" && inPlural) {\n        this.pos++\n        nodes.push({ type: \"pound\" })\n      } else if (ch === \"<\" && !this.ignoreTag) {\n        const next = this.msg[this.pos + 1]\n        // Support both alphabetic tags (<b>, <link>) and numeric tags (<0>, <1> - Lingui style)\n        if (next && (isAlpha(next) || isDigit(next))) {\n          nodes.push(this.parseTag(depth, parentArg))\n        } else if (next === \"/\") {\n          break // Closing tag - handled by parseTag\n        } else {\n          nodes.push(this.parseLiteral(depth, inPlural))\n        }\n      } else {\n        nodes.push(this.parseLiteral(depth, inPlural))\n      }\n    }\n\n    return nodes\n  }\n\n  // eslint-disable-next-line complexity -- argument type dispatch logic\n  private parseArgument(depth: number): IcuNode {\n    const start = this.pos\n    this.pos++ // skip {\n    this.skipWhitespace()\n\n    if (this.msg[this.pos] === \"}\") {\n      this.error(\"Empty argument\", start)\n    }\n\n    const name = this.parseIdentifier()\n    if (!name) {\n      this.error(\"Expected argument name\", start)\n    }\n\n    this.skipWhitespace()\n\n    // Simple argument: {name}\n    if (this.msg[this.pos] === \"}\") {\n      this.pos++\n      return { type: \"argument\", value: name }\n    }\n\n    // Formatted: {name, type, ...}\n    if (this.msg[this.pos] !== \",\") {\n      this.error(\"Expected ',' or '}'\", start)\n    }\n    this.pos++ // skip ,\n    this.skipWhitespace()\n\n    const argType = this.parseIdentifier()\n    if (!argType) {\n      this.error(\"Expected argument type\", start)\n    }\n\n    // ICU keywords are case-insensitive per spec\n    const argTypeLower = argType.toLowerCase()\n\n    switch (argTypeLower) {\n      case \"number\":\n      case \"date\":\n      case \"time\":\n      case \"list\":\n      case \"duration\":\n      case \"ago\":\n      case \"name\":\n        return this.parseFormattedArg(argTypeLower, name, start)\n      case \"plural\":\n      case \"selectordinal\":\n        return this.parsePlural(argTypeLower, name, depth, start)\n      case \"select\":\n        return this.parseSelect(name, depth, start)\n      default:\n        this.error(`Invalid argument type: ${argType}`, start)\n    }\n  }\n\n  private parseFormattedArg(\n    argType: \"number\" | \"date\" | \"time\" | \"list\" | \"duration\" | \"ago\" | \"name\",\n    name: string,\n    start: number\n  ):\n    | IcuNumberNode\n    | IcuDateNode\n    | IcuTimeNode\n    | IcuListNode\n    | IcuDurationNode\n    | IcuAgoNode\n    | IcuNameNode {\n    this.skipWhitespace()\n    let style: string | null = null\n\n    if (this.msg[this.pos] === \",\") {\n      this.pos++\n      this.skipWhitespace()\n      style = this.parseStyle()\n      if (!style) {\n        this.error(\"Expected style\", start)\n      }\n    }\n\n    this.expectChar(\"}\", start)\n\n    return { type: argType, value: name, style } as\n      | IcuNumberNode\n      | IcuDateNode\n      | IcuTimeNode\n      | IcuListNode\n      | IcuDurationNode\n      | IcuAgoNode\n      | IcuNameNode\n  }\n\n  private parsePlural(\n    argType: \"plural\" | \"selectordinal\",\n    name: string,\n    depth: number,\n    start: number\n  ): IcuPluralNode {\n    this.skipWhitespace()\n    this.expectChar(\",\", start)\n    this.skipWhitespace()\n\n    let offset = 0\n\n    // Check for offset:N using lookahead to avoid position rewind\n    if (this.peekIdentifier() === \"offset\") {\n      this.parseIdentifier() // consume \"offset\"\n      this.expectChar(\":\", start)\n      this.skipWhitespace()\n      offset = this.parseInteger()\n      this.skipWhitespace()\n    }\n\n    const options = this.parsePluralOptions(depth, argType)\n    this.expectChar(\"}\", start)\n\n    return {\n      type: \"plural\",\n      value: name,\n      options,\n      offset,\n      pluralType: argType === \"plural\" ? \"cardinal\" : \"ordinal\"\n    }\n  }\n\n  private parseSelect(name: string, depth: number, start: number): IcuSelectNode {\n    this.skipWhitespace()\n    this.expectChar(\",\", start)\n    this.skipWhitespace()\n\n    const options = this.parseSelectOptions(depth)\n    this.expectChar(\"}\", start)\n\n    return { type: \"select\", value: name, options }\n  }\n\n  private parsePluralOptions(\n    depth: number,\n    parentArg: ParentArgType\n  ): Record<string, IcuPluralOption> {\n    const options: Record<string, IcuPluralOption> = {}\n    const seen = new Set<string>()\n\n    while (this.pos < this.msg.length && this.msg[this.pos] !== \"}\") {\n      this.skipWhitespace()\n\n      // Parse selector: one, other, =0, =1, etc.\n      let selector: string\n      if (this.msg[this.pos] === \"=\") {\n        this.pos++\n        const num = this.parseInteger()\n        selector = `=${num}`\n      } else {\n        selector = this.parseIdentifier()\n        if (!selector) {\n          break\n        }\n      }\n\n      if (seen.has(selector)) {\n        this.error(`Duplicate selector: ${selector}`)\n      }\n      seen.add(selector)\n\n      this.skipWhitespace()\n      this.expectChar(\"{\")\n      const value = this.parseMessage(depth + 1, parentArg)\n      this.expectChar(\"}\")\n\n      options[selector] = { value }\n      this.skipWhitespace()\n    }\n\n    if (Object.keys(options).length === 0) {\n      this.error(\"Expected at least one plural option\")\n    }\n    if (this.requiresOther && !(\"other\" in options)) {\n      this.error(\"Missing 'other' clause\")\n    }\n\n    return options\n  }\n\n  private parseSelectOptions(depth: number): Record<string, IcuSelectOption> {\n    const options: Record<string, IcuSelectOption> = {}\n    const seen = new Set<string>()\n\n    while (this.pos < this.msg.length && this.msg[this.pos] !== \"}\") {\n      this.skipWhitespace()\n\n      const selector = this.parseIdentifier()\n      if (!selector) {\n        break\n      }\n\n      if (seen.has(selector)) {\n        this.error(`Duplicate selector: ${selector}`)\n      }\n      seen.add(selector)\n\n      this.skipWhitespace()\n      this.expectChar(\"{\")\n      const value = this.parseMessage(depth + 1, \"none\")\n      this.expectChar(\"}\")\n\n      options[selector] = { value }\n      this.skipWhitespace()\n    }\n\n    if (Object.keys(options).length === 0) {\n      this.error(\"Expected at least one select option\")\n    }\n    if (this.requiresOther && !(\"other\" in options)) {\n      this.error(\"Missing 'other' clause\")\n    }\n\n    return options\n  }\n\n  private parseTag(depth: number, parentArg: ParentArgType): IcuTagNode | IcuLiteralNode {\n    const start = this.pos\n    this.pos++ // skip <\n\n    const tagName = this.parseTagName()\n    this.skipWhitespace()\n\n    // Self-closing: <br/>\n    if (this.msg.slice(this.pos, this.pos + 2) === \"/>\") {\n      this.pos += 2\n      return { type: \"literal\", value: `<${tagName}/>` }\n    }\n\n    // Opening tag: <b>\n    this.expectChar(\">\", start)\n\n    const children = this.parseMessage(depth + 1, parentArg)\n\n    // Closing tag: </b>\n    if (this.msg.slice(this.pos, this.pos + 2) !== \"</\") {\n      this.error(\"Unclosed tag\", start)\n    }\n    this.pos += 2\n\n    const closingName = this.parseTagName()\n    if (closingName !== tagName) {\n      this.error(`Mismatched tag: expected </${tagName}>, got </${closingName}>`, start)\n    }\n\n    this.skipWhitespace()\n    this.expectChar(\">\", start)\n\n    return { type: \"tag\", value: tagName, children }\n  }\n\n  // eslint-disable-next-line complexity -- quote escaping state machine\n  private parseLiteral(depth: number, inPlural: boolean): IcuLiteralNode {\n    let value = \"\"\n\n    while (this.pos < this.msg.length) {\n      const ch = this.msg[this.pos]\n      if (ch == null) {\n        break\n      }\n\n      // End of literal\n      if (ch === \"{\" || (ch === \"}\" && depth > 0)) {\n        break\n      }\n      if (ch === \"#\" && inPlural) {\n        break\n      }\n      if (ch === \"<\" && !this.ignoreTag) {\n        const next = this.msg[this.pos + 1]\n        // Support both alphabetic tags (<b>, <link>) and numeric tags (<0>, <1> - Lingui style)\n        if ((next && (isAlpha(next) || isDigit(next))) || next === \"/\") {\n          break\n        }\n      }\n\n      // Quoting: '' → ' or '{...}' → {...}\n      if (ch === \"'\") {\n        const next = this.msg[this.pos + 1]\n        if (next === \"'\") {\n          // '' → '\n          value += \"'\"\n          this.pos += 2\n        } else if (\n          next === \"{\" ||\n          next === \"}\" ||\n          next === \"<\" ||\n          next === \">\" ||\n          (next === \"#\" && inPlural)\n        ) {\n          // '{...}' or '<...>' etc. → literal until closing '\n          this.pos++ // skip opening '\n          while (this.pos < this.msg.length) {\n            const quoted = this.msg[this.pos]\n            if (quoted == null) {\n              break\n            }\n            if (quoted === \"'\") {\n              if (this.msg[this.pos + 1] === \"'\") {\n                value += \"'\"\n                this.pos += 2\n              } else {\n                this.pos++ // skip closing '\n                break\n              }\n            } else {\n              value += quoted\n              this.pos++\n            }\n          }\n        } else {\n          value += ch\n          this.pos++\n        }\n      } else {\n        value += ch\n        this.pos++\n      }\n    }\n\n    return { type: \"literal\", value }\n  }\n\n  private parseStyle(): string {\n    const start = this.pos\n    let braceDepth = 0\n\n    while (this.pos < this.msg.length) {\n      const ch = this.msg[this.pos]\n      if (ch === \"'\") {\n        // Skip quoted content\n        this.pos++\n        while (this.pos < this.msg.length && this.msg[this.pos] !== \"'\") {\n          this.pos++\n        }\n        if (this.pos < this.msg.length) {\n          this.pos++\n        }\n      } else if (ch === \"{\") {\n        braceDepth++\n        this.pos++\n      } else if (ch === \"}\") {\n        if (braceDepth === 0) {\n          break\n        }\n        braceDepth--\n        this.pos++\n      } else {\n        this.pos++\n      }\n    }\n\n    return this.msg.slice(start, this.pos).trim()\n  }\n\n  private parseIdentifier(): string {\n    const start = this.pos\n    while (this.pos < this.msg.length && isIdentifierChar(this.msg[this.pos])) {\n      this.pos++\n    }\n    return this.msg.slice(start, this.pos)\n  }\n\n  private parseTagName(): string {\n    const start = this.pos\n    while (this.pos < this.msg.length) {\n      const ch = this.msg[this.pos]\n      if (!isTagChar(ch)) {\n        break\n      }\n      this.pos++\n    }\n    return this.msg.slice(start, this.pos)\n  }\n\n  private parseInteger(): number {\n    const start = this.pos\n    let sign = 1\n    if (this.msg[this.pos] === \"-\") {\n      sign = -1\n      this.pos++\n    } else if (this.msg[this.pos] === \"+\") {\n      this.pos++\n    }\n\n    const numStart = this.pos\n    while (this.pos < this.msg.length && isDigit(this.msg[this.pos])) {\n      this.pos++\n    }\n\n    if (this.pos === numStart) {\n      this.error(\"Expected integer\", start)\n    }\n\n    return sign * parseInt(this.msg.slice(numStart, this.pos), 10)\n  }\n\n  private skipWhitespace(): void {\n    while (this.pos < this.msg.length && isWhitespace(this.msg[this.pos])) {\n      this.pos++\n    }\n  }\n\n  /** Lookahead for identifier without consuming input */\n  private peekIdentifier(): string {\n    const start = this.pos\n    const id = this.parseIdentifier()\n    this.pos = start\n    return id\n  }\n\n  private expectChar(ch: string, errorPos?: number): void {\n    if (this.msg[this.pos] !== ch) {\n      this.error(`Expected '${ch}'`, errorPos)\n    }\n    this.pos++\n  }\n\n  private error(message: string, pos?: number): never {\n    throw new IcuSyntaxError(message, pos ?? this.pos)\n  }\n}\n\n/**\n * Parse an ICU MessageFormat string.\n *\n * @example\n * const result = parseIcu(\"Hello {name}!\")\n * if (result.success) {\n *   console.log(result.ast)\n * }\n *\n * @example\n * const result = parseIcu(\"{count, plural, one {# item} other {# items}}\")\n */\nexport function parseIcu(message: string, options?: IcuParserOptions): IcuParseResult {\n  try {\n    const ast = new IcuParser(message, options).parse()\n    return { success: true, ast, errors: [] }\n  } catch (e) {\n    if (e instanceof IcuSyntaxError) {\n      return {\n        success: false,\n        ast: null,\n        errors: [\n          {\n            kind: \"SYNTAX_ERROR\",\n            message: e.message,\n            location: {\n              start: { offset: e.offset, line: 1, column: e.offset + 1 },\n              end: { offset: e.offset, line: 1, column: e.offset + 1 }\n            }\n          }\n        ]\n      }\n    }\n    throw e\n  }\n}\n","/**\n * ICU Message Compiler\n *\n * Compiles ICU MessageFormat strings into executable JavaScript functions.\n * The compiled functions take a values object and return the formatted string.\n *\n * Features:\n * - Variables: {name} → values.name\n * - Plurals: {count, plural, one {# item} other {# items}} → CLDR plural rules\n * - Select: {gender, select, male {He} female {She} other {They}}\n * - Number/Date/Time: {n, number, percent}, {d, date, medium} → Intl formatters\n * - Tags: <bold>text</bold> → values.bold(children) for JSX support\n *\n * @example\n * const fn = compileIcu(\"{count, plural, one {# item} other {# items}}\", { locale: \"en\" })\n * fn({ count: 5 }) // → \"5 items\"\n */\n\nimport type { IcuNode, IcuPluralNode, IcuSelectNode, IcuTagNode } from \"./types\"\nimport { parseIcu } from \"./parser\"\nimport { getPluralFunction, getPluralCategories } from \"../plurals\"\n\n/**\n * Options for compiling ICU messages.\n */\nexport interface CompileIcuOptions {\n  /** Locale for plural rules and Intl formatting */\n  locale: string\n\n  /**\n   * Whether to throw on parse errors.\n   * If false, returns a function that returns the original message.\n   * @default true\n   */\n  strict?: boolean\n\n  /**\n   * Custom number format styles.\n   * Keys are style names used in messages, values are Intl.NumberFormat options.\n   * @example\n   * numberStyles: {\n   *   bytes: { style: \"unit\", unit: \"byte\", unitDisplay: \"narrow\" },\n   *   percent2: { style: \"percent\", minimumFractionDigits: 2 }\n   * }\n   * // Usage: {size, number, bytes}\n   */\n  numberStyles?: Record<string, Intl.NumberFormatOptions>\n\n  /**\n   * Custom date format styles.\n   * Keys are style names used in messages, values are Intl.DateTimeFormat options.\n   * @example\n   * dateStyles: {\n   *   monthYear: { month: \"long\", year: \"numeric\" },\n   *   iso: { year: \"numeric\", month: \"2-digit\", day: \"2-digit\" }\n   * }\n   * // Usage: {d, date, monthYear}\n   */\n  dateStyles?: Record<string, Intl.DateTimeFormatOptions>\n\n  /**\n   * Custom time format styles.\n   * Keys are style names used in messages, values are Intl.DateTimeFormat options.\n   * @example\n   * timeStyles: {\n   *   precise: { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" },\n   *   hourOnly: { hour: \"numeric\" }\n   * }\n   * // Usage: {t, time, precise}\n   */\n  timeStyles?: Record<string, Intl.DateTimeFormatOptions>\n\n  /**\n   * Custom list format styles.\n   * Keys are style names used in messages, values are Intl.ListFormat options.\n   * @example\n   * listStyles: {\n   *   narrow: { type: \"conjunction\", style: \"narrow\" },\n   *   or: { type: \"disjunction\" }\n   * }\n   * // Usage: {items, list, narrow}\n   */\n  listStyles?: Record<string, Intl.ListFormatOptions>\n}\n\n/**\n * Values that can be passed to a compiled message function.\n */\nexport type MessageValues = Record<string, unknown>\n\n/**\n * Return type of a compiled message function.\n * - string: when no tags are used\n * - (string | unknown)[]: when tags are used (for JSX support)\n */\nexport type MessageResult = string | readonly unknown[]\n\n/**\n * A compiled message function.\n */\nexport type CompiledMessageFunction = (values?: MessageValues) => MessageResult\n\n/**\n * Context passed during AST traversal.\n */\ninterface CompileContext {\n  locale: string\n  pluralFn: (n: number) => number\n  pluralCategories: readonly string[]\n  /** Current plural value for # substitution */\n  pluralValue: string | null\n  /** Current plural offset for # substitution */\n  pluralOffset: number\n  /** Cached Intl formatters */\n  formatters: FormatterCache\n  /** Whether any tags were encountered */\n  hasTags: boolean\n  /** Custom format styles */\n  customStyles: {\n    number: Record<string, Intl.NumberFormatOptions>\n    date: Record<string, Intl.DateTimeFormatOptions>\n    time: Record<string, Intl.DateTimeFormatOptions>\n    list: Record<string, Intl.ListFormatOptions>\n  }\n}\n\n/**\n * Cache for Intl formatters to avoid recreation.\n */\ninterface FormatterCache {\n  number: Map<string, Intl.NumberFormat>\n  date: Map<string, Intl.DateTimeFormat>\n  time: Map<string, Intl.DateTimeFormat>\n  list: Map<string, Intl.ListFormat>\n  ago: Map<string, Intl.RelativeTimeFormat>\n  name: Map<string, Intl.DisplayNames>\n}\n\n/**\n * Creates a new formatter cache.\n */\nfunction createFormatterCache(): FormatterCache {\n  return {\n    number: new Map(),\n    date: new Map(),\n    time: new Map(),\n    list: new Map(),\n    ago: new Map(),\n    name: new Map()\n  }\n}\n\n/**\n * Built-in date format styles.\n * These provide common date formatting patterns.\n */\nconst BUILTIN_DATE_STYLES: Record<string, Intl.DateTimeFormatOptions> = {\n  // Standard ICU styles (short, medium, long, full) handled separately\n\n  // ISO-like formats\n  iso: { year: \"numeric\", month: \"2-digit\", day: \"2-digit\" },\n  isoDate: { year: \"numeric\", month: \"2-digit\", day: \"2-digit\" },\n\n  // Component combinations\n  weekday: { weekday: \"long\" },\n  weekdayShort: { weekday: \"short\" },\n  monthYear: { month: \"long\", year: \"numeric\" },\n  monthYearShort: { month: \"short\", year: \"numeric\" },\n  monthDay: { month: \"short\", day: \"numeric\" },\n  monthDayLong: { month: \"long\", day: \"numeric\" },\n  yearMonth: { year: \"numeric\", month: \"2-digit\" },\n  dayMonth: { day: \"numeric\", month: \"short\" },\n  dayMonthYear: { day: \"numeric\", month: \"short\", year: \"numeric\" },\n\n  // With weekday\n  weekdayMonthDay: { weekday: \"long\", month: \"long\", day: \"numeric\" },\n  weekdayShortMonthDay: { weekday: \"short\", month: \"short\", day: \"numeric\" }\n}\n\n/**\n * Built-in time format styles.\n * These provide common time formatting patterns.\n */\nconst BUILTIN_TIME_STYLES: Record<string, Intl.DateTimeFormatOptions> = {\n  // Standard ICU styles (short, medium, long, full) handled separately\n\n  // Hour:Minute formats\n  hourMinute: { hour: \"2-digit\", minute: \"2-digit\" },\n  hourMinute12: { hour: \"numeric\", minute: \"2-digit\", hour12: true },\n  hourMinute24: { hour: \"2-digit\", minute: \"2-digit\", hour12: false },\n\n  // With seconds\n  hourMinuteSecond: { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" },\n  hourMinuteSecond12: { hour: \"numeric\", minute: \"2-digit\", second: \"2-digit\", hour12: true },\n  hourMinuteSecond24: { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\", hour12: false },\n\n  // Hour only\n  hour: { hour: \"numeric\" },\n  hour12: { hour: \"numeric\", hour12: true },\n  hour24: { hour: \"2-digit\", hour12: false }\n}\n\n/**\n * Maps ICU date/time styles to Intl.DateTimeFormat options.\n */\nfunction getDateTimeOptions(\n  style: string | null,\n  type: \"date\" | \"time\"\n): Intl.DateTimeFormatOptions {\n  const styleKey = type === \"date\" ? \"dateStyle\" : \"timeStyle\"\n\n  // Standard ICU styles\n  switch (style) {\n    case \"short\":\n    case \"medium\":\n    case \"long\":\n    case \"full\":\n      return { [styleKey]: style }\n    case null:\n      return { [styleKey]: \"medium\" }\n  }\n\n  // Check built-in styles\n  const builtinStyles = type === \"date\" ? BUILTIN_DATE_STYLES : BUILTIN_TIME_STYLES\n  const builtin = builtinStyles[style]\n  if (builtin) {\n    return builtin\n  }\n\n  // Handle skeleton format (::yyyyMMdd)\n  if (style.startsWith(\"::\")) {\n    // For now, fall back to medium - skeleton parsing is complex\n    return { [styleKey]: \"medium\" }\n  }\n\n  return { [styleKey]: \"medium\" }\n}\n\n/**\n * Built-in number format styles.\n * These provide common formatting patterns without needing custom styles.\n */\nconst BUILTIN_NUMBER_STYLES: Record<string, Intl.NumberFormatOptions> = {\n  // Standard ICU styles\n  percent: { style: \"percent\" },\n  integer: { maximumFractionDigits: 0 },\n\n  // Compact notation (1K, 1M, 1B)\n  compact: { notation: \"compact\" },\n  compactLong: { notation: \"compact\", compactDisplay: \"long\" },\n\n  // Precision control\n  decimal1: { minimumFractionDigits: 1, maximumFractionDigits: 1 },\n  decimal2: { minimumFractionDigits: 2, maximumFractionDigits: 2 },\n  decimal3: { minimumFractionDigits: 3, maximumFractionDigits: 3 },\n\n  // Sign display\n  signAlways: { signDisplay: \"always\" },\n  signExceptZero: { signDisplay: \"exceptZero\" },\n\n  // Grouping\n  noGrouping: { useGrouping: false },\n\n  // File size units\n  byte: { style: \"unit\", unit: \"byte\", unitDisplay: \"narrow\" },\n  kilobyte: { style: \"unit\", unit: \"kilobyte\", unitDisplay: \"short\" },\n  megabyte: { style: \"unit\", unit: \"megabyte\", unitDisplay: \"short\" },\n  gigabyte: { style: \"unit\", unit: \"gigabyte\", unitDisplay: \"short\" },\n  terabyte: { style: \"unit\", unit: \"terabyte\", unitDisplay: \"short\" },\n\n  // Distance units\n  meter: { style: \"unit\", unit: \"meter\" },\n  kilometer: { style: \"unit\", unit: \"kilometer\" },\n  mile: { style: \"unit\", unit: \"mile\" },\n\n  // Temperature units\n  celsius: { style: \"unit\", unit: \"celsius\" },\n  fahrenheit: { style: \"unit\", unit: \"fahrenheit\" },\n\n  // Weight units\n  kilogram: { style: \"unit\", unit: \"kilogram\" },\n  gram: { style: \"unit\", unit: \"gram\" },\n  pound: { style: \"unit\", unit: \"pound\" },\n\n  // Volume units\n  liter: { style: \"unit\", unit: \"liter\" },\n  milliliter: { style: \"unit\", unit: \"milliliter\" },\n\n  // Duration units (for simple cases; use {x, duration} for complex)\n  second: { style: \"unit\", unit: \"second\" },\n  minute: { style: \"unit\", unit: \"minute\" },\n  hour: { style: \"unit\", unit: \"hour\" },\n  day: { style: \"unit\", unit: \"day\" },\n  week: { style: \"unit\", unit: \"week\" },\n  month: { style: \"unit\", unit: \"month\" },\n  year: { style: \"unit\", unit: \"year\" }\n}\n\n/**\n * Maps ICU number styles to Intl.NumberFormat options.\n * Note: \"currency\" without skeleton is handled separately with runtime currency lookup.\n */\nfunction getNumberOptions(style: string | null): Intl.NumberFormatOptions {\n  if (style == null) {\n    return {}\n  }\n\n  // Check built-in styles first\n  const builtin = BUILTIN_NUMBER_STYLES[style]\n  if (builtin) {\n    return builtin\n  }\n\n  // Handle skeleton format (::currency/EUR)\n  if (style.startsWith(\"::\")) {\n    const skeleton = style.slice(2)\n    if (skeleton.startsWith(\"currency/\")) {\n      const currency = skeleton.slice(9, 12).toUpperCase()\n      return { style: \"currency\", currency }\n    }\n    // More skeleton patterns could be added here\n  }\n\n  return {}\n}\n\n/**\n * Gets or creates a number formatter.\n */\nfunction getNumberFormatter(\n  cache: FormatterCache,\n  locale: string,\n  style: string | null\n): Intl.NumberFormat {\n  const key = style ?? \"\"\n  let formatter = cache.number.get(key)\n  if (!formatter) {\n    formatter = new Intl.NumberFormat(locale, getNumberOptions(style))\n    cache.number.set(key, formatter)\n  }\n  return formatter\n}\n\n/**\n * Gets or creates a date/time formatter.\n */\nfunction getDateTimeFormatter(\n  cache: FormatterCache,\n  locale: string,\n  style: string | null,\n  type: \"date\" | \"time\"\n): Intl.DateTimeFormat {\n  const key = `${type}:${style ?? \"\"}`\n  const cacheMap = type === \"date\" ? cache.date : cache.time\n  let formatter = cacheMap.get(key)\n  if (!formatter) {\n    formatter = new Intl.DateTimeFormat(locale, getDateTimeOptions(style, type))\n    cacheMap.set(key, formatter)\n  }\n  return formatter\n}\n\n/**\n * Built-in list format styles.\n * These provide common list formatting patterns.\n */\nconst BUILTIN_LIST_STYLES: Record<string, Intl.ListFormatOptions> = {\n  // Type variations\n  conjunction: { type: \"conjunction\" },\n  disjunction: { type: \"disjunction\" },\n  or: { type: \"disjunction\" },\n  unit: { type: \"unit\" },\n\n  // Style variations (long is default)\n  short: { type: \"conjunction\", style: \"short\" },\n  narrow: { type: \"conjunction\", style: \"narrow\" },\n\n  // Combined type + style\n  orShort: { type: \"disjunction\", style: \"short\" },\n  orNarrow: { type: \"disjunction\", style: \"narrow\" },\n  unitShort: { type: \"unit\", style: \"short\" },\n  unitNarrow: { type: \"unit\", style: \"narrow\" }\n}\n\n/**\n * Gets or creates a list formatter.\n */\nfunction getListFormatter(\n  cache: FormatterCache,\n  locale: string,\n  style: string | null\n): Intl.ListFormat {\n  const key = style ?? \"\"\n  let formatter = cache.list.get(key)\n  if (!formatter) {\n    const options = style ? BUILTIN_LIST_STYLES[style] : undefined\n    formatter = new Intl.ListFormat(locale, options ?? { type: \"conjunction\" })\n    cache.list.set(key, formatter)\n  }\n  return formatter\n}\n\n/**\n * Parses relative time style: \"day\", \"hour short\", \"minute narrow\"\n */\nfunction parseRelativeTimeStyle(style: string | null): {\n  unit: Intl.RelativeTimeFormatUnit\n  formatStyle: Intl.RelativeTimeFormatStyle\n} {\n  if (!style) {\n    return { unit: \"day\", formatStyle: \"long\" }\n  }\n  const parts = style.split(/\\s+/)\n  const unit = (parts[0] ?? \"day\") as Intl.RelativeTimeFormatUnit\n  const formatStyle = (parts[1] ?? \"long\") as Intl.RelativeTimeFormatStyle\n  return { unit, formatStyle }\n}\n\n/**\n * Gets or creates a relative time formatter for {n, ago, unit}.\n */\nfunction getAgoFormatter(\n  cache: FormatterCache,\n  locale: string,\n  style: string | null\n): { formatter: Intl.RelativeTimeFormat; unit: Intl.RelativeTimeFormatUnit } {\n  const { unit, formatStyle } = parseRelativeTimeStyle(style)\n  const key = `${unit}:${formatStyle}`\n  let formatter = cache.ago.get(key)\n  if (!formatter) {\n    formatter = new Intl.RelativeTimeFormat(locale, { style: formatStyle })\n    cache.ago.set(key, formatter)\n  }\n  return { formatter, unit }\n}\n\n/**\n * Gets or creates a display names formatter for {code, name, type}.\n */\nfunction getNameFormatter(\n  cache: FormatterCache,\n  locale: string,\n  style: string | null\n): Intl.DisplayNames {\n  const type = (style ?? \"language\") as Intl.DisplayNamesType\n  const key = type\n  let formatter = cache.name.get(key)\n  if (!formatter) {\n    formatter = new Intl.DisplayNames(locale, { type })\n    cache.name.set(key, formatter)\n  }\n  return formatter\n}\n\n/**\n * Compiles an array of AST nodes into parts.\n */\nfunction compileNodes(nodes: IcuNode[], ctx: CompileContext): unknown[] {\n  const parts: unknown[] = []\n\n  for (const node of nodes) {\n    const result = compileNode(node, ctx)\n    if (result !== \"\") {\n      parts.push(result)\n    }\n  }\n\n  return parts\n}\n\n/**\n * Compiles a single AST node.\n */\n// eslint-disable-next-line complexity\nfunction compileNode(\n  node: IcuNode,\n  ctx: CompileContext\n): string | ((values?: MessageValues) => unknown) {\n  switch (node.type) {\n    case \"literal\":\n      return node.value\n\n    case \"argument\":\n      // Return a getter function - will be called with values\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : String(val as string | number | boolean)\n      }\n\n    case \"number\": {\n      // Check for custom style first\n      const customNumberStyle = node.style ? ctx.customStyles.number[node.style] : undefined\n      if (customNumberStyle) {\n        const formatter = new Intl.NumberFormat(ctx.locale, customNumberStyle)\n        return (values?: MessageValues) => {\n          const val = values?.[node.value]\n          if (typeof val === \"number\") {\n            return formatter.format(val)\n          }\n          if (val == null) {\n            return `{${node.value}}`\n          }\n          return typeof val === \"string\" ? val : String(val as string | number | boolean)\n        }\n      }\n\n      // Special handling for \"currency\" style without skeleton:\n      // Read currency code from values.currency at runtime\n      if (node.style === \"currency\") {\n        const currencyCache = new Map<string, Intl.NumberFormat>()\n        return (values?: MessageValues) => {\n          const val = values?.[node.value]\n          if (typeof val !== \"number\") {\n            if (val == null) {\n              return `{${node.value}}`\n            }\n            return typeof val === \"string\" ? val : String(val as string | number | boolean)\n          }\n          const currency = typeof values?.currency === \"string\" ? values.currency : \"USD\"\n          let formatter = currencyCache.get(currency)\n          if (!formatter) {\n            formatter = new Intl.NumberFormat(ctx.locale, { style: \"currency\", currency })\n            currencyCache.set(currency, formatter)\n          }\n          return formatter.format(val)\n        }\n      }\n\n      const formatter = getNumberFormatter(ctx.formatters, ctx.locale, node.style)\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (typeof val === \"number\") {\n          return formatter.format(val)\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : String(val as string | number | boolean)\n      }\n    }\n\n    case \"date\": {\n      // Check for custom style first\n      const customDateStyle = node.style ? ctx.customStyles.date[node.style] : undefined\n      const formatter = customDateStyle\n        ? new Intl.DateTimeFormat(ctx.locale, customDateStyle)\n        : getDateTimeFormatter(ctx.formatters, ctx.locale, node.style, \"date\")\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (val instanceof Date) {\n          return formatter.format(val)\n        }\n        if (typeof val === \"number\") {\n          return formatter.format(new Date(val))\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : String(val as string | number | boolean)\n      }\n    }\n\n    case \"time\": {\n      // Check for custom style first\n      const customTimeStyle = node.style ? ctx.customStyles.time[node.style] : undefined\n      const formatter = customTimeStyle\n        ? new Intl.DateTimeFormat(ctx.locale, customTimeStyle)\n        : getDateTimeFormatter(ctx.formatters, ctx.locale, node.style, \"time\")\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (val instanceof Date) {\n          return formatter.format(val)\n        }\n        if (typeof val === \"number\") {\n          return formatter.format(new Date(val))\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : String(val as string | number | boolean)\n      }\n    }\n\n    case \"list\": {\n      // Check for custom style first\n      const customListStyle = node.style ? ctx.customStyles.list[node.style] : undefined\n      const formatter = customListStyle\n        ? new Intl.ListFormat(ctx.locale, customListStyle)\n        : getListFormatter(ctx.formatters, ctx.locale, node.style)\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (Array.isArray(val)) {\n          return formatter.format(val.map((v) => String(v)))\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : JSON.stringify(val)\n      }\n    }\n\n    case \"duration\": {\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        // Duration can be a DurationLike object or we format it manually\n        // DurationFormat (Baseline 2025) - runtime check for older environments\n        if (typeof Intl !== \"undefined\" && \"DurationFormat\" in Intl) {\n          const style = (node.style ?? \"long\") as \"long\" | \"short\" | \"narrow\" | \"digital\"\n          // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n          const formatter = new (Intl as any).DurationFormat(ctx.locale, { style })\n          // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n          return formatter.format(val)\n        }\n        // Fallback: just stringify the object\n        return JSON.stringify(val)\n      }\n    }\n\n    case \"ago\": {\n      const { formatter, unit } = getAgoFormatter(ctx.formatters, ctx.locale, node.style)\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (typeof val === \"number\") {\n          return formatter.format(val, unit)\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : JSON.stringify(val)\n      }\n    }\n\n    case \"name\": {\n      const formatter = getNameFormatter(ctx.formatters, ctx.locale, node.style)\n      return (values?: MessageValues) => {\n        const val = values?.[node.value]\n        if (typeof val === \"string\") {\n          return formatter.of(val) ?? val\n        }\n        if (val == null) {\n          return `{${node.value}}`\n        }\n        return typeof val === \"string\" ? val : JSON.stringify(val)\n      }\n    }\n\n    case \"plural\":\n      return compilePlural(node, ctx)\n\n    case \"select\":\n      return compileSelect(node, ctx)\n\n    case \"pound\":\n      // # is replaced with the current plural value (minus offset)\n      return (values?: MessageValues) => {\n        if (ctx.pluralValue === null) {\n          return \"#\"\n        }\n        const val = values?.[ctx.pluralValue]\n        if (typeof val === \"number\") {\n          const formatter = getNumberFormatter(ctx.formatters, ctx.locale, null)\n          return formatter.format(val - ctx.pluralOffset)\n        }\n        if (val == null) {\n          return \"#\"\n        }\n        return typeof val === \"string\" ? val : String(val as string | number | boolean)\n      }\n\n    case \"tag\":\n      ctx.hasTags = true\n      return compileTag(node, ctx)\n\n    default:\n      return \"\"\n  }\n}\n\n/**\n * Compiles a plural node.\n */\nfunction compilePlural(\n  node: IcuPluralNode,\n  ctx: CompileContext\n): (values?: MessageValues) => string {\n  const { value: varName, options, offset } = node\n  const categories = ctx.pluralCategories\n\n  // Pre-compile all options\n  const compiledOptions: Record<string, (values?: MessageValues) => string> = {}\n\n  // Create a child context with plural value set for # substitution\n  const childCtx: CompileContext = {\n    ...ctx,\n    pluralValue: varName,\n    pluralOffset: offset\n  }\n\n  for (const [key, option] of Object.entries(options)) {\n    const parts = compileNodes(option.value, childCtx)\n    compiledOptions[key] = createResolver(parts)\n  }\n\n  return (values?: MessageValues) => {\n    const count = values?.[varName]\n    if (typeof count !== \"number\") {\n      return `{${varName}}`\n    }\n\n    const adjustedCount = count - offset\n\n    // Check for exact match first (=0, =1, etc.)\n    const exactKey = `=${count}`\n    if (compiledOptions[exactKey]) {\n      return compiledOptions[exactKey](values)\n    }\n\n    // Get plural category from CLDR rules\n    const categoryIndex = ctx.pluralFn(adjustedCount)\n    const category = categories[categoryIndex] ?? \"other\"\n\n    // Try category, fall back to \"other\"\n    const resolver = compiledOptions[category] ?? compiledOptions.other\n    return resolver?.(values) ?? `{${varName}}`\n  }\n}\n\n/**\n * Compiles a select node.\n */\nfunction compileSelect(\n  node: IcuSelectNode,\n  ctx: CompileContext\n): (values?: MessageValues) => string {\n  const { value: varName, options } = node\n\n  // Pre-compile all options\n  const compiledOptions: Record<string, (values?: MessageValues) => string> = {}\n\n  for (const [key, option] of Object.entries(options)) {\n    const parts = compileNodes(option.value, ctx)\n    compiledOptions[key] = createResolver(parts)\n  }\n\n  return (values?: MessageValues) => {\n    const selectorVal = values?.[varName]\n    const selector =\n      selectorVal == null\n        ? \"\"\n        : typeof selectorVal === \"string\"\n          ? selectorVal\n          : String(selectorVal as string | number | boolean)\n\n    // Try exact match, fall back to \"other\"\n    const resolver = compiledOptions[selector] ?? compiledOptions.other\n    return resolver?.(values) ?? `{${varName}}`\n  }\n}\n\n/**\n * Compiles a tag node.\n */\nfunction compileTag(node: IcuTagNode, ctx: CompileContext): (values?: MessageValues) => unknown {\n  const { value: tagName, children } = node\n\n  // Pre-compile children\n  const compiledChildren = compileNodes(children, ctx)\n  const childResolver = createResolver(compiledChildren)\n\n  return (values?: MessageValues) => {\n    const tagFn = values?.[tagName]\n\n    // Resolve children first\n    const resolvedChildren = childResolver(values)\n\n    // If tag value is a function, call it with children\n    if (typeof tagFn === \"function\") {\n      return (tagFn as (children: string) => unknown)(resolvedChildren)\n    }\n\n    // If no function provided, return children as-is\n    return resolvedChildren\n  }\n}\n\n/**\n * Creates a resolver function that combines parts into a string or array.\n */\nfunction createResolver(parts: unknown[]): (values?: MessageValues) => string {\n  // Optimize: if all parts are strings, just join them\n  if (parts.every((p) => typeof p === \"string\")) {\n    const joined = parts.join(\"\")\n    return () => joined\n  }\n\n  return (values?: MessageValues) => {\n    let result = \"\"\n    for (const part of parts) {\n      if (typeof part === \"string\") {\n        result += part\n      } else if (typeof part === \"function\") {\n        const resolved = (part as (v?: MessageValues) => unknown)(values)\n        if (typeof resolved === \"string\") {\n          result += resolved\n        } else if (resolved != null) {\n          result += String(resolved as string | number | boolean)\n        }\n      }\n    }\n    return result\n  }\n}\n\n/**\n * Compiles an ICU MessageFormat string into an executable function.\n *\n * @example\n * const fn = compileIcu(\"Hello {name}!\", { locale: \"en\" })\n * fn({ name: \"World\" }) // → \"Hello World!\"\n *\n * @example\n * const fn = compileIcu(\"{count, plural, one {# item} other {# items}}\", { locale: \"en\" })\n * fn({ count: 1 }) // → \"1 item\"\n * fn({ count: 5 }) // → \"5 items\"\n *\n * @example\n * const fn = compileIcu(\"Created on {date, date, medium}\", { locale: \"de\" })\n * fn({ date: new Date() }) // → \"Created on 15. Dez. 2024\"\n */\n/**\n * Creates the compilation context from options.\n */\nfunction createCompileContext(options: CompileIcuOptions): CompileContext {\n  const { locale, numberStyles, dateStyles, timeStyles, listStyles } = options\n  return {\n    locale,\n    pluralFn: getPluralFunction(locale),\n    pluralCategories: getPluralCategories(locale),\n    pluralValue: null,\n    pluralOffset: 0,\n    formatters: createFormatterCache(),\n    hasTags: false,\n    customStyles: {\n      number: numberStyles ?? {},\n      date: dateStyles ?? {},\n      time: timeStyles ?? {},\n      list: listStyles ?? {}\n    }\n  }\n}\n\n/**\n * Creates the final message function from compiled parts.\n */\nfunction createMessageFunction(parts: unknown[], ctx: CompileContext): CompiledMessageFunction {\n  // If no dynamic parts, return static string\n  if (parts.every((p) => typeof p === \"string\")) {\n    const staticResult = parts.join(\"\")\n    return () => staticResult\n  }\n\n  // If tags were used, we might return an array\n  if (ctx.hasTags) {\n    return (values?: MessageValues) => {\n      const result = resolveWithTags(parts, values)\n      if (result.every((r) => typeof r === \"string\")) {\n        return result.join(\"\")\n      }\n      return result\n    }\n  }\n\n  return createResolver(parts)\n}\n\nexport function compileIcu(message: string, options: CompileIcuOptions): CompiledMessageFunction {\n  const { strict = true } = options\n\n  // Parse the ICU message\n  const result = parseIcu(message)\n\n  if (!result.success) {\n    if (strict) {\n      throw new Error(`Failed to parse ICU message: ${result.errors[0]?.message}`)\n    }\n    return () => message\n  }\n\n  // Create compilation context and compile\n  const ctx = createCompileContext(options)\n  const parts = compileNodes(result.ast, ctx)\n\n  return createMessageFunction(parts, ctx)\n}\n\n/**\n * Resolves parts that may contain tag results (non-strings).\n */\nfunction resolveWithTags(parts: unknown[], values?: MessageValues): unknown[] {\n  const result: unknown[] = []\n\n  for (const part of parts) {\n    if (typeof part === \"string\") {\n      result.push(part)\n    } else if (typeof part === \"function\") {\n      const resolved = (part as (v?: MessageValues) => unknown)(values)\n      result.push(resolved)\n    }\n  }\n\n  return result\n}\n\n/**\n * Creates a pre-configured ICU compiler with custom styles.\n *\n * Use this factory when you want to define format styles once and reuse them\n * across your application. This avoids passing the same options to every\n * `compileIcu` call.\n *\n * @example\n * // Define once in your i18n config\n * export const compile = createIcuCompiler({\n *   locale: \"de\",\n *   numberStyles: {\n *     bytes: { style: \"unit\", unit: \"byte\", unitDisplay: \"narrow\" },\n *     filesize: { style: \"unit\", unit: \"kilobyte\", unitDisplay: \"short\" }\n *   },\n *   dateStyles: {\n *     iso: { year: \"numeric\", month: \"2-digit\", day: \"2-digit\" }\n *   }\n * })\n *\n * // Use everywhere\n * const msg = compile(\"{size, number, bytes}\")\n * msg({ size: 1024 }) // → \"1,024B\"\n */\nexport function createIcuCompiler(\n  options: CompileIcuOptions\n): (message: string) => CompiledMessageFunction {\n  return (message: string) => compileIcu(message, options)\n}\n","/**\n * Message ID generation utilities.\n *\n * Provides functions to generate stable, content-based message IDs\n * from source strings. Uses SHA-256 hashing with Base64URL encoding\n * for compact, URL-safe identifiers.\n */\n\n/** Length of generated message IDs (8 Base64URL chars = 281 trillion possibilities) */\nconst ID_LENGTH = 8\n\n/**\n * Generates a message ID from content using SHA-256.\n *\n * This is an async function that works in both Node.js and browser environments.\n * The generated ID is an 8-character Base64URL string derived from the SHA-256 hash.\n *\n * @param message - The source message text\n * @param context - Optional message context for disambiguation\n * @returns An 8-character Base64URL ID\n *\n * @example\n * const id = await generateMessageId(\"Hello {name}\")\n * // → \"Kj9xMnPq\"\n *\n * const idWithContext = await generateMessageId(\"Open\", \"menu.file\")\n * // → \"Xp2wLmNr\"\n */\nexport async function generateMessageId(message: string, context?: string): Promise<string> {\n  const input = context ? `${context}${message}` : message\n  const hashBytes = await sha256Bytes(input)\n  return bytesToBase64Url(hashBytes).slice(0, ID_LENGTH)\n}\n\n/**\n * Generates a message ID synchronously (Node.js only).\n *\n * This function uses Node.js's crypto module and will not work in browsers.\n * Use `generateMessageId` for isomorphic code.\n *\n * @param message - The source message text\n * @param context - Optional message context for disambiguation\n * @returns An 8-character Base64URL ID\n *\n * @example\n * const id = generateMessageIdSync(\"Hello {name}\")\n * // → \"Kj9xMnPq\"\n */\nexport function generateMessageIdSync(message: string, context?: string): string {\n  const input = context ? `${context}${message}` : message\n  // eslint-disable-next-line @typescript-eslint/no-require-imports\n  const crypto = require(\"node:crypto\") as typeof import(\"node:crypto\")\n  return crypto.createHash(\"sha256\").update(input).digest(\"base64url\").slice(0, ID_LENGTH)\n}\n\n/**\n * Computes SHA-256 hash bytes using Web Crypto API.\n */\nasync function sha256Bytes(input: string): Promise<Uint8Array> {\n  const encoder = new TextEncoder()\n  const data = encoder.encode(input)\n  const hashBuffer = await globalThis.crypto.subtle.digest(\"SHA-256\", data)\n  return new Uint8Array(hashBuffer)\n}\n\n/** Base64URL alphabet (64 characters) */\nconst BASE64URL = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\"\n\n/** 6-bit mask for extracting Base64 character index (0-63) */\nconst SIX_BIT_MASK = 0x3f\n\n/**\n * Converts bytes to Base64URL string.\n * Optimized for short output (only processes bytes needed for ID_LENGTH chars).\n */\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n  // We need ceil(ID_LENGTH * 6 / 8) = 6 bytes for 8 Base64 chars\n  const chars: string[] = []\n  let bits = 0\n  let value = 0\n\n  for (let i = 0; i < bytes.length && chars.length < ID_LENGTH; i++) {\n    const byte = bytes[i] ?? 0\n    value = (value << 8) | byte\n    bits += 8\n\n    while (bits >= 6 && chars.length < ID_LENGTH) {\n      bits -= 6\n      chars.push(BASE64URL.charAt((value >> bits) & SIX_BIT_MASK))\n    }\n  }\n\n  return chars.join(\"\")\n}\n\n/**\n * Options for batch message ID generation.\n */\nexport interface GenerateIdsOptions {\n  /**\n   * Whether to include the original message in the result.\n   * @default false\n   */\n  includeMessage?: boolean\n}\n\n/**\n * Generates message IDs for multiple messages.\n *\n * @param messages - Array of messages (strings or { message, context } objects)\n * @returns Map of input to generated ID\n *\n * @example\n * const ids = await generateMessageIds([\n *   \"Hello\",\n *   { message: \"Open\", context: \"menu.file\" }\n * ])\n * // → Map { \"Hello\" => \"a1b2c3\", \"Open\" => \"d4e5f6\" }\n */\nexport async function generateMessageIds(\n  messages: (string | { message: string; context?: string })[]\n): Promise<Map<string, string>> {\n  const results = new Map<string, string>()\n\n  await Promise.all(\n    messages.map(async (entry) => {\n      const message = typeof entry === \"string\" ? entry : entry.message\n      const context = typeof entry === \"string\" ? undefined : entry.context\n      const id = await generateMessageId(message, context)\n\n      // Use message as key (with context suffix if present)\n      const key = context ? `${message}\\u0004${context}` : message\n      results.set(key, id)\n    })\n  )\n\n  return results\n}\n","/**\n * Code Generation Utilities\n *\n * Internal module for generating JavaScript code from ICU AST.\n */\n\nimport type { IcuNode, IcuPluralNode, IcuSelectNode, IcuTagNode } from \"../icu/types\"\nimport type { FormatterUsage } from \"../types\"\n\n/** Default variable name for Gettext plurals when none can be extracted */\nexport const DEFAULT_PLURAL_VAR = \"count\"\n\n/**\n * Context for code generation.\n */\nexport interface CodeGenContext {\n  locale: string\n  formatters: FormatterUsage\n  pluralCategories: readonly string[]\n  /** Current plural variable for # substitution */\n  pluralVar: string | null\n  /** Current plural offset */\n  pluralOffset: number\n  needsPluralFn: boolean\n  hasTags: boolean\n}\n\n/**\n * Result of generating message code.\n */\nexport interface MessageCodeResult {\n  code: string\n  formatters: FormatterUsage\n  needsPluralFn: boolean\n  hasTags: boolean\n}\n\n/**\n * Creates a new code generation context.\n */\nexport function createCodeGenContext(\n  locale: string,\n  pluralCategories: readonly string[]\n): CodeGenContext {\n  return {\n    locale,\n    formatters: {\n      number: new Set<string>(),\n      date: new Set<string>(),\n      time: new Set<string>(),\n      list: new Set<string>(),\n      ago: new Set<string>(),\n      name: new Set<string>()\n    },\n    pluralCategories,\n    pluralVar: null,\n    pluralOffset: 0,\n    needsPluralFn: false,\n    hasTags: false\n  }\n}\n\n/**\n * Generates code for an array of nodes.\n * Returns a template literal string for simple cases, or an array for JSX.\n */\nexport function generateNodesCode(nodes: IcuNode[], ctx: CodeGenContext): string {\n  if (nodes.length === 0) {\n    return '\"\"'\n  }\n\n  if (nodes.length === 1) {\n    const firstNode = nodes[0]\n    if (firstNode) {\n      // For single literal node, just return the quoted string\n      if (firstNode.type === \"literal\") {\n        return JSON.stringify(firstNode.value)\n      }\n      return generateNodeCode(firstNode, ctx)\n    }\n    return '\"\"'\n  }\n\n  // Check if all nodes are simple (can be concatenated as strings)\n  const allSimple = nodes.every((n) => !isTagNode(n, ctx))\n\n  if (allSimple) {\n    // Use template literal for better readability\n    return generateTemplateLiteral(nodes, ctx)\n  } else {\n    // Use array for potential JSX content\n    ctx.hasTags = true\n    const parts = nodes.map((n) => generateNodeCode(n, ctx))\n    return `[${parts.join(\", \")}]`\n  }\n}\n\n/**\n * Generates a template literal from nodes.\n */\nfunction generateTemplateLiteral(nodes: IcuNode[], ctx: CodeGenContext): string {\n  let template = \"`\"\n\n  for (const node of nodes) {\n    if (node.type === \"literal\") {\n      // Escape backticks and ${} in literals\n      template += escapeTemplateString(node.value)\n    } else {\n      // Wrap expression in ${}\n      template += \"${\" + generateNodeCode(node, ctx) + \"}\"\n    }\n  }\n\n  template += \"`\"\n  return template\n}\n\n/**\n * Check if a node is a tag.\n */\nfunction isTagNode(node: IcuNode, ctx: CodeGenContext): boolean {\n  if (node.type === \"tag\") {\n    ctx.hasTags = true\n    return true\n  }\n  return false\n}\n\n/**\n * Generates code for a single node.\n */\n// eslint-disable-next-line complexity\nexport function generateNodeCode(node: IcuNode, ctx: CodeGenContext): string {\n  switch (node.type) {\n    case \"literal\":\n      return JSON.stringify(node.value)\n\n    case \"argument\":\n      return generateArgumentCode(node.value)\n\n    case \"number\":\n      return generateNumberCode(node.value, node.style, ctx)\n\n    case \"date\":\n      return generateDateCode(node.value, node.style, ctx)\n\n    case \"time\":\n      return generateTimeCode(node.value, node.style, ctx)\n\n    case \"list\":\n      return generateListCode(node.value, node.style, ctx)\n\n    case \"duration\":\n      return generateDurationCode(node.value, node.style, ctx)\n\n    case \"ago\":\n      return generateAgoCode(node.value, node.style, ctx)\n\n    case \"name\":\n      return generateNameCode(node.value, node.style, ctx)\n\n    case \"plural\":\n      return generatePluralCode(node, ctx)\n\n    case \"select\":\n      return generateSelectCode(node, ctx)\n\n    case \"pound\":\n      return generatePoundCode(ctx)\n\n    case \"tag\":\n      return generateTagCode(node, ctx)\n\n    default:\n      return '\"\"'\n  }\n}\n\n/**\n * Generates code for a simple argument {name}.\n */\nfunction generateArgumentCode(varValue: string): string {\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {n, number, style}.\n * Currency style without skeleton uses runtime lookup from values.currency.\n */\nfunction generateNumberCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n\n  // Special handling for \"currency\" without skeleton - read from values.currency at runtime\n  if (style === \"currency\") {\n    ctx.formatters.number.add(\"_currency_dynamic\")\n    return `(typeof v?.${varName} === \"number\" ? _nf_currency(v.currency ?? \"USD\").format(v.${varName}) : v?.${varName} ?? ${fallback})`\n  }\n\n  const styleKey = style ?? \"\"\n  ctx.formatters.number.add(styleKey)\n  const formatterName = styleKey ? `_nf_${sanitizeStyle(styleKey)}` : \"_nf\"\n  return `(typeof v?.${varName} === \"number\" ? ${formatterName}.format(v.${varName}) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {d, date, style}.\n */\nfunction generateDateCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const styleKey = style ?? \"medium\"\n  ctx.formatters.date.add(styleKey)\n  const formatterName = `_df_${sanitizeStyle(styleKey)}`\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(v?.${varName} instanceof Date ? ${formatterName}.format(v.${varName}) : typeof v?.${varName} === \"number\" ? ${formatterName}.format(new Date(v.${varName})) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {t, time, style}.\n */\nfunction generateTimeCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const styleKey = style ?? \"medium\"\n  ctx.formatters.time.add(styleKey)\n  const formatterName = `_tf_${sanitizeStyle(styleKey)}`\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(v?.${varName} instanceof Date ? ${formatterName}.format(v.${varName}) : typeof v?.${varName} === \"number\" ? ${formatterName}.format(new Date(v.${varName})) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {items, list, style}.\n */\nfunction generateListCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const styleKey = style ?? \"\"\n  ctx.formatters.list.add(styleKey)\n  const formatterName = styleKey ? `_lf_${sanitizeStyle(styleKey)}` : \"_lf\"\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(Array.isArray(v?.${varName}) ? ${formatterName}.format(v.${varName}.map(String)) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {d, duration, style}.\n */\nfunction generateDurationCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  const styleStr = JSON.stringify(style ?? \"long\")\n  // DurationFormat (Baseline 2025) - generate runtime check for older environments\n  return `(v?.${varName} != null && typeof Intl !== \"undefined\" && \"DurationFormat\" in Intl ? new Intl.DurationFormat(${JSON.stringify(ctx.locale)}, { style: ${styleStr} }).format(v.${varName}) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Parses relative time style: \"day\", \"hour short\"\n */\nfunction parseRelativeTimeStyleForCodegen(style: string | null): {\n  unit: string\n  formatStyle: string\n} {\n  if (!style) {\n    return { unit: \"day\", formatStyle: \"long\" }\n  }\n  const parts = style.split(/\\s+/)\n  return {\n    unit: parts[0] ?? \"day\",\n    formatStyle: parts[1] ?? \"long\"\n  }\n}\n\n/**\n * Generates code for {n, ago, unit style}.\n */\nfunction generateAgoCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const { unit, formatStyle } = parseRelativeTimeStyleForCodegen(style)\n  const styleKey = `${unit}_${formatStyle}`\n  ctx.formatters.ago.add(styleKey)\n  const formatterName = `_rtf_${sanitizeStyle(styleKey)}`\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(typeof v?.${varName} === \"number\" ? ${formatterName}.format(v.${varName}, ${JSON.stringify(unit)}) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for {code, name, type}.\n */\nfunction generateNameCode(varValue: string, style: string | null, ctx: CodeGenContext): string {\n  const type = style ?? \"language\"\n  ctx.formatters.name.add(type)\n  const formatterName = `_dn_${sanitizeStyle(type)}`\n  const varName = safeVarName(varValue)\n  const fallback = JSON.stringify(`{${varValue}}`)\n  return `(typeof v?.${varName} === \"string\" ? (${formatterName}.of(v.${varName}) ?? v.${varName}) : v?.${varName} ?? ${fallback})`\n}\n\n/**\n * Generates code for # in plurals.\n */\nfunction generatePoundCode(ctx: CodeGenContext): string {\n  if (ctx.pluralVar === null) {\n    return '\"#\"'\n  }\n  ctx.formatters.number.add(\"\")\n  const varName = safeVarName(ctx.pluralVar)\n  if (ctx.pluralOffset > 0) {\n    return `_nf.format((v?.${varName} ?? 0) - ${ctx.pluralOffset})`\n  }\n  return `_nf.format(v?.${varName} ?? 0)`\n}\n\n/**\n * Generates code for a plural node.\n */\nexport function generatePluralCode(node: IcuPluralNode, ctx: CodeGenContext): string {\n  ctx.needsPluralFn = true\n  const varName = safeVarName(node.value)\n  const offset = node.offset\n\n  // Save context and set plural variable for # substitution\n  const prevPluralVar = ctx.pluralVar\n  const prevPluralOffset = ctx.pluralOffset\n  ctx.pluralVar = node.value\n  ctx.pluralOffset = offset\n\n  // Collect exact matches and category matches\n  const exactMatches: { value: number; code: string }[] = []\n  const categoryMatches: Record<string, string> = {}\n\n  for (const [key, option] of Object.entries(node.options)) {\n    const optionCode = generateNodesCode(option.value, ctx)\n\n    if (key.startsWith(\"=\")) {\n      const exactValue = parseInt(key.slice(1), 10)\n      exactMatches.push({ value: exactValue, code: optionCode })\n    } else {\n      categoryMatches[key] = optionCode\n    }\n  }\n\n  // Restore context\n  ctx.pluralVar = prevPluralVar\n  ctx.pluralOffset = prevPluralOffset\n\n  // Build the conditional expression\n  const code = buildPluralCondition(varName, offset, exactMatches, categoryMatches, ctx)\n  return `(${code})`\n}\n\n/**\n * Builds the conditional expression for plural.\n * Combines exact matches (=0, =1) with category matches (one, other).\n */\nfunction buildPluralCondition(\n  varName: string,\n  offset: number,\n  exactMatches: { value: number; code: string }[],\n  categoryMatches: Record<string, string>,\n  ctx: CodeGenContext\n): string {\n  let code = \"\"\n\n  // Exact matches first (=0, =1, =2, etc.)\n  code += buildExactMatchCode(varName, exactMatches)\n\n  // Then category matches (zero, one, two, few, many, other)\n  code += buildCategoryMatchCode(varName, offset, categoryMatches, ctx)\n\n  return code\n}\n\n/** Builds ternary chain for exact value matches: v?.n === 0 ? ... : v?.n === 1 ? ... : */\nfunction buildExactMatchCode(\n  varName: string,\n  exactMatches: { value: number; code: string }[]\n): string {\n  let code = \"\"\n  for (const { value, code: optionCode } of exactMatches) {\n    code += `v?.${varName} === ${value} ? ${optionCode} : `\n  }\n  return code\n}\n\n/** Gets the adjusted variable expression for offset handling */\nfunction getAdjustedVar(varName: string, offset: number): string {\n  return offset > 0 ? `((v?.${varName} ?? 0) - ${offset})` : `(v?.${varName} ?? 0)`\n}\n\n/** Gets the fallback code for unmatched categories */\nfunction getCategoryFallback(varName: string, categoryMatches: Record<string, string>): string {\n  return categoryMatches.other ?? `\"{${varName}}\"`\n}\n\n/** Builds ternary chain for CLDR category matches using plural function */\nfunction buildCategoryMatchCode(\n  varName: string,\n  offset: number,\n  categoryMatches: Record<string, string>,\n  ctx: CodeGenContext\n): string {\n  if (Object.keys(categoryMatches).length === 0) {\n    return `\"{${varName}}\"`\n  }\n\n  const categories = ctx.pluralCategories\n  const adjustedVar = getAdjustedVar(varName, offset)\n  const fallback = getCategoryFallback(varName, categoryMatches)\n  const parts: string[] = []\n\n  for (let i = 0; i < categories.length; i++) {\n    const category = categories[i]\n    const matchCode = category ? categoryMatches[category] : undefined\n    if (!matchCode) {\n      continue\n    }\n\n    // Last category or \"other\" is the fallback (no condition needed)\n    const isLast = i === categories.length - 1 || category === \"other\"\n    if (isLast) {\n      parts.push(matchCode)\n    } else {\n      parts.push(`_pf(${adjustedVar}) === ${i} ? ${matchCode} : `)\n    }\n  }\n\n  const code = parts.join(\"\")\n  // Ensure we have a fallback\n  return code.endsWith(fallback) ? code : code + fallback\n}\n\n/**\n * Generates code for a select node.\n */\nexport function generateSelectCode(node: IcuSelectNode, ctx: CodeGenContext): string {\n  const varName = safeVarName(node.value)\n\n  const optionCodes: Record<string, string> = {}\n  for (const [key, option] of Object.entries(node.options)) {\n    optionCodes[key] = generateNodesCode(option.value, ctx)\n  }\n\n  let code = \"\"\n  const keys = Object.keys(optionCodes).filter((k) => k !== \"other\")\n\n  for (const key of keys) {\n    code += `v?.${varName} === ${JSON.stringify(key)} ? ${optionCodes[key]} : `\n  }\n\n  code += optionCodes.other ?? `\"{${node.value}}\"`\n\n  return `(${code})`\n}\n\n/**\n * Generates code for a tag node.\n */\nexport function generateTagCode(node: IcuTagNode, ctx: CodeGenContext): string {\n  ctx.hasTags = true\n  const tagName = safeVarName(node.value)\n\n  const childrenCode = generateNodesCode(node.children, ctx)\n\n  return `(typeof v?.${tagName} === \"function\" ? v.${tagName}(${childrenCode}) : ${childrenCode})`\n}\n\n/**\n * Makes a variable name safe for use in generated code.\n */\nexport function safeVarName(name: string): string {\n  if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)) {\n    return name\n  }\n  return `[${JSON.stringify(name)}]`\n}\n\n/**\n * Sanitizes a style string for use as a variable name suffix.\n */\nexport function sanitizeStyle(style: string): string {\n  return style.replace(/[^a-zA-Z0-9]/g, \"_\").replace(/^_+|_+$/g, \"\")\n}\n\n/**\n * Escapes a string for use inside a template literal.\n */\nexport function escapeTemplateString(str: string): string {\n  return str.replace(/\\\\/g, \"\\\\\\\\\").replace(/`/g, \"\\\\`\").replace(/\\$\\{/g, \"\\\\${\")\n}\n\n/**\n * Escapes a string for use in a comment.\n */\nexport function escapeComment(str: string): string {\n  return str.replace(/\\*\\//g, \"* /\").replace(/\\n/g, \" \")\n}\n\n/**\n * Extracts the plural variable name from msgid or msgid_plural.\n * Looks for {varName} patterns and returns the first one found.\n *\n * @example\n * extractPluralVariable(\"{count} item\", \"{count} items\") // → \"count\"\n * extractPluralVariable(\"One item\", \"{n} items\") // → \"n\"\n * extractPluralVariable(\"One item\", \"Many items\") // → null (use default)\n */\nexport function extractPluralVariable(msgid: string, pluralSource?: string): string | null {\n  // Try pluralSource first (msgid_plural), then msgid\n  const sources = [pluralSource, msgid].filter(Boolean) as string[]\n\n  for (const source of sources) {\n    // Match {varName} or {varName, ...}\n    const match = /\\{([a-zA-Z_$][a-zA-Z0-9_$]*?)(?:,|\\})/u.exec(source)\n    if (match?.[1]) {\n      return match[1]\n    }\n  }\n\n  return null\n}\n\n/**\n * Gets Intl.NumberFormat options for a style.\n * Note: \"currency\" without skeleton is handled dynamically via _nf_currency().\n */\nexport function getNumberOptionsForStyle(style: string): Intl.NumberFormatOptions {\n  switch (style) {\n    case \"percent\":\n      return { style: \"percent\" }\n    default:\n      return {}\n  }\n}\n\n/**\n * Generates the plural function code for a locale.\n * Uses native Intl.PluralRules for accurate CLDR-compliant plural selection.\n */\nexport function generatePluralFunctionCode(locale: string, categories: readonly string[]): string {\n  // For single category (only \"other\"), no plural function needed\n  if (categories.length === 1) {\n    return \"const _pf = () => 0\"\n  }\n\n  // For simple one/other pattern, use inline function for smaller output\n  if (categories.length === 2 && categories[0] === \"one\" && categories[1] === \"other\") {\n    return \"const _pf = (n) => n !== 1 ? 1 : 0\"\n  }\n\n  // Use Intl.PluralRules for complex patterns\n  // This ensures CLDR-compliant plural selection\n  return `const _pr = new Intl.PluralRules(\"${locale}\")\nconst _pc = _pr.resolvedOptions().pluralCategories\nconst _pf = (n) => { const i = _pc.indexOf(_pr.select(n)); return i >= 0 ? i : _pc.length - 1 }`\n}\n\n/**\n * Gets Intl.ListFormat type from style.\n */\nfunction getListTypeFromStyle(style: string): \"conjunction\" | \"disjunction\" | \"unit\" {\n  switch (style) {\n    case \"disjunction\":\n    case \"or\":\n      return \"disjunction\"\n    case \"unit\":\n      return \"unit\"\n    default:\n      return \"conjunction\"\n  }\n}\n\n/**\n * Generates Intl formatter declarations.\n */\n// eslint-disable-next-line complexity\nexport function generateFormatterDeclarations(locale: string, used: FormatterUsage): string | null {\n  const decls: string[] = []\n\n  for (const style of used.number) {\n    // Dynamic currency formatter with runtime cache\n    if (style === \"_currency_dynamic\") {\n      decls.push(`const _nf_currency_cache = new Map()`)\n      decls.push(\n        `const _nf_currency = (c) => { let f = _nf_currency_cache.get(c); if (!f) { f = new Intl.NumberFormat(\"${locale}\", { style: \"currency\", currency: c }); _nf_currency_cache.set(c, f); } return f }`\n      )\n      continue\n    }\n    const name = style ? `_nf_${sanitizeStyle(style)}` : \"_nf\"\n    const opts = style ? `, ${JSON.stringify(getNumberOptionsForStyle(style))}` : \"\"\n    decls.push(`const ${name} = new Intl.NumberFormat(\"${locale}\"${opts})`)\n  }\n\n  for (const style of used.date) {\n    const name = `_df_${sanitizeStyle(style)}`\n    decls.push(`const ${name} = new Intl.DateTimeFormat(\"${locale}\", { dateStyle: \"${style}\" })`)\n  }\n\n  for (const style of used.time) {\n    const name = `_tf_${sanitizeStyle(style)}`\n    decls.push(`const ${name} = new Intl.DateTimeFormat(\"${locale}\", { timeStyle: \"${style}\" })`)\n  }\n\n  for (const style of used.list) {\n    const name = style ? `_lf_${sanitizeStyle(style)}` : \"_lf\"\n    const type = getListTypeFromStyle(style)\n    decls.push(`const ${name} = new Intl.ListFormat(\"${locale}\", { type: \"${type}\" })`)\n  }\n\n  for (const styleKey of used.ago) {\n    // styleKey is \"unit_formatStyle\" e.g. \"day_long\", \"hour_short\"\n    const parts = styleKey.split(\"_\")\n    const formatStyle = parts[1] ?? \"long\"\n    const formatterName = `_rtf_${sanitizeStyle(styleKey)}`\n    decls.push(\n      `const ${formatterName} = new Intl.RelativeTimeFormat(\"${locale}\", { style: \"${formatStyle}\" })`\n    )\n  }\n\n  for (const type of used.name) {\n    const formatterName = `_dn_${sanitizeStyle(type)}`\n    decls.push(`const ${formatterName} = new Intl.DisplayNames(\"${locale}\", { type: \"${type}\" })`)\n  }\n\n  return decls.length > 0 ? decls.join(\"\\n\") : null\n}\n","/**\n * Catalog Compiler\n *\n * Compiles a PO catalog into optimized message functions.\n * Each message is compiled to a function that takes values and returns the formatted string.\n *\n * Uses messageId (8-char hash) as keys for minimal bundle size.\n *\n * @example\n * const po = PO.parse(poFileContent)\n * const catalog = itemsToCatalog(po.items)\n * const compiled = compileCatalog(catalog, { locale: \"de\" })\n *\n * compiled.format(\"Xk9mLp\", { name: \"Sebastian\" })\n * // → \"Hallo Sebastian!\"\n */\n\nimport type { Catalog } from \"./catalog\"\nimport type { FormatterUsage } from \"./types\"\nimport type { CompiledMessageFunction, MessageValues, MessageResult } from \"./icu/compile\"\nimport { compileIcu } from \"./icu/compile\"\nimport { parseIcu } from \"./icu/parser\"\nimport { generateMessageIdSync } from \"./messageId\"\nimport { getPluralCategories, getPluralFunction } from \"./plurals\"\nimport {\n  createCodeGenContext,\n  generateNodesCode,\n  generatePluralFunctionCode,\n  generateFormatterDeclarations,\n  escapeComment,\n  extractPluralVariable,\n  DEFAULT_PLURAL_VAR,\n  type MessageCodeResult\n} from \"./internal/codegen\"\n\n// ============================================================================\n// Runtime Compilation (compileCatalog)\n// ============================================================================\n\n/**\n * Options for compiling a catalog.\n */\nexport interface CompileCatalogOptions {\n  /** Locale for plural rules and Intl formatting */\n  locale: string\n\n  /**\n   * Whether to use messageId (hash) as key.\n   * If false, uses msgid as key.\n   * @default true\n   */\n  useMessageId?: boolean\n\n  /**\n   * Whether to throw on parse errors.\n   * If false, invalid messages return the original text.\n   * @default false\n   */\n  strict?: boolean\n}\n\n/**\n * A compiled catalog with message lookup and formatting.\n */\nexport interface CompiledCatalog {\n  /**\n   * Get a compiled message function by key (messageId or msgid).\n   */\n  get(key: string): CompiledMessageFunction | undefined\n\n  /**\n   * Format a message with values.\n   * Returns the formatted string, or the key if not found.\n   */\n  format(key: string, values?: MessageValues): MessageResult\n\n  /**\n   * Check if a message exists.\n   */\n  has(key: string): boolean\n\n  /**\n   * Get all message keys.\n   */\n  keys(): string[]\n\n  /**\n   * Number of compiled messages.\n   */\n  readonly size: number\n\n  /**\n   * The locale this catalog was compiled for.\n   */\n  readonly locale: string\n}\n\n/**\n * Compiles a catalog into optimized message functions.\n *\n * @example\n * const compiled = compileCatalog(catalog, { locale: \"de\" })\n * compiled.format(\"Xk9mLp\", { name: \"World\" }) // → \"Hallo World!\"\n */\nexport function compileCatalog(catalog: Catalog, options: CompileCatalogOptions): CompiledCatalog {\n  const { locale, useMessageId = true, strict = false } = options\n\n  const messages = new Map<string, CompiledMessageFunction>()\n  const pluralFn = getPluralFunction(locale)\n\n  for (const [msgid, entry] of Object.entries(catalog)) {\n    const translation = entry.translation\n\n    if (translation === undefined) {\n      continue\n    }\n\n    const key = useMessageId ? generateMessageIdSync(msgid, entry.context) : msgid\n\n    if (Array.isArray(translation)) {\n      // Gettext plural format - compile all forms and select at runtime\n      const compiled = compileGettextPluralRuntime(\n        msgid,\n        entry.pluralSource,\n        translation,\n        locale,\n        pluralFn,\n        strict\n      )\n      messages.set(key, compiled)\n    } else {\n      const compiled = compileIcu(translation, { locale, strict })\n      messages.set(key, compiled)\n    }\n  }\n\n  return {\n    get(key: string) {\n      return messages.get(key)\n    },\n\n    format(key: string, values?: MessageValues) {\n      const fn = messages.get(key)\n      if (!fn) {\n        return key\n      }\n      return fn(values)\n    },\n\n    has(key: string) {\n      return messages.has(key)\n    },\n\n    keys() {\n      return [...messages.keys()]\n    },\n\n    get size() {\n      return messages.size\n    },\n\n    locale\n  }\n}\n\n/**\n * Compiles Gettext plural forms for runtime use.\n */\nfunction compileGettextPluralRuntime(\n  msgid: string,\n  pluralSource: string | undefined,\n  translations: string[],\n  locale: string,\n  pluralFn: (n: number) => number,\n  strict: boolean\n): CompiledMessageFunction {\n  // Extract variable name from msgid or pluralSource\n  const varName = extractPluralVariable(msgid, pluralSource) ?? DEFAULT_PLURAL_VAR\n\n  // Compile each form\n  const compiledForms = translations.map((form) => compileIcu(form, { locale, strict }))\n\n  // Return a function that selects the right form at runtime\n  return (values?: MessageValues): MessageResult => {\n    const rawCount = values?.[varName]\n    const count = typeof rawCount === \"number\" ? rawCount : 0\n    const index = pluralFn(count)\n    // Use the form at index, or fall back to the last form\n    const form = compiledForms[index]\n    if (form) {\n      return form(values)\n    }\n    // Fallback to last form if index is out of range\n    const lastForm = compiledForms[compiledForms.length - 1]\n    return lastForm ? lastForm(values) : String(count)\n  }\n}\n\n// ============================================================================\n// Static Code Generation (generateCompiledCode)\n// ============================================================================\n\n/**\n * Options for generating compiled code.\n */\nexport interface GenerateCodeOptions {\n  /** Locale for plural rules and Intl formatting */\n  locale: string\n\n  /**\n   * Whether to use messageId (hash) as key.\n   * @default true\n   */\n  useMessageId?: boolean\n\n  /**\n   * Export name for the messages object.\n   * @default \"messages\"\n   */\n  exportName?: string\n\n  /**\n   * Whether to generate TypeScript or JavaScript.\n   * @default \"typescript\"\n   */\n  format?: \"typescript\" | \"javascript\"\n\n  /**\n   * Whether to include source comments with original msgid.\n   * @default false\n   */\n  includeSourceComments?: boolean\n}\n\n/**\n * Entry in compiled output for code generation.\n */\ninterface CompiledEntry {\n  key: string\n  msgid: string\n  code: string\n}\n\n/**\n * Generates JavaScript/TypeScript code for a compiled catalog.\n *\n * This can be used in build pipelines to generate static message files\n * that don't require runtime ICU parsing.\n *\n * @example\n * const code = generateCompiledCode(catalog, { locale: \"de\" })\n * // Write to file: messages.de.ts\n *\n * // Generated code:\n * // const _nf = new Intl.NumberFormat(\"de\")\n * // export const messages = {\n * //   \"Xk9mLp\": (v) => `Hallo ${v?.name ?? \"{name}\"}!`,\n * //   ...\n * // }\n */\nexport function generateCompiledCode(catalog: Catalog, options: GenerateCodeOptions): string {\n  const {\n    locale,\n    useMessageId = true,\n    exportName = \"messages\",\n    format = \"typescript\",\n    includeSourceComments = false\n  } = options\n\n  const pluralCategories = getPluralCategories(locale)\n\n  // Process all catalog entries\n  const { entries, usedFormatters, needsPluralFn } = processCatalogEntries(\n    catalog,\n    locale,\n    pluralCategories,\n    useMessageId\n  )\n\n  // Build output\n  return buildOutput({\n    locale,\n    format,\n    exportName,\n    includeSourceComments,\n    entries,\n    usedFormatters,\n    needsPluralFn,\n    pluralCategories\n  })\n}\n\n/**\n * Processes all catalog entries and generates code for each.\n */\nfunction processCatalogEntries(\n  catalog: Catalog,\n  locale: string,\n  pluralCategories: readonly string[],\n  useMessageId: boolean\n): {\n  entries: CompiledEntry[]\n  usedFormatters: FormatterUsage\n  needsPluralFn: boolean\n} {\n  const entries: CompiledEntry[] = []\n  const usedFormatters = {\n    number: new Set<string>(),\n    date: new Set<string>(),\n    time: new Set<string>(),\n    list: new Set<string>(),\n    ago: new Set<string>(),\n    name: new Set<string>()\n  }\n  let needsPluralFn = false\n\n  for (const [msgid, entry] of Object.entries(catalog)) {\n    const translation = entry.translation\n\n    if (translation === undefined) {\n      continue\n    }\n\n    const key = useMessageId ? generateMessageIdSync(msgid, entry.context) : msgid\n\n    let result: MessageCodeResult\n\n    if (Array.isArray(translation)) {\n      // Gettext plural format: msgstr[0], msgstr[1], ...\n      result = generateGettextPluralCode(\n        msgid,\n        entry.pluralSource,\n        translation,\n        locale,\n        pluralCategories\n      )\n    } else {\n      // Single string (may contain ICU syntax)\n      result = generateMessageCodeFromString(translation, locale, pluralCategories)\n    }\n\n    // Merge formatters\n    mergeFormatters(usedFormatters, result.formatters)\n    if (result.needsPluralFn) {\n      needsPluralFn = true\n    }\n\n    entries.push({ key, msgid, code: result.code })\n  }\n\n  return { entries, usedFormatters, needsPluralFn }\n}\n\n/**\n * Generates code for Gettext plural format (msgstr[] array).\n */\nfunction generateGettextPluralCode(\n  msgid: string,\n  pluralSource: string | undefined,\n  translations: string[],\n  locale: string,\n  pluralCategories: readonly string[]\n): MessageCodeResult {\n  const formatters = {\n    number: new Set<string>(),\n    date: new Set<string>(),\n    time: new Set<string>(),\n    list: new Set<string>(),\n    ago: new Set<string>(),\n    name: new Set<string>()\n  }\n\n  // Extract the plural variable name from msgid or pluralSource\n  const varName = extractPluralVariable(msgid, pluralSource) ?? DEFAULT_PLURAL_VAR\n\n  // Compile each msgstr[] form\n  const compiledForms = compileGettextForms(translations, locale, pluralCategories, formatters)\n\n  // Handle edge cases\n  if (compiledForms.length === 0) {\n    return { code: `() => \"\"`, formatters, needsPluralFn: false, hasTags: false }\n  }\n\n  if (compiledForms.length === 1) {\n    return {\n      code: compiledForms[0] ?? `() => \"\"`,\n      formatters,\n      needsPluralFn: false,\n      hasTags: false\n    }\n  }\n\n  // Build plural switch expression\n  const code = buildGettextPluralSwitch(varName, compiledForms)\n\n  return { code, formatters, needsPluralFn: true, hasTags: false }\n}\n\n/**\n * Compiles all Gettext plural forms.\n */\nfunction compileGettextForms(\n  translations: string[],\n  locale: string,\n  pluralCategories: readonly string[],\n  formatters: FormatterUsage\n): string[] {\n  const compiledForms: string[] = []\n\n  for (const form of translations) {\n    const result = generateMessageCodeFromString(form, locale, pluralCategories)\n    compiledForms.push(result.code)\n    mergeFormatters(formatters, result.formatters)\n  }\n\n  return compiledForms\n}\n\n/**\n * Builds the plural switch expression for Gettext format.\n */\nfunction buildGettextPluralSwitch(varName: string, compiledForms: string[]): string {\n  let code = `(v) => { const _n = v?.${varName} ?? 0; const _i = _pf(_n); return `\n\n  // Regex to extract body from arrow function: (v) => body OR () => body\n  const fnBodyRegex = /^\\([^)]*\\) => (.+)$/\n\n  for (let i = 0; i < compiledForms.length; i++) {\n    const formCode = compiledForms[i] ?? '() => \"\"'\n    const bodyMatch = fnBodyRegex.exec(formCode)\n    const body = bodyMatch?.[1] ?? formCode\n\n    if (i === compiledForms.length - 1) {\n      code += body\n    } else {\n      code += `_i === ${i} ? ${body} : `\n    }\n  }\n\n  code += \" }\"\n  return code\n}\n\n/**\n * Merges formatter sets from a result into the accumulated set.\n */\nfunction mergeFormatters(target: FormatterUsage, source: FormatterUsage): void {\n  for (const key of Object.keys(source) as (keyof FormatterUsage)[]) {\n    for (const style of source[key]) {\n      target[key].add(style)\n    }\n  }\n}\n\n/**\n * Generates JavaScript code for a single message string.\n */\nfunction generateMessageCodeFromString(\n  message: string,\n  locale: string,\n  pluralCategories: readonly string[]\n): MessageCodeResult {\n  const formatters = {\n    number: new Set<string>(),\n    date: new Set<string>(),\n    time: new Set<string>(),\n    list: new Set<string>(),\n    ago: new Set<string>(),\n    name: new Set<string>()\n  }\n\n  // Static string - no placeholders\n  if (!message.includes(\"{\") && !message.includes(\"<\")) {\n    return {\n      code: `() => ${JSON.stringify(message)}`,\n      formatters,\n      needsPluralFn: false,\n      hasTags: false\n    }\n  }\n\n  // Parse the ICU message\n  const result = parseIcu(message)\n  if (!result.success) {\n    return {\n      code: `() => ${JSON.stringify(message)}`,\n      formatters,\n      needsPluralFn: false,\n      hasTags: false\n    }\n  }\n\n  // Create context and generate code\n  const ctx = createCodeGenContext(locale, pluralCategories)\n  const bodyCode = generateNodesCode(result.ast, ctx)\n\n  // Build the function\n  let code: string\n  if (ctx.hasTags) {\n    code = `(v) => { const _r = ${bodyCode}; return Array.isArray(_r) && _r.every(x => typeof x === \"string\") ? _r.join(\"\") : _r }`\n  } else {\n    code = `(v) => ${bodyCode}`\n  }\n\n  return {\n    code,\n    formatters: ctx.formatters,\n    needsPluralFn: ctx.needsPluralFn,\n    hasTags: ctx.hasTags\n  }\n}\n\n/**\n * Options for building the output string.\n */\ninterface BuildOutputOptions {\n  locale: string\n  format: \"typescript\" | \"javascript\"\n  exportName: string\n  includeSourceComments: boolean\n  entries: CompiledEntry[]\n  usedFormatters: FormatterUsage\n  needsPluralFn: boolean\n  pluralCategories: readonly string[]\n}\n\n/**\n * Builds the final output string.\n */\nfunction buildOutput(options: BuildOutputOptions): string {\n  const {\n    locale,\n    format,\n    exportName,\n    includeSourceComments,\n    entries,\n    usedFormatters,\n    needsPluralFn,\n    pluralCategories\n  } = options\n\n  const lines: string[] = []\n\n  // Header\n  lines.push(\"/**\")\n  lines.push(` * Compiled messages for locale: ${locale}`)\n  lines.push(\" * Generated by pofile-ts\")\n  lines.push(\" * DO NOT EDIT - This file is auto-generated\")\n  lines.push(\" */\")\n  lines.push(\"\")\n\n  // Plural function\n  if (needsPluralFn) {\n    lines.push(generatePluralFunctionCode(locale, pluralCategories))\n    lines.push(\"\")\n  }\n\n  // Formatter declarations\n  const formatterDecls = generateFormatterDeclarations(locale, usedFormatters)\n  if (formatterDecls) {\n    lines.push(formatterDecls)\n    lines.push(\"\")\n  }\n\n  // Type (TypeScript only)\n  if (format === \"typescript\") {\n    lines.push(\"type V = Record<string, unknown>\")\n    lines.push(\"\")\n  }\n\n  // Messages object\n  lines.push(`export const ${exportName} = {`)\n\n  for (const entry of entries) {\n    if (includeSourceComments) {\n      lines.push(`  // ${escapeComment(entry.msgid)}`)\n    }\n    lines.push(`  \"${entry.key}\": ${entry.code},`)\n  }\n\n  lines.push(\"}\")\n  lines.push(\"\")\n\n  return lines.join(\"\\n\")\n}\n","/**\n * Comment processing utilities.\n *\n * Provides helpers for handling comments in PO files,\n * particularly for integration with build tools that extract\n * comments from source code.\n */\n\n/**\n * Splits multiline comments into individual lines.\n *\n * Source code comments often contain newlines, but PO format expects\n * one comment per line. This helper normalizes comments for PO output.\n *\n * Features:\n * - Splits on newlines (\\n, \\r\\n, \\r)\n * - Trims whitespace from each line\n * - Filters out empty lines\n * - Flattens arrays (handles both single strings and arrays)\n *\n * @example\n * // Split a multiline comment\n * splitMultilineComments([\"Line1\\nLine2\", \"Line3\"])\n * // → [\"Line1\", \"Line2\", \"Line3\"]\n *\n * @example\n * // Handles whitespace\n * splitMultilineComments([\"  Line1\\n  Line2  \"])\n * // → [\"Line1\", \"Line2\"]\n *\n * @example\n * // Windows line endings\n * splitMultilineComments([\"First\\r\\nSecond\"])\n * // → [\"First\", \"Second\"]\n *\n * @example\n * // Empty lines are filtered out\n * splitMultilineComments([\"Line1\\n\\n\\nLine2\"])\n * // → [\"Line1\", \"Line2\"]\n *\n * @example\n * // Single-line comments pass through unchanged\n * splitMultilineComments([\"Simple comment\"])\n * // → [\"Simple comment\"]\n */\nexport function splitMultilineComments(comments: string[]): string[] {\n  return comments\n    .flatMap((comment) => comment.split(/\\r?\\n|\\r/))\n    .map((line) => line.trim())\n    .filter(Boolean)\n}\n","/**\n * ICU MessageFormat conversion utilities.\n *\n * Converts between Gettext plural format and ICU MessageFormat.\n */\n\nimport type { PoItem, PoFile } from \"../types\"\nimport { getPluralCategories } from \"../plurals\"\nimport { DEFAULT_PLURAL_VAR } from \"../internal/codegen\"\n\n/**\n * Options for Gettext to ICU conversion.\n */\nexport interface GettextToIcuOptions {\n  /**\n   * Target locale for determining plural categories.\n   * Required to map msgstr indices to ICU plural keywords.\n   */\n  locale: string\n\n  /**\n   * Variable name to use in the ICU plural expression.\n   * @default \"count\"\n   */\n  pluralVariable?: string\n\n  /**\n   * Replace `#` with the explicit variable reference `{varname}`.\n   * Makes translations more readable in TMS tools.\n   * @default true\n   */\n  expandOctothorpe?: boolean\n}\n\n/**\n * Options for converting an entire PO file to ICU format.\n */\nexport interface NormalizeToIcuOptions extends GettextToIcuOptions {\n  /**\n   * Whether to modify items in-place or return copies.\n   * @default false\n   */\n  inPlace?: boolean\n}\n\n/**\n * Maps msgstr indices to CLDR plural categories for a given locale.\n * Intl.PluralRules.pluralCategories already returns categories in index order.\n */\nfunction getMsgstrToCategory(locale: string): string[] {\n  // pluralCategories is ordered: index 0 → categories[0], index 1 → categories[1], etc.\n  return [...getPluralCategories(locale)]\n}\n\n/**\n * Converts a Gettext plural item to ICU MessageFormat.\n *\n * @example\n * const item = {\n *   msgid: \"One item\",\n *   msgid_plural: \"{count} items\",\n *   msgstr: [\"Ein Artikel\", \"{count} Artikel\"]\n * }\n *\n * gettextToIcu(item, { locale: \"de\" })\n * // → \"{count, plural, one {Ein Artikel} other {{count} Artikel}}\"\n *\n * @example\n * // Polish with 4 plural forms\n * const plItem = {\n *   msgid: \"One file\",\n *   msgid_plural: \"{count} files\",\n *   msgstr: [\"plik\", \"pliki\", \"plików\", \"pliki\"]\n * }\n *\n * gettextToIcu(plItem, { locale: \"pl\" })\n * // → \"{count, plural, one {plik} few {pliki} many {plików} other {pliki}}\"\n */\nexport function gettextToIcu(item: PoItem, options: GettextToIcuOptions): string | null {\n  const { locale, pluralVariable = DEFAULT_PLURAL_VAR, expandOctothorpe = true } = options\n\n  // Not a plural item\n  if (!item.msgid_plural || item.msgstr.length <= 1) {\n    return null\n  }\n\n  // Get the category mapping for this locale\n  const categories = getMsgstrToCategory(locale)\n\n  // Build ICU plural clauses\n  const clauses = item.msgstr\n    .map((translation, index) => {\n      const category = categories[index] ?? \"other\"\n      // Replace # with explicit variable reference for better TMS readability\n      const text = expandOctothorpe ? translation.replace(/#/g, `{${pluralVariable}}`) : translation\n      return `${category} {${text}}`\n    })\n    .join(\" \")\n\n  return `{${pluralVariable}, plural, ${clauses}}`\n}\n\n/**\n * Checks if an item is a plural item (has msgid_plural).\n */\nexport function isPluralItem(item: PoItem): boolean {\n  return !!item.msgid_plural && item.msgstr.length > 1\n}\n\n/**\n * Normalizes a plural item to ICU format in-place.\n * The ICU string is stored in msgstr[0], and msgid_plural is cleared.\n *\n * @returns true if the item was converted, false otherwise\n */\nexport function normalizeItemToIcu(item: PoItem, options: GettextToIcuOptions): boolean {\n  const icu = gettextToIcu(item, options)\n\n  if (icu) {\n    item.msgstr = [icu]\n    item.msgid_plural = \"\"\n    return true\n  }\n\n  return false\n}\n\n/**\n * Normalizes all plural items in a PO file to ICU format.\n *\n * @example\n * const po = parsePo(content)\n * const normalized = normalizeToIcu(po, { locale: \"de\" })\n *\n * // All plural items now have ICU in msgstr[0]\n * normalized.items[0].msgstr[0]\n * // → \"{count, plural, one {Ein Artikel} other {{count} Artikel}}\"\n */\nexport function normalizeToIcu(po: PoFile, options: NormalizeToIcuOptions): PoFile {\n  const { inPlace = false, ...gettextOptions } = options\n\n  const result = inPlace\n    ? po\n    : {\n        ...po,\n        headers: { ...po.headers },\n        items: po.items.map((item) => ({\n          ...item,\n          msgstr: [...item.msgstr],\n          flags: { ...item.flags }\n        }))\n      }\n\n  for (const item of result.items) {\n    normalizeItemToIcu(item, gettextOptions)\n  }\n\n  return result\n}\n\nexport interface IcuToGettextOptions {\n  /**\n   * Replace `#` with the explicit variable reference `{varname}`.\n   * Makes source strings more readable.\n   * @default true\n   */\n  expandOctothorpe?: boolean\n}\n\ninterface PluralCase {\n  category: string\n  text: string\n}\n\n/**\n * Extracts plural cases from ICU case string.\n */\nfunction extractPluralCases(casesStr: string): PluralCase[] {\n  const caseRegex = /(\\w+)\\s*\\{([^{}]*(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n  const cases: PluralCase[] = []\n\n  let match: RegExpExecArray | null\n  while ((match = caseRegex.exec(casesStr)) !== null) {\n    const category = match[1]\n    const text = match[2]\n    if (category && text !== undefined) {\n      cases.push({ category, text })\n    }\n  }\n\n  return cases\n}\n\n/**\n * Converts ICU plural back to source msgid/msgid_plural.\n * Extracts the first and last plural cases.\n *\n * @example\n * const icu = \"{count, plural, one {# item} other {# items}}\"\n * icuToGettextSource(icu)\n * // → { msgid: \"{count} item\", msgid_plural: \"{count} items\", pluralVariable: \"count\" }\n *\n * icuToGettextSource(icu, { expandOctothorpe: false })\n * // → { msgid: \"# item\", msgid_plural: \"# items\", pluralVariable: \"count\" }\n */\nexport function icuToGettextSource(\n  icu: string,\n  options: IcuToGettextOptions = {}\n): {\n  msgid: string\n  msgid_plural: string\n  pluralVariable: string\n} | null {\n  const { expandOctothorpe = true } = options\n\n  // Simple regex-based extraction (no full ICU parser needed)\n  const icuPluralRegex = /^\\{(\\w+),\\s*plural,\\s*(.+)\\}$/s\n  const match = icuPluralRegex.exec(icu)\n\n  if (!match?.[1] || !match[2]) {\n    return null\n  }\n\n  const pluralVariable = match[1]\n  const cases = extractPluralCases(match[2])\n\n  if (cases.length < 2) {\n    return null\n  }\n\n  const first = cases[0]\n  const last = cases[cases.length - 1]\n\n  if (!first || !last) {\n    return null\n  }\n\n  // Replace # with explicit variable reference for better readability\n  const expand = (text: string) =>\n    expandOctothorpe ? text.replace(/#/g, `{${pluralVariable}}`) : text\n\n  return {\n    msgid: expand(first.text),\n    msgid_plural: expand(last.text),\n    pluralVariable\n  }\n}\n","/**\n * ICU MessageFormat utility functions.\n *\n * Convenience APIs for working with ICU messages.\n */\n\nimport type { IcuNode, IcuNodeType, IcuParseError, IcuParserOptions } from \"./types\"\nimport { parseIcu } from \"./parser\"\n\n/**\n * Information about a variable in an ICU message.\n */\nexport interface IcuVariable {\n  /** Variable name */\n  name: string\n  /** Variable type: argument, number, date, time, plural, select */\n  type: \"argument\" | \"number\" | \"date\" | \"time\" | \"plural\" | \"select\"\n  /** Format style (for number/date/time) */\n  style?: string\n}\n\n/**\n * Validation result for an ICU message.\n */\nexport interface IcuValidationResult {\n  /** Whether the message is valid */\n  valid: boolean\n  /** Validation errors (if any) */\n  errors: IcuParseError[]\n}\n\n/**\n * Comparison result between source and translation variables.\n */\nexport interface IcuVariableComparison {\n  /** Variables in source but missing in translation */\n  missing: string[]\n  /** Variables in translation but not in source */\n  extra: string[]\n  /** Whether the variables match exactly */\n  isMatch: boolean\n}\n\n/**\n * Extract all variable names from an ICU message.\n *\n * @example\n * extractVariables(\"Hello {name}, you have {count, plural, one {# msg} other {# msgs}}\")\n * // → [\"name\", \"count\"]\n *\n * @example\n * extractVariables(\"{date, date, short} at {time, time}\")\n * // → [\"date\", \"time\"]\n */\nexport function extractVariables(message: string): string[] {\n  const result = parseIcu(message, { requiresOtherClause: false })\n  if (!result.success) {\n    return []\n  }\n  return extractVariablesFromAst(result.ast)\n}\n\n/**\n * Extract variable information from an ICU message.\n * Returns detailed info about each variable including type and style.\n *\n * @example\n * extractVariableInfo(\"{price, number, currency}\")\n * // → [{ name: \"price\", type: \"number\", style: \"currency\" }]\n */\nexport function extractVariableInfo(message: string): IcuVariable[] {\n  const result = parseIcu(message, { requiresOtherClause: false })\n  if (!result.success) {\n    return []\n  }\n  return extractVariableInfoFromAst(result.ast)\n}\n\n/**\n * Validate an ICU message string.\n *\n * @example\n * validateIcu(\"{count, plural, one {#} other {#}}\")\n * // → { valid: true, errors: [] }\n *\n * @example\n * validateIcu(\"{unclosed\")\n * // → { valid: false, errors: [{ kind: \"EXPECT_ARGUMENT_CLOSING_BRACE\", ... }] }\n */\nexport function validateIcu(message: string, options?: IcuParserOptions): IcuValidationResult {\n  const result = parseIcu(message, options)\n  return {\n    valid: result.success,\n    errors: result.success ? [] : result.errors\n  }\n}\n\n/**\n * Compare variables between source and translation messages.\n * Useful for detecting missing or extra placeholders in translations.\n *\n * @example\n * compareVariables(\n *   \"Hello {name}, you have {count} messages\",\n *   \"Hallo {name}, du hast {count} Nachrichten\"\n * )\n * // → { missing: [], extra: [], isMatch: true }\n *\n * @example\n * compareVariables(\n *   \"Hello {name}\",\n *   \"Hallo {userName}\"\n * )\n * // → { missing: [\"name\"], extra: [\"userName\"], isMatch: false }\n */\nexport function compareVariables(source: string, translation: string): IcuVariableComparison {\n  const sourceVars = new Set(extractVariables(source))\n  const translationVars = new Set(extractVariables(translation))\n\n  const missing = [...sourceVars].filter((v) => !translationVars.has(v))\n  const extra = [...translationVars].filter((v) => !sourceVars.has(v))\n\n  return {\n    missing,\n    extra,\n    isMatch: missing.length === 0 && extra.length === 0\n  }\n}\n\n/**\n * Check if a message contains ICU plural syntax (cardinal or ordinal).\n */\nexport function hasPlural(message: string): boolean {\n  const result = parseIcu(message, { requiresOtherClause: false })\n  if (!result.success) {\n    return false\n  }\n  return containsNodeType(result.ast, \"plural\")\n}\n\n/**\n * Check if a message contains ICU selectordinal syntax.\n * Note: selectordinal is internally stored as a plural node with pluralType: \"ordinal\".\n */\nexport function hasSelectOrdinal(message: string): boolean {\n  const result = parseIcu(message, { requiresOtherClause: false })\n  if (!result.success) {\n    return false\n  }\n  return containsOrdinalPlural(result.ast)\n}\n\n/**\n * Check if a message contains ICU select syntax.\n */\nexport function hasSelect(message: string): boolean {\n  const result = parseIcu(message, { requiresOtherClause: false })\n  if (!result.success) {\n    return false\n  }\n  return containsNodeType(result.ast, \"select\")\n}\n\n/**\n * Check if a message contains any ICU syntax (variables, plural, select, etc.).\n * Returns false for plain text.\n */\nexport function hasIcuSyntax(message: string): boolean {\n  const result = parseIcu(message, { requiresOtherClause: false, ignoreTag: true })\n  if (!result.success) {\n    return false\n  }\n  return result.ast.some((node) => node.type !== \"literal\")\n}\n\n// --- Internal helpers ---\n\n/** Node types that have a variable name in the `value` field */\nconst VARIABLE_NODE_TYPES = new Set([\n  \"argument\",\n  \"number\",\n  \"date\",\n  \"time\",\n  \"list\",\n  \"duration\",\n  \"ago\",\n  \"name\",\n  \"plural\",\n  \"select\"\n])\n\n/** Checks if a node type has a variable name */\nfunction hasVariableName(node: IcuNode): node is IcuNode & { value: string } {\n  return VARIABLE_NODE_TYPES.has(node.type) && \"value\" in node && typeof node.value === \"string\"\n}\n\n/** Recursively visits all nodes and calls the callback */\nfunction forEachNode(nodes: IcuNode[], callback: (node: IcuNode) => void): void {\n  for (const node of nodes) {\n    callback(node)\n    forEachNode(getChildNodes(node), callback)\n  }\n}\n\nfunction extractVariablesFromAst(nodes: IcuNode[]): string[] {\n  const variables = new Set<string>()\n\n  forEachNode(nodes, (node) => {\n    if (hasVariableName(node)) {\n      variables.add(node.value)\n    }\n  })\n\n  return [...variables]\n}\n\n/** Maps node types to their variable type */\nconst NODE_TYPE_TO_VARIABLE_TYPE: Record<string, IcuVariable[\"type\"] | undefined> = {\n  argument: \"argument\",\n  number: \"number\",\n  date: \"date\",\n  time: \"time\",\n  list: \"argument\",\n  duration: \"argument\",\n  ago: \"argument\",\n  name: \"argument\",\n  plural: \"plural\",\n  select: \"select\"\n}\n\n/** Node types that have a style property */\nconst STYLED_NODE_TYPES = new Set([\"number\", \"date\", \"time\", \"list\", \"duration\", \"ago\", \"name\"])\n\n/** Extracts variable info from a single node */\nfunction nodeToVariable(node: IcuNode): IcuVariable | null {\n  const variableType = NODE_TYPE_TO_VARIABLE_TYPE[node.type]\n  if (!variableType || !hasVariableName(node)) {\n    return null\n  }\n\n  const style =\n    STYLED_NODE_TYPES.has(node.type) && \"style\" in node ? (node.style ?? undefined) : undefined\n  return { name: node.value, type: variableType, style }\n}\n\nfunction extractVariableInfoFromAst(nodes: IcuNode[]): IcuVariable[] {\n  const variables: IcuVariable[] = []\n  const seen = new Set<string>()\n\n  forEachNode(nodes, (node) => {\n    const variable = nodeToVariable(node)\n    if (variable && !seen.has(variable.name)) {\n      seen.add(variable.name)\n      variables.push(variable)\n    }\n  })\n\n  return variables\n}\n\n/** Gets child nodes from a node for recursive traversal */\nfunction getChildNodes(node: IcuNode): IcuNode[] {\n  switch (node.type) {\n    case \"plural\":\n    case \"select\":\n      return Object.values(node.options).flatMap((opt) => opt.value)\n    case \"tag\":\n      return node.children\n    default:\n      return []\n  }\n}\n\n/** Recursively checks if any node matches the predicate */\nfunction someNode(nodes: IcuNode[], predicate: (node: IcuNode) => boolean): boolean {\n  for (const node of nodes) {\n    if (predicate(node)) {\n      return true\n    }\n    if (someNode(getChildNodes(node), predicate)) {\n      return true\n    }\n  }\n  return false\n}\n\nfunction containsNodeType(nodes: IcuNode[], type: IcuNodeType): boolean {\n  return someNode(nodes, (node) => node.type === type)\n}\n\nfunction containsOrdinalPlural(nodes: IcuNode[]): boolean {\n  return someNode(nodes, (node) => node.type === \"plural\" && node.pluralType === \"ordinal\")\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqCO,IAAM,kBAAkB;AAMxB,IAAM,yBAAyB;AAG/B,IAAM,qBAAqB;AAG3B,IAAM,cAAc;AAIpB,IAAM,YAAY;AASlB,IAAM,kBAA2B;AAAA,EACtC,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,6BAA6B;AAAA,EAC7B,gBAAgB;AAClB;AAKO,IAAM,aAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR;AAKO,IAAM,eAAuC;AAAA,EAClD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;;;AChGA,IAAM,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