{"version":3,"file":"styloviz-core-data.mjs","names":[],"sources":["../../../../projects/core/data/diff.ts","../../../../projects/core/data/paste-list.ts","../../../../projects/core/data/tri-state.ts","../../../../projects/core/data/keyed-request-guard.ts","../../../../projects/core/data/query.ts","../../../../projects/core/data/errors.ts","../../../../projects/core/data/request-guard.ts","../../../../projects/core/data/async-action.ts","../../../../projects/core/data/suggest-controller.ts","../../../../projects/core/data/select-source.ts","../../../../projects/core/data/stale.directive.ts","../../../../projects/core/data/debounce.ts","../../../../projects/core/data/item-key.ts","../../../../projects/core/data/hierarchy.ts","../../../../projects/core/data/live-feed.ts","../../../../projects/core/data/record-merge.ts","../../../../projects/core/data/visibility-pause.ts","../../../../projects/core/data/live-ticker.ts","../../../../projects/core/data/offscreen-pause.ts","../../../../projects/core/data/small-shares.ts","../../../../projects/core/data/series-gaps.ts","../../../../projects/core/data/series-decimate.ts","../../../../projects/core/data/series-emphasis.ts","../../../../projects/core/data/chart-disclosures.ts","../../../../projects/core/data/value-policy.ts","../../../../projects/core/data/point-bins.ts","../../../../projects/core/data/nice-scale.ts","../../../../projects/core/data/indicators.ts","../../../../projects/core/data/stream-overlay.ts","../../../../projects/core/data/optimistic.ts","../../../../projects/core/data/shells/skeleton-shell.component.ts","../../../../projects/core/data/shells/skeleton-shell.component.html","../../../../projects/core/data/shells/error-shell.component.ts","../../../../projects/core/data/shells/error-shell.component.html","../../../../projects/core/data/shells/empty-shell.component.ts","../../../../projects/core/data/shells/empty-shell.component.html","../../../../projects/core/data/shells/chart-frame.component.ts","../../../../projects/core/data/shells/chart-frame.component.html","../../../../projects/core/data/chart-sync.ts","../../../../projects/core/data/shells/connection-status.component.ts","../../../../projects/core/data/shells/connection-status.component.html","../../../../projects/core/data/scale-ceiling.ts","../../../../projects/core/data/shells/scale-notice.component.ts"],"sourcesContent":["/**\n * The diff engine, owned once.\n *\n * ★★★ FOUR FAMILIES WERE EACH GROWING A CORNER OF THIS. Code Block renders a\n * diff it is HANDED — `DiffHunk[]` supplied by the host — and computes nothing.\n * JSON Viewer wanted a JSON diff, Tree View wanted to compare trees,\n * Descriptions wanted to diff a record. Four UIs, four half-engines, four sets\n * of edge cases discovered separately. This is the engine; the renderers stay\n * where they are.\n *\n * ★★ IT IS PURE, AND THAT IS THE POINT. No Angular, no DOM, no rendering\n * opinion — so it can be tested as arithmetic, run in a worker, or called on a\n * server, and the components that use it disagree about presentation without\n * disagreeing about what changed.\n */\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport type { SvCoreLabels } from '@styloviz/core/i18n';\n\n/** The `core` labels a line diff's summary is built from. */\nexport type SvDiffLabels = Pick<\n  SvCoreLabels,\n  | 'diffNoChanges' | 'diffTooDifferent' | 'diffChanges' | 'diffLinesAdded' | 'diffLinesRemoved' | 'diffSummary'\n  | 'diffListSeparator'\n>;\n\n/** The `core` labels a structural diff's summary is built from. */\nexport type SvValueDiffLabels = Pick<\n  SvCoreLabels,\n  'diffNoChanges' | 'valueDiffChanged' | 'valueDiffAdded' | 'valueDiffRemoved' | 'valueDiffSummary' | 'diffListSeparator'\n>;\n\n// ─── Line diff ────────────────────────────────────────────────────────────────\n\nexport type SvDiffLineKind = 'add' | 'del' | 'context';\n\n/** One line of a diff. Shaped to match what `sv-code-block` already renders. */\nexport interface SvDiffLine {\n  readonly kind: SvDiffLineKind;\n  readonly text: string;\n  /** Line number in the original, or `null` for an added line. */\n  readonly oldNo: number | null;\n  /** Line number in the new text, or `null` for a removed line. */\n  readonly newNo: number | null;\n}\n\n/** A contiguous run of change, with a few unchanged lines either side. */\nexport interface SvDiffHunk {\n  readonly id: string;\n  /** `@@ -12,7 +12,9 @@`. */\n  readonly header: string;\n  readonly lines: readonly SvDiffLine[];\n}\n\nexport interface SvDiffOptions {\n  /** Unchanged lines kept either side of a change. @default 3 */\n  readonly context?: number;\n  /** Compare with leading and trailing whitespace removed. @default false */\n  readonly ignoreWhitespace?: boolean;\n  /** Compare case-insensitively. @default false */\n  readonly ignoreCase?: boolean;\n  /**\n   * Give up past this many edits and report a wholesale replacement.\n   *\n   * ★★★ THE BUDGET IS THE HONEST PART. Myers is O(ND) — fast when the two texts\n   * are related and quadratic when they are not, which is exactly the case a\n   * user reaches by pasting the wrong file. A diff of two unrelated 5,000-line\n   * texts is the classic frozen tab. Past the budget this stops and says the\n   * texts are too different to diff, which is both true and instant; grinding\n   * for forty seconds to produce a diff that is one giant delete followed by\n   * one giant insert is neither.\n   * @default 4000\n   */\n  readonly maxEdits?: number;\n}\n\n/** What a diff turned out to be. */\nexport interface SvDiffResult {\n  readonly hunks: readonly SvDiffHunk[];\n  readonly added: number;\n  readonly removed: number;\n  /** True when the texts are identical under the comparison rules in force. */\n  readonly identical: boolean;\n  /**\n   * True when the edit budget was exhausted and the result is a wholesale\n   * replacement rather than a line-by-line comparison.\n   */\n  readonly tooDifferent: boolean;\n  /** One sentence, for the accessible summary. */\n  readonly summary: string;\n}\n\nconst DEFAULT_CONTEXT = 3;\nconst DEFAULT_MAX_EDITS = 4000;\n\ntype Op = { readonly kind: SvDiffLineKind; readonly oldIndex: number; readonly newIndex: number };\n\nfunction normalise(line: string, options: SvDiffOptions): string {\n  let out = line;\n  if (options.ignoreWhitespace) out = out.trim();\n  if (options.ignoreCase) out = out.toLowerCase();\n  return out;\n}\n\n/**\n * Myers' O(ND) difference algorithm, with a budget.\n *\n * ★ The classic formulation, kept close to the paper: `v` holds the furthest\n * reaching x for each diagonal k, and a trace of those arrays is what lets the\n * path be walked backwards afterwards. The only departure is `maxEdits`.\n */\nfunction myers(a: readonly string[], b: readonly string[], maxEdits: number): Op[] | null {\n  const n = a.length;\n  const m = b.length;\n  const max = Math.min(n + m, maxEdits);\n  const offset = max;\n  const v = new Int32Array(2 * max + 2);\n  const trace: Int32Array[] = [];\n\n  for (let d = 0; d <= max; d++) {\n    trace.push(v.slice());\n    for (let k = -d; k <= d; k += 2) {\n      let x: number;\n      if (k === -d || (k !== d && v[k - 1 + offset] < v[k + 1 + offset])) {\n        x = v[k + 1 + offset];\n      } else {\n        x = v[k - 1 + offset] + 1;\n      }\n      let y = x - k;\n      while (x < n && y < m && a[x] === b[y]) {\n        x++;\n        y++;\n      }\n      v[k + offset] = x;\n      if (x >= n && y >= m) return walkBack(trace, a, b, d, offset);\n    }\n  }\n  // ★ Out of budget. `null` rather than a partial path: half a diff is not a\n  //   smaller diff, it is a wrong one.\n  return null;\n}\n\n/** Reconstruct the edit script from the trace, then reverse it. */\nfunction walkBack(\n  trace: readonly Int32Array[],\n  a: readonly string[],\n  b: readonly string[],\n  d: number,\n  offset: number,\n): Op[] {\n  const ops: Op[] = [];\n  let x = a.length;\n  let y = b.length;\n\n  for (let depth = d; depth > 0; depth--) {\n    const v = trace[depth];\n    const k = x - y;\n    const down = k === -depth || (k !== depth && v[k - 1 + offset] < v[k + 1 + offset]);\n    const prevK = down ? k + 1 : k - 1;\n    const prevX = v[prevK + offset];\n    const prevY = prevX - prevK;\n\n    while (x > prevX && y > prevY) {\n      ops.push({ kind: 'context', oldIndex: x - 1, newIndex: y - 1 });\n      x--;\n      y--;\n    }\n    if (down) {\n      ops.push({ kind: 'add', oldIndex: -1, newIndex: y - 1 });\n      y--;\n    } else {\n      ops.push({ kind: 'del', oldIndex: x - 1, newIndex: -1 });\n      x--;\n    }\n  }\n  while (x > 0 && y > 0) {\n    ops.push({ kind: 'context', oldIndex: x - 1, newIndex: y - 1 });\n    x--;\n    y--;\n  }\n  return ops.reverse();\n}\n\n/** Split a text into lines, with `''` for an empty text rather than `['']`. */\nfunction toLines(text: string): string[] {\n  return text.length === 0 ? [] : text.split('\\n');\n}\n\n/**\n * Diff two texts, line by line.\n *\n * ★ `context` is what makes the output readable rather than complete: a hunk\n * shows a few unchanged lines either side so the reader can see where they are.\n * Zero shows only the changes, which is right for a machine and useless to a\n * person.\n */\nexport function svDiffLines(\n  before: string,\n  after: string,\n  labels: SvDiffLabels,\n  options: SvDiffOptions = {},\n): SvDiffResult {\n  const context = Math.max(0, options.context ?? DEFAULT_CONTEXT);\n  const maxEdits = Math.max(1, options.maxEdits ?? DEFAULT_MAX_EDITS);\n\n  const oldLines = toLines(before);\n  const newLines = toLines(after);\n  const a = oldLines.map((l) => normalise(l, options));\n  const b = newLines.map((l) => normalise(l, options));\n\n  const ops = myers(a, b, maxEdits);\n\n  if (!ops) {\n    // Wholesale replacement, and said so rather than implied.\n    const lines: SvDiffLine[] = [\n      ...oldLines.map((text, i) => ({ kind: 'del' as const, text, oldNo: i + 1, newNo: null })),\n      ...newLines.map((text, i) => ({ kind: 'add' as const, text, oldNo: null, newNo: i + 1 })),\n    ];\n    return {\n      hunks: lines.length\n        ? [{ id: 'hunk-1', header: `@@ -1,${oldLines.length} +1,${newLines.length} @@`, lines }]\n        : [],\n      added: newLines.length,\n      removed: oldLines.length,\n      identical: false,\n      tooDifferent: true,\n      summary: svFormatLabel(labels.diffTooDifferent, { removed: oldLines.length, added: newLines.length }),\n    };\n  }\n\n  const all: SvDiffLine[] = ops.map((op) => ({\n    kind: op.kind,\n    text: op.kind === 'add' ? newLines[op.newIndex] : oldLines[op.oldIndex],\n    oldNo: op.oldIndex >= 0 ? op.oldIndex + 1 : null,\n    newNo: op.newIndex >= 0 ? op.newIndex + 1 : null,\n  }));\n\n  const added = all.filter((l) => l.kind === 'add').length;\n  const removed = all.filter((l) => l.kind === 'del').length;\n  const identical = added === 0 && removed === 0;\n\n  return {\n    hunks: identical ? [] : groupIntoHunks(all, context),\n    added,\n    removed,\n    identical,\n    tooDifferent: false,\n    summary: svDiffSummary(identical ? 0 : groupIntoHunks(all, context).length, added, removed, labels),\n  };\n}\n\n/** Collapse long runs of unchanged lines, keeping `context` either side. */\nfunction groupIntoHunks(lines: readonly SvDiffLine[], context: number): SvDiffHunk[] {\n  const changed = lines\n    .map((line, i) => (line.kind === 'context' ? -1 : i))\n    .filter((i) => i >= 0);\n  if (!changed.length) return [];\n\n  const ranges: [number, number][] = [];\n  for (const i of changed) {\n    const from = Math.max(0, i - context);\n    const to = Math.min(lines.length - 1, i + context);\n    const last = ranges[ranges.length - 1];\n    // ★ Merged when they touch OR abut. Two hunks separated by nothing is one\n    //   hunk, and emitting them apart makes the count in the summary wrong.\n    if (last && from <= last[1] + 1) last[1] = Math.max(last[1], to);\n    else ranges.push([from, to]);\n  }\n\n  return ranges.map(([from, to], index) => {\n    const slice = lines.slice(from, to + 1);\n    const oldStart = slice.find((l) => l.oldNo !== null)?.oldNo ?? 0;\n    const newStart = slice.find((l) => l.newNo !== null)?.newNo ?? 0;\n    const oldCount = slice.filter((l) => l.oldNo !== null).length;\n    const newCount = slice.filter((l) => l.newNo !== null).length;\n    return {\n      id: `hunk-${index + 1}`,\n      header: `@@ -${oldStart},${oldCount} +${newStart},${newCount} @@`,\n      lines: slice,\n    };\n  });\n}\n\n/**\n * The sentence a screen reader gets instead of the colours.\n *\n * ★★ A diff conveys everything through red and green, which is the plainest\n * possible 1.4.1 failure — and the counts are also what a sighted reader wants\n * before deciding whether to read it at all.\n */\nexport function svDiffSummary(hunks: number, added: number, removed: number, labels: SvDiffLabels): string {\n  if (added === 0 && removed === 0) return labels.diffNoChanges;\n  const parts = [svFormatLabel(labels.diffChanges, { count: hunks })];\n  if (added) parts.push(svFormatLabel(labels.diffLinesAdded, { count: added }));\n  if (removed) parts.push(svFormatLabel(labels.diffLinesRemoved, { count: removed }));\n  return svFormatLabel(labels.diffSummary, { parts: parts.join(labels.diffListSeparator) });\n}\n\n// ─── Structural diff ──────────────────────────────────────────────────────────\n\nexport type SvChangeKind = 'added' | 'removed' | 'changed' | 'unchanged';\n\n/** One difference between two values, at a path. */\nexport interface SvValueChange {\n  /** Dotted path — `items.0.price`. `''` is the root. */\n  readonly path: string;\n  readonly kind: SvChangeKind;\n  readonly before: unknown;\n  readonly after: unknown;\n}\n\nexport interface SvValueDiffOptions {\n  /** Paths to leave out of the comparison entirely. */\n  readonly ignore?: (path: string) => boolean;\n  /** Include unchanged leaves in the result. @default false */\n  readonly includeUnchanged?: boolean;\n  /** Refuse to walk deeper than this. @default 12 */\n  readonly maxDepth?: number;\n}\n\n/**\n * Compare two JSON-ish values, leaf by leaf.\n *\n * ★★★ THE IGNORE RULE IS NOT A CONVENIENCE. Every real object comparison\n * carries fields that always differ and never matter — `updatedAt`, a request\n * id, a cache key — and a diff that reports them is a diff nobody reads. The\n * predicate takes the PATH rather than the key so `meta.updatedAt` can be\n * ignored while `record.updatedAt` is not.\n *\n * ★ `maxDepth` exists because a cyclic structure is a hang and a stack\n * overflow, and both are worse than an incomplete answer that says so: past the\n * limit the node is reported as one `changed` leaf rather than walked.\n */\nexport function svDiffValues(\n  before: unknown,\n  after: unknown,\n  options: SvValueDiffOptions = {},\n): SvValueChange[] {\n  const out: SvValueChange[] = [];\n  walk(before, after, '', out, options, options.maxDepth ?? 12);\n  return out;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction walk(\n  before: unknown,\n  after: unknown,\n  path: string,\n  out: SvValueChange[],\n  options: SvValueDiffOptions,\n  depth: number,\n): void {\n  if (options.ignore?.(path)) return;\n\n  const bothMissing = before === undefined && after === undefined;\n  if (bothMissing) return;\n\n  if (before === undefined) {\n    out.push({ path, kind: 'added', before: undefined, after });\n    return;\n  }\n  if (after === undefined) {\n    out.push({ path, kind: 'removed', before, after: undefined });\n    return;\n  }\n\n  const container =\n    depth > 0 &&\n    ((isPlainObject(before) && isPlainObject(after)) ||\n      (Array.isArray(before) && Array.isArray(after)));\n\n  if (!container) {\n    const same = Object.is(before, after) || JSON.stringify(before) === JSON.stringify(after);\n    if (!same) out.push({ path, kind: 'changed', before, after });\n    else if (options.includeUnchanged) {\n      out.push({ path, kind: 'unchanged', before, after });\n    }\n    return;\n  }\n\n  if (Array.isArray(before) && Array.isArray(after)) {\n    const length = Math.max(before.length, after.length);\n    for (let i = 0; i < length; i++) {\n      walk(before[i], after[i], path ? `${path}.${i}` : String(i), out, options, depth - 1);\n    }\n    return;\n  }\n\n  const a = before as Record<string, unknown>;\n  const b = after as Record<string, unknown>;\n  // ★ Keys in the order they appear in `before`, then anything new from `after`.\n  //   A diff sorted alphabetically reorders the reader's own object under them.\n  const keys = [...Object.keys(a), ...Object.keys(b).filter((k) => !(k in a))];\n  for (const key of keys) {\n    walk(a[key], b[key], path ? `${path}.${key}` : key, out, options, depth - 1);\n  }\n}\n\n/** The same sentence, for a structural diff. */\nexport function svValueDiffSummary(changes: readonly SvValueChange[], labels: SvValueDiffLabels): string {\n  const counted = changes.filter((c) => c.kind !== 'unchanged');\n  if (!counted.length) return labels.diffNoChanges;\n  const added = counted.filter((c) => c.kind === 'added').length;\n  const removed = counted.filter((c) => c.kind === 'removed').length;\n  const changed = counted.filter((c) => c.kind === 'changed').length;\n  const parts: string[] = [];\n  if (changed) parts.push(svFormatLabel(labels.valueDiffChanged, { count: changed }));\n  if (added) parts.push(svFormatLabel(labels.valueDiffAdded, { count: added }));\n  if (removed) parts.push(svFormatLabel(labels.valueDiffRemoved, { count: removed }));\n  return svFormatLabel(labels.valueDiffSummary, { count: counted.length, parts: parts.join(labels.diffListSeparator) });\n}\n","/**\n * Pasting a list of things into a control that takes one at a time.\n *\n * ── The defect this exists for (`FI-26-I3` / `FI-26-M3`) ────────────────────\n *\n * ★★★ NEITHER TAG INPUT HAD A PASTE HANDLER AT ALL. Grepped, in both twins:\n *     zero occurrences of `paste` or `clipboard`. So pasting two hundred email\n *     addresses put two hundred addresses in the query box as ONE STRING, and\n *     pressing Enter made a single tag whose label was the entire list — or,\n *     with `allowCreate` off, made nothing and cleared the box.\n *\n * ★★ THE ITEM ASKED \"what happens when a paste of 200 emails hits a limit of\n *    50\". The answer was that the limit never came into it, because the paste\n *    was never a list.\n *\n * ── ★★★ WHY SPLITTING AND DECIDING ARE TWO FUNCTIONS ───────────────────────\n *\n * Splitting is mechanical and belongs to the clipboard: commas, semicolons,\n * newlines, tabs. Deciding is policy and belongs to the control: which of these\n * already exist, how many fit, what counts as valid. A single function would\n * have to take every policy as a parameter and would still be wrong for the\n * next caller.\n */\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/**\n * The delimiter set, written down rather than inferred.\n *\n * ⚠️ SPACE IS NOT A DELIMITER, and that is the decision worth defending.\n *    \"Alex Chen\" is one name, and a parser that split on whitespace would turn\n *    every pasted person into two broken tags. Mail clients, spreadsheets and\n *    CSV exports all emit one of the four below.\n *\n * ★ A NEWLINE IS A DELIMITER IN BOTH SPELLINGS. A list copied out of Windows\n *   Notepad arrives `\\r\\n`-separated, and treating `\\r` as content leaves an\n *   invisible character on the end of every entry — which then fails an\n *   equality check against the identical-looking entry already in the list.\n */\nconst DELIMITERS = /[,;\\t\\r\\n]+/;\n\n/**\n * Split pasted text into candidate entries.\n *\n * ★★ QUOTED SEGMENTS SURVIVE THEIR COMMAS. `\"Chen, Alex\" <a@x.com>` is one\n *    entry in every mail client's clipboard format, and splitting inside the\n *    quotes produces two entries, neither of which is an address. This is the\n *    one piece of structure worth knowing about, because it is the one that\n *    silently produces plausible-looking garbage.\n */\nexport function svSplitPastedList(text: string): string[] {\n  const src = String(text ?? '');\n  if (!src.trim()) return [];\n\n  const out: string[] = [];\n  let current = '';\n  let inQuotes = false;\n\n  for (const ch of Array.from(src)) {\n    if (ch === '\"') { inQuotes = !inQuotes; current += ch; continue; }\n    if (!inQuotes && DELIMITERS.test(ch)) {\n      if (current.trim()) out.push(current.trim());\n      current = '';\n      continue;\n    }\n    current += ch;\n  }\n  if (current.trim()) out.push(current.trim());\n  return out;\n}\n\n/**\n * Why an entry did not make it in.\n *\n * ★★ `ambiguous` IS NOT A KIND OF `invalid`. An entry that matched two options\n *    is one the user wrote correctly and the control cannot act on — \"Alex Chen\"\n *    when there are two people called Alex Chen. Telling them it was not\n *    recognised sends them to check their spelling; telling them it matched more\n *    than one sends them to disambiguate it, which is the thing that works.\n */\nexport type SvPasteRejection = 'duplicate' | 'limit' | 'invalid' | 'ambiguous';\n\nexport interface SvPasteListResult {\n  /** Entries that were added, in the order they appeared. */\n  readonly accepted: readonly string[];\n  /** Entries that were not, each with the reason. */\n  readonly rejected: readonly { readonly text: string; readonly reason: SvPasteRejection }[];\n  /** How many entries the text contained. `accepted.length + rejected.length`. */\n  readonly total: number;\n}\n\nexport interface SvApplyPastedOptions {\n  /** What is already in the control. */\n  readonly existing?: readonly string[];\n  /** Cap on the TOTAL, existing included. `0` means no cap. */\n  readonly max?: number;\n  /** What \"already there\" means. Defaults to strict equality. */\n  readonly compare?: (a: string, b: string) => boolean;\n  /** Host's verdict on a single entry. Return `false` to reject it as invalid. */\n  readonly validate?: (entry: string) => boolean;\n  /**\n   * Entries the caller could not resolve to exactly one thing.\n   *\n   * ★★ Checked FIRST, before duplicate and limit, because an entry that cannot\n   *    be resolved is not a candidate for either — reporting it as \"already in\n   *    the list\" would be a claim about a tag that may not exist.\n   */\n  readonly ambiguous?: (entry: string) => boolean;\n}\n\n/**\n * Decide which pasted entries go in, and report every one that does not.\n *\n * ★★★ A PARTIAL ACCEPT IS THE ONLY HONEST ANSWER TO 200-INTO-50. Taking all\n *     200 breaks the host's cap. Taking none punishes the user for the 150 they\n *     could not have known about. Taking 50 silently is the worst of the three,\n *     because the list looks like it worked and 150 addresses are gone. So: 50\n *     in, 150 reported, and the caller says so out loud.\n *\n * ⚠️ ORDER IS PRESERVED AND THE FIRST N WIN. Not \"the ones that fit best\" —\n *    there is no such thing — and not the last N, which would silently prefer\n *    the bottom of a pasted column.\n *\n * ⚠️ A DUPLICATE INSIDE THE PASTE ITSELF IS A DUPLICATE. Pasting the same\n *    address twice adds it once and reports the second; the alternative is two\n *    identical entries, which is the `FI-26-I1` defect arriving by a different\n *    door.\n */\nexport function svApplyPastedList(\n  entries: readonly string[],\n  options: SvApplyPastedOptions = {},\n): SvPasteListResult {\n  const compare = options.compare ?? ((a, b) => a === b);\n  const validate = options.validate;\n  const max = options.max ?? 0;\n\n  const accepted: string[] = [];\n  const rejected: { text: string; reason: SvPasteRejection }[] = [];\n  const taken = [...(options.existing ?? [])];\n\n  const ambiguous = options.ambiguous;\n\n  for (const entry of entries) {\n    if (ambiguous?.(entry)) { rejected.push({ text: entry, reason: 'ambiguous' }); continue; }\n    if (validate && !validate(entry)) { rejected.push({ text: entry, reason: 'invalid' }); continue; }\n    if (taken.some((t) => compare(t, entry))) { rejected.push({ text: entry, reason: 'duplicate' }); continue; }\n    // ★ The cap is checked LAST, so an entry that was going to be rejected as a\n    //   duplicate is reported as a duplicate rather than as the thing that\n    //   happened to be sitting on the boundary.\n    if (max > 0 && taken.length >= max) { rejected.push({ text: entry, reason: 'limit' }); continue; }\n    accepted.push(entry);\n    taken.push(entry);\n  }\n\n  return { accepted, rejected, total: accepted.length + rejected.length };\n}\n\n/**\n * A sentence a person can act on, or `''` when everything went in.\n *\n * ⚠️ `svPasteListSummary`, NOT `svPasteSummary`. That name is already taken in\n *    this package by the HTML sanitiser's own paste report\n *    (`lib/security/html-sanitizer.ts`), which takes a different type entirely.\n *    The first draft of this file used it, and the duplicate `export { … }` in\n *    `public-api.ts` did not throw — the LATER export simply won, so every\n *    caller in `sv-tag-input` silently got the sanitiser's function and every\n *    summary came back `''`. A unit test cannot see that; the runtime just\n *    picks one. `typecheck:all` is what catches it (TS2308).\n *\n * ★★ IT NAMES THE REASONS SEPARATELY. \"150 were not added\" tells somebody\n *    nothing about what to do; \"50 added, 120 over the limit of 50, 30 already\n *    in the list\" tells them to remove some tags or split the paste.\n */\n/** The templates `svPasteListSummary` fills — core's English by default. */\nexport type SvPasteListLabels = Pick<\n  SvCoreLabels,\n  | 'pasteListAdded' | 'pasteListOverLimit' | 'pasteListDuplicate' | 'pasteListAmbiguous'\n  | 'pasteListInvalid' | 'pasteListSeparator' | 'pasteListSentence'\n>;\n\n/**\n * @param noun the entry's singular (`'tag'`); `nouns` its plural — pass both from\n *   your labels so they translate. Without `nouns` the plural is English `noun + 's'`.\n */\nexport function svPasteListSummary(\n  result: SvPasteListResult,\n  noun = 'item',\n  labels: SvPasteListLabels = SV_CORE_LABELS,\n  locale = '',\n  nouns = `${noun}s`, // sv-i18n-ignore: English fallback for a caller that names no plural\n): string {\n  if (!result.rejected.length) return '';\n  const part = (template: string, n: number): string =>\n    svFormatLabel(template, { count: n, n: String(n), noun, nouns }, locale);\n\n  const counts = { duplicate: 0, limit: 0, invalid: 0, ambiguous: 0 };\n  for (const r of result.rejected) counts[r.reason]++;\n\n  const parts: string[] = [part(labels.pasteListAdded, result.accepted.length)];\n  if (counts.limit) parts.push(part(labels.pasteListOverLimit, counts.limit));\n  if (counts.duplicate) parts.push(part(labels.pasteListDuplicate, counts.duplicate));\n  if (counts.ambiguous) parts.push(part(labels.pasteListAmbiguous, counts.ambiguous));\n  if (counts.invalid) parts.push(part(labels.pasteListInvalid, counts.invalid));\n  return svFormatLabel(labels.pasteListSentence, { parts: parts.join(labels.pasteListSeparator) }, locale);\n}\n","/**\n * Tri-state selection over a tree: tick down, roll up, and what \"partly\" means.\n *\n * ── Why this is in core (`FI-05-M2`, `FI-06-V1`, Data Display's `DD-45`) ────\n *\n * ★★★ THE BACKLOG SAYS \"ONE OWNER\" ABOUT THESE THREE ITEMS AND IT IS RIGHT.\n *     `sv-tree-view` already had a correct implementation, `sv-tree-select`\n *     had none, and a checkbox tree was filed a third time under Data Display.\n *     Three copies of this algorithm is three chances to get the `disabled`\n *     rule subtly different — and that rule is the one with teeth.\n *\n * ── ★★★ THE RULE THAT MATTERS: `disabled` IS THE WHOLE RULE, DOWN AND UP ───\n *\n * `sv-tree-view` shipped a version that reached past `disabled`: the box of a\n * disabled node was correctly refused, and then its PARENT'S box ticked it\n * anyway. A read-only row the user could not have selected arrived in the\n * change event regardless, and the host granted, exported or deleted on that\n * basis. This module carries that fix rather than inviting each caller to\n * rediscover it.\n *\n *   DOWN  a tick reaches every **enabled** descendant; a disabled one keeps the\n *         state it had, whichever direction the parent moved.\n *   UP    a branch is ticked when every enabled child is, **indeterminate**\n *         while only some are, and a branch whose children are all disabled\n *         follows only its own box.\n *\n * ⚠️ THESE FUNCTIONS TAKE A SHAPE, NOT A COMPONENT'S NODE TYPE.\n *    `sv-tree-view` keys on `id`, `sv-tree-select` on `value`, and the Data\n *    Display tree on neither yet. A `keyOf` accessor is the seam; a shared\n *    interface would have forced two components to rename their public fields\n *    to reuse an internal algorithm.\n */\n\nexport interface SvTriStateAdapter<T> {\n  /** This node's stable identity. */\n  keyOf(node: T): string;\n  /** Children, or nothing for a leaf. */\n  childrenOf(node: T): readonly T[] | undefined;\n  /** `true` when the user cannot change this node's own box. */\n  disabledOf(node: T): boolean;\n}\n\n/**\n * The keys a tick on `node` may reach.\n *\n * ★ A disabled node AND ITS WHOLE SUBTREE are skipped. Descending through a\n *   disabled branch to reach enabled grandchildren would let a parent tick\n *   something the user cannot see a path to, which is the same defect one level\n *   deeper.\n */\nexport function svCheckableDescendants<T>(node: T, a: SvTriStateAdapter<T>): string[] {\n  return (a.childrenOf(node) ?? [])\n    .filter((c) => !a.disabledOf(c))\n    .flatMap((c) => [a.keyOf(c), ...svCheckableDescendants(c, a)]);\n}\n\n/**\n * Toggle `node`, cascade down, and roll every ancestor up. Returns a new Set.\n *\n * ⚠️ IT RETURNS A NEW SET rather than mutating. The caller usually holds the\n *    old one in a signal, and a mutated Set is the same reference — so nothing\n *    re-renders and the bug looks like a template problem.\n */\nexport function svToggleTriState<T>(\n  roots: readonly T[],\n  node: T,\n  checked: ReadonlySet<string>,\n  a: SvTriStateAdapter<T>,\n): Set<string> {\n  const next = new Set(checked);\n  if (a.disabledOf(node)) return next;\n\n  const key = a.keyOf(node);\n  const descendants = svCheckableDescendants(node, a);\n\n  if (next.has(key)) {\n    next.delete(key);\n    for (const d of descendants) next.delete(d);\n  } else {\n    next.add(key);\n    for (const d of descendants) next.add(d);\n  }\n\n  svRollUpTriState(roots, next, a);\n  return next;\n}\n\n/**\n * Bring every branch into line with its enabled children. Mutates `checked`.\n *\n * ★★ DEPTH FIRST, because a branch's own state depends on children that are\n *    themselves branches. Rolling up in the wrong order settles a parent\n *    against children that have not been settled yet, and the result is stable\n *    but wrong — which is the worst kind, since re-running does not fix it.\n */\nexport function svRollUpTriState<T>(\n  nodes: readonly T[],\n  checked: Set<string>,\n  a: SvTriStateAdapter<T>,\n): void {\n  for (const n of nodes) {\n    const kids = a.childrenOf(n);\n    if (!kids?.length) continue;\n    svRollUpTriState(kids, checked, a);\n\n    // Nothing enabled below to complete the set, or the branch itself is\n    // locked: its box stands for the branch alone, so a roll-up must not move\n    // it. Otherwise a folder of read-only children could never be ticked, and\n    // clicking its box would have looked broken.\n    const rollUp = kids.filter((c) => !a.disabledOf(c));\n    if (!rollUp.length || a.disabledOf(n)) continue;\n\n    if (rollUp.every((c) => checked.has(a.keyOf(c)))) checked.add(a.keyOf(n));\n    else checked.delete(a.keyOf(n));\n  }\n}\n\n/**\n * The branches that are partly selected.\n *\n * ★★ A BRANCH IS INDETERMINATE IF ANY DESCENDANT IS CHECKED **OR\n *    INDETERMINATE** — which is why this walks depth first and reads its own\n *    result set as it goes. Checking only immediate children makes a\n *    grandparent look empty while a grandchild is ticked, and the user sees a\n *    blank box above a half-filled one.\n */\nexport function svIndeterminateKeys<T>(\n  roots: readonly T[],\n  checked: ReadonlySet<string>,\n  a: SvTriStateAdapter<T>,\n): Set<string> {\n  const result = new Set<string>();\n\n  const walk = (nodes: readonly T[]): void => {\n    for (const n of nodes) {\n      const kids = a.childrenOf(n);\n      if (!kids?.length) continue;\n      walk(kids);\n\n      const rollUp = kids.filter((c) => !a.disabledOf(c));\n      if (!rollUp.length) continue;\n\n      const some = rollUp.some((c) => checked.has(a.keyOf(c)) || result.has(a.keyOf(c)));\n      const all = rollUp.every((c) => checked.has(a.keyOf(c)));\n      if (some && !all) result.add(a.keyOf(n));\n    }\n  };\n\n  walk(roots);\n  return result;\n}\n\n/**\n * Re-apply a ticked branch to children that have only just arrived.\n *\n * ★★ A LAZY BRANCH HAS NO CHILDREN TO REACH WHEN IT IS TICKED, so the tick\n *    stands for a set the component cannot see. When the load lands, the folder\n *    is ticked and every file in it is not — while the change event has already\n *    told the host \"the whole folder\", which is what the user meant. A ticked\n *    branch must cascade to whatever turns up inside it.\n *\n * @returns `true` when anything changed, so a caller can skip an emit.\n */\nexport function svCascadeToNewChildren<T>(\n  roots: readonly T[],\n  checked: Set<string>,\n  a: SvTriStateAdapter<T>,\n): boolean {\n  if (!checked.size) return false;\n  const before = checked.size;\n\n  const cascade = (nodes: readonly T[], inherited: boolean): void => {\n    for (const n of nodes) {\n      const key = a.keyOf(n);\n      const mine = inherited && !a.disabledOf(n);\n      if (mine) checked.add(key);\n      const kids = a.childrenOf(n);\n      if (kids?.length) cascade(kids, mine || checked.has(key));\n    }\n  };\n\n  cascade(roots, false);\n  return checked.size !== before;\n}\n","import { computed, signal, type Signal } from '@angular/core';\n\n/**\n * Several requests in flight at once, each cancellable on its own.\n *\n * ── The gap this fills (`FI-05-M1`, `FI-03-M3`) ─────────────────────────────\n *\n * ★★★ `createRequestGuard` IS SINGLE-FLIGHT, AND THAT IS RIGHT FOR A SEARCH\n *     BOX: one term, one answer, and a newer keystroke supersedes the older\n *     request. It is exactly wrong for a TREE. Expanding three folders means\n *     three requests that are not refinements of each other — settling one must\n *     not discard the other two, and collapsing one branch must not cancel its\n *     siblings.\n *\n * ★★★ TWO BACKLOG ITEMS ARE THE SAME PROBLEM. `FI-05-M1` says `sv-tree-select`\n *     \"has `loading`/`error` and no loader input at all\"; `FI-03-M3` says\n *     `sv-cascader` has no \"cancellation of a branch the user has navigated\n *     away from\". One is the missing feature and the other is the missing\n *     cancellation, and a component that had the feature without the\n *     cancellation would have the second bug by construction.\n *\n * ── ★★★ WHY A BRANCH THE USER LEFT MUST BE CANCELLED ───────────────────────\n *\n * A user opens a folder, waits, gets bored, collapses it and opens another.\n * Without cancellation the first request is still coming, and when it lands the\n * component inserts children into a branch that is no longer on screen —\n * usually harmlessly, occasionally by re-expanding it under the user's cursor,\n * and always by holding memory and a connection nobody is waiting for. On a\n * deep tree browsed quickly that is dozens of live requests.\n */\n\nexport interface SvKeyedRequestGuard {\n  /**\n   * Start a request for `key`, cancelling any earlier one for the SAME key.\n   * Returns the token to hand back to `settle`.\n   *\n   * ⚠️ It does NOT touch other keys. That is the whole difference from\n   *    `createRequestGuard`.\n   */\n  take(key: string): number;\n  /**\n   * `true` when this response is still the newest for its key. `false` means it\n   * was superseded or cancelled, and the caller must drop it on the floor.\n   */\n  settle(key: string, token: number): boolean;\n  /** Abort the in-flight request for `key`, if any. */\n  cancel(key: string): void;\n  /** Abort everything. For `ngOnDestroy`, and for a tree being replaced. */\n  cancelAll(): void;\n  /** The `AbortSignal` for `key`'s current request, or `undefined`. */\n  signalFor(key: string): AbortSignal | undefined;\n  /** `true` while a request for `key` is outstanding. */\n  isPending(key: string): boolean;\n  /** Every key with a request outstanding — drives per-row spinners. */\n  readonly pending: Signal<ReadonlySet<string>>;\n}\n\n/** Why an abort happened, so a caller can tell it from a network failure. */\nexport const SV_SUPERSEDED = 'sv-superseded';\n\nexport function svKeyedRequestGuard(): SvKeyedRequestGuard {\n  const latest = new Map<string, number>();\n  const controllers = new Map<string, AbortController>();\n  const pendingKeys = signal<ReadonlySet<string>>(new Set());\n\n  const publish = (): void => pendingKeys.set(new Set(controllers.keys()));\n\n  const abort = (key: string): void => {\n    const c = controllers.get(key);\n    if (!c) return;\n    c.abort(SV_SUPERSEDED);\n    controllers.delete(key);\n  };\n\n  return {\n    take(key) {\n      abort(key);\n      const token = (latest.get(key) ?? 0) + 1;\n      latest.set(key, token);\n      controllers.set(key, new AbortController());\n      publish();\n      return token;\n    },\n\n    settle(key, token) {\n      // ★★ A CANCELLED REQUEST MUST NOT SETTLE. `cancel` deletes the\n      //    controller but leaves `latest` alone, so a late response from the\n      //    cancelled request still carries the current token — which would\n      //    make it look current. Checking the controller is what distinguishes\n      //    \"still wanted\" from \"was wanted when it started\".\n      if (latest.get(key) !== token || !controllers.has(key)) return false;\n      controllers.delete(key);\n      publish();\n      return true;\n    },\n\n    cancel(key) {\n      abort(key);\n      publish();\n    },\n\n    cancelAll() {\n      for (const key of [...controllers.keys()]) abort(key);\n      publish();\n    },\n\n    signalFor: (key) => controllers.get(key)?.signal,\n    isPending: (key) => controllers.has(key),\n    pending: computed(() => pendingKeys()),\n  };\n}\n","import type { SvDataQuery, SvSort } from './types';\n\n/**\n * A query asking for the first page with nothing sorted, filtered or searched.\n * Frozen — it is shared, and a component mutating it would poison every other.\n */\nexport const SV_DEFAULT_QUERY: SvDataQuery = Object.freeze({\n  page: 1,\n  pageSize: 10,\n  sorts: Object.freeze([]) as readonly SvSort[],\n  filters: Object.freeze({}) as Readonly<Record<string, string>>,\n  search: '',\n  cursor: null,\n});\n\n/**\n * Build a query from a partial, filling the rest from `SV_DEFAULT_QUERY`.\n *\n * ```ts\n * createQuery({ pageSize: 25, sorts: [{ key: 'created', direction: 'desc' }] })\n * ```\n */\nexport function createQuery(patch: Partial<SvDataQuery> = {}): SvDataQuery {\n  return { ...SV_DEFAULT_QUERY, ...patch };\n}\n\n/**\n * Apply a change to a query, resetting to page 1 whenever the result set itself\n * changes shape.\n *\n * This is the rule every component gets wrong on its own: changing a filter\n * while on page 7 asks the server for page 7 of a result set that may only have\n * two pages, and the user sees an empty table. Sorting is the exception —\n * re-sorting keeps you on the same page by convention in every data grid.\n * An explicit `page` in the patch always wins.\n */\nexport function patchQuery(base: SvDataQuery, patch: Partial<SvDataQuery>): SvDataQuery {\n  const resetsPaging =\n    ('filters' in patch || 'search' in patch || 'pageSize' in patch) && !('page' in patch);\n\n  const next: SvDataQuery = { ...base, ...patch };\n  // A cursor from the previous result set is meaningless once the query changes.\n  return resetsPaging ? { ...next, page: 1, cursor: null } : next;\n}\n\n/** Structural equality for sort lists — order is significant. */\nfunction sortsEqual(a: readonly SvSort[], b: readonly SvSort[]): boolean {\n  if (a === b) return true;\n  if (a.length !== b.length) return false;\n  return a.every((s, i) => s.key === b[i].key && s.direction === b[i].direction);\n}\n\n/** Structural equality for filter maps, ignoring key order. */\nfunction filtersEqual(\n  a: Readonly<Record<string, string>>,\n  b: Readonly<Record<string, string>>,\n): boolean {\n  if (a === b) return true;\n  const ak = Object.keys(a);\n  const bk = Object.keys(b);\n  return ak.length === bk.length && ak.every((k) => a[k] === b[k]);\n}\n\n/**\n * Whether two queries ask for the same thing.\n *\n * Guard every `queryChange` emission with this. Without it, a host that stores\n * the query and binds it back in — the normal, correct way to make the query\n * controllable — gets an emit → bind → emit loop that hammers the API. Object\n * identity is not enough: a component rebuilding its filters map produces a new\n * object with identical contents on every keystroke.\n */\nexport function queriesEqual(a: SvDataQuery, b: SvDataQuery): boolean {\n  return (\n    a === b ||\n    (a.page === b.page &&\n      a.pageSize === b.pageSize &&\n      a.search === b.search &&\n      a.cursor === b.cursor &&\n      sortsEqual(a.sorts, b.sorts) &&\n      filtersEqual(a.filters, b.filters))\n  );\n}\n\n/**\n * Toggle a column's sort the way a data grid header does: unsorted → asc →\n * desc → unsorted.\n *\n * With `multi`, the column joins the existing sorts (last-clicked lowest\n * priority, matching every grid the buyer's users have already used); without\n * it, it replaces them.\n */\nexport function toggleSort(\n  sorts: readonly SvSort[],\n  key: string,\n  multi = false,\n): readonly SvSort[] {\n  const existing = sorts.find((s) => s.key === key);\n  const others = multi ? sorts.filter((s) => s.key !== key) : [];\n\n  if (!existing) return [...others, { key, direction: 'asc' }];\n  if (existing.direction === 'asc') return [...others, { key, direction: 'desc' }];\n  return others;\n}\n","import type { SvDataError } from './types';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\n\n/** Shape of an `HttpErrorResponse` without importing `@angular/common/http`. */\ninterface HttpLikeError {\n  readonly status?: unknown;\n  readonly statusText?: unknown;\n  readonly message?: unknown;\n  readonly error?: unknown;\n  /** `HttpHeaders`, duck-typed: only `get` is needed, and only if present. */\n  readonly headers?: { readonly get?: (name: string) => string | null };\n}\n\n/**\n * Body fields APIs use for a correlation id, most specific first.\n *\n * ★ `id` is LAST and deliberately last: plenty of error bodies use it for the\n *   id of the thing that failed rather than of the request, so it is a\n *   fallback rather than a first guess.\n */\nconst REFERENCE_FIELDS = [\n  'requestId',\n  'request_id',\n  'traceId',\n  'trace_id',\n  'correlationId',\n  'correlation_id',\n  'errorId',\n  'error_id',\n  'reference',\n  'incidentId',\n  'id',\n] as const;\n\n/**\n * Headers that carry one. Checked AFTER the body.\n *\n * ★★ THE BODY WINS OVER THE HEADER when both exist, because the body's id was\n *    chosen by the code that knows about the error while the header's is\n *    usually stamped by a proxy for every request alike — and a per-request\n *    id from the edge is the less useful of the two when support goes looking.\n */\nconst REFERENCE_HEADERS = [\n  'x-request-id',\n  'x-correlation-id',\n  'x-trace-id',\n  'x-amzn-requestid',\n  'traceparent',\n] as const;\n\n/** Pull a correlation id out of an error body, if it has one. */\nfunction referenceFromBody(body: unknown): string | undefined {\n  if (!isObject(body)) return undefined;\n  for (const field of REFERENCE_FIELDS) {\n    const v = body[field];\n    if (typeof v === 'string' && v.trim()) return v.trim();\n    // ★ A numeric id is still an id. Servers send both, and rejecting a number\n    //   means dropping the reference for the ones that send it that way.\n    if (typeof v === 'number' && Number.isFinite(v)) return String(v);\n  }\n  return undefined;\n}\n\n/** …or out of its response headers. */\nfunction referenceFromHeaders(e: HttpLikeError): string | undefined {\n  const get = e.headers?.get;\n  if (typeof get !== 'function') return undefined;\n  for (const name of REFERENCE_HEADERS) {\n    let value: string | null = null;\n    try {\n      // ★ Guarded: `headers` is whatever the host's HTTP layer put there, and\n      //   an error page is the worst place to throw a second error.\n      value = get.call(e.headers, name);\n    } catch { value = null; }\n    if (typeof value === 'string' && value.trim()) return value.trim();\n  }\n  return undefined;\n}\n\n/** Statuses where retrying the same request can plausibly succeed. */\nconst RETRYABLE = new Set([0, 408, 425, 429, 500, 502, 503, 504]);\n\nconst isObject = (v: unknown): v is Record<string, unknown> =>\n  typeof v === 'object' && v !== null;\n\n/**\n * Pull the most useful human-readable string out of a server error body.\n * APIs disagree on the field name, so try the common ones in order of how\n * specific they usually are.\n */\nfunction messageFromBody(body: unknown): string {\n  if (typeof body === 'string') return displayable(body);\n  if (!isObject(body)) return '';\n  for (const field of ['message', 'error', 'detail', 'title'] as const) {\n    const v = body[field];\n    if (typeof v === 'string') {\n      const text = displayable(v);\n      if (text) return text;\n    }\n  }\n  return '';\n}\n\n/** Longest server string shown verbatim; anything longer is a dump, not a sentence. */\nconst MAX_DISPLAY_LENGTH = 300;\n\n/**\n * `SvDataError.message` is documented as SAFE TO DISPLAY (`OF-16-I6`), so a\n * string that is plainly not a sentence meant for a user is refused and the\n * caller falls through to the next candidate. Refused: markup (a proxy's HTML\n * 502 page), stack traces, and anything past `MAX_DISPLAY_LENGTH`.\n */\nfunction displayable(raw: string): string {\n  const text = raw.trim();\n  if (!text || text.length > MAX_DISPLAY_LENGTH) return '';\n  if (/^<|<\\/?[a-z][\\s\\S]*>/i.test(text)) return '';\n  if (/\\n\\s*at\\s+\\S|^\\w*(Error|Exception):.*\\n/.test(text)) return '';\n  return text;\n}\n\n/**\n * Angular's own `HttpErrorResponse.message` — `Http failure response for\n * https://internal-host/api/orders: 500 …` — names the request URL, which is\n * an internal hostname leak on screen (`OF-16-I6`). It is never shown.\n */\nconst FRAMEWORK_HTTP_MESSAGE = /^Http failure (response|during parsing) for /i;\n\n/**\n * `statusText` values Angular invents rather than receives. HTTP/2 and `fetch`\n * carry no reason phrase, so Angular fills in `'OK'` — which, once the\n * framework message above is skipped, would put \"OK\" on an error screen. A\n * network failure and a timeout get `'Unknown Error'` / `'Request timeout'`.\n * None says more than the caller's `fallbackMessage`, so all three fall through to it.\n */\nconst ANGULAR_PLACEHOLDER_STATUS = new Set(['OK', 'Unknown Error', 'Request timeout']); // sv-i18n-ignore: Angular statusText values compared in code\n\n/**\n * Normalize anything thrown into a renderable `SvDataError`.\n *\n * Handles `HttpErrorResponse`, `Error`, a plain string, and an already-normalized\n * `SvDataError` (returned unchanged). Anything unrecognized becomes a generic\n * message rather than `[object Object]` on screen.\n *\n * `retryable` is inferred from the status: a 404 or a 403 will fail identically\n * on retry, so offering \"Try again\" for them is a lie. Pass `fallbackMessage`\n * when the calling context can say something better than \"Something went wrong\".\n *\n * ```ts\n * this.http.get<Page>(url).subscribe({\n *   error: (e) => this.error.set(toSvDataError(e, 'Could not load orders.')),\n * });\n * ```\n */\nexport function toSvDataError(cause: unknown, fallbackMessage = SV_CORE_LABELS.errorMessage): SvDataError {\n  if (isSvDataError(cause)) return cause;\n\n  if (typeof cause === 'string') {\n    return { message: displayable(cause) || fallbackMessage, retryable: true, cause };\n  }\n\n  if (isObject(cause)) {\n    const e = cause as HttpLikeError;\n    const status = typeof e.status === 'number' ? e.status : undefined;\n\n    // Prefer the server's own words, then the framework's, then the caller's.\n    const message =\n      messageFromBody(e.error) ||\n      (typeof e.message === 'string' && !FRAMEWORK_HTTP_MESSAGE.test(e.message.trim())\n        ? displayable(e.message)\n        : '') ||\n      (typeof e.statusText === 'string' && !ANGULAR_PLACEHOLDER_STATUS.has(e.statusText.trim())\n        ? displayable(e.statusText)\n        : '') ||\n      fallbackMessage;\n\n    return {\n      message,\n      status,\n      retryable: status === undefined ? true : RETRYABLE.has(status),\n      reference: referenceFromBody(e.error) ?? referenceFromHeaders(e),\n      cause,\n    };\n  }\n\n  return { message: fallbackMessage, retryable: true, cause };\n}\n\n/**\n * Type guard for an already-normalized error.\n *\n * Two things have to hold, and both are load-bearing.\n *\n * It must be a *plain* object: `new Error('x')` and `HttpErrorResponse` both\n * have a string `message`, so a duck-type check alone lets them through\n * un-normalized, arriving with no `retryable` flag.\n *\n * And it must carry a boolean `retryable`. That flag *is* the normalization —\n * it is the one field `toSvDataError` derives rather than copies. Without this\n * check, a server's own JSON error body (`{ message: 'Not found', status: 404 }`\n * is a completely ordinary shape) passes the guard, is returned untouched, and\n * reaches the UI with `retryable` undefined — which {@link isRetryable} then\n * reads as *true*. The result is a \"Try again\" button on a 404, which will fail\n * identically every time the user presses it.\n */\nexport function isSvDataError(value: unknown): value is SvDataError {\n  if (!isObject(value) || typeof value['message'] !== 'string') return false;\n  if (typeof value['retryable'] !== 'boolean') return false;\n  const proto: unknown = Object.getPrototypeOf(value);\n  return (proto === Object.prototype || proto === null) && !('statusText' in value);\n}\n\n/**\n * Whether the UI should offer a retry. Defaults to `true` for errors that did\n * not say — an extra button is a smaller failure than a dead end.\n */\nexport function isRetryable(error: SvDataError | null | undefined): boolean {\n  return error ? error.retryable !== false : false;\n}\n","import { computed, signal, type Signal } from '@angular/core';\n\n/**\n * One in-flight request, with the two things its caller needs: the signal to\n * hand the transport, and the settle that says whether to apply the answer.\n *\n * Returned by {@link SvRequestGuard.start}. Prefer it over the bare\n * {@link SvRequestGuard.begin} token — carrying the signal next to the token\n * is what stops the two drifting apart, which is the failure mode of every\n * hand-rolled version of this.\n */\nexport interface SvRequest {\n  /** Monotonic id. Newer requests have higher tokens. */\n  readonly token: number;\n  /**\n   * Aborts as soon as a newer request supersedes this one, or the guard is\n   * cancelled. Pass it to `fetch`, to `HttpClient` via `AbortSignal`-aware\n   * middleware, or check `signal.aborted` before applying anything.\n   */\n  readonly signal: AbortSignal;\n  /**\n   * Settle this request. Returns `false` when it was superseded — the caller\n   * must discard the response. Equivalent to `guard.settle(request.token)`.\n   */\n  settle(): boolean;\n}\n\n/**\n * Tracks which in-flight request is still the one the UI cares about.\n *\n * The bug this prevents: the user types \"ab\", then \"abc\". Two requests go out.\n * The \"ab\" response is slower and lands second, so the list ends up showing\n * results for a query the user has already moved past — and nothing in the code\n * looks wrong. Every component that fires a request per keystroke needs this,\n * and none of them had it.\n *\n * Discarding a superseded response is the correctness half. Aborting it is the\n * cost half: an in-flight request the user has already typed past is wasted\n * server work, and on a slow connection it is what makes a filter feel laggy.\n * {@link start} does both.\n */\nexport interface SvRequestGuard {\n  /** True while the newest request has not settled. Bind to `loading`. */\n  readonly pending: Signal<boolean>;\n  /**\n   * True while a newer request is in flight **and** an earlier one has already\n   * been applied — that is, whatever is on screen is answered but may be out of\n   * date.\n   *\n   * This is the state a picker has no vocabulary for today: `loading` is true\n   * both while the first results are being fetched (nothing on screen, show a\n   * skeleton) and while a refinement of them is being fetched (results on\n   * screen, keep them and mark them provisional). Blanking the panel on the\n   * second is the most jarring thing a search box can do; showing the old list\n   * with no indication that it is answering an older query is a quiet lie.\n   *\n   * `stale` says nothing about *why* the earlier request settled — a failed\n   * request settles too. Render the error branch first and this one after it,\n   * so a retry in flight shows the error, not stale results.\n   */\n  readonly stale: Signal<boolean>;\n  /**\n   * Start a request and take a token. Immediately supersedes any older one,\n   * and aborts its signal.\n   *\n   * Prefer {@link start} unless the transport genuinely cannot be aborted.\n   */\n  begin(): number;\n  /**\n   * Start a request and take a token **and** an `AbortSignal`. Immediately\n   * supersedes any older one, and aborts its signal.\n   */\n  start(): SvRequest;\n  /** Whether `token` is still the newest request — check before applying data. */\n  isCurrent(token: number): boolean;\n  /**\n   * Settle `token`. Returns `false` if it was superseded, in which case the\n   * caller must discard the response. Clears `pending` only for the newest.\n   */\n  settle(token: number): boolean;\n  /**\n   * Abandon everything in flight — aborts the current signal and clears\n   * `pending` without applying results.\n   *\n   * Call it on destroy, and when the panel closes: a picker that keeps fetching\n   * for a dropdown nobody can see is the same waste as a superseded request.\n   */\n  cancel(): void;\n}\n\n/** The reason every abort this guard raises carries. */\nconst SUPERSEDED = (): DOMException =>\n  new DOMException('Superseded by a newer request.', 'AbortError'); // sv-i18n-ignore: developer message (abort reason)\n\n/**\n * A monotonic request guard with per-request abort.\n *\n * ```ts\n * private readonly guard = createRequestGuard();\n *\n * protected async search(term: string): Promise<void> {\n *   const req = this.guard.start();\n *   try {\n *     const rows = await this.api.search(term, req.signal);\n *     if (req.settle()) this.rows.set(rows);\n *   } catch (e) {\n *     if (req.signal.aborted) return;      // superseded — say nothing\n *     if (req.settle()) this.error.set(toSvDataError(e));\n *   }\n * }\n * ```\n * ```html\n * @if (error()) { <sv-error-shell … /> }\n * @else if (guard.stale()) { <ul [attr.aria-busy]=\"true\" class=\"opacity-60\">…</ul> }\n * @else if (guard.pending()) { <sv-skeleton-shell … /> }\n * ```\n *\n * A plain factory, not a service: it holds three counters and needs no\n * injection context, so it can be called straight from a field initializer.\n */\nexport function createRequestGuard(): SvRequestGuard {\n  const latest = signal(0);\n  const settled = signal(0);\n  // Counts responses actually applied. Distinct from `settled`, which cancel()\n  // also advances — cancelling is not an answer, and must not make the next\n  // request look like a refinement of one.\n  const applied = signal(0);\n\n  let controller: AbortController | null = null;\n\n  const abortInFlight = (): void => {\n    controller?.abort(SUPERSEDED());\n    controller = null;\n  };\n\n  const take = (): number => {\n    abortInFlight();\n    const token = latest() + 1;\n    latest.set(token);\n    return token;\n  };\n\n  const settle = (token: number): boolean => {\n    if (token !== latest()) return false;\n    settled.set(token);\n    applied.update((n) => n + 1);\n    // Settled, not superseded: drop the controller without aborting it, so a\n    // late `cancel()` cannot abort a request that already answered.\n    controller = null;\n    return true;\n  };\n\n  return {\n    pending: computed(() => latest() > settled()),\n\n    // `applied` rather than `settled > 0`: after a cancel the two disagree, and\n    // it is `applied` that answers \"is there anything on screen to go stale?\".\n    stale: computed(() => latest() > settled() && applied() > 0),\n\n    begin: take,\n\n    start: (): SvRequest => {\n      const token = take();\n      const ac = new AbortController();\n      controller = ac;\n      return {\n        token,\n        signal: ac.signal,\n        settle: () => settle(token),\n      };\n    },\n\n    isCurrent: (token: number) => token === latest(),\n\n    settle,\n\n    // Burn a token so that everything already on the wire is superseded: the\n    // point of cancel() is that a response arriving after it must be discarded,\n    // and merely levelling `settled` with `latest` would still accept the\n    // newest in-flight request.\n    cancel: () => {\n      abortInFlight();\n      const void_ = latest() + 1;\n      latest.set(void_);\n      settled.set(void_);\n    },\n  };\n}\n","import { computed, signal, type DestroyRef, type Signal } from '@angular/core';\nimport { toSvDataError } from './errors';\nimport { createRequestGuard, type SvRequest, type SvRequestGuard } from './request-guard';\nimport type { SvDataError } from './types';\n\n/**\n * The async contract for an ACTION — a write the user asked for once.\n *\n * ── Why this exists next to `createRequestGuard` and not instead of it ───────\n *\n * ★★★ READS AND WRITES WANT OPPOSITE RULES, AND CONFLATING THEM IS THE BUG.\n *     A search box wants LATEST-WINS: the user typed past \"ab\", so the \"abc\"\n *     request supersedes it and the older answer is discarded. That is\n *     `createRequestGuard`, and it is right for every list, picker and\n *     palette in the kit.\n *\n *     A Delete button wants FIRST-WINS. \"Supersede the in-flight request with\n *     a newer one\" means *running the destructive thing twice* — which is\n *     exactly what a double-click on Confirm did in eight families, each of\n *     them having decided independently what `loading` meant. So a second\n *     `run()` while one is in flight is REFUSED, and the caller is told so.\n *\n * ★★ AND IT OWNS THE HALF THE GUARD DOES NOT: the error. The guard answers\n *    \"is this answer still wanted?\"; it has nothing to say about a rejection,\n *    which is why every adopter grew its own `error` signal, its own\n *    normalization (or none), and its own idea of whether a retry was even\n *    possible. `SvDataError.retryable` already encodes that — a 404 will fail\n *    identically on retry, so offering \"Try again\" for one is a lie.\n *\n * ★ `idle → pending → error → retry | cancelled` is the whole machine. It is\n *   deliberately not a discriminated union of data states: the DATA belongs to\n *   the host, and a component that owns its host's data is the coupling this\n *   contract is trying to remove. `X-10`.\n */\nexport type SvAsyncActionStatus = 'idle' | 'pending' | 'error';\n\n/**\n * What `run()` did. Returned rather than thrown, because all four are ordinary\n * outcomes a caller has to tell apart — and \"it threw\" is the one that is not.\n */\nexport type SvAsyncActionOutcome =\n  /** The work resolved. */\n  | 'done'\n  /** The work rejected; `error()` now holds it. */\n  | 'failed'\n  /** Refused: something was already in flight. The work did NOT run. */\n  | 'busy'\n  /** `cancel()` (or teardown) happened first. Nothing was written. */\n  | 'cancelled';\n\n/**\n * May the user dismiss the surface while the action is in flight?\n *\n * ★★ THE POINT IS THAT SOMEBODY ANSWERS IT. The audit found eight families\n *    with an async mode and eight answers, most of them implicit: a dialog\n *    that silently swallowed Escape, a drawer that closed and left the request\n *    running, a modal with no opinion at all. Neither answer is wrong; not\n *    having one is.\n */\nexport type SvPendingDismissal =\n  /** Dismissal is refused while pending. The safe default for a write. */\n  | 'block'\n  /** Dismissal aborts the request (via its `AbortSignal`) and closes. */\n  | 'abort';\n\nexport interface SvAsyncActionOptions {\n  /**\n   * Message used when the rejection carries nothing readable.\n   * @default 'Something went wrong.'\n   */\n  readonly fallbackMessage?: string;\n  /**\n   * Destroy hook. Pass `inject(DestroyRef)` from a field initializer and the\n   * in-flight request is aborted on teardown — otherwise a resolution after\n   * destruction writes to signals nobody is reading, and a rejection reports\n   * an error on a surface that no longer exists.\n   */\n  readonly destroyRef?: DestroyRef | null;\n  /** Share an existing guard. Defaults to one of its own. */\n  readonly guard?: SvRequestGuard;\n}\n\nexport interface SvAsyncAction {\n  /** `idle` · `pending` · `error`. Bind whichever the surface renders. */\n  readonly status: Signal<SvAsyncActionStatus>;\n  /** True while the work is in flight. Bind to `loading` / `aria-busy`. */\n  readonly pending: Signal<boolean>;\n  /** The last rejection, normalized, or `null`. */\n  readonly error: Signal<SvDataError | null>;\n  /**\n   * True when there is an error AND retrying it could plausibly succeed.\n   *\n   * ★ A failed DELETE that returned 403 is not retryable, and a \"Try again\"\n   *   button for it wastes the user's time twice.\n   */\n  readonly canRetry: Signal<boolean>;\n  /** How many times the work has been started, including retries. */\n  readonly attempts: Signal<number>;\n\n  /**\n   * Run `work` once. Refused with `'busy'` if something is already in flight.\n   *\n   * `work` receives the request: pass `req.signal` to the transport so a\n   * `cancel()` actually stops it.\n   */\n  run(work: (request: SvRequest) => unknown): Promise<SvAsyncActionOutcome>;\n  /**\n   * Run the last `work` again, clearing the error as it starts.\n   *\n   * Returns `'busy'` when nothing has been run yet — there is nothing to\n   * retry, and inventing an empty attempt would clear the error for free.\n   */\n  retry(): Promise<SvAsyncActionOutcome>;\n  /** Abort what is in flight, clear the error, and return to `idle`. */\n  cancel(): void;\n  /** Back to `idle` without aborting — for a surface that has closed cleanly. */\n  reset(): void;\n}\n\n/**\n * One async action's state, with first-wins semantics and a normalized error.\n *\n * ```ts\n * protected readonly save = createAsyncAction({ destroyRef: inject(DestroyRef) });\n *\n * protected async onConfirm(): Promise<void> {\n *   const outcome = await this.save.run((req) => this.api.delete(this.id(), req.signal));\n *   if (outcome === 'done') this.open.set(false);\n * }\n * ```\n * ```html\n * @if (save.error(); as e) { <p role=\"alert\">{{ e.message }}</p> }\n * <button [disabled]=\"save.pending()\" (click)=\"onConfirm()\">Delete</button>\n * ```\n */\nexport function createAsyncAction(options: SvAsyncActionOptions = {}): SvAsyncAction {\n  const guard = options.guard ?? createRequestGuard();\n  const error = signal<SvDataError | null>(null);\n  const attempts = signal(0);\n  let last: ((request: SvRequest) => unknown) | null = null;\n\n  const run = async (work: (request: SvRequest) => unknown): Promise<SvAsyncActionOutcome> => {\n    // ★★ FIRST-WINS. The second click on Confirm is not a newer intent, it is\n    //    the same intent arriving twice — see the header. Refusing it here is\n    //    what makes `[disabled]=\"pending()\"` a courtesy rather than the only\n    //    thing standing between the user and two DELETEs.\n    if (guard.pending()) return 'busy';\n\n    last = work;\n    error.set(null);\n    attempts.update((n) => n + 1);\n    const request = guard.start();\n\n    try {\n      await work(request);\n      // ★ `settle()` false means this run was superseded or cancelled. Writing\n      //   anything then is the stale-write bug the guard exists to prevent —\n      //   here it would clear `pending` for a request that is still running.\n      return request.settle() ? 'done' : 'cancelled';\n    } catch (cause) {\n      // ★★ AN ABORT IS NOT A FAILURE. The user cancelled; reporting \"Request\n      //    aborted\" back to them as an error is the most common way this goes\n      //    wrong, and it looks like a bug in the thing they just stopped.\n      //\n      // ★ AND `settle()` IS THE WHOLE TEST — it does not need help from\n      //   `request.signal.aborted`. I wrote both and the extra check survived\n      //   every mutation: the signal is the guard's, so the only things that\n      //   abort it are a supersede and a cancel, and both of those already\n      //   make `settle()` false. Not every transport rejects with an\n      //   `AbortError` anyway, so reading the rejection rather than the\n      //   bookkeeping would have been the weaker test of the two.\n      if (!request.settle()) return 'cancelled';\n      error.set(toSvDataError(cause, options.fallbackMessage));\n      return 'failed';\n    }\n  };\n\n  const api: SvAsyncAction = {\n    pending: guard.pending,\n    error: error.asReadonly(),\n    canRetry: computed(() => error()?.retryable === true),\n    attempts: attempts.asReadonly(),\n    // ★ The two orders are equivalent, and that is worth a line rather than a\n    //   reader's time: `run()` clears the error before it starts, so `pending`\n    //   and `error` are never both true. Swapping these branches passes every\n    //   test in the spec, which is how I know. It is written pending-first\n    //   because that is the order a surface renders them in.\n    status: computed(() => (guard.pending() ? 'pending' : error() ? 'error' : 'idle')),\n\n    run,\n\n    retry: async (): Promise<SvAsyncActionOutcome> => {\n      const work = last;\n      if (!work) return 'busy';\n      return run(work);\n    },\n\n    cancel: (): void => {\n      guard.cancel();\n      error.set(null);\n    },\n\n    reset: (): void => {\n      error.set(null);\n      attempts.set(0);\n      last = null;\n    },\n  };\n\n  options.destroyRef?.onDestroy(() => guard.cancel());\n\n  return api;\n}\n","import {\n  DestroyRef,\n  PendingTasks,\n  computed,\n  inject,\n  signal,\n  untracked,\n  type Signal,\n} from '@angular/core';\nimport { createRequestGuard } from './request-guard';\nimport { toSvDataError } from './errors';\nimport type { SvDataError, SvEmptyReason } from './types';\n\n/**\n * A function that turns what the user has typed into a list of suggestions.\n *\n * Promise + `AbortSignal`, matching {@link SvDataSource} and every other\n * transport contract in the kit. The `signal` aborts the moment a newer\n * keystroke supersedes this one — honour it, because a picker fires a request\n * per word and the ones nobody is waiting for are pure cost.\n */\nexport type SvSuggestSource<T> = (term: string, signal: AbortSignal) => Promise<readonly T[]>;\n\n/** Tuning for {@link svSuggestController}. */\nexport interface SvSuggestControllerOptions {\n  /**\n   * Wait this long after the last keystroke before fetching. Accepts a signal,\n   * so a component can pass its own `debounceMs` input straight through.\n   *\n   * 300ms matches `search-bar`, `autocomplete` and every Phase 2 picker.\n   * @default 300\n   */\n  readonly debounceMs?: number | Signal<number>;\n\n  /**\n   * Do not fetch until the term is at least this long.\n   *\n   * Below it the controller reports `tooShort` and holds no options — which is\n   * a *different* state from \"we searched and found nothing\", and the reason\n   * `emptyReason` exists.\n   * @default 0\n   */\n  readonly minChars?: number | Signal<number>;\n\n  /**\n   * Keep the previous suggestions visible while the next set loads.\n   *\n   * On by default, and this is the option `stale` exists to make honest: the\n   * list stays put, `stale` goes true, and the panel dims rather than\n   * collapsing under the user's cursor. Turn it off and every keystroke blanks\n   * the panel — measurably the most disliked behaviour a combobox has.\n   * @default true\n   */\n  readonly keepPreviousData?: boolean;\n}\n\n/**\n * The headless engine behind a server-backed picker: a term in, a list of\n * suggestions out, with the request lifecycle handled once.\n *\n * @see svSuggestController\n */\nexport interface SvSuggestController<T> {\n  // ── Bind these to the component ──────────────────────────────────────────\n  /** The suggestions to render. */\n  readonly options: Signal<readonly T[]>;\n  /** True while a request is in flight. Bind to the component's `loading`. */\n  readonly loading: Signal<boolean>;\n  /**\n   * True while a request is in flight **and** an earlier one has already been\n   * applied — the options on screen answer an older term.\n   *\n   * Render it *after* `error` and *before* `loading`: a first fetch is a\n   * skeleton, a refinement is a dimmed list, and a retry after a failure is an\n   * error. Collapsing the three into one boolean is what makes a combobox feel\n   * like it is fighting the user.\n   */\n  readonly stale: Signal<boolean>;\n  /** The last failure, or `null`. Already normalized for `<sv-error-shell>`. */\n  readonly error: Signal<SvDataError | null>;\n  /** The term the visible options actually answer — not the one being typed. */\n  readonly term: Signal<string>;\n  /** What the user has typed, un-debounced. */\n  readonly typed: Signal<string>;\n  /** True between a keystroke and the debounce settling. */\n  readonly typing: Signal<boolean>;\n  /** True when the term is shorter than `minChars`, so nothing was fetched. */\n  readonly tooShort: Signal<boolean>;\n  /**\n   * Why the list is empty, or `null` when it is not.\n   *\n   * `no-results` once a search has answered with nothing; `no-data` for the\n   * opening state, where the right copy is \"start typing\" rather than \"no\n   * matches\". Never non-null while a first load is in flight.\n   */\n  readonly emptyReason: Signal<SvEmptyReason | null>;\n\n  // ── Call these from the component's outputs ──────────────────────────────\n  /** Record a keystroke — wire to `(queryChange)` / `(searched)`. */\n  search(term: string): void;\n  /** Search now, skipping the debounce. For Enter, and for opening the panel. */\n  flush(): void;\n  /** Re-run the settled term immediately — wire to `(retry)`. */\n  reload(): void;\n  /**\n   * Abandon anything in flight without clearing what is on screen.\n   *\n   * Call it when the panel closes. A picker that keeps fetching for a dropdown\n   * nobody can see is the same waste as a superseded request, and the response\n   * would land against a closed panel.\n   */\n  cancel(): void;\n  /** Back to the opening state: no term, no options, no error. */\n  clear(): void;\n}\n\n/**\n * Wire a Styloviz picker to a search endpoint in five lines.\n *\n * ```ts\n * readonly people = svSuggestController<Person>(\n *   (term, signal) => fetch(`/api/people?q=${encodeURIComponent(term)}`, { signal })\n *     .then((r) => r.json()),\n *   { minChars: 2 },\n * );\n * ```\n * ```html\n * <sv-autocomplete\n *   [options]=\"people.options()\"  [loading]=\"people.loading()\"\n *   [stale]=\"people.stale()\"      [error]=\"people.error()\"\n *   (inputChange)=\"people.search($event)\" />\n * ```\n *\n * The page-shaped sibling is {@link svDataController} — use that for a table or\n * a list that pages, sorts and filters. This one is for the term → options\n * shape every combobox in the kit has, where there is no page, no sort, and the\n * only query is a string.\n *\n * What it does that a hand-rolled `subscribe` does not:\n *\n * - **Debounces** keystrokes, so typing five characters is one request.\n * - **Guards** responses, so a slow answer to an abandoned term cannot\n *   overwrite a newer one — the bug that makes a combobox show suggestions for\n *   what the user typed two keystrokes ago, and that looks correct in review.\n * - **Aborts** the superseded request rather than just ignoring it.\n * - **Distinguishes** \"loading the first time\" from \"refining what is already\n *   there\" (`stale`), and \"found nothing\" from \"not asked yet\" (`emptyReason`).\n *\n * There is deliberately **no retry policy**. A table's user is waiting and has\n * nothing else to do, so backoff is right there; a picker's user has a\n * keyboard, and their next keystroke is a better retry than anything a timer\n * can schedule. Expose `error` and let `reload()` be the deliberate one. Wrap\n * the source yourself if your endpoint genuinely needs backoff.\n *\n * Nothing in the kit depends on this: components stay headless and this is\n * sugar. It needs an injection context for `DestroyRef` (a field initializer is\n * one); pass `destroyRef` if you are calling it from somewhere else.\n */\nexport function svSuggestController<T>(\n  source: SvSuggestSource<T>,\n  options: SvSuggestControllerOptions & {\n    destroyRef?: DestroyRef;\n    pendingTasks?: PendingTasks;\n  } = {},\n): SvSuggestController<T> {\n  const {\n    debounceMs = 300,\n    minChars = 0,\n    keepPreviousData = true,\n    destroyRef = inject(DestroyRef),\n    pendingTasks = inject(PendingTasks),\n  } = options;\n\n  const readOption = (v: number | Signal<number>): number => {\n    const n = typeof v === 'number' ? v : v();\n    return Number.isFinite(n) && n > 0 ? n : 0;\n  };\n  const delayOf = (): number => readOption(debounceMs);\n  const minCharsOf = (): number => readOption(minChars);\n\n  const typed = signal('');\n  const items = signal<readonly T[]>([]);\n  const error = signal<SvDataError | null>(null);\n  /** The term the visible options answer. `null` until one has landed. */\n  const applied = signal<string | null>(null);\n  /** True between a keystroke and the debounce elapsing. */\n  const armed = signal(false);\n\n  const guard = createRequestGuard();\n  let timer: ReturnType<typeof setTimeout> | null = null;\n  let destroyed = false;\n\n  const clearTimer = (): void => {\n    if (timer !== null) {\n      clearTimeout(timer);\n      timer = null;\n    }\n    armed.set(false);\n  };\n\n  const fetchOnce = async (target: string): Promise<void> => {\n    const req = guard.start();\n    try {\n      const next = await source(target, req.signal);\n      if (!req.settle()) return;\n      items.set(next);\n      applied.set(target);\n      error.set(null);\n    } catch (cause) {\n      // A superseded request is not a failure the user should ever see: its\n      // rejection is this controller's own abort, arriving after the answer\n      // that replaced it.\n      if (req.signal.aborted || destroyed) return;\n      if (!req.settle()) return;\n      error.set(toSvDataError(cause));\n      // The options stay: they answered the last term that *worked*, and\n      // blanking the panel on a transient 503 takes away the only thing the\n      // user can still act on.\n      if (!keepPreviousData) items.set([]);\n    }\n  };\n\n  /**\n   * ★★ A fetch in flight blocks application stability — the same reason\n   * `svDataController` registers its own. Without it `whenStable()` resolves\n   * while the request is still on the wire, and a server render serialises an\n   * empty panel.\n   */\n  const run = async (target: string): Promise<void> => {\n    const done = pendingTasks.add();\n    try {\n      await fetchOnce(target);\n    } finally {\n      done();\n    }\n  };\n\n  /** Below `minChars` there is nothing to ask for, and nothing to show. */\n  const holdBack = (): void => {\n    guard.cancel();\n    error.set(null);\n    items.set([]);\n    applied.set(null);\n  };\n\n  const dispatch = (target: string): void => {\n    if (destroyed) return;\n    if (target.length < minCharsOf()) {\n      holdBack();\n      return;\n    }\n    void run(target);\n  };\n\n  const schedule = (target: string, delay: number): void => {\n    clearTimer();\n    if (delay <= 0) {\n      dispatch(target);\n      return;\n    }\n    armed.set(true);\n    timer = setTimeout(() => {\n      timer = null;\n      armed.set(false);\n      dispatch(target);\n    }, delay);\n  };\n\n  destroyRef.onDestroy(() => {\n    destroyed = true;\n    clearTimer();\n    guard.cancel();\n  });\n\n  return {\n    options: items.asReadonly(),\n    loading: guard.pending,\n    stale: guard.stale,\n    error: error.asReadonly(),\n    term: computed(() => applied() ?? ''),\n    typed: typed.asReadonly(),\n    typing: armed.asReadonly(),\n    tooShort: computed(() => typed().length < minCharsOf()),\n\n    // Reads `applied`, not the typed term: while a search is in flight the\n    // panel answers the *old* term, and calling it \"no matches\" before the\n    // answer lands is a lie either way it resolves.\n    emptyReason: computed(() => {\n      if (items().length > 0) return null;\n      if (guard.pending()) return null;\n      return applied() === null ? 'no-data' : 'no-results';\n    }),\n\n    search: (term: string) => {\n      typed.set(term);\n      // Below the threshold there is nothing to wait for: drop the timer and\n      // the options now, rather than after a delay that can only end one way.\n      if (term.length < minCharsOf()) {\n        clearTimer();\n        holdBack();\n        return;\n      }\n      schedule(term, delayOf());\n    },\n\n    // Enter, and opening the panel: waiting 300ms after a deliberate act is\n    // what makes a picker feel broken.\n    flush: () => {\n      clearTimer();\n      dispatch(untracked(typed));\n    },\n\n    reload: () => {\n      error.set(null);\n      clearTimer();\n      dispatch(untracked(typed));\n    },\n\n    cancel: () => {\n      clearTimer();\n      guard.cancel();\n    },\n\n    clear: () => {\n      clearTimer();\n      guard.cancel();\n      typed.set('');\n      items.set([]);\n      applied.set(null);\n      error.set(null);\n    },\n  };\n}\n","import {\n  DestroyRef,\n  PendingTasks,\n  computed,\n  inject,\n  signal,\n  untracked,\n  type Signal,\n} from '@angular/core';\nimport { createRequestGuard } from './request-guard';\nimport { svSuggestController } from './suggest-controller';\nimport { toSvDataError } from './errors';\nimport type { SvDataError } from './types';\n\n/** Which slice of the answer a {@link SvSelectSourceSearch} call is for. */\nexport interface SvSelectSourcePageRequest {\n  /** Rows already loaded for this term — the index of the first row wanted. */\n  readonly offset: number;\n  /** Rows wanted; `0` when the source is not paged. */\n  readonly limit: number;\n}\n\n/** One page of an answer, when the server can say whether there is more. */\nexport interface SvSelectSourcePage<T> {\n  readonly items: readonly T[];\n  /**\n   * More rows exist for this term. Omit it and a page that came back full\n   * (`items.length >= pageSize`) is taken to mean \"there may be more\".\n   */\n  readonly hasMore?: boolean;\n}\n\n/**\n * The server call behind a select. Return the rows, or a page that also says\n * whether more exist. Honour `signal`: it aborts the moment a newer term\n * supersedes this one.\n */\nexport type SvSelectSourceSearch<T> = (\n  term: string,\n  signal: AbortSignal,\n  page: SvSelectSourcePageRequest,\n) => Promise<readonly T[] | SvSelectSourcePage<T>>;\n\n/** Options for {@link svSelectSource}. */\nexport interface SvSelectSourceOptions<T> {\n  /** The server call. */\n  readonly search: SvSelectSourceSearch<T>;\n  /**\n   * Rows per page. `0` means the call returns the whole answer for a term and\n   * there is no \"Load more\".\n   * @default 0\n   */\n  readonly pageSize?: number;\n  /**\n   * Characters required before a term is searched. Applied by the consuming\n   * select, which also renders the \"type N characters\" hint; `undefined` leaves\n   * the select's own setting in force.\n   */\n  readonly minChars?: number;\n  /**\n   * Keystroke debounce in ms. Applied by the consuming select — which already\n   * debounces its search box, and debouncing a second time here would make a\n   * 300 ms picker answer in 600. `undefined` leaves the select's own setting.\n   */\n  readonly debounceMs?: number;\n  /** Needed only outside an injection context. */\n  readonly destroyRef?: DestroyRef;\n  /** Needed only outside an injection context. */\n  readonly pendingTasks?: PendingTasks;\n}\n\n/**\n * Search, paging and async state for one select, as one object.\n *\n * @see svSelectSource\n */\nexport interface SvSelectSource<T> {\n  /** Every row loaded for the current term, pages appended in order. */\n  readonly options: Signal<readonly T[]>;\n  /** The first page for a term is in flight. */\n  readonly loading: Signal<boolean>;\n  /** The rows on screen answer an older term; a newer one is in flight. */\n  readonly stale: Signal<boolean>;\n  /** The last failure — of the search or of a \"Load more\" — or `null`. */\n  readonly error: Signal<SvDataError | null>;\n  /** More rows exist for the current term. */\n  readonly hasMore: Signal<boolean>;\n  /** A \"Load more\" is in flight. */\n  readonly loadingMore: Signal<boolean>;\n  /** The term the visible rows answer. */\n  readonly term: Signal<string>;\n  /** See {@link SvSelectSourceOptions.minChars}. */\n  readonly minChars: number | undefined;\n  /** See {@link SvSelectSourceOptions.debounceMs}. */\n  readonly debounceMs: number | undefined;\n\n  /** Fetch the first page for `term` now. The select calls this debounced. */\n  search(term: string): void;\n  /**\n   * The panel opened with `term` in the box: fetch unless the rows on screen\n   * already answer it.\n   */\n  open(term: string): void;\n  /** Fetch and append the next page. No-op when there is none, or one is in flight. */\n  loadMore(): void;\n  /** Retry whatever failed — the \"Load more\" if that was it, else the search. */\n  reload(): void;\n  /** Abandon anything in flight, keeping what is on screen. */\n  cancel(): void;\n}\n\n/** The first page, kept as one object so its rows and its `hasMore` can never disagree. */\ninterface FirstPage<T> {\n  readonly items: readonly T[];\n  readonly hasMore: boolean;\n}\n\n/**\n * The adapter layer of the select split (`FI-23-M1`): where a select's options\n * come from.\n *\n * ```ts\n * readonly people = svSelectSource<SelectOption>({\n *   search: (term, signal, { offset, limit }) => api.people(term, offset, limit, signal),\n *   pageSize: 50,\n *   minChars: 2,\n * });\n * ```\n * ```html\n * <sv-select-dropdown [source]=\"people\" [selectedOption]=\"current()\" />\n * ```\n *\n * One object replaces twelve members of the select's API — `serverSide`,\n * `debounceMs`, `minChars`, `loadOptions`, `hasMore`, `loadingMore`,\n * `loading`, `stale`, `error`, `searchChange`, `retry` and `loadMore` —\n * because they are one conversation with one server.\n *\n * ★★ NOT A SECOND ASYNC ENGINE. The first page is {@link svSuggestController}\n *    — the guard, the abort, the stale/loading split, the pending task — and\n *    \"Load more\" is one more {@link createRequestGuard}. What this adds is only\n *    the paging: appending a page to the term that asked for it, and never to a\n *    newer term's rows.\n *\n * ★★★ A PAGE BELONGS TO THE FIRST PAGE IT EXTENDS. Appended rows are stored\n *     against the identity of the first-page object they followed, so the\n *     moment a new term's first page lands the old term's extra pages are no\n *     longer read — there is no reset to forget and no window where page two of\n *     \"ada\" sits under page one of \"bob\".\n *\n * Needs an injection context (a field initializer is one), or pass\n * `destroyRef` and `pendingTasks`.\n */\nexport function svSelectSource<T>(options: SvSelectSourceOptions<T>): SvSelectSource<T> {\n  const destroyRef = options.destroyRef ?? inject(DestroyRef);\n  const pendingTasks = options.pendingTasks ?? inject(PendingTasks);\n  const pageSize = Number.isFinite(options.pageSize) && (options.pageSize ?? 0) > 0\n    ? Math.floor(options.pageSize as number)\n    : 0;\n\n  const normalize = (answer: readonly T[] | SvSelectSourcePage<T>): FirstPage<T> => {\n    const items = isPage(answer) ? answer.items : answer;\n    const declared = isPage(answer) ? answer.hasMore : undefined;\n    return { items, hasMore: declared ?? (pageSize > 0 && items.length >= pageSize) };\n  };\n\n  // The first page: the existing engine, unchanged. `debounceMs: 0` and\n  // `minChars: 0` because the consuming select applies both — see the options.\n  const first = svSuggestController<FirstPage<T>>(\n    (term, signal) =>\n      options.search(term, signal, { offset: 0, limit: pageSize }).then((a) => [normalize(a)]),\n    { debounceMs: 0, minChars: 0, destroyRef, pendingTasks },\n  );\n\n  const firstPage = computed<FirstPage<T> | null>(() => first.options()[0] ?? null);\n\n  /** Pages appended after `base`. Ignored once `base` is no longer the first page. */\n  const more = signal<{ readonly base: FirstPage<T> | null; readonly items: readonly T[]; readonly hasMore: boolean }>(\n    { base: null, items: [], hasMore: false },\n  );\n  const moreError = signal<SvDataError | null>(null);\n  const moreGuard = createRequestGuard();\n  destroyRef.onDestroy(() => moreGuard.cancel());\n\n  const extension = computed(() => {\n    const page = firstPage();\n    const extra = more();\n    return page !== null && extra.base === page ? extra : null;\n  });\n\n  const rows = computed<readonly T[]>(() => {\n    const page = firstPage();\n    if (!page) return [];\n    const extra = extension();\n    return extra ? [...page.items, ...extra.items] : page.items;\n  });\n\n  const hasMore = computed(() => {\n    const page = firstPage();\n    if (!page) return false;\n    return extension()?.hasMore ?? page.hasMore;\n  });\n\n  const loadMore = (): void => {\n    const base = untracked(firstPage);\n    if (!base || !untracked(hasMore) || untracked(moreGuard.pending) || untracked(first.loading)) return;\n    const term = untracked(first.term);\n    const offset = untracked(rows).length;\n    const req = moreGuard.start();\n    moreError.set(null);\n    const done = pendingTasks.add();\n    options\n      .search(term, req.signal, { offset, limit: pageSize })\n      .then((answer) => {\n        if (!req.settle() || untracked(firstPage) !== base) return;\n        const page = normalize(answer);\n        const prior = untracked(extension);\n        more.set({ base, items: [...(prior?.items ?? []), ...page.items], hasMore: page.hasMore });\n      })\n      .catch((cause: unknown) => {\n        if (req.signal.aborted) return;\n        if (req.settle()) moreError.set(toSvDataError(cause));\n      })\n      .finally(done);\n  };\n\n  const search = (term: string): void => {\n    moreGuard.cancel();\n    moreError.set(null);\n    first.search(term);\n  };\n\n  return {\n    options: rows,\n    loading: first.loading,\n    stale: first.stale,\n    error: computed(() => moreError() ?? first.error()),\n    hasMore,\n    loadingMore: moreGuard.pending,\n    term: first.term,\n    minChars: options.minChars,\n    debounceMs: options.debounceMs,\n    search,\n    // `emptyReason() === 'no-data'` is the never-fetched case, which `term()`\n    // alone cannot tell apart from a settled empty term.\n    open: (term: string) => {\n      if (untracked(first.term) !== term || untracked(first.emptyReason) === 'no-data') search(term);\n    },\n    loadMore,\n    reload: () => {\n      if (untracked(moreError)) {\n        loadMore();\n        return;\n      }\n      moreGuard.cancel();\n      first.reload();\n    },\n    cancel: () => {\n      moreGuard.cancel();\n      first.cancel();\n    },\n  };\n}\n\nfunction isPage<T>(answer: readonly T[] | SvSelectSourcePage<T>): answer is SvSelectSourcePage<T> {\n  return !Array.isArray(answer);\n}\n","import { Directive, booleanAttribute, input } from '@angular/core';\n\n/**\n * Marks a list, panel or region as **answered but out of date**: a newer\n * request is in flight, and what is on screen answers the previous one.\n *\n * ── Why this is a directive and not seven copies of two classes ──────────────\n * Six picker families in the kit independently need the same treatment, and\n * every hand-rolled version of it differs — one dims, one spins, one blanks,\n * one does nothing at all and simply lies. Worse, most of them reach for\n * `loading`, which cannot express this: `loading` is true both while the FIRST\n * results are being fetched (nothing on screen — show a skeleton) and while a\n * refinement of them is being fetched (results on screen — keep them, mark\n * them). Blanking the panel on the second is the most jarring thing a combobox\n * can do; showing the old list with no indication that it answers an older\n * query is a quiet lie. `stale` is the third state, and this is its treatment.\n *\n * ── What it does ────────────────────────────────────────────────────────────\n * - `aria-busy=\"true\"` — the ARIA-correct statement that this region is being\n *   updated, so a screen reader does not announce a changing list mid-change.\n * - `data-sv-state=\"stale\"` — the same machine-readable hook the async shells\n *   publish, so a spec (and `check:ui`) can assert the state without selectors.\n * - Dims to 60% opacity, with a transition so it fades rather than flickers.\n *\n * It deliberately does **not** disable pointer events. The whole point of\n * keeping the previous results is that they stay usable: an option the user was\n * already reaching for is still the option they want.\n *\n * ```html\n * @if (error()) {\n *   <sv-error-shell [error]=\"error()\" (retry)=\"retry.emit()\" />\n * } @else if (options().length > 0) {\n *   <ul role=\"listbox\" [svStale]=\"stale()\"> … </ul>\n * } @else if (loading()) {\n *   <sv-skeleton-shell />\n * }\n * ```\n *\n * Pair it with `createRequestGuard().stale` from this package, or\n * `svSuggestController(...).stale` from `@styloviz/data`, which computes it.\n *\n * ⚠️ Do not put it on an element that already sets `data-sv-state` — the two\n * bindings would fight, and the state that element is in is not this one.\n */\n@Directive({\n  selector: '[svStale]',\n  host: {\n    '[attr.aria-busy]': \"svStale() ? 'true' : null\", // sv-i18n-ignore: host binding key\n    '[attr.data-sv-state]': \"svStale() ? 'stale' : null\", // sv-i18n-ignore: host binding key\n    '[class.opacity-60]': 'svStale()', // sv-i18n-ignore: host binding key\n    '[class.transition-opacity]': 'true', // sv-i18n-ignore: host binding key\n  },\n})\nexport class SvStaleDirective {\n  /**\n   * True while a newer request is in flight and the content here answers an\n   * older one. Accepts a bare attribute (`svStale`) as `true`.\n   */\n  readonly svStale = input(false, { transform: booleanAttribute });\n}\n","import { computed, signal, type DestroyRef, type Signal } from '@angular/core';\n\n/** Options for {@link createDebouncer}. */\nexport interface SvDebouncerOptions {\n  /**\n   * Delay before the value settles. Accepts a signal so a component can expose\n   * `debounceMs` as an input and have changes take effect immediately.\n   * A delay of `0` or less applies synchronously — no timer is scheduled.\n   * @default 300\n   */\n  readonly delayMs?: number | Signal<number>;\n  /**\n   * Destroy hook. Pass `inject(DestroyRef)` from a field initializer and the\n   * pending timer is cleared automatically; omit it and you must call\n   * `destroy()` yourself. A stray timer firing after teardown writes to a\n   * destroyed component — the kind of leak that only shows up under a router\n   * that reuses the route.\n   */\n  readonly destroyRef?: DestroyRef | null;\n}\n\n/** A value that trails its input by a delay. */\nexport interface SvDebouncer<T> {\n  /** The settled value. This is what you fire requests from. */\n  readonly value: Signal<T>;\n  /** The latest value, un-delayed. This is what you bind to the input box. */\n  readonly raw: Signal<T>;\n  /** True between a `set()` and the value settling. */\n  readonly pending: Signal<boolean>;\n  /** Record a new value and (re)start the delay. */\n  set(next: T): void;\n  /** Settle immediately — for Enter, or blur, where waiting is wrong. */\n  flush(): void;\n  /** Drop the pending value; `value` keeps its last settled contents. */\n  cancel(): void;\n  /** Clear the timer. Called for you when `destroyRef` was supplied. */\n  destroy(): void;\n}\n\nconst DEFAULT_DELAY_MS = 300;\n\n/**\n * Debounce a value into a signal, with no rxjs and no injection context.\n *\n * ```ts\n * protected readonly search = createDebouncer('', {\n *   delayMs: this.debounceMs,\n *   destroyRef: inject(DestroyRef),\n * });\n *\n * constructor() {\n *   effect(() => this.queryChange.emit(patchQuery(this.query(), {\n *     search: this.search.value(),\n *   })));\n * }\n * ```\n *\n * Pair it with {@link createRequestGuard}: debouncing cuts the number of\n * requests, the guard makes the ones that do overlap land in the right order.\n * Neither replaces the other.\n */\nexport function createDebouncer<T>(initial: T, options: SvDebouncerOptions = {}): SvDebouncer<T> {\n  const delay = options.delayMs ?? DEFAULT_DELAY_MS;\n  const delayOf = (): number => {\n    const ms = typeof delay === 'number' ? delay : delay();\n    return Number.isFinite(ms) && ms > 0 ? ms : 0;\n  };\n\n  const settled = signal(initial);\n  const raw = signal(initial);\n  let timer: ReturnType<typeof setTimeout> | null = null;\n\n  const clear = (): void => {\n    if (timer !== null) {\n      clearTimeout(timer);\n      timer = null;\n    }\n  };\n\n  const api: SvDebouncer<T> = {\n    value: settled.asReadonly(),\n    raw: raw.asReadonly(),\n    // Derived rather than a third signal: one source of truth, and it cannot\n    // drift out of sync with the timer.\n    pending: computed(() => !Object.is(raw(), settled())),\n\n    set: (next: T) => {\n      raw.set(next);\n      clear();\n      const ms = delayOf();\n      if (ms === 0) {\n        settled.set(next);\n        return;\n      }\n      timer = setTimeout(() => {\n        timer = null;\n        settled.set(next);\n      }, ms);\n    },\n\n    flush: () => {\n      clear();\n      settled.set(raw());\n    },\n\n    cancel: () => {\n      clear();\n      raw.set(settled());\n    },\n\n    destroy: clear,\n  };\n\n  options.destroyRef?.onDestroy(clear);\n\n  return api;\n}\n","import type { SvItemKey } from './types';\nimport { svWarn } from '@styloviz/core/dev';\n\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * ============================================================================\n *  The identity contract every collection family answers (audit item X-6)\n * ============================================================================\n *\n * Two questions, one answer per family, so a buyer who has learned the List\n * View already knows the Tree, the Kanban, the Transfer and the Data Table:\n *\n *  1. **What is this item's key?** An `itemKey` input typed {@link SvItemKey},\n *     defaulting to the property the family already assumed (`'id'` almost\n *     everywhere, `'key'` for the Transfer). A string names a property; a\n *     function builds a composite key, which is the case that used to be\n *     impossible — six families hardcoded `item.id` and the seventh took a\n *     `string`, so a row identified by `orderId + lineNo` had no way in.\n *\n *  2. **Who owns this item's state?** Anything the host might want to restore,\n *     persist, or drive — which selection, expansion and collapse all are — is\n *     a `model()`, so it can be both set and observed. Held in a plain\n *     `signal`, that state is invisible: a table's expanded rows could not be\n *     restored after a route change because the host had no way to write them\n *     and no way to learn they had changed.\n *\n * Both halves are enforced by `scripts/check-collection-identity.mjs` rather\n * than by review, because the drift they prevent is exactly the kind that\n * reappears one family at a time.\n * ============================================================================\n */\n\n/** One warning per property name, so a 500-row list logs once, not 500 times. */\nconst warned = new Set<string>();\n\nfunction warnOnce(key: string): void {\n  if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n  if (warned.has(key)) return;\n  warned.add(key);\n  svWarn(\n    `[styloviz] itemKey \"${key}\" is missing or not a string/number on at least one item — ` +\n      'falling back to the list index. Server refreshes will reuse DOM by position: ' +\n      'focus can jump, and the wrong row can appear selected. Pass an itemKey that exists ' +\n      'on every item, or a function for composite keys.',\n  );\n}\n\n/**\n * Resolve an item's stable identity, falling back to its index.\n *\n * The fallback keeps a misconfigured component rendering rather than throwing,\n * but it is a real defect — hence the dev-mode warning. It is silent in\n * production builds.\n */\nexport function resolveItemKey<T>(\n  item: T,\n  key: SvItemKey<T> | null | undefined,\n  index: number,\n): string | number {\n  if (typeof key === 'function') return key(item, index);\n\n  if (typeof key === 'string' && key) {\n    const value = (item as Record<string, unknown> | null)?.[key];\n    if (typeof value === 'string' || typeof value === 'number') return value;\n    warnOnce(key);\n  }\n\n  return index;\n}\n\n/**\n * Build a `track` function for `@for` from a fixed key.\n *\n * The argument order matches Angular's `track` expression and the kit's\n * existing `trackByRow($index, row)` usage:\n *\n * ```ts\n * protected readonly trackItem = trackByItemKey<Order>('id');\n * ```\n * ```html\n * @for (item of items(); track trackItem($index, item)) { … }\n * ```\n *\n * When the key comes from a signal input, call {@link resolveItemKey} directly\n * instead — a `SvItemKey` may itself be a function, so a helper cannot tell a\n * key-function from a signal accessor without guessing:\n *\n * ```ts\n * protected readonly trackItem = (i: number, item: Order): string | number =>\n *   resolveItemKey(item, this.itemKey(), i);\n * ```\n */\nexport function trackByItemKey<T>(\n  key: SvItemKey<T> | null | undefined,\n): (index: number, item: T) => string | number {\n  return (index, item) => resolveItemKey(item, key, index);\n}\n\n/**\n * Warn, in dev builds only, when two items resolve to the same key.\n *\n * Angular's own diagnostic for this is NG0955, which it raises from inside\n * `@for` after the duplicate has already destroyed the view: the collection\n * disappears and the message names neither the input that supplied it nor the\n * key that collided. The Kanban hit the same wall from the other side — two\n * cards confirmed inside one millisecond shared a `Date.now()` id — and the\n * only reason it was diagnosable was that someone happened to be looking.\n *\n * So the check runs first, where the component still knows which input the rows\n * arrived on and what the offending key was, and it does not throw: a warning\n * plus a rendered list beats a correct complaint about a blank screen.\n *\n * Call it from wherever the family already derives its rendered rows:\n *\n * ```ts\n * protected readonly rows = computed(() => {\n *   const rows = this.filtered();\n *   warnOnDuplicateItemKeys(rows, this.itemKey(), 'sv-data-table [rows]');\n *   return rows;\n * });\n * ```\n *\n * @param context Which component and input to name in the message — the reader\n *   is holding a page of several collections and needs to know which one.\n */\nexport function warnOnDuplicateItemKeys<T>(\n  items: readonly T[] | null | undefined,\n  key: SvItemKey<T> | null | undefined,\n  context: string,\n): void {\n  if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n  if (!items || items.length < 2) return;\n  if (warned.has(`dup:${context}`)) return;\n\n  const seen = new Set<string | number>();\n  for (let i = 0; i < items.length; i++) {\n    const id = resolveItemKey(items[i], key, i);\n    if (seen.has(id)) {\n      warned.add(`dup:${context}`);\n      svWarn(\n        `[styloviz] ${context}: two items share the key ${JSON.stringify(id)}. ` +\n          'Angular rejects a duplicate track key (NG0955) and destroys the view, so the ' +\n          'collection renders blank. Give every item a unique key, or pass an itemKey ' +\n          'function that combines fields into one.',\n      );\n      return;\n    }\n    seen.add(id);\n  }\n}\n","import { svWarn } from '@styloviz/core/dev';\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * ============================================================================\n *  A hierarchy that cannot be walked (audit items DD-45-I4, DD-45-M3)\n * ============================================================================\n *\n * Every tree component in the kit walks `children` recursively — to flatten the\n * visible rows, to seed expansion, to roll a checkbox up to its ancestors, to\n * find a node before moving it. All of that is correct for a tree and none of it\n * terminates on a graph.\n *\n * A cycle is not an exotic input. It is what a host produces the ordinary way:\n * rows arrive flat with a `parentId`, the host builds `children` by looking each\n * parent up in a map, and one row's `parentId` points at its own descendant —\n * because someone dragged a folder into itself in another client, or a migration\n * reparented a row, or the id is a slug two rows share. The tree then recurses\n * until the stack ends and the whole tab dies. There is no error boundary in\n * front of that and nothing in the type system that could have said so.\n *\n * So the tree does not walk what it was given. It walks the result of this\n * function: the same tree with every back-edge cut, plus the list of nodes whose\n * children were dropped. Rendering a truncated branch and saying so is strictly\n * better than rendering nothing and taking the page with it.\n * ============================================================================\n */\n\n/** The shape this walks: an identified node with optional nested children. */\nexport interface SvHierarchyNode {\n  readonly id: string;\n  children?: SvHierarchyNode[];\n}\n\n/**\n * How to read a node that is not shaped like {@link SvHierarchyNode}.\n *\n * The treemap is the second consumer of this walk and its nodes carry a `label`\n * rather than an `id`, with a `readonly` child array. Rather than a second\n * cycle-cutter that could disagree with this one about what a cycle is, the walk\n * takes accessors and there stays exactly one answer.\n */\nexport interface SvHierarchyAccessors<T> {\n  /** Names the node in the cycle report and in the dev warning. */\n  readonly label: (node: T) => string;\n  /** The node's children, if it has any. */\n  readonly children: (node: T) => readonly T[] | undefined;\n  /** Rebuilds a node around a new child list. Only called on a branch that was cut. */\n  readonly withChildren: (node: T, children: readonly T[]) => T;\n}\n\nconst DEFAULT_ACCESSORS: SvHierarchyAccessors<SvHierarchyNode> = {\n  label: node => node.id,\n  children: node => node.children,\n  withChildren: (node, children) => ({ ...node, children: [...children] }),\n};\n\n/** One node that was its own ancestor. */\nexport interface SvHierarchyCycle {\n  /** The repeated node's id. */\n  readonly id: string;\n  /** Ids from the root down to the repeat, so the loop can be found in the data. */\n  readonly path: readonly string[];\n}\n\n/** A tree that is safe to recurse into, and what had to be cut to make it one. */\nexport interface SvAcyclicHierarchy<T> {\n  /**\n   * The tree with each back-edge removed. The very same arrays and objects when\n   * there was no cycle, so the common case allocates nothing and a host's\n   * `[nodes]` identity survives for change detection.\n   */\n  readonly nodes: readonly T[];\n  /** Empty when the input was already a tree. */\n  readonly cycles: readonly SvHierarchyCycle[];\n}\n\n/** One warning per selector, so a 5,000-node tree logs once rather than per row. */\nconst warned = new Set<string>();\n\n/**\n * The tree with every cycle cut, and the cuts that were made.\n *\n * Detection is by node **identity**, not by id: a repeated object reference is\n * what makes the recursion infinite, and it is the only thing that does. Two\n * distinct objects sharing an id nest finitely — that is a duplicate-key defect,\n * which {@link warnOnDuplicateItemKeys} already reports, and cutting it here\n * would silently drop a branch a host meant to render twice.\n *\n * A cut node keeps its place and its label and loses only its children, which is\n * the honest rendering: the loop means its subtree is not a subtree.\n *\n * @param nodes    Root nodes, as supplied by the host.\n * @param selector Component selector, used to name the source in the warning.\n */\nexport function svCutHierarchyCycles<T extends SvHierarchyNode>(\n  nodes: readonly T[],\n  selector: string,\n): SvAcyclicHierarchy<T>;\nexport function svCutHierarchyCycles<T>(\n  nodes: readonly T[],\n  selector: string,\n  accessors: SvHierarchyAccessors<T>,\n): SvAcyclicHierarchy<T>;\nexport function svCutHierarchyCycles<T>(\n  nodes: readonly T[],\n  selector: string,\n  accessors?: SvHierarchyAccessors<T>,\n): SvAcyclicHierarchy<T> {\n  const read = (accessors ??\n    (DEFAULT_ACCESSORS as unknown as SvHierarchyAccessors<T>));\n  const cycles: SvHierarchyCycle[] = [];\n  const onPath = new Set<T>();\n  const labels: string[] = [];\n\n  /** Returns the rebuilt level, or `null` when nothing at or below it changed. */\n  const walk = (level: readonly T[]): T[] | null => {\n    let changed = false;\n    const out: T[] = [];\n\n    for (const node of level) {\n      if (onPath.has(node)) {\n        cycles.push({ id: read.label(node), path: [...labels] });\n        // Drop the repeat entirely rather than keeping it childless: it is the\n        // SAME node already on screen higher up, and a second copy of a row the\n        // user is looking at reads as two things that exist.\n        changed = true;\n        continue;\n      }\n\n      const children = read.children(node);\n      if (!children?.length) {\n        out.push(node);\n        continue;\n      }\n\n      onPath.add(node);\n      labels.push(read.label(node));\n      const next = walk(children);\n      labels.pop();\n      onPath.delete(node);\n\n      if (next === null) {\n        out.push(node);\n      } else {\n        out.push(read.withChildren(node, next));\n        changed = true;\n      }\n    }\n\n    return changed ? out : null;\n  };\n\n  const safe = walk(nodes) ?? nodes;\n\n  if (cycles.length && typeof ngDevMode !== 'undefined' && ngDevMode && !warned.has(selector)) {\n    warned.add(selector);\n    const first = cycles[0];\n    svWarn(\n      `[styloviz] ${selector}: [nodes] contains ${cycles.length} cycle(s) — ` +\n        `\"${first.id}\" is its own descendant, reached via ${first.path.join(' → ')}. ` +\n        'Those branches are cut so the tree can be rendered; walking them would ' +\n        'recurse until the stack ends. This is almost always a parentId that points ' +\n        'at a descendant, or two rows sharing an id.',\n    );\n  }\n\n  return { nodes: safe, cycles };\n}\n","/**\n * live-feed.ts — the questions every streaming chart has to answer, answered once.\n *\n * ★★★ SIX VARIANTS ANSWERED THESE SIX DIFFERENT WAYS, WHICH MEANS FIVE OF THEM\n *     WERE WRONG ABOUT SOMETHING. A chart that updates on a timer has to decide\n *     what happens when the tab is hidden, how much history it keeps, what it\n *     does with a sample that arrives out of order or twice, and what it tells\n *     the reader about any of it. None of those are chart-specific questions and\n *     none of them were being asked consistently.\n *\n * ★ The visibility half lives in `visibility-pause.ts` because it needs an\n *   injection context and a `document`. Everything here is arithmetic on an\n *   array, which is what lets it be tested with no DOM and no Angular at all.\n */\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/** How a feed treats a sample that is not newer than the one before it. */\nexport type SvLateSamplePolicy = 'append' | 'drop' | 'reorder';\n\n/** Options for {@link svAppendSample}. */\nexport interface SvAppendSampleOptions<T = unknown> {\n  /**\n   * How many samples to keep. Older ones fall off the front.\n   * @default 0 — unbounded\n   */\n  readonly retain?: number;\n  /**\n   * What to do with a sample whose timestamp is not after the last one.\n   *\n   * - `append` (default) — keep it in arrival order. Right for a feed with no\n   *   meaningful timestamps, where position IS the order.\n   * - `drop` — refuse it. Right when a repeat is a retransmission.\n   * - `reorder` — insert it where its timestamp belongs. Right when the\n   *   transport can genuinely deliver out of order.\n   * @default 'append'\n   */\n  readonly late?: SvLateSamplePolicy;\n  /** Reads a sample's timestamp. Required for `drop` and `reorder`. */\n  readonly timestamp?: (sample: T) => number;\n}\n\n/** The new history, and what had to be done to get it. */\nexport interface SvAppendResult<T> {\n  readonly samples: readonly T[];\n  /** True when the incoming sample was refused. */\n  readonly dropped: boolean;\n  /** True when it had to be inserted before the end. */\n  readonly reordered: boolean;\n  /** How many old samples fell off the front to stay within `retain`. */\n  readonly evicted: number;\n}\n\n/**\n * Append one sample to a bounded history, applying the late-sample policy.\n *\n * ★ Returns a NEW array only when something changed, so an unchanged history\n *   keeps its identity for change detection.\n *\n * ★ `retain` counts the result, not the input: a feed asked to keep 60 points\n *   holds 60 after the append, not 61. Off-by-one here is a chart that slowly\n *   grows past the window its own axis is drawn for.\n */\nexport function svAppendSample<T>(\n  history: readonly T[],\n  sample: T,\n  options: SvAppendSampleOptions<T> = {},\n): SvAppendResult<T> {\n  const retain = options.retain ?? 0;\n  const late = options.late ?? 'append';\n  const stamp = options.timestamp;\n\n  let reordered = false;\n  let next: T[];\n\n  if (late !== 'append' && stamp && history.length > 0) {\n    const incoming = stamp(sample);\n    const last = stamp(history[history.length - 1]!);\n\n    if (Number.isFinite(incoming) && Number.isFinite(last) && incoming <= last) {\n      if (late === 'drop') {\n        return { samples: history, dropped: true, reordered: false, evicted: 0 };\n      }\n      // `reorder`: find the first sample it should precede.\n      const at = history.findIndex(s => {\n        const t = stamp(s);\n        return Number.isFinite(t) && t > incoming;\n      });\n      const index = at === -1 ? history.length : at;\n      next = [...history.slice(0, index), sample, ...history.slice(index)];\n      reordered = index < history.length;\n    } else {\n      next = [...history, sample];\n    }\n  } else {\n    next = [...history, sample];\n  }\n\n  let evicted = 0;\n  if (retain > 0 && next.length > retain) {\n    evicted = next.length - retain;\n    next = next.slice(evicted);\n  }\n\n  return { samples: next, dropped: false, reordered, evicted };\n}\n\n/**\n * The sentence a feed owes its reader after a pause, or `null` when the gap is\n * too short to matter.\n *\n * ★★ A RESUMED FEED THAT SAYS NOTHING DRAWS A CONTINUOUS LINE ACROSS A GAP\n *    WHERE NOTHING WAS SAMPLED. That is the same lie as interpolating a missing\n *    reading, and worse, because the reader has no reason to suspect it: the\n *    chart looks exactly like one that ran the whole time.\n *\n * The floor exists because a tab switch of half a second is not a gap in the\n * data — it is a person alt-tabbing — and a chart that announced every one of\n * those would train its reader to ignore the line that matters.\n */\nexport function svPauseNotice(\n  pausedMs: number,\n  floorMs = 2000,\n  labels: Pick<SvCoreLabels, 'pauseNoticeSeconds' | 'pauseNoticeMinutes'> = SV_CORE_LABELS,\n  locale = '',\n): string | null {\n  if (!Number.isFinite(pausedMs) || pausedMs < floorMs) return null;\n\n  const seconds = Math.round(pausedMs / 1000);\n  return seconds < 60\n    ? svFormatLabel(labels.pauseNoticeSeconds, { count: seconds }, locale)\n    : svFormatLabel(labels.pauseNoticeMinutes, { count: Math.round(seconds / 60) }, locale);\n}\n","/**\n * record-merge.ts — identity, version and order for a list that arrives in\n * pieces (`X-12`, `OF-10-M1`, `OF-10-M5`).\n *\n * ★★★ EVERY REALTIME LIST IN A DASHBOARD HAS THE SAME FOUR QUESTIONS, AND\n *     WRITING THEM PER FEATURE MEANS WRITING THEM WRONG SOMEWHERE: which\n *     record is this one (identity), is what just arrived NEWER than what I\n *     have (version), are these two rows the same event (deduplication), and\n *     what order do they go in (sequence). A notification centre asks all\n *     four; so does an activity feed, an audit log and an inbox.\n *\n * ★★ PURE ARITHMETIC ON ARRAYS — no Angular, no DOM, no signals. That is what\n *    lets it be tested exhaustively (`.node.spec.ts`) and used from a host's\n *    own store, which is where a realtime list actually lives. The components\n *    take `[items]` as an INPUT: merging is the host's job, and this is the\n *    thing the host would otherwise have to get right alone.\n */\n\n/** The shape a mergeable record has to have. Everything but `id` is optional. */\nexport interface SvMergeableRecord {\n  /** Stable server identity. Two records with the same `id` are one record. */\n  readonly id: string;\n  /**\n   * Monotonic per-record revision. A lower one is stale and is rejected.\n   *\n   * ★ WITHOUT THIS A STALE UPDATE CANNOT BE DETECTED AT ALL, which is the\n   *   finding: an out-of-order delivery — two sockets, a retry, a replay after\n   *   a reconnect — overwrote a newer row with an older copy of itself, and\n   *   the row silently went backwards in time.\n   */\n  readonly version?: number;\n  /**\n   * Monotonic position in the STREAM, not in this record's history.\n   *\n   * ★★ A DIFFERENT AXIS FROM `version`, and both are needed. `version` orders\n   *    a record against its own past; `seq` orders records against each other\n   *    when timestamps tie or the clocks disagree — which they do, because\n   *    `timestamp` is a string somebody's server rendered.\n   */\n  readonly seq?: number;\n  /** ISO timestamp. The ordering fallback when the stream has no `seq`. */\n  readonly timestamp?: string;\n  /**\n   * Two records with the same key are the same EVENT and collapse into one.\n   *\n   * ★ Different from `id`, which is the same RECORD. Three comments on one\n   *   ticket are three records and, for a notification list, one event.\n   */\n  readonly dedupeKey?: string;\n  /** Pinned records sort before everything else, whatever the order rule. */\n  readonly pinned?: boolean;\n}\n\n/** What {@link svMergeRecords} did, for a host that wants to react to it. */\nexport interface SvMergeReport<T> {\n  /** The merged list, ordered by {@link svOrderRecords}. */\n  readonly items: readonly T[];\n  /** Records that were not present before. */\n  readonly added: readonly T[];\n  /** Records that replaced an existing one. */\n  readonly updated: readonly T[];\n  /**\n   * Records refused as STALE — an equal or lower `version` than the copy held.\n   *\n   * ★ Reported rather than swallowed. A stream that keeps delivering stale\n   *   revisions is a bug in something, and the only party that can see the\n   *   pattern is the host.\n   */\n  readonly rejected: readonly T[];\n  /**\n   * Records dropped because another record shares their `dedupeKey`.\n   *\n   * ★ No count is written onto the survivor. A collapsed group's headline is\n   *   copy — \"3 new comments on TICKET-14\" — and copy is the host's, not a\n   *   number this function can invent a wording for. The dropped records are\n   *   handed back so the host can write it.\n   */\n  readonly collapsed: readonly T[];\n}\n\n/** Options for {@link svMergeRecords}. */\nexport interface SvMergeOptions {\n  /**\n   * Collapse records that share a `dedupeKey`. @default true\n   *\n   * ★ On by default, because a `dedupeKey` is only ever set deliberately: a\n   *   record that carries one is asking to be collapsed.\n   */\n  readonly collapse?: boolean;\n}\n\nconst MISSING_TIME = Number.NEGATIVE_INFINITY;\n\n/** Epoch ms, or `-Infinity` for a missing or unparseable timestamp. */\nfunction timeOf(record: SvMergeableRecord): number {\n  const raw = record.timestamp;\n  if (!raw) return MISSING_TIME;\n  const ms = new Date(raw).getTime();\n  // ★★ `NaN` IS THE WHOLE REASON THIS FUNCTION EXISTS. `new Date('n/a')`\n  //    gives an Invalid Date, whose `getTime()` is NaN, and a comparator that\n  //    returns NaN makes the sort's result implementation-defined — rows\n  //    change places between two renders of the same data. One unparsed\n  //    timestamp from one integration was enough. Undated records sort last,\n  //    which is at least a decision.\n  return Number.isNaN(ms) ? MISSING_TIME : ms;\n}\n\n/**\n * Order a list: pinned first, then newest first, then by id.\n *\n * ★★★ `seq` IS USED ONLY WHEN EVERY RECORD HAS ONE, and this is deliberate\n *     rather than lenient. Deciding per PAIR — \"use seq if both have it, else\n *     timestamp\" — builds an intransitive comparator: a beats b on seq, b\n *     beats c on timestamp, and c beats a. A sort given an intransitive\n *     comparator does not merely order things oddly; it produces a different\n *     answer depending on the array's starting arrangement. A sequence is a\n *     property of the STREAM, so it is decided once for the list.\n *\n * ★ The final tiebreak is `id`, so two records that are equal by every other\n *   measure still have ONE order. Without it, \"equal\" rows swap places\n *   whenever anything else about the list changes, and a user watching a live\n *   list sees rows twitch.\n */\nexport function svOrderRecords<T extends SvMergeableRecord>(\n  records: readonly T[],\n): readonly T[] {\n  const sequenced = records.length > 0 && records.every((r) => typeof r.seq === 'number');\n  return [...records].sort((a, b) => {\n    if (!!a.pinned !== !!b.pinned) return a.pinned ? -1 : 1;\n    if (sequenced) {\n      const bySeq = (b.seq as number) - (a.seq as number);\n      if (bySeq !== 0) return bySeq;\n    } else {\n      const byTime = timeOf(b) - timeOf(a);\n      if (byTime !== 0) return byTime;\n    }\n    return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n  });\n}\n\n/**\n * Is `incoming` newer than `held`?\n *\n * ★★ THE ASYMMETRY IS THE DECISION. Both versioned: higher wins, and EQUAL\n *    loses — a redelivery of the same revision is not news, and accepting it\n *    would replace the object for no reason, which re-renders a row the user\n *    may be interacting with.\n *\n * ★ Incoming with no version wins. \"No version\" means the source does not\n *   version, not that the record is old — refusing it would freeze that row\n *   for the life of the session. Held-without-version, incoming-with: the\n *   incoming wins too, for the same reason read the other way.\n */\nfunction isNewer(incoming: SvMergeableRecord, held: SvMergeableRecord): boolean {\n  if (typeof incoming.version !== 'number') return true;\n  if (typeof held.version !== 'number') return true;\n  return incoming.version > held.version;\n}\n\n/**\n * Fold `incoming` into `current`: same id replaces (if newer), new id adds,\n * shared `dedupeKey` collapses, and the result is ordered.\n *\n * ★ `current` is not mutated, and neither are the records. The result is a new\n *   array of the same object references wherever nothing changed, so a\n *   `track`-by-identity render only re-creates the rows that actually moved.\n */\nexport function svMergeRecords<T extends SvMergeableRecord>(\n  current: readonly T[],\n  incoming: readonly T[],\n  options: SvMergeOptions = {},\n): SvMergeReport<T> {\n  const byId = new Map<string, T>();\n  // ★★ A duplicate id inside `current` is not the host being careless — it is\n  //    what a naive append produces, and Angular's `@for` THROWS on a\n  //    duplicate track key, so the list is already unrenderable by the time it\n  //    reaches here. Collapsing it is therefore not tidying: it is the\n  //    difference between a panel and an exception.\n  //\n  // ★ The same version rule decides which copy survives, rather than \"last\n  //   wins\": a replay that appended an older revision after a newer one is the\n  //   exact case this function exists for, and position is not evidence.\n  for (const record of current) {\n    const held = byId.get(record.id);\n    if (!held || isNewer(record, held)) byId.set(record.id, record);\n  }\n\n  const added:    T[] = [];\n  const updated:  T[] = [];\n  const rejected: T[] = [];\n\n  for (const record of incoming) {\n    const held = byId.get(record.id);\n    if (!held) {\n      byId.set(record.id, record);\n      added.push(record);\n      continue;\n    }\n    if (!isNewer(record, held)) {\n      rejected.push(record);\n      continue;\n    }\n    byId.set(record.id, record);\n    updated.push(record);\n  }\n\n  const ordered = svOrderRecords([...byId.values()]);\n\n  if (options.collapse === false) {\n    return { items: ordered, added, updated, rejected, collapsed: [] };\n  }\n\n  // ★ Collapse AFTER ordering, so the survivor is the first in the order the\n  //   user will see — the newest, or the pinned one — rather than whichever\n  //   arrived first.\n  const seen = new Set<string>();\n  const kept: T[] = [];\n  const collapsed: T[] = [];\n  for (const record of ordered) {\n    const key = record.dedupeKey;\n    if (key === undefined) {\n      kept.push(record);\n      continue;\n    }\n    if (seen.has(key)) {\n      collapsed.push(record);\n      continue;\n    }\n    seen.add(key);\n    kept.push(record);\n  }\n\n  return { items: kept, added, updated, rejected, collapsed };\n}\n","import { DestroyRef, PLATFORM_ID, inject, signal, type Signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * visibility-pause.ts — a background tab should cost nothing.\n *\n * ★★★ NOT ONE LIVE CHART LISTENED FOR `visibilitychange`. A dashboard left open\n *     behind another window kept its interval, its `requestAnimationFrame`\n *     chain and its change detection running for as long as it was there — on a\n *     laptop, for hours. Browsers throttle a hidden tab's timers but do not stop\n *     them, and they do nothing at all about the work each tick queues.\n *\n * ★★★ AND STOPPING IS ONLY HALF OF IT. A feed that silently resumes draws a\n *     continuous line across a stretch where nothing was sampled — the same lie\n *     as interpolating a missing reading, and worse, because the chart looks\n *     exactly like one that ran the whole time. See `svPauseNotice`.\n */\n\n/** What a paused feed knows when it comes back. */\nexport interface SvLivePause {\n  /** True while the document is hidden and the feed is stopped. */\n  readonly paused: Signal<boolean>;\n  /**\n   * How long the most recent pause lasted, in milliseconds. `0` before the\n   * first pause, and it keeps the LAST pause's duration after resuming so the\n   * chart can disclose the gap it just skipped.\n   */\n  readonly lastPauseMs: Signal<number>;\n  /**\n   * Be told the moment the tab hides (`true`) or comes back (`false`), after\n   * `paused` and `lastPauseMs` have been updated. Returns an unsubscribe.\n   *\n   * ★ This is what lets a caller STOP its interval rather than skip ticks. A\n   *   skipped tick is still a timer firing, and in a zone.js host every one of\n   *   those is a change-detection pass behind a tab nobody is looking at.\n   */\n  readonly onChange: (listener: (paused: boolean) => void) => () => void;\n  /** Stop listening. Called for you when the injection context is destroyed. */\n  readonly destroy: () => void;\n}\n\n/**\n * Stop a feed while its tab is hidden, and remember how long for.\n *\n * Must be called from an injection context — it takes its own `DestroyRef`, so\n * a component that creates one cannot leak the listener.\n *\n * ★ SSR-safe: with no `document` there is nothing to hide, so `paused` stays\n *   false and no listener is registered. A server render must not reach for a\n *   browser global, and a feed that \"paused\" on the server would render its\n *   disclosure into the static HTML.\n *\n * ★ It reports the pause but owns no timer — `onChange` tells the caller when\n *   to stop and restart its own. `createLiveTicker` is that caller for the\n *   common case of one interval.\n */\nexport function createVisibilityPause(): SvLivePause {\n  const paused = signal(false);\n  const lastPauseMs = signal(0);\n  const platformId = inject(PLATFORM_ID);\n\n  if (!isPlatformBrowser(platformId) || typeof document === 'undefined') {\n    return { paused, lastPauseMs, onChange: () => () => undefined, destroy: () => undefined };\n  }\n\n  const listeners = new Set<(paused: boolean) => void>();\n  const onChangeListener = (listener: (paused: boolean) => void): (() => void) => {\n    listeners.add(listener);\n    return () => listeners.delete(listener);\n  };\n\n  // ★ A tab can be born hidden — a dashboard opened with a middle-click, or\n  //   restored behind another window. No `visibilitychange` fires for that,\n  //   so reading the state only on change left the feed running at full price\n  //   until the reader had looked at it and looked away again.\n  let hiddenAt = document.visibilityState === 'hidden' ? Date.now() : 0;\n  if (hiddenAt > 0) paused.set(true);\n\n  const onChange = (): void => {\n    if (document.visibilityState === 'hidden') {\n      // A repeat `hidden` must not restart the clock — the pause began at the\n      // first one, and resetting it would under-report the gap.\n      if (hiddenAt > 0) return;\n      hiddenAt = Date.now();\n      paused.set(true);\n      listeners.forEach(l => l(true));\n    } else {\n      // Visible-to-visible is not a resume: nothing paused, nothing to tell.\n      if (hiddenAt === 0) return;\n      // `hiddenAt` of zero means we were never hidden — a visibilitychange can\n      // fire visible-to-visible on some platforms, and reporting `Date.now()`\n      // as the gap would claim a pause since the epoch.\n      lastPauseMs.set(Date.now() - hiddenAt);\n      hiddenAt = 0;\n      paused.set(false);\n      listeners.forEach(l => l(false));\n    }\n  };\n\n  document.addEventListener('visibilitychange', onChange);\n  const destroy = (): void => {\n    document.removeEventListener('visibilitychange', onChange);\n    listeners.clear();\n  };\n  inject(DestroyRef).onDestroy(destroy);\n\n  return { paused, lastPauseMs, onChange: onChangeListener, destroy };\n}\n","import { DestroyRef, PLATFORM_ID, computed, inject, signal, untracked, type Signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { svPauseNotice } from './live-feed';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\nimport { svLocale } from '@styloviz/core/i18n';\nimport { createVisibilityPause, type SvLivePause } from './visibility-pause';\n\n/**\n * live-ticker.ts — one interval that is actually off while its tab is hidden,\n * and a gap notice that is only ever about that interval.\n *\n * ★★★ SKIPPING A TICK IS NOT STOPPING A TIMER. The live charts used to check\n *     `paused()` inside the tick and return — the interval kept firing, and in a\n *     zone.js host every firing is a change-detection pass behind a tab nobody\n *     is looking at. This clears the interval on hide and creates a new one on\n *     return.\n *\n * ★★★ AND THE GAP NOTICE BELONGS TO THE GENERATOR, NOT TO THE TAB. \"Updates\n *     stopped … nothing was sampled\" is true of a chart whose own timer was\n *     stopped. It is false of a chart the host feeds — the host's socket kept\n *     delivering while the tab was hidden. So `gapMs` is set only when THIS\n *     ticker was running at the moment the tab hid.\n */\n\n/** What a live chart hands the ticker. Every callback is read lazily, never at construction. */\nexport interface SvLiveTickerOptions {\n  /** Called once per interval while the ticker runs. */\n  readonly tick: () => void;\n  /** Interval in ms. A value ≤ 0 or non-finite keeps the ticker off. */\n  readonly intervalMs: () => number;\n  /**\n   * Whether the component wants its generator running — \"the user has not\n   * paused it, and there is a generator at all\". Visibility is layered on top;\n   * do not fold it in here.\n   */\n  readonly enabled: () => boolean;\n}\n\n/** A visibility-aware interval. */\nexport interface SvLiveTicker {\n  /** The tab-visibility state the ticker listens to. */\n  readonly visibility: SvLivePause;\n  /** True while an interval is actually scheduled. */\n  readonly active: Signal<boolean>;\n  /**\n   * Length of the last hidden stretch during which this ticker was running and\n   * so was stopped. `0` until then — a hidden tab while the ticker was already\n   * off (user-paused, or a host-fed chart with no generator) leaves it alone.\n   */\n  readonly gapMs: Signal<number>;\n  /** `svPauseNotice(gapMs())` — the sentence to put under the plot, or null. */\n  readonly notice: Signal<string | null>;\n  /**\n   * Re-evaluate whether the interval should run: call after anything\n   * `enabled` or `intervalMs` reads has changed. Idempotent — never schedules\n   * a second interval.\n   */\n  readonly sync: () => void;\n  /** Forget the last gap, e.g. when the history it described was reset. */\n  readonly clearGap: () => void;\n}\n\n/**\n * Create a visibility-aware interval in an injection context. The interval is\n * cleared on destroy, and never scheduled during SSR.\n */\nexport function createLiveTicker(options: SvLiveTickerOptions): SvLiveTicker {\n  const visibility = createVisibilityPause();\n  const browser = isPlatformBrowser(inject(PLATFORM_ID));\n  const labels = injectSvLabels('core', SV_CORE_LABELS);\n  const locale = svLocale();\n  const active = signal(false);\n  const gapMs = signal(0);\n\n  let handle: ReturnType<typeof setInterval> | null = null;\n  let runningMs = 0;\n  /** Whether the ticker was running — and generating — when the tab hid. */\n  let stoppedByHide = false;\n\n  const stop = (): void => {\n    if (handle !== null) clearInterval(handle);\n    handle = null;\n    active.set(false);\n  };\n\n  const sync = (): void =>\n    untracked(() => {\n      const ms = options.intervalMs();\n      const want =\n        browser && !visibility.paused() && Number.isFinite(ms) && ms > 0 && options.enabled();\n      if (!want) {\n        stop();\n        return;\n      }\n      if (handle !== null && runningMs === ms) return;\n      stop();\n      runningMs = ms;\n      handle = setInterval(() => options.tick(), ms);\n      active.set(true);\n    });\n\n  visibility.onChange(hidden => {\n    if (hidden) {\n      // `enabled()` too, not just the handle: a chart whose generator was\n      // switched off since the last sync (a host started supplying data) was\n      // not generating, so it has no gap of its own to report.\n      stoppedByHide = handle !== null && untracked(() => options.enabled());\n      stop();\n    } else {\n      if (stoppedByHide) gapMs.set(untracked(() => visibility.lastPauseMs()));\n      stoppedByHide = false;\n      sync();\n    }\n  });\n\n  inject(DestroyRef).onDestroy(stop);\n\n  return {\n    visibility,\n    active: active.asReadonly(),\n    gapMs: gapMs.asReadonly(),\n    notice: computed(() => svPauseNotice(gapMs(), undefined, labels, locale)),\n    sync,\n    clearGap: () => gapMs.set(0),\n  };\n}\n","import { DestroyRef, PLATFORM_ID, inject, signal, type Signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * offscreen-pause.ts — a live surface below the fold should cost nothing either.\n *\n * ★★★ `visibilitychange` IS ONLY HALF THE SAVING. It fires when the *tab* goes\n *     away, and a wallboard, a long dashboard or a queue three screens down a\n *     scrolling page is visible to the browser and invisible to the reader. The\n *     tick costs the same either way: a timer, a signal write, a change\n *     detection pass and a reflow, once a second, for a surface nobody is\n *     looking at.\n *\n * ★★★ AND THE FALLBACK IS TODAY'S BEHAVIOUR, NOT A PAUSE. With no\n *     `IntersectionObserver` — SSR, a DOM shim, an old browser — `offscreen`\n *     stays false and the caller keeps ticking. A pause that fires because the\n *     environment lacks an observer would freeze a queue the reader is watching,\n *     which is a far worse failure than a wasted interval.\n *\n * Pairs with `createVisibilityPause`: a caller that wants both stops when either\n * says so, which is one `||` at the tick site.\n */\n\n/** What a caller needs to know about its own element's position. */\nexport interface SvOffscreenPause {\n  /**\n   * True while the observed element is known to be outside the viewport.\n   *\n   * ★ \"Known to be\" is load-bearing: false means *not known to be offscreen*,\n   *   which covers both a visible element and an environment that cannot tell.\n   */\n  readonly offscreen: Signal<boolean>;\n  /**\n   * Start watching an element, replacing any previous one. Passing `null` stops\n   * watching and resets `offscreen` to false — an element nobody is watching is\n   * not known to be offscreen.\n   */\n  readonly observe: (element: Element | null) => void;\n  /** Stop watching. Called for you when the injection context is destroyed. */\n  readonly destroy: () => void;\n}\n\n/**\n * Pause a feed while its own element is scrolled out of view.\n *\n * Must be called from an injection context — it takes its own `DestroyRef`, so a\n * component that creates one cannot leak the observer.\n *\n * @param rootMargin How far outside the viewport still counts as visible.\n *   Defaults to `'200px'`: the surface resumes just *before* it scrolls into\n *   view, so the reader never arrives at a frozen clock and watches it catch up.\n */\nexport function createOffscreenPause(rootMargin = '200px'): SvOffscreenPause {\n  const offscreen = signal(false);\n  const platformId = inject(PLATFORM_ID);\n\n  if (!isPlatformBrowser(platformId) || typeof IntersectionObserver === 'undefined') {\n    return { offscreen, observe: () => undefined, destroy: () => undefined };\n  }\n\n  let observer: IntersectionObserver | null = null;\n\n  const destroy = (): void => {\n    observer?.disconnect();\n    observer = null;\n  };\n\n  const observe = (element: Element | null): void => {\n    destroy();\n    if (!element) {\n      offscreen.set(false);\n      return;\n    }\n    observer = new IntersectionObserver(\n      (entries) => {\n        // ★ The LAST entry, not the first. A batch can carry several crossings\n        //   for one element when scrolling fast, and the first of them is the\n        //   oldest — acting on it leaves the flag describing where the element\n        //   used to be.\n        const latest = entries[entries.length - 1];\n        if (latest) offscreen.set(!latest.isIntersecting);\n      },\n      { rootMargin },\n    );\n    observer.observe(element);\n  };\n\n  inject(DestroyRef).onDestroy(destroy);\n\n  return { offscreen, observe, destroy };\n}\n","/**\n * small-shares.ts — the long tail of a part-to-whole chart, and the order of it.\n *\n * ★★★ A PIE WITH THIRTY SLICES IS NOT A CHART OF THIRTY THINGS. Past roughly\n *     eight, the slices at the end are a few degrees each: they cannot be\n *     labelled, they cannot be told apart, they cannot be clicked reliably, and\n *     their colours run out. What the reader actually takes from the picture is\n *     the three or four big ones plus an unreadable fringe — so the honest\n *     drawing is the big ones plus ONE slice that says how much the fringe came\n *     to, which is the only fact about the fringe anybody can use.\n *\n *     Both of these are OFF by default. Folding a host's categories together is\n *     a decision about their data, and a chart that quietly did it would be\n *     reporting a category the host never sent.\n */\n\nimport type { SvSummaryRow } from '@styloviz/core/a11y';\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/**\n * The colour the aggregate slice takes when the host names none.\n *\n * ★ Neutral on purpose. `Other` used to be spread from the first slice it\n *   folded, so it arrived in THAT slice's colour — and a reader matching colours\n *   to the legend saw one real category drawn twice, or read the aggregate as\n *   more of whichever category happened to be folded first. A slate grey says\n *   \"not a category\" in both themes, and it is a six-digit hex because the\n *   gradient donut derives its light stop from the base colour arithmetically.\n *\n * ★ Slate-500, not the lighter slate-400 it first shipped as. One fill has to\n *   hold in BOTH themes, and slate-400 measured 2.56:1 on a white card — under\n *   the 3:1 WCAG 1.4.11 asks of a graphic a reader has to find — while being\n *   comfortable on dark. Slate-500 is 4.76:1 on white, 3.73:1 on gray-900 and\n *   3.08:1 on gray-800, so the slice and its legend swatch clear 3:1 either way.\n */\nexport const SV_OTHER_SHARE_COLOR = '#64748b';\n\n/** A slice of a part-to-whole chart: enough shape for grouping and ordering. */\nexport interface SvShareSlice {\n  readonly label: string;\n  readonly value: number;\n  readonly color?: string;\n}\n\n/** How slices are ordered around the chart. */\nexport type SvShareOrder = 'input' | 'value';\n\n/** What the grouping pass folded together, and what it has to say about it. */\nexport interface SvShareGrouping<T> {\n  /** Survivors in their original relative order, with any `Other` slice last. */\n  readonly items: readonly T[];\n  /** The aggregate slice in `items`, or `null` when nothing was folded. */\n  readonly other: T | null;\n  /**\n   * The slices folded into `other`, in the order they were met. Empty when\n   * nothing was. This is what lets the summary table list them separately, as\n   * the notice says it does.\n   */\n  readonly folded: readonly T[];\n  /** How many slices were folded into `Other`. `0` when nothing was. */\n  readonly grouped: number;\n  /** Their combined value. */\n  readonly groupedValue: number;\n  /** One sentence for the reader, or `null` when nothing was folded. */\n  readonly notice: string | null;\n}\n\n/** Options for {@link svGroupSmallShares}. Both thresholds are off at zero. */\nexport interface SvGroupSharesOptions {\n  /**\n   * Fold any slice below this share of the total, `0`–`1`.\n   * @default 0 — no grouping\n   */\n  readonly minShare?: number;\n  /**\n   * Keep at most this many slices, folding the remainder. Applied after\n   * `minShare`, and counted against the ordered list so the survivors are the\n   * largest ones when the chart is sorted by value.\n   * @default 0 — no cap\n   */\n  readonly maxSlices?: number;\n  /** Label for the aggregate slice. @default `labels.smallSharesOther` — 'Other' */\n  readonly label?: string;\n  /** Colour for the aggregate slice. @default SV_OTHER_SHARE_COLOR — a neutral slate */\n  readonly color?: string;\n  /** The words of the notice and the default aggregate name. @default SV_CORE_LABELS (English) */\n  readonly labels?: SvSmallSharesLabels;\n  /** Locale the notice's numbers are formatted in. @default '' */\n  readonly locale?: string;\n}\n\n/** The `core` labels `svGroupSmallShares` writes its notice from. */\nexport type SvSmallSharesLabels = Pick<\n  SvCoreLabels,\n  'smallSharesNotice' | 'smallSharesNames' | 'smallSharesNamesMore' | 'smallSharesOther' | 'smallSharesOtherTaken'\n>;\n\n/** The `core` labels `svShareSummaryRows` heads the aggregate's rows with. */\nexport type SvShareRowLabels = Pick<SvCoreLabels, 'smallSharesCombinedRow' | 'smallSharesFoldedRow'>;\n\n/**\n * Fold the unreadable tail of a part-to-whole chart into one `Other` slice.\n *\n * ★ NEVER FOLDS A SINGLE SLICE. One slice inside an `Other` of one is the same\n *   slice with its name taken away — strictly worse than leaving it alone, and\n *   it is what a naive threshold does to a chart with one small category.\n *\n * ★ The aggregate goes LAST regardless of ordering. \"Other\" is not a category\n *   with a rank; sorting it by value would put it in the middle of the ring and\n *   invite the reader to compare it with a real one.\n *\n * ★ The aggregate carries a label, a value and a NEUTRAL colour, and nothing\n *   else. It used to be spread from the first slice it folded, so it inherited\n *   that slice's colour, its description, and on the radius pie its emphasis —\n *   the aggregate drawn as if it were more of one real category. A chart that\n *   gives slices other per-slice fields decides what `Other` gets for them.\n *\n * ★ Non-finite and negative values are left for the value policy that runs\n *   before this — `svResolveShares` has already decided whether they are\n *   clamped, omitted or fatal, and second-guessing that here would mean two\n *   answers to one question.\n */\nexport function svGroupSmallShares<T extends SvShareSlice>(\n  items: readonly T[],\n  total: number,\n  options: SvGroupSharesOptions = {},\n): SvShareGrouping<T> {\n  const minShare = options.minShare ?? 0;\n  const maxSlices = options.maxSlices ?? 0;\n  const noGrouping: SvShareGrouping<T> = {\n    items,\n    other: null,\n    folded: [],\n    grouped: 0,\n    groupedValue: 0,\n    notice: null,\n  };\n\n  const wantsShare = Number.isFinite(minShare) && minShare > 0;\n  const wantsCap = Number.isFinite(maxSlices) && maxSlices > 0;\n  if ((!wantsShare && !wantsCap) || !items.length || !(total > 0)) return noGrouping;\n\n  const keep: T[] = [];\n  const fold: T[] = [];\n\n  for (const item of items) {\n    const belowShare = wantsShare && item.value / total < minShare;\n    // The cap counts survivors, so a chart sorted by value keeps the biggest.\n    const pastCap = wantsCap && keep.length >= maxSlices;\n    if (belowShare || pastCap) fold.push(item);\n    else keep.push(item);\n  }\n\n  // Folding one slice renames it and gains nothing.\n  if (fold.length < 2) return noGrouping;\n\n  let groupedValue = 0;\n  for (const item of fold) groupedValue += item.value;\n\n  const labels = options.labels ?? SV_CORE_LABELS;\n  const locale = options.locale ?? '';\n  const requested = options.label ?? labels.smallSharesOther;\n  // ★★ \"Other\" is also a category hosts send. When one survives the fold, an\n  //    aggregate of the same name is a second \"Other\" on the ring and in the\n  //    legend — two entries a reader cannot tell apart, and two marks every\n  //    chart template tracks by label (NG0955). The aggregate says what it is.\n  const label = keep.some((item) => item.label === requested)\n    ? svFormatLabel(labels.smallSharesOtherTaken, { label: requested }, locale)\n    : requested;\n  // Only the fields every share slice has. `T` may carry more (a radius, a\n  // description), and none of them is true of an aggregate.\n  const aggregate: SvShareSlice = {\n    label,\n    value: groupedValue,\n    color: options.color || SV_OTHER_SHARE_COLOR,\n  };\n  const other = aggregate as T;\n\n  const share = Math.round((groupedValue / total) * 100);\n  return {\n    items: [...keep, other],\n    other,\n    folded: fold,\n    grouped: fold.length,\n    groupedValue,\n    // ★★ The notice is VISIBLE text, and the summary table it used to point at\n    //    alone is not: `sv-data-summary-table` is clipped to 1×1 for assistive\n    //    technology. \"The summary table lists them separately\" was true in the\n    //    DOM and false on the screen, so a sighted reader was sent looking for a\n    //    table that is never drawn. The names go in the sentence itself; the\n    //    values are said to be in the table, and who that table is for.\n    notice: svFormatLabel(\n      labels.smallSharesNotice,\n      { count: fold.length, label, share, names: foldedNames(fold, labels, locale) },\n      locale,\n    ),\n  };\n}\n\n/** How many folded names the notice spells out before it counts the rest. */\nconst NOTICE_NAME_LIMIT = 6;\n\n/** `A, B and C` — or `A, B, … F and 4 more` past `NOTICE_NAME_LIMIT`. */\nfunction foldedNames(fold: readonly SvShareSlice[], labels: SvSmallSharesLabels, locale: string): string {\n  const names = fold.map((s) => s.label);\n  if (names.length > NOTICE_NAME_LIMIT) {\n    const shown = names.slice(0, NOTICE_NAME_LIMIT);\n    return svFormatLabel(\n      labels.smallSharesNamesMore,\n      { list: shown.join(', '), count: names.length - NOTICE_NAME_LIMIT },\n      locale,\n    );\n  }\n  // A fold is never fewer than two slices — `svGroupSmallShares` refuses one.\n  return svFormatLabel(\n    labels.smallSharesNames,\n    { list: names.slice(0, -1).join(', '), last: names[names.length - 1] },\n    locale,\n  );\n}\n\n/**\n * Order slices around the chart.\n *\n * `'value'` is the convention a pie is easiest to read in — largest first, so\n * the eye compares neighbours rather than arcs on opposite sides of the circle,\n * which is the comparison people are worst at. `'input'` keeps the host's order,\n * which is what a chart with a natural sequence (stages, months, grades) needs.\n *\n * ★ Ties break by input position rather than by whatever `sort` does with them.\n *   Two equal slices swapping places between renders is a picture that moves\n *   for no reason, and `Array.prototype.sort` stability is not the property\n *   being relied on here — reproducibility is.\n *\n * ★ Returns the SAME array when nothing needs reordering, so an unchanged input\n *   keeps its identity for change detection.\n */\nexport function svOrderShares<T extends SvShareSlice>(\n  items: readonly T[],\n  order: SvShareOrder,\n): readonly T[] {\n  if (order !== 'value' || items.length < 2) return items;\n\n  const position = new Map<T, number>();\n  items.forEach((item, i) => position.set(item, i));\n\n  return [...items].sort((a, b) => {\n    const delta = b.value - a.value;\n    return delta !== 0 ? delta : position.get(a)! - position.get(b)!;\n  });\n}\n\n/** The result of {@link svPrepareShares}. */\nexport interface SvPreparedShares<T> {\n  /** Slices to draw, ordered, with any aggregate last. */\n  readonly items: readonly T[];\n  /** Unchanged by grouping — the aggregate is a sum, not a sample. */\n  readonly total: number;\n  /** Everything the reader has to be told, policy notice included. */\n  readonly notice: string | null;\n  /** How many slices were folded into the aggregate. */\n  readonly grouped: number;\n  /** The aggregate slice in `items`, or `null` when nothing was folded. */\n  readonly other: T | null;\n  /** The slices folded into `other`, in the order they were met. */\n  readonly folded: readonly T[];\n}\n\n/** Ordering and grouping options, as a chart's `options` object carries them. */\nexport interface SvPrepareSharesOptions extends SvGroupSharesOptions {\n  /** Slice order around the chart. @default 'input' */\n  readonly order?: SvShareOrder;\n}\n\n/**\n * The whole preparation pass a part-to-whole chart runs after its value policy:\n * order the slices, fold the unreadable tail, and merge what has to be said\n * about both into whatever the policy already had to say.\n *\n * ★ Ordering runs BEFORE grouping so that `maxSlices` keeps the largest slices\n *   on a chart sorted by value. Grouping first would cap the input order and\n *   then sort the survivors, which quietly discards big categories that\n *   happened to be written late.\n */\nexport function svPrepareShares<T extends SvShareSlice>(\n  items: readonly T[],\n  total: number,\n  policyNotice: string | null,\n  options: SvPrepareSharesOptions = {},\n): SvPreparedShares<T> {\n  const ordered = svOrderShares(items, options.order ?? 'input');\n  const grouped = svGroupSmallShares(ordered, total, options);\n  const notices = [policyNotice, grouped.notice].filter(Boolean) as string[];\n\n  return {\n    items: grouped.items,\n    total,\n    notice: notices.length ? notices.join(' ') : null,\n    grouped: grouped.grouped,\n    other: grouped.other,\n    folded: grouped.folded,\n  };\n}\n\n/**\n * The summary-table rows for a prepared part-to-whole chart: one per drawn\n * slice, and — under the aggregate — one per slice it folded, marked as such.\n *\n * ★★ THE FOLD NOTICE PROMISES THIS. It tells the reader \"the summary table for\n *    screen readers lists each one's value separately\", and every table was built from the drawn slices, so it\n *    listed one `Other` row and nothing under it: a disclosure pointing at\n *    detail that did not exist. Built once here so the promise and the rows\n *    cannot drift apart per chart.\n *\n * ★ The folded rows follow the aggregate rather than taking their own place in\n *   the order, and each names the aggregate it belongs to, so a listener hears\n *   them as the breakdown of `Other` — not as extra slices the picture forgot to\n *   draw, and not as values to add to the `Other` row a second time.\n *\n * @param shares The prepared shares — `items`, plus the `other`/`folded` a fold\n *   produced.\n * @param cells The formatted data cells for one slice, in column order. Called\n *   for folded slices too, with the same total, so their shares read against\n *   the whole chart.\n */\nexport function svShareSummaryRows<T extends SvShareSlice>(\n  shares: Pick<SvPreparedShares<T>, 'items' | 'other' | 'folded'>,\n  cells: (item: T) => readonly string[],\n  labels: SvShareRowLabels = SV_CORE_LABELS,\n  locale = '',\n): SvSummaryRow[] {\n  const rows: SvSummaryRow[] = [];\n  const { other, folded } = shares;\n  // ★ `track row.key` throws NG0955 on a repeat, and labels are the host's:\n  //   two slices both called \"Direct\" are a data mistake the table should still\n  //   render, not a console error. A repeat keeps its label and gains a suffix.\n  const seen = new Set<string>();\n  const unique = (key: string): string => {\n    let candidate = key;\n    for (let n = 2; seen.has(candidate); n++) candidate = `${key}#${n}`;\n    seen.add(candidate);\n    return candidate;\n  };\n  for (const item of shares.items) {\n    if (!other || item !== other) {\n      rows.push({ key: unique(item.label), header: item.label, cells: cells(item) });\n      continue;\n    }\n    rows.push({\n      key: unique(`aggregate:${other.label}`),\n      header: svFormatLabel(labels.smallSharesCombinedRow, { label: other.label, count: folded.length }, locale),\n      cells: cells(other),\n    });\n    folded.forEach((slice, i) => {\n      rows.push({\n        key: unique(`aggregate:${other.label}:${i}:${slice.label}`),\n        header: svFormatLabel(labels.smallSharesFoldedRow, { label: slice.label, other: other.label }, locale),\n        cells: cells(slice),\n      });\n    });\n  }\n  return rows;\n}\n","/**\n * series-gaps.ts — a reading that is missing, drawn as missing.\n *\n * ★★★ ONE GAP USED TO BLANK THE WHOLE CHART. A line chart's y-axis is derived\n *     from `Math.max(...data)`, and `Math.max` of anything containing `NaN` is\n *     `NaN`. So a single unusable reading poisoned the axis maximum, every\n *     point's y came back `NaN`, and the path rendered as\n *     `M 0 NaN L 173 NaN L 346 NaN` — which SVG draws as nothing at all, with no\n *     error. Measured on four points with one gap: the entire series vanished,\n *     not just the missing point.\n *\n *     That is the worst possible failure for a missing value, because the two\n *     alternatives a host has without gap support are both lies: sending `0`\n *     asserts a reading of zero, and interpolating asserts a reading nobody\n *     took. The honest rendering is a BREAK — the line stops before the gap and\n *     resumes after it, so the reader can see there is nothing there.\n *\n * These live in `@styloviz/core` because the free and Pro line charts are\n * separate components rather than a mirrored pair, and two gap rules that\n * disagree about what counts as missing is exactly the defect the shared axis\n * ladder was written to remove.\n */\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/**\n * Whether a datum is a gap rather than a value.\n *\n * `null` and `undefined` are the deliberate ways to say \"no reading\". `NaN` and\n * `±Infinity` are the accidental ones — a division by zero, a `parseFloat` of\n * `'n/a'`, a sensor fault — and they mean the same thing to a chart, so they are\n * treated the same rather than being allowed through to break the geometry.\n */\nexport function svIsGap(value: number | null | undefined): boolean {\n  return value === null || value === undefined || !Number.isFinite(value);\n}\n\n/** The range of the readings that exist, and how many did not. */\nexport interface SvFiniteExtent {\n  /** Smallest usable value, or `null` when there is none. */\n  readonly min: number | null;\n  /** Largest usable value, or `null` when there is none. */\n  readonly max: number | null;\n  /** How many entries were gaps. */\n  readonly gaps: number;\n  /** How many entries there were in total. */\n  readonly total: number;\n}\n\n/**\n * Min and max over the readings that exist, plus a count of the ones that do not.\n *\n * The gap count comes back with the extent rather than from a second pass\n * because the axis and the disclosure have to describe the same set: a chart\n * that scales to the values it can draw and then reports a total including the\n * ones it cannot is telling the reader two different stories about one series.\n */\nexport function svFiniteExtent(values: Iterable<number | null | undefined>): SvFiniteExtent {\n  let min: number | null = null;\n  let max: number | null = null;\n  let gaps = 0;\n  let total = 0;\n\n  for (const value of values) {\n    total++;\n    if (svIsGap(value)) {\n      gaps++;\n      continue;\n    }\n    const v = value as number;\n    if (min === null || v < min) min = v;\n    if (max === null || v > max) max = v;\n  }\n\n  return { min, max, gaps, total };\n}\n\n/**\n * Split a series into the contiguous runs that can actually be drawn.\n *\n * Each run is a stretch with no gap in it, so a path built from the runs stops\n * at every gap and starts again after it. An empty result means the series is\n * entirely missing, which is a different thing from an empty series and should\n * be said differently.\n *\n * `project` is only called for real values, so it never has to defend itself\n * against `NaN` — which is the point: the `NaN` guard belongs here, once, rather\n * than in every coordinate helper that a gap could reach.\n */\nexport function svGapRuns<T>(\n  data: readonly (number | null | undefined)[],\n  project: (value: number, index: number) => T,\n): T[][] {\n  const runs: T[][] = [];\n  let run: T[] = [];\n\n  for (let i = 0; i < data.length; i++) {\n    if (svIsGap(data[i])) {\n      if (run.length > 0) {\n        runs.push(run);\n        run = [];\n      }\n      continue;\n    }\n    run.push(project(data[i] as number, i));\n  }\n  if (run.length > 0) runs.push(run);\n\n  return runs;\n}\n\n/**\n * One sentence naming the gaps, or `null` when there are none.\n *\n * ★ A break in a line is genuinely ambiguous on sight: it reads as \"no data\n *   here\" to one person and as a rendering glitch to another, and at one missing\n *   point in a dense series it is easy to miss entirely. Saying how many there\n *   are turns the break from something the reader has to interpret into\n *   something they have been told.\n *\n * `stacked` exists because a stacked chart cannot honour a gap: every band above\n * it is positioned by the running total, so the gap has to count as zero for the\n * stack to add up — and a zero that the host did not send is exactly the lie\n * this file exists to prevent. It cannot be avoided, so it is disclosed.\n */\nexport function svGapNotice(\n  gaps: number,\n  total: number,\n  stacked = false,\n  labels: Pick<SvCoreLabels, 'gapAllMissing' | 'gapStacked' | 'gapLine'> = SV_CORE_LABELS,\n  locale = '',\n): string | null {\n  if (gaps <= 0) return null;\n\n  if (gaps >= total && total > 0) {\n    return svFormatLabel(labels.gapAllMissing, { total }, locale);\n  }\n  return svFormatLabel(stacked ? labels.gapStacked : labels.gapLine, { count: gaps }, locale);\n}\n","/**\n * series-decimate.ts — which readings of a long series to draw.\n *\n * A line through ten thousand readings on a 520-unit-wide plot puts about twenty\n * points in every horizontal unit. They cannot be told apart on screen, and each\n * one still costs path data the browser has to parse and stroke. The fix is to\n * draw fewer points, but which ones matters:\n *\n * ★★ EVERY Nth POINT IS THE WRONG SAMPLE. A spike between two kept points just\n *    disappears, and a spike is often the reason someone is looking at the chart.\n *    This keeps the lowest and the highest finite reading of every bucket (a\n *    bucket is one horizontal plot unit), so the outline of the line — every peak\n *    and every trough — is drawn exactly. Only the points that are hidden\n *    behind their neighbours anyway are left out.\n *\n * ★ BREAKS STAY WHERE THEY ARE. A reading next to a gap is always kept, so a\n *   line still stops and resumes at the real readings either side of a missing\n *   one (see `series-gaps.ts`), instead of the break moving to whichever\n *   reading the bucket happened to keep.\n *\n * ★ ONE SHARED INDEX SET FOR ALL SERIES. Several series on one axis share their\n *   categories, so the kept indices are the union of what each series needs.\n *   That keeps the series aligned, and gives a screen-reader table one row per\n *   kept index that is true for every column.\n */\nimport { svIsGap } from './series-gaps';\n\n/**\n * The indices of `series` worth drawing at `buckets` horizontal units, between\n * `start` and `end` (inclusive).\n *\n * For each bucket and each series it keeps the lowest and highest finite reading,\n * plus any reading next to a gap. `start` and `end` are always kept. The result\n * is sorted. Returns `null` when there is nothing to save: the window holds no\n * more than two points per bucket, so everything can be drawn.\n */\nexport function svDecimateIndices(\n  series: readonly (readonly (number | null | undefined)[])[],\n  start: number,\n  end: number,\n  buckets: number,\n): number[] | null {\n  const lo = Math.max(0, Math.floor(start));\n  const hi = Math.floor(end);\n  const span = hi - lo + 1;\n  const width = Math.max(1, Math.floor(buckets));\n  if (!Number.isFinite(span) || span <= width * 2) return null;\n\n  const keep = new Set<number>([lo, hi]);\n  const bucketOf = (i: number) => Math.min(width - 1, Math.floor(((i - lo) / span) * width));\n\n  for (const data of series) {\n    let bucket = -1;\n    let minI = -1;\n    let maxI = -1;\n    const flush = () => {\n      if (minI >= 0) keep.add(minI);\n      if (maxI >= 0) keep.add(maxI);\n      minI = -1;\n      maxI = -1;\n    };\n    for (let i = lo; i <= hi; i++) {\n      const b = bucketOf(i);\n      if (b !== bucket) {\n        flush();\n        bucket = b;\n      }\n      const v = data[i];\n      if (svIsGap(v)) continue;\n      // A reading beside a gap is where the line stops or resumes.\n      if ((i > 0 && svIsGap(data[i - 1])) || (i < data.length - 1 && svIsGap(data[i + 1]))) keep.add(i);\n      if (minI < 0 || (v as number) < (data[minI] as number)) minI = i;\n      if (maxI < 0 || (v as number) > (data[maxI] as number)) maxI = i;\n    }\n    flush();\n  }\n\n  return [...keep].sort((a, b) => a - b);\n}\n","import { computed, inject, signal, type Signal, type WritableSignal } from '@angular/core';\nimport { SvLiveAnnouncer } from '@styloviz/core/a11y';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { svFormatLabel } from '@styloviz/core/i18n';\n\n/**\n * series-emphasis.ts — one model for \"which series am I looking at\" (FL-J3-CH-03).\n *\n * ★★★ MANY SERIES OVERLAP, AND NOTHING LET THE READER PULL ONE OUT. A radar\n *     with five polygons, or a line chart with six lines through the same\n *     band, is a tangle (CH-13-I3, CH-07-I5). Neither chart had any series\n *     highlight or hide, and the line chart's legend was static text. The two\n *     answers every charting tool converges on are the same two here:\n *\n *     - **Isolate** — hover or keyboard-focus a legend entry and every OTHER\n *       series fades (CH-13-M4). Nothing is removed, so the comparison the\n *       chart exists for is still there, one series in front.\n *     - **Toggle** — activate the entry and the series is hidden until it is\n *       activated again. The hidden set is the host's (`model()`), so a\n *       dashboard can persist it and restore it.\n *\n * ★★ THE LEGEND IS THE KEYBOARD PATH BETWEEN SERIES (CH-07-M5). It is a\n *    toolbar of `aria-pressed` buttons with ONE tab stop: the arrow keys move\n *    from series to series and each one is isolated as focus lands on it, so a\n *    keyboard reader steps through the series exactly as a mouse reader sweeps\n *    the legend.\n *\n * ★ The last visible series cannot be hidden. A chart with every series off\n *   draws empty axes that look like a failed load; the refusal is announced\n *   rather than silent.\n *\n * ★ Lives in core, like the gap primitives, because the free and Pro charts are\n *   separate components rather than a mirrored pair — two emphasis rules that\n *   disagree about what \"dimmed\" means would be the defect.\n */\n\n/** Opacity of a series faded behind the emphasised one. */\nexport const SV_SERIES_DIMMED_OPACITY = 0.18;\n\n/** What a chart hands the model. */\nexport interface SvSeriesEmphasisOptions {\n  /** Series keys (names) in drawing order. */\n  readonly keys: () => readonly string[];\n  /** The host-bound hidden set — normally the component's `hiddenSeries` model. */\n  readonly hidden: WritableSignal<readonly string[]>;\n}\n\n/** The emphasis state one chart reads in its template. */\nexport interface SvSeriesEmphasis {\n  /** The series the reader is looking at (hovered or focused), or null. */\n  readonly emphasized: Signal<string | null>;\n  /** Keys still drawn, in drawing order. */\n  readonly visibleKeys: Signal<readonly string[]>;\n  /** The legend toolbar's accessible name (\"Series\"), from the core labels. */\n  readonly legendLabel: string;\n  /** The legend's off-screen keyboard hint, from the core labels. */\n  readonly legendHint: string;\n  /** The legend entry that owns the toolbar's single tab stop. */\n  readonly activeIndex: Signal<number>;\n  /** True when `key` is switched off. */\n  isHidden(key: string): boolean;\n  /** True when another series is emphasised and `key` is not it. */\n  isDimmed(key: string): boolean;\n  /** The opacity `key` is drawn at: 1, or `SV_SERIES_DIMMED_OPACITY` behind another. */\n  opacity(key: string): number;\n  /** Put `key` in front (null clears it). A hidden series is never emphasised. */\n  emphasize(key: string | null): void;\n  /** Show or hide `key`. Returns false when refused (the last visible series). */\n  toggle(key: string): boolean;\n  /** The legend button's tabindex — 0 for the active entry, -1 for the rest. */\n  tabIndex(index: number): 0 | -1;\n  /** Legend focus landed on entry `index`: it takes the tab stop and is emphasised. */\n  focusEntry(index: number): void;\n  /**\n   * Toolbar roving: Arrow keys (both axes — the legend wraps), Home and End.\n   * Bind it on each legend button; it moves DOM focus to the sibling\n   * `[data-sv-series-index]` button inside the nearest `role=\"toolbar\"`.\n   */\n  onLegendKeydown(event: KeyboardEvent): void;\n}\n\n/** Create the model. Call from an injection context (it injects the announcer and labels). */\nexport function createSeriesEmphasis(options: SvSeriesEmphasisOptions): SvSeriesEmphasis {\n  const announcer = inject(SvLiveAnnouncer);\n  const labels = injectSvLabels('core', SV_CORE_LABELS);\n  const requested = signal<string | null>(null);\n  const active = signal(0);\n\n  const hiddenSet = computed(() => new Set(options.hidden()));\n  const visibleKeys = computed(() => options.keys().filter((k) => !hiddenSet().has(k)));\n  const emphasized = computed(() => {\n    const key = requested();\n    return key !== null && options.keys().includes(key) && !hiddenSet().has(key) ? key : null;\n  });\n  const activeIndex = computed(() => Math.min(active(), Math.max(0, options.keys().length - 1)));\n\n  const isHidden = (key: string): boolean => hiddenSet().has(key);\n  const isDimmed = (key: string): boolean => {\n    const e = emphasized();\n    return e !== null && e !== key;\n  };\n\n  function toggle(key: string): boolean {\n    if (!options.keys().includes(key)) return false;\n    if (hiddenSet().has(key)) {\n      options.hidden.set(options.hidden().filter((k) => k !== key));\n      announcer.announce(svFormatLabel(labels.seriesShown, { series: key }));\n      return true;\n    }\n    if (visibleKeys().length <= 1) {\n      announcer.announce(svFormatLabel(labels.seriesLastVisible, { series: key }));\n      return false;\n    }\n    options.hidden.set([...options.hidden(), key]);\n    // A series that leaves the plot cannot stay in front of it.\n    if (requested() === key) requested.set(null);\n    announcer.announce(svFormatLabel(labels.seriesHidden, { series: key }));\n    return true;\n  }\n\n  function onLegendKeydown(event: KeyboardEvent): void {\n    const count = options.keys().length;\n    if (!count) return;\n    const from = activeIndex();\n    let to: number;\n    switch (event.key) {\n      case 'ArrowRight':\n      case 'ArrowDown': to = (from + 1) % count; break;\n      case 'ArrowLeft':\n      case 'ArrowUp': to = (from - 1 + count) % count; break;\n      case 'Home': to = 0; break;\n      case 'End': to = count - 1; break;\n      default: return;\n    }\n    event.preventDefault();\n    active.set(to);\n    // Bound on each legend button (a focusable element); the toolbar is the\n    // nearest ancestor that holds its siblings.\n    const from_el = event.currentTarget as HTMLElement | null;\n    const toolbar = from_el?.closest<HTMLElement>('[role=\"toolbar\"]') ?? from_el?.parentElement ?? null;\n    toolbar?.querySelector<HTMLElement>(`[data-sv-series-index=\"${to}\"]`)?.focus();\n  }\n\n  return {\n    legendLabel: labels.seriesLegend,\n    legendHint: labels.seriesLegendHint,\n    emphasized,\n    visibleKeys,\n    activeIndex,\n    isHidden,\n    isDimmed,\n    opacity: (key) => (isDimmed(key) ? SV_SERIES_DIMMED_OPACITY : 1),\n    emphasize: (key) => requested.set(key),\n    toggle,\n    tabIndex: (index) => (index === activeIndex() ? 0 : -1),\n    focusEntry: (index) => {\n      active.set(index);\n      requested.set(options.keys()[index] ?? null);\n    },\n    onLegendKeydown,\n  };\n}\n","/**\n * The wording a chart's data disclosures are written from — the value-policy\n * notice, the long-tail fold and its summary rows, and the gap notice.\n *\n * ★ Core writes the sentences, but a chart package OWNS their translation: its\n *   labels interface extends {@link SvChartDisclosureLabels} and its English\n *   spreads {@link SV_CHART_DISCLOSURE_LABELS}, so `provideSvLabels({ chartsPro:\n *   { valueClamped: '…' } })` reaches the notice under that package's charts,\n *   and the component passes its own `labels` to the helpers.\n */\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/** Every `core` key the chart disclosure helpers read. */\nexport type SvChartDisclosureLabels = Pick<\n  SvCoreLabels,\n  | 'valueMissing' | 'valueUnbounded' | 'valueNegativelyUnbounded' | 'valueForExample' | 'valueRendered'\n  | 'valueRejected' | 'valueOmitted' | 'valueOmitShare' | 'valueClamped' | 'valueAllZero'\n  | 'smallSharesNotice' | 'smallSharesNames' | 'smallSharesNamesMore' | 'smallSharesOther' | 'smallSharesOtherTaken'\n  | 'smallSharesCombinedRow' | 'smallSharesFoldedRow'\n  | 'gapAllMissing' | 'gapStacked' | 'gapLine'\n>;\n\n/** The English of {@link SvChartDisclosureLabels}, for a chart package's labels to spread. */\nexport const SV_CHART_DISCLOSURE_LABELS: SvChartDisclosureLabels = {\n  valueMissing: SV_CORE_LABELS.valueMissing,\n  valueUnbounded: SV_CORE_LABELS.valueUnbounded,\n  valueNegativelyUnbounded: SV_CORE_LABELS.valueNegativelyUnbounded,\n  valueForExample: SV_CORE_LABELS.valueForExample,\n  valueRendered: SV_CORE_LABELS.valueRendered,\n  valueRejected: SV_CORE_LABELS.valueRejected,\n  valueOmitted: SV_CORE_LABELS.valueOmitted,\n  valueOmitShare: SV_CORE_LABELS.valueOmitShare,\n  valueClamped: SV_CORE_LABELS.valueClamped,\n  valueAllZero: SV_CORE_LABELS.valueAllZero,\n  smallSharesNotice: SV_CORE_LABELS.smallSharesNotice,\n  smallSharesNames: SV_CORE_LABELS.smallSharesNames,\n  smallSharesNamesMore: SV_CORE_LABELS.smallSharesNamesMore,\n  smallSharesOther: SV_CORE_LABELS.smallSharesOther,\n  smallSharesOtherTaken: SV_CORE_LABELS.smallSharesOtherTaken,\n  smallSharesCombinedRow: SV_CORE_LABELS.smallSharesCombinedRow,\n  smallSharesFoldedRow: SV_CORE_LABELS.smallSharesFoldedRow,\n  gapAllMissing: SV_CORE_LABELS.gapAllMissing,\n  gapStacked: SV_CORE_LABELS.gapStacked,\n  gapLine: SV_CORE_LABELS.gapLine,\n};\n","import type { SvDataError } from './types';\nimport { svFormatLabel, type SvLabelParams } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\nimport { svWarn } from '@styloviz/core/dev';\n\n/** The `core` labels a value policy's disclosures are written from. */\nexport type SvValuePolicyLabels = Pick<\n  SvCoreLabels,\n  | 'valueMissing' | 'valueUnbounded' | 'valueNegativelyUnbounded' | 'valueForExample' | 'valueRendered'\n  | 'valueRejected' | 'valueOmitted' | 'valueOmitShare' | 'valueClamped' | 'valueAllZero'\n>;\n\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * ============================================================================\n *  What a chart does with a datum it cannot plot (audit item X-7)\n * ============================================================================\n *\n * Six families were each asked for this separately — bar (negatives), donut and\n * pie (zero totals and negatives), polar area (negatives), treemap (zero and\n * negative weights), heatmap (missing values). Six answers would have been six\n * behaviours, so this is one.\n *\n * The failure they share is not that the datum is rejected. It is that it is\n * accepted and then quietly altered:\n *\n * - A zero-based bar clamps a negative to 0 and warns in **dev only**, so\n *   production drew a missing bar and said nothing.\n * - A pie sums raw values for its denominator, so `[10, -5]` gives a total of 5\n *   and the first slice sweeps 720°. Nothing is dropped and nothing is warned —\n *   the chart draws a *different dataset* than it was given, convincingly.\n * - `[5, -5]` sums to 0, which every pie and donut reads as \"no data\" and\n *   renders as an empty state, over two non-zero data points.\n * - A treemap divides by its own subtree sum, so a negative weight inverts a\n *   tile's share and the squarify recursion lays out tiles that overlap.\n *\n * So the four behaviours below are named, typed, and one of them is chosen\n * per chart — and whichever is chosen, the *rendered output* says what happened.\n * A console warning is not a disclosure: nobody reading the dashboard sees it.\n * ============================================================================\n */\n\n/**\n * What to do with a datum this chart cannot plot as given.\n *\n * - `render` — plot it truthfully in whatever way the chart can. Only some\n *   charts have such a way (a heatmap can hatch a missing cell; a zero-based\n *   bar has no room below its baseline), so each chart declares whether it\n *   supports this.\n * - `clamp` — plot the nearest value the chart can draw, and **mark the datum**\n *   so the reader can see that this one is not to scale.\n * - `omit` — leave it out, and disclose how many were left out.\n * - `reject` — refuse the whole dataset and show the error state, on the view\n *   that a wrong chart is worse than no chart.\n */\nexport type SvValuePolicy = 'render' | 'clamp' | 'omit' | 'reject';\n\n/** Everything one chart needs to apply a policy to one collection. */\nexport interface SvValuePolicyOptions<T> {\n  /** The number this chart plots for an item. */\n  readonly value: (item: T) => number;\n  /** The same item with its plotted value replaced. Only called under `clamp`. */\n  readonly clamp: (item: T, to: number) => T;\n  /** The requested policy, usually a host input over the chart's own default. */\n  readonly policy: SvValuePolicy;\n  /**\n   * The behaviours this chart can actually carry out. A request outside this set\n   * is a host asking for something the chart has no way to draw; it falls back\n   * to `fallback` and says so in dev rather than pretending.\n   */\n  readonly supported: readonly SvValuePolicy[];\n  /** Used when `policy` is outside `supported`. Must itself be supported. */\n  readonly fallback: SvValuePolicy;\n  /** Component selector, so a warning names the chart it came from. */\n  readonly selector: string;\n  /**\n   * What this chart calls one datum — 'bar', 'slice', 'tile', 'cell'. Names the\n   * chart in dev warnings, and words the disclosures in English when\n   * `nounCount` is not given.\n   */\n  readonly noun: string;\n  /**\n   * How a disclosure counts these data, as a label template the CALLING package\n   * owns — `'{count, plural, one {# bar} other {# bars}}'`. Pass it from the\n   * chart's labels so the count reads in the app's language; without it the\n   * count is `noun` with an English \"s\".\n   */\n  readonly nounCount?: string;\n  /**\n   * Whether a value is plottable as given. Defaults to \"finite and not\n   * negative\", which is what the five share-of-total families need; the heatmap\n   * passes its own, because a negative temperature is perfectly plottable there\n   * and a missing one is not.\n   */\n  readonly plottable?: (value: number) => boolean;\n  /** The value a clamped datum takes. @default 0 */\n  readonly clampTo?: number;\n  /**\n   * Why an unplottable value cannot be drawn on THIS chart, and what the reader\n   * should take from the ones that remain. Used under `omit` only.\n   *\n   * ★ Parameterised because the default is a claim about share-of-total charts —\n   *   \"this chart plots a share of a total, and a missing value cannot be part of\n   *   one\" — and it was being told to readers of a heatmap, which plots no total\n   *   and has no percentages below. A disclosure that misdescribes the chart it\n   *   sits under is not much better than no disclosure: the reader now has a\n   *   confident, wrong account of what they are looking at.\n   *\n   * @param described How the missing value reads in prose — see `describeValue`.\n   * @param remaining How many items are still plotted.\n   */\n  readonly omitReason?: (described: string, remaining: number) => string;\n  /** The disclosures' wording. @default SV_CORE_LABELS (English) */\n  readonly labels?: SvValuePolicyLabels;\n  /** Locale the disclosures' numbers are formatted in. @default '' */\n  readonly locale?: string;\n}\n\n/** The dataset a chart should plot, and what it must disclose about it. */\nexport interface SvValuePolicyResult<T> {\n  /**\n   * What to draw. The **same array reference** when every value was plottable,\n   * so the common case allocates nothing and a host's input identity survives\n   * change detection.\n   */\n  readonly items: readonly T[];\n  /**\n   * Items in `items` whose value was altered, for the visible marker `clamp`\n   * promises. A set, not a list, because a heatmap asks this per cell.\n   */\n  readonly clamped: ReadonlySet<T>;\n  /** How many items were left out under `omit`. */\n  readonly omitted: number;\n  /**\n   * One sentence for the chart to render beside the plot, or `null` when nothing\n   * was altered and there is nothing to disclose.\n   */\n  readonly notice: string | null;\n  /** Set only under `reject`, for the chart to hand to its error state. */\n  readonly error: SvDataError | null;\n}\n\n/**\n * `true` for a value a share-of-total chart can plot, and the default predicate.\n *\n * Exported because charts need the same test to decide their empty state: \"every\n * value was unplottable and the policy omitted them all\" is empty, and\n * `items.length === 0` alone cannot tell that apart from \"the host passed\n * nothing\", which needs different copy.\n */\nexport function svIsPlottableShare(value: number): boolean {\n  return Number.isFinite(value) && value >= 0;\n}\n\n/** Shared empty set — the untouched result is by far the common one. */\nconst EMPTY_SET: ReadonlySet<never> = new Set<never>();\n\n/**\n * The policies a share-of-total chart can carry out. See `svResolveShares` for\n * why `render` and `clamp` are not among them.\n */\nconst SV_SHARE_POLICIES: readonly SvValuePolicy[] = ['omit', 'reject'];\n\n/** The least a share-of-total chart needs from one datum. */\nexport interface SvSharePoint {\n  readonly label: string;\n  readonly value: number;\n}\n\n/** How `svResolveShares` words its disclosures — see the same fields on {@link SvValuePolicyOptions}. */\nexport interface SvShareWording {\n  /** The count of data as a label template the calling package owns. @default English from `noun` */\n  readonly nounCount?: string;\n  /** @default SV_CORE_LABELS (English) */\n  readonly labels?: SvValuePolicyLabels;\n  /** @default '' */\n  readonly locale?: string;\n}\n\n/** A share-of-total dataset, resolved: what to plot and what it adds up to. */\nexport interface SvShareResult<T> extends SvValuePolicyResult<T> {\n  /** Sum over `items` — the only correct denominator for a share. */\n  readonly total: number;\n  /**\n   * There are points to plot and they add to nothing. Distinct from \"no points\":\n   * `[0, 0]` is a real answer about a real dataset, and drawing the same \"No data\n   * to plot\" for both tells the reader the fetch failed when it did not.\n   */\n  readonly allZero: boolean;\n}\n\n/**\n * The policy, applied the way every share-of-total chart needs it.\n *\n * Seven components — two pies, three pie variants, two donuts — each wrote\n * `total = slices.reduce((s, x) => s + x.value, 0)` and divided by it. That is\n * the bug, not a step on the way to it: `[10, -5]` totals 5, so the first slice\n * sweeps 720° and laps the second, and `[5, -5]` totals 0, which every one of\n * them reads as \"no data\" and renders as an empty state over two real values.\n * Neither case warned. This function is what they call instead, so the fix is in\n * one place and the denominator can only ever be a sum over plotted values.\n *\n * `render` is not offered: a circle has no way to draw a negative arc, so a chart\n * claiming it could would be the substitution X-7 exists to prevent.\n *\n * ★★ Neither is `clamp`. Its contract is \"plot the nearest drawable value and\n *    MARK the datum\", and its notice ends \"Marked in the plot.\" On a share chart\n *    the nearest drawable value is a 0° arc (or, on a polar area chart, a wedge\n *    of radius 0): invisible, so there is nothing to put a marker on, and the\n *    table printed a flat `0` indistinguishable from a real zero. Accepting it\n *    meant every pie, donut and polar chart asserted a marker it never drew. A\n *    host that asks for it gets `omit` — the documented default — with a dev\n *    warning, the same as any other policy a chart cannot carry out.\n */\nexport function svResolveShares<T extends SvSharePoint>(\n  points: readonly T[],\n  policy: SvValuePolicy,\n  selector: string,\n  noun = 'slice',\n  wording: SvShareWording = {},\n): SvShareResult<T> {\n  const { nounCount, labels = SV_CORE_LABELS, locale = '' } = wording;\n  const resolved = svApplyValuePolicy(points, {\n    value: (p) => p.value,\n    clamp: (p, to) => ({ ...p, value: to }),\n    policy,\n    supported: SV_SHARE_POLICIES,\n    fallback: 'omit',\n    selector,\n    noun,\n    nounCount,\n    labels,\n    locale,\n  });\n\n  let total = 0;\n  for (const point of resolved.items) total += point.value;\n\n  const allZero = resolved.items.length > 0 && total === 0;\n  const zeroNote = allZero\n    ? svFormatLabel(labels.valueAllZero, { items: count(resolved.items.length, noun, nounCount, locale) }, locale)\n    : null;\n\n  return {\n    ...resolved,\n    total,\n    allZero,\n    notice:\n      resolved.notice && zeroNote\n        ? `${resolved.notice} ${zeroNote}`\n        : (resolved.notice ?? zeroNote),\n  };\n}\n\n/** One warning per selector per reason, so 300 bad cells log once. */\nconst warned = new Set<string>();\n\nfunction warnOnce(key: string, message: string): void {\n  if (typeof ngDevMode === 'undefined' || !ngDevMode || warned.has(key)) return;\n  warned.add(key);\n  svWarn(message);\n}\n\n/**\n * `3 slices` / `1 slice` — the disclosure reads as a sentence either way. From\n * the caller's `nounCount` template when it gives one; otherwise the English\n * the `noun`-only API has always produced.\n */\nfunction count(n: number, noun: string, nounCount: string | undefined, locale: string): string {\n  if (nounCount) return svFormatLabel(nounCount, { count: n }, locale);\n  return `${n} ${noun}${n === 1 ? '' : 's'}`; // sv-i18n-ignore: English fallback for the legacy `noun`-only option\n}\n\n/**\n * How a disclosure names a value it could not plot.\n *\n * `${NaN}` is the string `\"NaN\"`, and a sentence reading \"for example NaN\" tells a\n * reader the chart received a measurement it disliked. It received nothing: `NaN`\n * is what `Number(row.amount)` returns for a blank cell, and `Infinity` is what a\n * division by a zero denominator returns. Those are absences and arithmetic\n * accidents, and the sentence says which. A real number is quoted as itself,\n * because \"-5\" is the value the reader will find in their own source data.\n */\nfunction describe(value: number, labels: SvValuePolicyLabels): string {\n  if (Number.isNaN(value)) return labels.valueMissing;\n  if (value === Infinity) return labels.valueUnbounded;\n  if (value === -Infinity) return labels.valueNegativelyUnbounded;\n  return `${value}`;\n}\n\n/**\n * Resolves what a chart plots, and what it has to say about it.\n *\n * The policy is applied **before** any share-of-total arithmetic, which is the\n * whole point: a denominator computed from the raw input is already wrong, and no\n * amount of per-slice guarding downstream can recover the shares from it.\n *\n * @example\n * ```ts\n * private readonly plotted = computed(() =>\n *   svApplyValuePolicy(this.slices(), {\n *     value: (s) => s.value,\n *     clamp: (s, to) => ({ ...s, value: to }),\n *     policy: this.valuePolicy(),\n *     supported: ['omit', 'reject'],\n *     fallback: 'omit',\n *     selector: 'sv-pie-chart',\n *     noun: 'slice',\n *   }),\n * );\n * // total is a sum over `plotted().items`, never over `slices()`\n * ```\n */\nexport function svApplyValuePolicy<T>(\n  items: readonly T[],\n  options: SvValuePolicyOptions<T>,\n): SvValuePolicyResult<T> {\n  const {\n    value,\n    clamp,\n    supported,\n    fallback,\n    selector,\n    noun,\n    nounCount,\n    plottable = svIsPlottableShare,\n    labels = SV_CORE_LABELS,\n    locale = '',\n    clampTo = 0,\n  } = options;\n  const say = (template: string, params: SvLabelParams) => svFormatLabel(template, params, locale);\n  const counted = (n: number) => count(n, noun, nounCount, locale);\n  // The share-of-total wording, which is what five families need and what the\n  // other two must override. See `omitReason` on the options.\n  const omitReason =\n    options.omitReason ??\n    ((described: string, remaining: number) =>\n      say(labels.valueOmitShare, { value: described, items: counted(remaining) }));\n  const describeValue = (v: number) => describe(v, labels);\n\n  let policy = options.policy;\n  if (!supported.includes(policy)) {\n    warnOnce(\n      `${selector}:unsupported:${policy}`,\n      `<${selector}> does not support the '${policy}' value policy — it has no way to ` +\n        `draw a ${noun} whose value it cannot plot that way. Using '${fallback}' instead. ` +\n        `Supported here: ${supported.map((p) => `'${p}'`).join(', ')}.`,\n    );\n    policy = fallback;\n  }\n\n  const offending: number[] = [];\n  for (let i = 0; i < items.length; i++) {\n    if (!plottable(value(items[i]))) offending.push(i);\n  }\n\n  if (!offending.length) {\n    return { items, clamped: EMPTY_SET as ReadonlySet<T>, omitted: 0, notice: null, error: null };\n  }\n\n  const first = value(items[offending[0]]);\n  // \"for example\" only earns its place when there is more than one to choose from.\n  const example =\n    offending.length === 1 ? describeValue(first) : say(labels.valueForExample, { value: describeValue(first) });\n\n  if (policy === 'render') {\n    // The chart said it can draw these truthfully, so nothing is altered here —\n    // but the reader is still told, because \"truthfully\" for an unplottable\n    // value means a rendering they have not seen before (a hatch, a gap) and a\n    // legend for it is the difference between honest and cryptic.\n    return {\n      items,\n      clamped: EMPTY_SET as ReadonlySet<T>,\n      omitted: 0,\n      notice: say(labels.valueRendered, { items: counted(offending.length) }),\n      error: null,\n    };\n  }\n\n  if (policy === 'reject') {\n    return {\n      items: [],\n      clamped: EMPTY_SET as ReadonlySet<T>,\n      omitted: 0,\n      notice: null,\n      error: {\n        message: say(labels.valueRejected, { items: counted(offending.length), example }),\n        code: 'SV_UNPLOTTABLE_VALUE',\n        retryable: false,\n      },\n    };\n  }\n\n  if (policy === 'omit') {\n    const kept: T[] = [];\n    for (const item of items) {\n      if (plottable(value(item))) kept.push(item);\n    }\n    return {\n      items: kept,\n      clamped: EMPTY_SET as ReadonlySet<T>,\n      omitted: offending.length,\n      notice: say(labels.valueOmitted, {\n        items: counted(offending.length),\n        reason: omitReason(describeValue(first), kept.length),\n      }),\n      error: null,\n    };\n  }\n\n  const out = items.slice();\n  const clamped = new Set<T>();\n  for (const i of offending) {\n    const replacement = clamp(items[i], clampTo);\n    out[i] = replacement;\n    clamped.add(replacement);\n  }\n  return {\n    items: out,\n    clamped,\n    omitted: 0,\n    notice: say(labels.valueClamped, {\n      items: counted(offending.length),\n      clampTo: `${clampTo}`,\n      count: offending.length,\n      example,\n    }),\n    error: null,\n  };\n}\n","/**\n * point-bins.ts — aggregate 2-D points into hexagonal bins.\n *\n * ## Why this exists\n *\n * A scatter plot draws one mark per datum, and a mark cannot be drawn twice: the\n * second point at the same coordinate replaces the first, pixel for pixel. Ten\n * thousand points inside one cluster and a hundred therefore produce the SAME\n * picture, and the picture is confident either way. There is no visual cue that\n * an order of magnitude is hidden — which makes overplotting worse than a missing\n * chart, because a missing chart does not persuade anyone of anything.\n *\n * Binning replaces \"one mark per datum\" with \"one mark per neighbourhood, shaded\n * by how many landed in it\". The count is then a number the chart can print,\n * announce and put in a table, instead of a density the reader has to guess at.\n *\n * ## Why hexagons rather than squares\n *\n * A square grid has two axis-aligned neighbours at distance `s` and two diagonal\n * ones at `s√2`, so the same cluster bins differently depending on how it sits\n * relative to the grid, and rows and columns of cells line up into stripes the\n * eye reads as structure in the data. Every hexagon's six neighbours are\n * equidistant, so the tiling has no preferred direction and no stripes. It is the\n * standard choice for density plots for exactly this reason.\n *\n * ## What this module is not\n *\n * It does not know about SVG, pixels or colour ramps. `x`/`y` are accessors and\n * `radius` is in whatever unit they return — call it with screen coordinates and\n * the bins are screen-sized, which is what a density plot wants (a bin should be\n * a constant size on the page, not a constant size in the data). Deciding how a\n * count becomes a shade belongs to the caller, because that decision needs the\n * caller's palette and its legend.\n */\n\n/** One hexagonal bin and the items that fell inside it. */\nexport interface SvPointBin<T> {\n  /**\n   * Column index within the hex lattice. Odd rows are offset half a column, so\n   * `q` is an identity rather than a subscript — two bins in adjacent rows with\n   * the same `q` are not vertically aligned.\n   */\n  readonly q: number;\n  /** Row index within the hex lattice. */\n  readonly r: number;\n  /** Centre of the hexagon, in the same units as the accessors returned. */\n  readonly cx: number;\n  /** @see cx */\n  readonly cy: number;\n  /** How many items fell in this bin. Always `items.length`, never zero. */\n  readonly count: number;\n  /**\n   * The items themselves, in the order they were supplied. Kept rather than\n   * discarded so a caller can answer \"which points are these?\" on hover, on\n   * selection and in a table — a bin whose contents cannot be listed is a dead\n   * end for a keyboard user.\n   */\n  readonly items: readonly T[];\n}\n\n/** Accessors and bin size for {@link svHexBin}. */\nexport interface SvHexBinOptions<T> {\n  /** Horizontal coordinate of an item. */\n  readonly x: (item: T) => number;\n  /** Vertical coordinate of an item. */\n  readonly y: (item: T) => number;\n  /**\n   * Circumradius of one hexagon, in the units the accessors return. Must be\n   * finite and above zero; anything else throws, because a zero radius silently\n   * collapses every point into one bin.\n   */\n  readonly radius: number;\n}\n\n/**\n * Group `items` into hexagonal bins of the given radius.\n *\n * Items whose coordinates are not finite are **skipped** — they have no position,\n * so no bin can honestly claim them. Compare `items.length` against the summed\n * `count` to find out how many were dropped; this function does not report it,\n * because what to say about it depends on the caller.\n *\n * Bins come back in first-seen order, so the same input always produces the same\n * paint order and the same table.\n */\nexport function svHexBin<T>(\n  items: readonly T[],\n  options: SvHexBinOptions<T>,\n): readonly SvPointBin<T>[] {\n  const { x, y, radius } = options;\n  if (!Number.isFinite(radius) || radius <= 0) {\n    throw new Error(`svHexBin: radius must be a finite number above zero, got ${radius}.`);\n  }\n\n  // Lattice pitch for a pointy-top hexagon of circumradius `radius`: columns are\n  // one short diagonal apart, rows three half-radii apart.\n  const dx = radius * 2 * Math.sin(Math.PI / 3);\n  const dy = radius * 1.5;\n\n  const byKey = new Map<string, { q: number; r: number; items: T[] }>();\n  const order: { q: number; r: number; items: T[] }[] = [];\n\n  for (const item of items) {\n    const px = x(item);\n    const py = y(item);\n    if (!Number.isFinite(px) || !Number.isFinite(py)) continue;\n\n    // Nearest lattice row, then nearest column on that row.\n    const ry = py / dy;\n    let r = Math.round(ry);\n    const rx = px / dx - (r & 1) / 2;\n    let q = Math.round(rx);\n\n    // Rounding each axis independently picks the nearest cell of a RECTANGULAR\n    // grid, which is not the nearest hexagon near the slanted edges. Only the\n    // outer third of a row can be wrong, so the two candidates are compared by\n    // true distance just there.\n    //\n    // ★ The distances are weighted back into the caller's units before being\n    //   compared. A column is `dx` wide and a row `dy` tall and those differ by\n    //   √3 : 1.5, so comparing the offsets raw — as the textbook form of this\n    //   rounding does — measures against a stretched circle and hands a sliver of\n    //   points along every slanted edge to the wrong neighbour. The tiling then\n    //   has seams: a lattice of gaps and doubled cells across a dense cloud.\n    const dry = ry - r;\n    if (Math.abs(dry) * 3 > 1) {\n      const drq = rx - q;\n      const qNear = q + (rx < q ? -1 : 1) / 2;\n      const rNear = r + (ry < r ? -1 : 1);\n      const drq2 = rx - qNear;\n      const dry2 = ry - rNear;\n      const here = (drq * dx) ** 2 + (dry * dy) ** 2;\n      const there = (drq2 * dx) ** 2 + (dry2 * dy) ** 2;\n      if (here > there) {\n        // `r & 1` is deliberately the OLD row: the half-column offset being undone\n        // here is the one that was applied when `rx` was computed.\n        q = qNear + ((r & 1) ? 1 : -1) / 2;\n        r = rNear;\n      }\n    }\n\n    const key = `${q},${r}`;\n    const existing = byKey.get(key);\n    if (existing) {\n      existing.items.push(item);\n    } else {\n      const bin = { q, r, items: [item] };\n      byKey.set(key, bin);\n      order.push(bin);\n    }\n  }\n\n  return order.map(bin => ({\n    q: bin.q,\n    r: bin.r,\n    cx: (bin.q + (bin.r & 1) / 2) * dx,\n    cy: bin.r * dy,\n    count: bin.items.length,\n    items: bin.items,\n  }));\n}\n\n/**\n * The outline of one hexagon of circumradius `radius`, centred on the origin, as\n * an SVG path `d`. Pointy-top, matching the lattice {@link svHexBin} bins onto.\n *\n * Returned centred so a caller positions it with a `translate`, which keeps one\n * path string for every bin instead of one per bin.\n */\nexport function svHexPath(radius: number): string {\n  if (!Number.isFinite(radius) || radius <= 0) {\n    throw new Error(`svHexPath: radius must be a finite number above zero, got ${radius}.`);\n  }\n  const step = Math.PI / 3;\n  const points: string[] = [];\n  for (let i = 0; i < 6; i++) {\n    const angle = i * step;\n    points.push(`${round(Math.sin(angle) * radius)},${round(-Math.cos(angle) * radius)}`);\n  }\n  return `M${points.join('L')}Z`;\n}\n\n/**\n * Map a bin count onto one of `steps` density levels, `1` to `steps`.\n *\n * Linear in the count would be useless on the distribution these plots actually\n * have: one bin of 900 and a hundred bins of 1–5 is the normal shape of a cluster,\n * and linear shading paints all hundred of them the palest step and the whole plot\n * reads as empty. The scale is therefore logarithmic, which is what makes the\n * difference between 1 and 5 visible at the same time as the difference between\n * 100 and 900.\n *\n * A `max` of 1 (every bin holding one item) returns `1` for every bin rather than\n * dividing by a zero log range.\n */\nexport function svBinDensityStep(count: number, max: number, steps: number): number {\n  if (!Number.isFinite(count) || count <= 0) return 1;\n  if (!Number.isFinite(steps) || steps < 1) return 1;\n  const top = Math.max(1, max);\n  if (top <= 1) return 1;\n  const fraction = Math.log(Math.min(count, top)) / Math.log(top);\n  return Math.min(steps, Math.max(1, Math.ceil(fraction * steps)));\n}\n\n/** Trim float noise off a coordinate so the path strings stay short and stable. */\nfunction round(value: number): number {\n  return Math.round(value * 1000) / 1000;\n}\n","/**\n * nice-scale.ts — a numeric axis rounded out to numbers a person would have written.\n *\n * Every chart whose axis is NOT zero-based needs this, and there are several: a box\n * plot of response times between 180 ms and 240 ms zero-based is a flat smear at the\n * top of the plot, and a scatter plot has no category list to fall back on at all —\n * both of its axes are `(v - min) / (max - min)` over whatever the host sent.\n *\n * It lives in core rather than beside either of them because it was written twice\n * with two different rounding ladders, and two charts in the same kit that disagree\n * about where a tick belongs is a bug the reader sees.\n */\n\n/** A rounded axis: the drawn ends, the tick step, and the ticks themselves. */\nexport interface SvNiceScale {\n  /** Lower end of the DRAWN axis, at or below the data minimum. */\n  readonly min: number;\n  /** Upper end of the DRAWN axis, at or above the data maximum. */\n  readonly max: number;\n  /** Spacing between ticks. Always above zero. */\n  readonly step: number;\n  /** Tick values from `min` to `max` inclusive. Never fewer than two. */\n  readonly ticks: readonly number[];\n}\n\n/**\n * Round a data range out to human tick values.\n *\n * Both ends are rounded outward to a 1 / 2 / 2.5 / 5 / 10 × 10ⁿ step, rather than\n * only the top as a zero-based `niceMax()` does, so the axis fits the data instead\n * of the data being pushed against one edge of it.\n *\n * A degenerate range — every sample identical, or a single point — is widened by a\n * step rather than divided through: a zero span makes every position `NaN`, and an\n * SVG coordinate of `NaN` is dropped in silence, so the whole plot comes out blank\n * with nothing in the console to say why.\n */\nexport function svNiceScale(min: number, max: number, tickCount = 5): SvNiceScale {\n  const a = Number.isFinite(min) ? min : 0;\n  const b = Number.isFinite(max) ? max : 1;\n  // Sorted rather than trusted: a caller handing over a reversed range means the\n  // range, and treating it as degenerate would silently drop half the data\n  // off-axis.\n  const lo = Math.min(a, b);\n  const hi = Math.max(a, b);\n  const want = Number.isFinite(tickCount) ? Math.max(2, Math.floor(tickCount)) : 5;\n\n  if (hi <= lo) {\n    const step = Math.abs(lo) > 0 ? Math.abs(lo) / 4 : 1;\n    return { min: lo - step, max: lo + step, step, ticks: [lo - step, lo, lo + step] };\n  }\n\n  const rawStep = (hi - lo) / want;\n  const magnitude = Math.pow(10, Math.floor(Math.log10(rawStep)));\n  const step = niceMultiple(rawStep / magnitude) * magnitude;\n\n  // Snap the quotient before rounding it. `1.1 / 0.1` is 11.000000000000002 in\n  // IEEE-754, so a bare `Math.ceil` adds a whole spurious step — an axis that ends\n  // one tick above the data for no reason the reader can see.\n  const QUOTIENT_EPS = 1e-9;\n  const niceMin = round12(Math.floor(lo / step + QUOTIENT_EPS) * step);\n  const niceMax = round12(Math.ceil(hi / step - QUOTIENT_EPS) * step);\n  const count = Math.max(1, Math.round((niceMax - niceMin) / step));\n\n  return {\n    min: niceMin,\n    max: niceMax,\n    step,\n    // Re-derived from the index rather than accumulating `+= step`, which drifts on\n    // decimal steps (0.1 + 0.1 + 0.1 = 0.30000000000000004) — and a tick is where\n    // that drift becomes a LABEL the reader can see.\n    ticks: Array.from({ length: count + 1 }, (_, i) => round12(niceMin + i * step)),\n  };\n}\n\n/**\n * Snap a mantissa up to the next rung of the 1 / 2 / 2.5 / 5 / 10 ladder.\n *\n * 2.5 is on the ladder because without it a mantissa just past 2 jumps straight to\n * 5, which halves the grid: a range wanting a step of 2,200 got 5,000 and came back\n * with three ticks where six were asked for.\n *\n * The ladder rounds UP rather than to the nearest rung, so the tick count is a\n * ceiling on what was asked for rather than an approximation of it — a request for\n * five ticks never comes back with nine.\n */\nfunction niceMultiple(normalized: number): number {\n  if (normalized <= 1) return 1;\n  if (normalized <= 2) return 2;\n  if (normalized <= 2.5) return 2.5;\n  if (normalized <= 5) return 5;\n  return 10;\n}\n\n/** Trim the float tail off a computed tick without disturbing its value. */\nfunction round12(value: number): number {\n  return Number(value.toFixed(12));\n}\n\n/**\n * Label one tick, given the step the axis is walking in.\n *\n * ★★★ Compacting each value on its own is the obvious version and it silently\n *     destroys an axis: `2014` becomes `2.0k`, and so do 2016, 2018, 2020 and 2022.\n *     A year axis therefore printed the SAME string on all six ticks — no more use\n *     than one labelled with numbers from a different chart.\n *\n * The STEP decides the unit, so every tick on an axis is scaled the same way and the\n * labels can be read against each other; a step below a thousand is never compacted,\n * which is what keeps a year a year. The number of decimals comes from the step too,\n * so a 2.5 step keeps the `.5` that tells its ticks apart and a 20,000 step does not\n * carry a `.0` that says nothing.\n */\nexport function svTickLabel(value: number, step: number): string {\n  if (!Number.isFinite(value)) return '';\n  // Zero is zero in every unit, and `0k` reads as a rounding error.\n  if (value === 0) return '0';\n\n  // The cuts sit half a unit below the unit itself: 250,000 reads better as `250k`\n  // than as `0.25M`, and 500,000 better as `0.5M` than as `500k`.\n  const scale = Number.isFinite(step) && step > 0 ? step : Math.abs(value);\n  if (scale >= 500_000) {\n    return `${(value / 1_000_000).toFixed(decimalsFor(scale / 1_000_000))}M`;\n  }\n  if (scale >= 1_000) {\n    return `${(value / 1_000).toFixed(decimalsFor(scale / 1_000))}k`;\n  }\n  return value.toFixed(decimalsFor(scale));\n}\n\n/**\n * How many decimals a step needs to stay distinguishable from the next one.\n *\n * A whole step needs none. Below one it needs as many as its magnitude implies, plus\n * one more for the 2.5 rung — the only step on the ladder whose own value carries a\n * decimal.\n */\nfunction decimalsFor(step: number): number {\n  if (!Number.isFinite(step) || step <= 0 || Number.isInteger(step)) return 0;\n  const exponent = Math.floor(Math.log10(step));\n  const mantissa = step / Math.pow(10, exponent);\n  const extra = Math.abs(mantissa - 2.5) < 1e-9 ? 1 : 0;\n  return Math.min(8, Math.max(0, -exponent + extra));\n}\n","/**\n * indicators.ts — the technical indicators a price chart overlays, as pure\n * functions over a series of closes (`FL-D4`).\n *\n * Every function returns an array THE SAME LENGTH as its input, with `null`\n * where the indicator has no value yet. Index `i` of the output belongs to\n * session `i` of the input, so a chart can zip them without an offset to get\n * wrong — and a reader of the table sees a blank, not a number invented to fill\n * the warm-up.\n *\n * ★★★ THE WARM-UP IS BLANK, NOT ZERO AND NOT PARTIAL. A 20-session average over\n *     the first 3 sessions is a 3-session average wearing the wrong label, and\n *     a zero is a price. Both draw a line that looks like data. So the first\n *     `period - 1` values are `null` and a chart leaves the gap.\n *\n * ★★ THE CONVENTIONS ARE THE PUBLISHED ONES, so a value can be checked against\n *    any charting terminal: an EMA is seeded with the simple average of its\n *    first `period` values; RSI uses Wilder's smoothing (an EMA with\n *    α = 1/period, seeded the same way); Bollinger bands use the POPULATION\n *    standard deviation; MACD is EMA(fast) − EMA(slow) with an EMA(signal) of\n *    it. A spec in the `node` project holds each one to a known series.\n *\n * ★ A NON-FINITE VALUE BREAKS THE RUN rather than poisoning it. `NaN` would\n *   carry through every later average forever; instead the indicator restarts\n *   its warm-up after the gap, which is what a missing session means.\n */\n\n/** One value per session; `null` while the indicator is warming up. */\nexport type SvIndicatorSeries = readonly (number | null)[];\n\n/** Bollinger bands: the moving average and the bands `multiplier` deviations either side. */\nexport interface SvBollingerBands {\n  readonly middle: SvIndicatorSeries;\n  readonly upper: SvIndicatorSeries;\n  readonly lower: SvIndicatorSeries;\n}\n\n/** MACD: the line, its signal line, and the difference between them. */\nexport interface SvMacd {\n  readonly macd: SvIndicatorSeries;\n  readonly signal: SvIndicatorSeries;\n  readonly histogram: SvIndicatorSeries;\n}\n\n/** A period must be a whole number of sessions, at least one. */\nfunction checkPeriod(period: number, name: string): number {\n  if (!Number.isInteger(period) || period < 1) {\n    throw new RangeError(`${name} must be a whole number of sessions, at least 1 — got ${period}`); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  }\n  return period;\n}\n\n/**\n * Split a series into runs of consecutive finite values, so a gap restarts the\n * warm-up. Yields `[start, end)` index pairs.\n */\nfunction finiteRuns(values: readonly (number | null)[]): [number, number][] {\n  const runs: [number, number][] = [];\n  let start = -1;\n  for (let i = 0; i <= values.length; i++) {\n    const v = i < values.length ? values[i] : null;\n    const ok = typeof v === 'number' && Number.isFinite(v);\n    if (ok && start < 0) start = i;\n    if (!ok && start >= 0) {\n      runs.push([start, i]);\n      start = -1;\n    }\n  }\n  return runs;\n}\n\n/**\n * Simple moving average: the mean of the last `period` values.\n *\n * Summed incrementally, and re-summed from scratch every `period` steps so the\n * running total's floating-point drift cannot build up over a long history.\n */\nexport function svSma(values: readonly (number | null)[], period: number): SvIndicatorSeries {\n  const n = checkPeriod(period, 'svSma period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  const out: (number | null)[] = new Array(values.length).fill(null);\n  for (const [start, end] of finiteRuns(values)) {\n    let sum = 0;\n    for (let i = start; i < end; i++) {\n      sum += values[i] as number;\n      if (i - start >= n) sum -= values[i - n] as number;\n      if (i - start + 1 < n) continue;\n      if ((i - start) % n === 0) {\n        sum = 0;\n        for (let j = i - n + 1; j <= i; j++) sum += values[j] as number;\n      }\n      out[i] = sum / n;\n    }\n  }\n  return out;\n}\n\n/**\n * Exponential moving average with smoothing `alpha`, seeded with the simple\n * average of the first `period` values. Shared by `svEma` (α = 2/(n+1)) and\n * Wilder's smoothing in `svRsi` (α = 1/n).\n */\nfunction smooth(values: readonly (number | null)[], period: number, alpha: number): (number | null)[] {\n  const out: (number | null)[] = new Array(values.length).fill(null);\n  for (const [start, end] of finiteRuns(values)) {\n    if (end - start < period) continue;\n    let seed = 0;\n    for (let i = start; i < start + period; i++) seed += values[i] as number;\n    let prev = seed / period;\n    out[start + period - 1] = prev;\n    for (let i = start + period; i < end; i++) {\n      prev = prev + alpha * ((values[i] as number) - prev);\n      out[i] = prev;\n    }\n  }\n  return out;\n}\n\n/** Exponential moving average, α = 2 / (period + 1), seeded with the first SMA. */\nexport function svEma(values: readonly (number | null)[], period: number): SvIndicatorSeries {\n  const n = checkPeriod(period, 'svEma period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  return smooth(values, n, 2 / (n + 1));\n}\n\n/**\n * Bollinger bands: an SMA of `period` and the bands `multiplier` POPULATION\n * standard deviations either side — the definition John Bollinger published,\n * and the one every terminal draws.\n */\nexport function svBollinger(\n  values: readonly (number | null)[],\n  period = 20,\n  multiplier = 2,\n): SvBollingerBands {\n  const n = checkPeriod(period, 'svBollinger period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  if (!Number.isFinite(multiplier) || multiplier < 0) {\n    throw new RangeError(`svBollinger multiplier must be a finite number ≥ 0 — got ${multiplier}`); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  }\n  const middle = svSma(values, n);\n  const upper: (number | null)[] = new Array(values.length).fill(null);\n  const lower: (number | null)[] = new Array(values.length).fill(null);\n  for (let i = 0; i < values.length; i++) {\n    const mean = middle[i];\n    if (mean === null || mean === undefined) continue;\n    let sq = 0;\n    for (let j = i - n + 1; j <= i; j++) {\n      const d = (values[j] as number) - mean;\n      sq += d * d;\n    }\n    const sd = Math.sqrt(sq / n);\n    upper[i] = mean + multiplier * sd;\n    lower[i] = mean - multiplier * sd;\n  }\n  return { middle, upper, lower };\n}\n\n/**\n * Relative Strength Index, Wilder's method: the average gain and average loss\n * over `period` changes, smoothed with α = 1/period, as `100 − 100 / (1 + RS)`.\n *\n * The first value lands on session `period` — it needs `period` CHANGES, which\n * is `period + 1` closes. A run with no losses reads 100, no gains 0, and a\n * flat run (no movement either way) 50: neither side has any strength.\n */\nexport function svRsi(values: readonly (number | null)[], period = 14): SvIndicatorSeries {\n  const n = checkPeriod(period, 'svRsi period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  const out: (number | null)[] = new Array(values.length).fill(null);\n  for (const [start, end] of finiteRuns(values)) {\n    if (end - start <= n) continue;\n    const gains: number[] = [];\n    const losses: number[] = [];\n    for (let i = start + 1; i < end; i++) {\n      const d = (values[i] as number) - (values[i - 1] as number);\n      gains.push(d > 0 ? d : 0);\n      losses.push(d < 0 ? -d : 0);\n    }\n    const avgGain = smooth(gains, n, 1 / n);\n    const avgLoss = smooth(losses, n, 1 / n);\n    for (let k = n - 1; k < gains.length; k++) {\n      const g = avgGain[k] as number;\n      const l = avgLoss[k] as number;\n      out[start + 1 + k] = g === 0 && l === 0 ? 50 : l === 0 ? 100 : 100 - 100 / (1 + g / l);\n    }\n  }\n  return out;\n}\n\n/**\n * MACD: EMA(`fast`) − EMA(`slow`), its EMA(`signal`), and the histogram\n * (MACD − signal). The line starts on session `slow − 1`; the signal and the\n * histogram `signal − 1` sessions after that.\n */\nexport function svMacd(\n  values: readonly (number | null)[],\n  fast = 12,\n  slow = 26,\n  signal = 9,\n): SvMacd {\n  const f = checkPeriod(fast, 'svMacd fast period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  const s = checkPeriod(slow, 'svMacd slow period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  const g = checkPeriod(signal, 'svMacd signal period'); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  if (f >= s) throw new RangeError(`svMacd fast period (${f}) must be shorter than the slow one (${s})`); // sv-i18n-ignore: developer error, thrown to the caller, never rendered\n  const emaFast = svEma(values, f);\n  const emaSlow = svEma(values, s);\n  const macd = values.map((_, i) => {\n    const a = emaFast[i];\n    const b = emaSlow[i];\n    return a === null || a === undefined || b === null || b === undefined ? null : a - b;\n  });\n  const sig = svEma(macd, g);\n  const histogram = macd.map((m, i) => {\n    const v = sig[i];\n    return m === null || v === null || v === undefined ? null : m - v;\n  });\n  return { macd, signal: sig, histogram };\n}\n","import { computed, signal, type Signal } from '@angular/core';\nimport { resolveItemKey } from './item-key';\nimport type { SvItemKey } from './types';\n\n/**\n * A live layer over a host-owned list.\n *\n * @see createStreamOverlay\n */\nexport interface SvStreamOverlay<T> {\n  /** The host's list with everything the stream added or changed applied. */\n  readonly merged: Signal<readonly T[]>;\n  /** True while the overlay is holding anything on top of the host's list. */\n  readonly dirty: Signal<boolean>;\n  /**\n   * Append one item. Re-delivering a key already present patches that item\n   * instead of adding a second copy.\n   */\n  append(item: T): void;\n  /** Change fields on an item already on screen. */\n  patch(key: string | number, changes: Partial<T>): void;\n  /** Drop the whole layer, leaving the host's list exactly as given. */\n  clear(): void;\n}\n\ninterface Layer<T> {\n  /** The base array this layer was built against — identity, not contents. */\n  readonly base: readonly T[];\n  readonly added: readonly T[];\n  readonly patches: ReadonlyMap<string | number, Partial<T>>;\n}\n\nconst EMPTY_BASE: readonly never[] = [];\n\n/**\n * Let a component take events one at a time without the host rebuilding its\n * whole array.\n *\n * A component fed by SSE or a WebSocket has two bad options otherwise: the host\n * clones the entire list per token (O(n) per event, and every row re-renders\n * for one status change), or the component keeps private state that silently\n * diverges from what the host passed in. This is the third: the host's input\n * stays the source of truth, and the overlay sits on top of it.\n *\n * **The overlay evaporates when the host's list changes.** A fresh array from\n * the host is the new truth — anything the socket pushed against the *previous*\n * one must not survive onto it, or a reconnect that refetches shows every event\n * twice. Identity, not contents, is the trigger, so a host that re-emits the\n * same array reference keeps its stream.\n *\n * ```ts\n * private readonly overlay = createStreamOverlay(() => this.events(), 'id');\n * readonly allEvents = this.overlay.merged;\n *\n * appendEvent(e: ActivityEvent) { this.overlay.append(e); }\n * ```\n */\nexport function createStreamOverlay<T>(\n  base: () => readonly T[],\n  itemKey: SvItemKey<T>,\n): SvStreamOverlay<T> {\n  const layer = signal<Layer<T>>({ base: EMPTY_BASE as readonly T[], added: [], patches: new Map() });\n\n  const keyOf = (item: T, index: number): string | number => resolveItemKey(item, itemKey, index);\n\n  /** The layer if it still belongs to the current base, else nothing. */\n  const live = computed<Layer<T> | null>(() => {\n    const current = base();\n    const l = layer();\n    return l.base === current ? l : null;\n  });\n\n  const merged = computed<readonly T[]>(() => {\n    const current = base();\n    const l = live();\n    if (!l) return current;\n    const all = l.added.length ? [...current, ...l.added] : current;\n    if (l.patches.size === 0) return all;\n    return all.map((item, i) => {\n      const patch = l.patches.get(keyOf(item, i));\n      return patch ? { ...item, ...patch } : item;\n    });\n  });\n\n  const dirty = computed(() => {\n    const l = live();\n    return !!l && (l.added.length > 0 || l.patches.size > 0);\n  });\n\n  /** Re-base onto the host's current array, dropping a layer that went stale. */\n  const current = (): Layer<T> => {\n    const b = base();\n    const l = layer();\n    return l.base === b ? l : { base: b, added: [], patches: new Map() };\n  };\n\n  return {\n    merged,\n    dirty,\n    append(item: T): void {\n      const l = current();\n      const key = keyOf(item, -1);\n      const known =\n        l.base.some((existing, i) => keyOf(existing, i) === key) ||\n        l.added.some((existing, i) => keyOf(existing, i) === key);\n      if (known) {\n        layer.set({ ...l, patches: new Map(l.patches).set(key, { ...(l.patches.get(key) ?? {}), ...item }) });\n        return;\n      }\n      layer.set({ ...l, added: [...l.added, item] });\n    },\n    patch(key: string | number, changes: Partial<T>): void {\n      const l = current();\n      const patches = new Map(l.patches);\n      patches.set(key, { ...(patches.get(key) ?? {}), ...changes });\n      layer.set({ ...l, patches });\n    },\n    clear(): void {\n      layer.set({ base: base(), added: [], patches: new Map() });\n    },\n  };\n}\n","import { svWarn } from '@styloviz/core/dev';\ndeclare const ngDevMode: boolean | undefined;\n\n/** Fallback counter for `svRequestKey`, used only when `randomUUID` is missing. */\n// module-id-counter: data id — never rendered as a DOM id during a server render.\nlet _svRequestUid = 0;\n\n/**\n * A key identifying one write, unique across clients and page loads — the third\n * thing an optimistic action owes its host, alongside `rollback()` and a pending\n * input.\n *\n * Put it in the event payload, send it with the request, and have the server\n * ignore a key it has already applied. Without one, a flaky connection retried\n * by an HTTP interceptor turns one \"like\" into two, and a double-tap becomes\n * like-unlike-like against a server free to apply them in any order.\n *\n * ★ Not `crypto.randomUUID()` on its own. That is only defined in a **secure\n *   context**, so it is `undefined` on a demo served over plain http from a\n *   staging box — which is exactly where a buyer first tries the kit, and a\n *   `TypeError` thrown from a click handler is not the impression to make. The\n *   fallback is not cryptographically random and does not need to be: it only\n *   has to be distinct per write.\n *\n * Deliberately NOT the module counter used for DOM ids elsewhere in the kit.\n * Those only have to be unique within one document; this has to be unique\n * against every other client writing to the same server.\n *\n * @param prefix Short component tag for readability in a server log (`'like'`).\n */\nexport function svRequestKey(prefix: string): string {\n  const uuid = globalThis.crypto?.randomUUID?.();\n  if (uuid) return uuid;\n  return `${prefix}-${Date.now().toString(36)}-${++_svRequestUid}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\n/**\n * A rollback handle for one optimistically-applied edit.\n *\n * @see createOptimisticEdit\n */\nexport interface SvOptimisticEdit {\n  /**\n   * Take a handle for the edit about to be applied. `undo` runs when the host\n   * calls the returned function — unless a later edit has superseded this one,\n   * in which case the call is refused with a dev-mode warning.\n   */\n  begin(undo: () => void): () => void;\n}\n\n/** How the warning names what happened, and how the host can prevent it. */\nexport interface SvOptimisticEditOptions {\n  /**\n   * The revision of the state this edit is against. Any change to the number\n   * means a later edit has landed and this handle is stale.\n   *\n   * A monotonic counter the component bumps per action is the usual answer; a\n   * component with a command history (the Gantt chart) passes that revision,\n   * because undoing there means popping a command rather than restoring a\n   * snapshot, and the history is what makes it exact.\n   */\n  readonly revision: () => number;\n  /** Element selector, for the warning prefix. */\n  readonly selector: string;\n  /**\n   * What has changed, what undoing would now lose, and the input to bind so it\n   * cannot arise. Written per component because only the component knows which\n   * input locks the action out — `[saving]` for one list, `[pendingCardIds]`\n   * for a board.\n   */\n  readonly superseded: string;\n}\n\n/**\n * Let a host undo an optimistically-applied edit, and refuse when undoing would\n * silently destroy a newer one.\n *\n * The bug this prevents: a card is dragged, the write fails, the host calls\n * `rollback()` — but the user has already dragged a second card, and the\n * snapshot the first handle is holding predates both. Restoring it puts the\n * first card back AND throws away the second move, which no one asked for and\n * nothing reports. So a stale handle does nothing and says why.\n *\n * The kit's optimistic contract in three parts, of which this is the second:\n *\n *   1. **Apply immediately.** A row that snaps back while a request is in flight\n *      feels broken, so the component moves first and tells the host after.\n *   2. **Hand back a way out.** The event payload carries `rollback()`. Not a\n *      method reached through a `ViewChild` — the host that needs it is the one\n *      handling the event, and it should not have to query the view to answer.\n *   3. **Lock the action while it is in flight.** A `saving` / `pending…` input\n *      the host binds. That is what keeps rule 2 unambiguous, and the warning\n *      below names the input to bind.\n *\n * Deliberately NOT here: an undo *window*. A component that starts a timer and\n * commits a deletion when it expires is claiming a write it never makes — the\n * defect class of a progress bar that completes on its own. The undo window is\n * the host's, built on the handle this returns and whatever toast it already\n * has.\n *\n * ```ts\n * private _moveSeq = 0;\n * private readonly edit = createOptimisticEdit({\n *   revision: () => this._moveSeq,\n *   selector: 'sv-kanban-board',\n *   superseded:\n *     'another card has moved since. Restoring the old board would discard that ' +\n *     'move. Bind [pendingCardIds] so a card cannot be moved again while its ' +\n *     'write is in flight.',\n * });\n *\n * private emitMove(): void {\n *   const snapshot = this._cols();\n *   this._moveSeq++;\n *   this.cardMoved.emit({ …, rollback: this.edit.begin(() => this._cols.set(snapshot)) });\n * }\n * ```\n *\n * A plain factory, not a service: it closes over one function and needs no\n * injection context, so it can be called straight from a field initializer.\n */\nexport function createOptimisticEdit(options: SvOptimisticEditOptions): SvOptimisticEdit {\n  const { revision, selector, superseded } = options;\n\n  return {\n    begin(undo: () => void): () => void {\n      // Read AFTER the caller has bumped its counter, so the handle is against\n      // the state its own edit produced — not the one before it.\n      const taken = revision();\n\n      return () => {\n        if (revision() !== taken) {\n          if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n            svWarn(`[styloviz] ${selector}: rollback() ignored — ${superseded}`);\n          }\n          return;\n        }\n        undo();\n      };\n    },\n  };\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\n\n/**\n * Layout the placeholder imitates while data loads.\n *\n * - `text`  — stacked lines of prose\n * - `list`  — avatar + two lines per row\n * - `table` — a header strip plus aligned cell bars\n * - `card`  — media block, title, two body lines\n * - `chart` — plot area with an axis, for any chart or sparkline\n */\nexport type SvSkeletonShellVariant = 'text' | 'list' | 'table' | 'card' | 'chart';\n\n/**\n * SkeletonShell — the loading placeholder every data component renders.\n *\n * Deliberately tiny and dependency-free: it lives in `@styloviz/core` so a\n * table, a kanban board and a chart all show the *same* loading treatment\n * without any of them taking a dependency on a component package.\n *\n * It is not a replacement for `@styloviz/skeleton-loader` — that ships eleven\n * composed presets and per-bone control for building bespoke placeholders. This\n * is the five-shape version that data components reach for internally.\n *\n * Width variation across bones is derived from the row index rather than\n * randomised, so the placeholder is stable between renders. A skeleton whose\n * bars resize on every change-detection pass reads as a glitch.\n */\n@Component({\n  selector: 'sv-skeleton-shell',\n  standalone: true,\n  templateUrl: './skeleton-shell.component.html',\n  styleUrl: './skeleton-shell.component.css',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  // The async contract is a public promise, so it needs one machine-detectable\n  // hook rather than 110 hand-written ones. Applied on the shell itself, every\n  // component that renders it advertises the state without touching its own\n  // template — which is what lets a single test harness assert the contract for\n  // every data component instead of one bespoke spec each.\n  host: {\n    'data-sv-state': 'loading',\n    // Bone fill and sweep, per theme — read by `.sv-bone` in the stylesheet.\n    // See the note there for why this cannot be a `:where(.dark)` rule.\n    class:\n      '[--sv-bone-fill:var(--color-gray-200)] [--sv-bone-sheen:rgb(255_255_255/0.35)] dark:[--sv-bone-fill:var(--color-gray-700)] dark:[--sv-bone-sheen:rgb(255_255_255/0.06)]',\n  },\n})\nexport class SvSkeletonShellComponent {\n  protected readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /**\n   * Layout to imitate.\n   * @default 'list'\n   */\n  readonly variant = input<SvSkeletonShellVariant>('list');\n\n  /**\n   * Number of rows (or lines, or cards) to draw. Clamped to 1–24.\n   * @default 3\n   */\n  readonly rows = input<number>(3);\n\n  /**\n   * Number of columns drawn by the `table` variant. Clamped to 1–12.\n   * @default 4\n   */\n  readonly columns = input<number>(4);\n\n  /**\n   * Height of the `chart` variant's plot area, as a CSS length.\n   * @default '12rem'\n   */\n  readonly chartHeight = input<string>('12rem');\n\n  /**\n   * Announced to assistive tech while the placeholder is on screen.\n   * @default 'Loading'\n   */\n  readonly ariaLabel = input<string>(this.labels.loading);\n\n  /** Extra classes for the outer wrapper. @default '' */\n  readonly customClass = input<string>('');\n\n  /** Row indices, clamped so a bad input cannot render 10,000 bones. */\n  protected readonly rowList = computed(() => indices(this.rows(), 1, 24, 3));\n\n  /** Column indices for the table variant. */\n  protected readonly colList = computed(() => indices(this.columns(), 1, 12, 4));\n\n  /** Bars for the chart variant — a fixed count reads better than `rows`. */\n  protected readonly barList = computed(() => indices(9, 1, 12, 9));\n\n  /**\n   * Deterministic width for the bone at (row, column), between 45% and 95%.\n   * Coprime multipliers keep neighbouring bones from landing on the same width,\n   * which is what makes the block read as text rather than as a bar chart.\n   */\n  protected width(row: number, col = 0): string {\n    return `${45 + ((row * 37 + col * 23) % 51)}%`;\n  }\n\n  /** Deterministic height for a chart bar, between 25% and 95%. */\n  protected barHeight(index: number): string {\n    return `${25 + ((index * 29) % 71)}%`;\n  }\n}\n\n/** Build `[0..n)` with `value` coerced into `[min, max]`. */\nfunction indices(value: number, min: number, max: number, fallback: number): readonly number[] {\n  const n = Number.isFinite(value) ? Math.floor(value) : fallback;\n  return Array.from({ length: Math.min(Math.max(n, min), max) }, (_, i) => i);\n}\n","<div\n  role=\"status\"\n  aria-busy=\"true\"\n  [attr.aria-label]=\"ariaLabel()\"\n  [class]=\"'w-full ' + customClass()\"\n>\n  @switch (variant()) {\n\n    @case ('text') {\n      <div class=\"space-y-2.5\">\n        @for (row of rowList(); track row) {\n          <div class=\"sv-bone h-3.5\" [style.width]=\"width(row)\"></div>\n        }\n      </div>\n    }\n\n    @case ('list') {\n      <div class=\"space-y-3\">\n        @for (row of rowList(); track row) {\n          <div class=\"flex items-center gap-3\">\n            <div class=\"sv-bone h-9 w-9 shrink-0 rounded-full\"></div>\n            <div class=\"flex-1 space-y-2\">\n              <div class=\"sv-bone h-3.5\" [style.width]=\"width(row)\"></div>\n              <div class=\"sv-bone h-2.5\" [style.width]=\"width(row, 2)\"></div>\n            </div>\n          </div>\n        }\n      </div>\n    }\n\n    @case ('table') {\n      <div class=\"space-y-3\">\n        <div class=\"flex gap-4 border-b border-gray-200 pb-3 dark:border-gray-700\">\n          @for (col of colList(); track col) {\n            <div class=\"sv-bone h-3 flex-1\"></div>\n          }\n        </div>\n        @for (row of rowList(); track row) {\n          <div class=\"flex gap-4\">\n            @for (col of colList(); track col) {\n              <div class=\"flex-1\">\n                <div class=\"sv-bone h-3.5\" [style.width]=\"width(row, col)\"></div>\n              </div>\n            }\n          </div>\n        }\n      </div>\n    }\n\n    @case ('card') {\n      <div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n        @for (row of rowList(); track row) {\n          <div\n            class=\"space-y-3 rounded-xl border border-gray-200 p-4 dark:border-gray-700\"\n          >\n            <div class=\"sv-bone h-28 w-full rounded-lg\"></div>\n            <div class=\"sv-bone h-4\" [style.width]=\"width(row)\"></div>\n            <div class=\"sv-bone h-2.5\" [style.width]=\"width(row, 3)\"></div>\n            <div class=\"sv-bone h-2.5\" [style.width]=\"width(row, 5)\"></div>\n          </div>\n        }\n      </div>\n    }\n\n    @case ('chart') {\n      <div class=\"space-y-3\">\n        <div class=\"flex items-end gap-2\" [style.height]=\"chartHeight()\">\n          @for (bar of barList(); track bar) {\n            <div class=\"sv-bone w-full self-end\" [style.height]=\"barHeight(bar)\"></div>\n          }\n        </div>\n        <div class=\"sv-bone h-2.5 w-full\"></div>\n      </div>\n    }\n  }\n</div>\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  ElementRef,\n  input,\n  output,\n  viewChild,\n} from '@angular/core';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\nimport { isRetryable } from '../errors';\nimport type { SvDataError } from '../types';\n\n/**\n * ErrorShell — what a data component renders when the fetch failed.\n *\n * The gap this closes: before it, no component in the kit had any load-failure\n * state at all. A buyer wiring a real API had to build the error card, the\n * retry button and the announcement themselves, outside the component, where it\n * would not match anything else in the kit.\n *\n * Accessibility is the point of the component, not decoration. The block is a\n * live `role=\"alert\"`, so the failure is announced rather than silently\n * replacing a spinner, and `focusRetry()` lets the host move focus to the one\n * control that can recover — important when the failure was triggered by a\n * keyboard action and focus is now on a button that no longer exists.\n *\n * Icons are projected rather than drawn: `@styloviz/core` ships no SVG, so the\n * host passes one from `@styloviz/icons` and the kit keeps a single icon source.\n *\n * ```html\n * <sv-error-shell [error]=\"error()\" (retry)=\"load()\">\n *   <sv-icon svShellIcon name=\"alert-triangle\" cssClass=\"h-8 w-8\" />\n * </sv-error-shell>\n * ```\n */\n@Component({\n  selector: 'sv-error-shell',\n  standalone: true,\n  templateUrl: './error-shell.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  // Conditional, unlike the other two shells: this component renders nothing\n  // when `error` is null, and a host element permanently advertising\n  // `data-sv-state=\"error\"` would make every component look broken to any\n  // check that reads it.\n  //\n  // `data-sv-retryable` is published separately because \"a 404 gets no Try\n  // again\" is a rule worth asserting, and the absence of a button is also what\n  // a genuinely broken template looks like.\n  host: {\n    '[attr.data-sv-state]': \"normalized() ? 'error' : null\", // sv-i18n-ignore: host binding key\n    '[attr.data-sv-retryable]': \"normalized() ? (canRetry() ? 'true' : 'false') : null\", // sv-i18n-ignore: host binding key\n  },\n})\nexport class SvErrorShellComponent {\n  protected readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /**\n   * The failure. A bare string is accepted for convenience and normalized to a\n   * retryable error. `null` renders nothing.\n   */\n  readonly error = input<SvDataError | string | null>(null);\n\n  /**\n   * Heading above the message.\n   * @default 'Something went wrong'\n   */\n  readonly title = input<string>(this.labels.errorTitle);\n\n  /**\n   * Label of the recovery button.\n   * @default 'Try again'\n   */\n  readonly retryLabel = input<string>(this.labels.retry);\n\n  /**\n   * Show the retry button. Forced off for errors marked `retryable: false` —\n   * offering to retry a 404 is a dead end dressed up as a recovery.\n   * @default true\n   */\n  readonly retryable = input<boolean>(true);\n\n  /**\n   * Render as a single inline row instead of a centred block. Use inside a\n   * table cell, a dropdown panel or a card header.\n   * @default false\n   */\n  readonly compact = input<boolean>(false);\n\n  /**\n   * Status code shown beside the message, when the error carries one.\n   * @default true\n   */\n  readonly showStatus = input<boolean>(true);\n\n  /** Extra classes for the outer wrapper. @default '' */\n  readonly customClass = input<string>('');\n\n  /** The host should re-run the failed request. */\n  readonly retry = output<void>();\n\n  private readonly retryButton = viewChild<ElementRef<HTMLButtonElement>>('retryButton');\n\n  /** Normalized error, or `null` when there is nothing to show. */\n  protected readonly normalized = computed<SvDataError | null>(() => {\n    const raw = this.error();\n    if (!raw) return null;\n    return typeof raw === 'string' ? { message: raw, retryable: true } : raw;\n  });\n\n  protected readonly message = computed(() => {\n    const message = this.normalized()?.message ?? '';\n    // `toSvDataError`'s English fallback, said in the app's language.\n    return message === SV_CORE_LABELS.errorMessage ? this.labels.errorMessage : message;\n  });\n\n  protected readonly status = computed(() => {\n    const code = this.normalized()?.status;\n    return this.showStatus() && typeof code === 'number' && code > 0 ? code : null;\n  });\n\n  protected readonly canRetry = computed(() => this.retryable() && isRetryable(this.normalized()));\n\n  /**\n   * Move focus to the retry button.\n   *\n   * Call this after the error appears in response to a keyboard action, so the\n   * user is not left with focus on a control that has been replaced.\n   */\n  focusRetry(): void {\n    this.retryButton()?.nativeElement.focus();\n  }\n}\n","@if (normalized()) {\n  <div\n    role=\"alert\"\n    [class]=\"\n      (compact()\n        ? 'flex w-full items-center gap-3 rounded-lg border border-danger-200 bg-danger-50/60 px-3 py-2 text-start dark:border-danger-900/50 dark:bg-danger-950/30'\n        : 'flex w-full flex-col items-center gap-3 px-6 py-12 text-center') +\n      ' ' + customClass()\n    \"\n  >\n    <span class=\"shrink-0 text-danger-500 dark:text-danger-400\" aria-hidden=\"true\">\n      <ng-content select=\"[svShellIcon]\" />\n    </span>\n\n    <div [class]=\"compact() ? 'min-w-0 flex-1' : 'space-y-1'\">\n      @if (!compact()) {\n        <p class=\"text-sm font-semibold text-gray-900 dark:text-gray-100\">{{ title() }}</p>\n      }\n      <p class=\"text-sm text-gray-600 dark:text-gray-400\">\n        {{ message() }}\n        @if (status(); as code) {\n          <span class=\"ms-1 text-xs text-gray-500 dark:text-gray-400\">({{ code }})</span>\n        }\n      </p>\n    </div>\n\n    @if (canRetry()) {\n      <button\n        #retryButton\n        type=\"button\"\n        (click)=\"retry.emit()\"\n        [class]=\"\n          compact()\n            ? 'shrink-0 rounded-md px-2 py-1 text-xs font-medium text-primary-600 transition-colors hover:bg-primary-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:text-primary-400 dark:hover:bg-primary-950/40'\n            : 'mt-1 rounded-lg bg-primary-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-primary-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500'\n        \"\n      >\n        {{ retryLabel() }}\n      </button>\n    }\n  </div>\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport type { SvEmptyReason } from '../types';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\n\n/**\n * EmptyShell — the zero-row state, with the distinction that matters.\n *\n * \"No orders\" and \"no orders *matching these filters*\" are different facts and\n * need different copy and different actions. Showing the first when the second\n * is true — the default behaviour of every component in the kit before this —\n * tells a customer with four thousand orders that they have none, because they\n * mistyped a search term. It reads as a bug, and it generates support tickets.\n *\n * Set `reason` from whether any filter, search term or facet is active; the\n * component supplies sensible copy and the matching action for each case, and\n * every string is overridable.\n *\n * This is the inline, dependency-free version that data components render\n * internally. `@styloviz/empty-state` remains the right choice for a full-page\n * illustrated treatment with multiple CTAs.\n */\n@Component({\n  selector: 'sv-empty-shell',\n  standalone: true,\n  templateUrl: './empty-shell.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  // `reason` is exposed as well as the state: \"no orders\" and \"no orders\n  // matching these filters\" are different facts, and a test that cannot tell\n  // them apart cannot catch the regression that tells a customer with 4,000\n  // orders they have none.\n  host: {\n    'data-sv-state': 'empty',\n    '[attr.data-sv-empty-reason]': 'reason()', // sv-i18n-ignore: host binding key\n  },\n})\nexport class SvEmptyShellComponent {\n  protected readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /**\n   * Why the collection is empty. Drive this from whether a filter or search is\n   * active — not from the row count.\n   * @default 'no-data'\n   */\n  readonly reason = input<SvEmptyReason>('no-data');\n\n  /** Heading. Falls back to copy chosen from `reason`. @default '' */\n  readonly title = input<string>('');\n\n  /** Supporting line. Falls back to copy chosen from `reason`. @default '' */\n  readonly message = input<string>('');\n\n  /**\n   * Action label. Falls back to `'Clear filters'` for `no-results` and to no\n   * button at all for `no-data` — the kit cannot know what \"create one\" means\n   * in the host's domain, and a button that does nothing useful is worse than\n   * none.\n   * @default ''\n   */\n  readonly actionLabel = input<string>('');\n\n  /**\n   * Render as a single inline row instead of a centred block.\n   * @default false\n   */\n  readonly compact = input<boolean>(false);\n\n  /** Extra classes for the outer wrapper. @default '' */\n  readonly customClass = input<string>('');\n\n  /** The action button was pressed — clear the filters, or start the flow. */\n  readonly action = output<void>();\n\n  protected readonly resolvedTitle = computed(() => {\n    const stated = this.title();\n    if (stated) return stated;\n    switch (this.reason()) {\n      case 'no-results': return this.labels.emptyNoResultsTitle;\n      case 'no-access':  return this.labels.emptyNoAccessTitle;\n      case 'error':      return this.labels.emptyErrorTitle;\n      default:           return this.labels.emptyNoDataTitle;\n    }\n  });\n\n  protected readonly resolvedMessage = computed(() => {\n    const stated = this.message();\n    if (stated) return stated;\n    switch (this.reason()) {\n      case 'no-results': return this.labels.emptyNoResultsMessage;\n      case 'no-access':  return this.labels.emptyNoAccessMessage;\n      case 'error':      return this.labels.emptyErrorMessage;\n      default:           return this.labels.emptyNoDataMessage;\n    }\n  });\n\n  /**\n   * ★★★ ONLY `no-results` GETS A DEFAULT BUTTON, AND THAT IS THE POINT OF\n   *     SEPARATING THE CAUSES. \"Clear filters\" under `no-access` clears\n   *     filters that are not what is hiding the data, and the user tries it\n   *     twice before reading the sentence above it. `no-data` has no default\n   *     because the kit cannot know what \"create one\" means in the host's\n   *     domain, and `error` has none because the retry belongs to whoever owns\n   *     the request — pass `actionLabel` to add one.\n   */\n  protected readonly resolvedAction = computed(\n    () => this.actionLabel() || (this.reason() === 'no-results' ? this.labels.emptyClearFilters : ''),\n  );\n}\n","<div\n  [class]=\"\n    (compact()\n      ? 'flex w-full items-center gap-3 px-3 py-4 text-start'\n      : 'flex w-full flex-col items-center gap-2 px-6 py-14 text-center') +\n    ' ' + customClass()\n  \"\n>\n  <span class=\"shrink-0 text-gray-300 dark:text-gray-600\" aria-hidden=\"true\">\n    <ng-content select=\"[svShellIcon]\" />\n  </span>\n\n  <div [class]=\"compact() ? 'min-w-0 flex-1' : 'space-y-1'\">\n    <p class=\"text-sm font-semibold text-gray-900 dark:text-gray-100\">{{ resolvedTitle() }}</p>\n    <p class=\"text-sm text-gray-500 dark:text-gray-400\">{{ resolvedMessage() }}</p>\n  </div>\n\n  @if (resolvedAction(); as label) {\n    <button\n      type=\"button\"\n      (click)=\"action.emit()\"\n      [class]=\"\n        (compact() ? 'shrink-0 text-xs' : 'mt-2 text-sm') +\n        ' rounded-md px-2 py-1 font-medium text-primary-600 transition-colors hover:bg-primary-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500 dark:text-primary-400 dark:hover:bg-primary-950/40'\n      \"\n    >\n      {{ label }}\n    </button>\n  }\n\n  <ng-content />\n</div>\n","import { ChangeDetectionStrategy, Component, computed, inject, input, output, signal } from '@angular/core';\nimport { SvEmptyShellComponent } from './empty-shell.component';\nimport { SvErrorShellComponent } from './error-shell.component';\nimport { SvSkeletonShellComponent } from './skeleton-shell.component';\nimport type { SvDataError } from '../types';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\nimport { SvDataSummaryTableComponent } from '@styloviz/core/a11y';\nimport type { SvDataSummary } from '@styloviz/core/a11y';\nimport { SV_CHART_A11Y, SvChartDataTableDirective, type SvChartDataTableMode } from '@styloviz/core/a11y';\nimport { svUniqueId } from '@styloviz/core/a11y';\n\n/**\n * ChartFrame — the async states for a chart, by composition.\n *\n * Every chart in the kit renders its plot inside this. It exists because the\n * alternative was adding the same skeleton / error / empty markup to sixty\n * chart components by hand, and because a dashboard whose charts cannot show a\n * spinner or a failed request is the most visible way a kit reads as demo-ware.\n *\n * It reserves `height` in every state, so the page does not jump as a chart\n * moves from skeleton to plot to error — the single most common complaint about\n * async dashboards.\n *\n * ```html\n * <sv-chart-frame\n *   [loading]=\"loading()\"\n *   [error]=\"error()\"\n *   [isEmpty]=\"!datasets().length\"\n *   [height]=\"height()\"\n *   (retry)=\"retry.emit()\"\n * >\n *   <svg>…</svg>\n * </sv-chart-frame>\n * ```\n */\n@Component({\n  selector: 'sv-chart-frame',\n  standalone: true,\n  imports: [SvSkeletonShellComponent, SvErrorShellComponent, SvEmptyShellComponent, SvDataSummaryTableComponent],\n  templateUrl: './chart-frame.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SvChartFrameComponent {\n  protected readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /** True while the series are being fetched. @default false */\n  readonly loading = input<boolean>(false);\n\n  /**\n   * Load failure. A bare string is accepted; use `toSvDataError()` to normalize\n   * an `HttpErrorResponse` and get sensible retry behaviour.\n   * @default null\n   */\n  readonly error = input<SvDataError | string | null>(null);\n\n  /**\n   * Whether there is nothing to plot. Charts decide this themselves — an empty\n   * `datasets`, all-zero series, a filtered-out range — so it is an input\n   * rather than something guessed here.\n   * @default false\n   */\n  readonly isEmpty = input<boolean>(false);\n\n  /**\n   * Plot height in pixels, reserved in every state so the page does not jump\n   * between skeleton, plot and error.\n   * @default 240\n   */\n  readonly height = input<number>(240);\n\n  /** Copy for the empty state. @default 'No data to plot' */\n  readonly emptyMessage = input<string>(this.labels.chartEmpty);\n\n  /** Heading for the error state. @default 'Could not load this chart' */\n  readonly errorTitle = input<string>(this.labels.chartErrorTitle);\n\n  /**\n   * Distinguishes \"no data at all\" from \"nothing matched the current filters\",\n   * which need different copy and different recovery.\n   * @default false\n   */\n  readonly filtered = input<boolean>(false);\n\n  /**\n   * A disclosure to render beside the plot — what the chart altered or left out\n   * of the data it was given, in words the person reading the dashboard sees.\n   *\n   * This exists because a console warning was the kit's answer to an unplottable\n   * datum, and a warning in devtools is not a disclosure: the chart still showed\n   * a clean plot of a dataset it had quietly changed. `svApplyValuePolicy()`\n   * produces the text; every chart that plots a share of a total binds it here.\n   *\n   * @default null\n   */\n  readonly notice = input<string | null>(null);\n\n  /**\n   * The plot as a table — what the chart says, in rows (`SvDataSummary`). The\n   * frame renders it for assistive technology under the plot, and on screen\n   * behind a \"Show data table\" button when the chart a11y module asks for one\n   * (`provideSvChartA11y`, or `svChartDataTable` on the chart's element).\n   * Only in the plot state: loading, error and empty have their own words.\n   * @default null\n   */\n  readonly summary = input<SvDataSummary | null>(null);\n\n  /**\n   * The plot is already a semantic structure — a grid of named cells — so the\n   * table is offered on screen only, never as a second hidden copy that would\n   * read every value twice. @default false\n   */\n  readonly nativeAlternative = input<boolean>(false);\n\n  /** The host should re-run the failed load. */\n  readonly retry = output<void>();\n\n  private readonly a11y = inject(SV_CHART_A11Y);\n  /** The chart's own `svChartDataTable`, from its host element. */\n  private readonly perChart = inject(SvChartDataTableDirective, { optional: true });\n\n  protected readonly tableMode = computed<SvChartDataTableMode>(() => {\n    const own = this.perChart?.svChartDataTable();\n    return own === '' ? 'toggle' : own ?? this.a11y.dataTable;\n  });\n\n  /** Whether the \"Show data table\" table is on screen. */\n  protected readonly tableOpen = signal(false);\n  protected readonly tableId = svUniqueId('sv-chart-table');\n\n  protected readonly hasRows = computed(() => (this.summary()?.rows.length ?? 0) > 0);\n\n  /** Height as a CSS length, clamped so a bad input cannot collapse the frame. */\n  protected readonly heightPx = computed(() => {\n    const h = this.height();\n    return `${Number.isFinite(h) && h > 0 ? h : 240}px`;\n  });\n}\n","@if (loading()) {\n  <div [style.height]=\"heightPx()\" class=\"flex items-center\" data-sv-state=\"loading\">\n    <sv-skeleton-shell variant=\"chart\" [chartHeight]=\"heightPx()\" [ariaLabel]=\"labels.loadingChart\" />\n  </div>\n} @else if (error()) {\n  <div [style.min-height]=\"heightPx()\" class=\"flex items-center justify-center\" data-sv-state=\"error\">\n    <sv-error-shell [error]=\"error()\" [title]=\"errorTitle()\" (retry)=\"retry.emit()\" />\n  </div>\n} @else if (isEmpty()) {\n  <div [style.min-height]=\"heightPx()\" class=\"flex items-center justify-center\" data-sv-state=\"empty\">\n    <sv-empty-shell\n      [reason]=\"filtered() ? 'no-results' : 'no-data'\"\n      [title]=\"emptyMessage()\"\n      [message]=\"filtered() ? 'Try widening the range or clearing a filter.' : ''\"\n    />\n  </div>\n} @else {\n  <ng-content />\n  @if (hasRows()) {\n    <!-- The chart a11y module: the plot as a table, for everyone when asked. -->\n    @if (tableMode() === 'toggle') {\n      <div class=\"mt-2 flex justify-end\">\n        <button\n          type=\"button\"\n          data-sv-data-table-toggle\n          [attr.aria-expanded]=\"tableOpen()\"\n          [attr.aria-controls]=\"tableOpen() ? tableId : null\"\n          (click)=\"tableOpen.set(!tableOpen())\"\n          class=\"inline-flex min-h-6 items-center rounded-md px-2 py-1 text-xs font-medium text-primary-700 dark:text-primary-300 hover:bg-primary-50 dark:hover:bg-primary-500/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500\"\n        >{{ tableOpen() ? labels.chartHideDataTable : labels.chartShowDataTable }}</button>\n      </div>\n    }\n    @if (tableOpen() && tableMode() === 'toggle') {\n      <div [id]=\"tableId\"><sv-data-summary-table [summary]=\"summary()!\" [visible]=\"true\" /></div>\n    } @else if (!nativeAlternative()) {\n      <sv-data-summary-table [summary]=\"summary()!\" />\n    }\n  }\n}\n\n<!-- Renders under the plot AND under the empty state: \"every value was\n     unplottable, so all of them were omitted\" is empty, and the notice is the\n     only thing on screen that says why. Not under `error`, where the error\n     state already carries the reason, and not under `loading`, where nothing\n     has been measured yet. -->\n@if (notice() && !loading() && !error()) {\n  <!-- No icon, for the same reason `sv-error-shell` above renders without one:\n       `@styloviz/core` ships no SVG, so a glyph here would be either the kit's\n       only inline path or a projection slot fifteen chart templates have to fill.\n       The `warning` family carries the tone instead — the semantic token, not the\n       literal `amber` ramp, so a buyer who rebrands warning moves this text and\n       the mark in the plot together. -->\n  <p\n    data-sv-notice\n    class=\"mt-2 text-xs leading-relaxed text-warning-700 dark:text-warning-400\"\n  >{{ notice() }}</p>\n}\n","import { Directive, Injectable, computed, effect, input, inject, signal, untracked, type Signal, type WritableSignal } from '@angular/core';\nimport { svUniqueId } from '@styloviz/core/a11y';\n\n/**\n * Chart synchronisation groups — one hover and one zoom shared by every chart\n * that names the same group.\n *\n * ```html\n * <sv-line-chart svChartSync=\"ops\" [categories]=\"days\" [series]=\"latency\" />\n * <sv-line-chart svChartSync=\"ops\" [categories]=\"days\" [series]=\"errors\" />\n * <sv-bar-chart  svChartSync=\"ops\" [categories]=\"days\" [datasets]=\"deploys\" />\n * ```\n *\n * Hover one and every chart in \"ops\" shows the same day; brush one (a\n * `zoomable` line chart) and the others show the same window. This is the\n * dashboard pattern Highcharts calls synchronized charts.\n *\n * ★★ CATEGORIES, NOT INDICES. The group shares the category LABEL under the\n *    pointer and the labels at the window's ends. Index 7 is a different day in\n *    a chart that starts a week later; the label is the same day in both, and a\n *    chart that does not have that label simply shows nothing.\n *\n * ★★ A REMOTE CHANGE IS NEVER RE-PUBLISHED. Each state carries the id of the\n *    chart that set it; a chart reads only states that are not its own, and\n *    applying one does not publish. Without that, two zoomable charts would\n *    bounce a window between them for ever.\n *\n * Participating families read the directive from their own host element; the\n * docs list which ones (line and bar, pro and free). Any chart a buyer writes can\n * join the same way: `inject(SvChartSyncDirective, { self: true, optional: true })`.\n */\nexport interface SvChartSyncHover {\n  /** The category label under the pointer or keyboard focus. */\n  readonly key: string;\n  readonly source: string;\n}\n\nexport interface SvChartSyncZoom {\n  /** First and last category label of the visible window; both `null` = the full range. */\n  readonly start: string | null;\n  readonly end: string | null;\n  readonly source: string;\n}\n\ninterface GroupState {\n  readonly hover: WritableSignal<SvChartSyncHover | null>;\n  readonly zoom: WritableSignal<SvChartSyncZoom | null>;\n}\n\n/** Root registry of groups. One per application, so SSR requests never share one. */\n@Injectable({ providedIn: 'root' })\nexport class SvChartSyncHub {\n  private readonly groups = new Map<string, GroupState>();\n\n  group(name: string): GroupState {\n    let g = this.groups.get(name);\n    if (!g) {\n      g = { hover: signal(null), zoom: signal(null) };\n      this.groups.set(name, g);\n    }\n    return g;\n  }\n}\n\n@Directive({ selector: '[svChartSync]', standalone: true })\nexport class SvChartSyncDirective {\n  private readonly hub = inject(SvChartSyncHub);\n\n  /** The group's name — every chart naming the same group shares hover and zoom. */\n  readonly svChartSync = input.required<string>();\n\n  /** Share the hovered category with the group. @default true */\n  readonly syncHover = input<boolean>(true);\n\n  /** Share the zoom window with the group (charts that zoom). @default true */\n  readonly syncZoom = input<boolean>(true);\n\n  /** This chart's id in the group, so its own state is never read back. */\n  readonly id = svUniqueId('sv-chart-sync');\n\n  private readonly group = computed(() => this.hub.group(this.svChartSync()));\n\n  /** Another chart's hovered category, or `null`. */\n  readonly remoteHover: Signal<string | null> = computed(() => {\n    const h = this.syncHover() ? this.group().hover() : null;\n    return h && h.source !== this.id ? h.key : null;\n  });\n\n  /**\n   * Another chart's zoom window — `{ start: null, end: null }` when it went back\n   * to the full range — or `null` when the last window set was this chart's own.\n   */\n  readonly remoteZoom: Signal<{ start: string | null; end: string | null } | null> = computed(() => {\n    const z = this.syncZoom() ? this.group().zoom() : null;\n    return z && z.source !== this.id ? { start: z.start, end: z.end } : null;\n  });\n\n  /** Publish this chart's hovered category; `null` when the pointer or focus leaves. */\n  publishHover(key: string | null): void {\n    if (!this.syncHover()) return;\n    const hover = this.group().hover;\n    if (key === null) {\n      // Clear only what this chart set: a late leave must not wipe another chart's hover.\n      if (hover()?.source === this.id) hover.set(null);\n      return;\n    }\n    if (hover()?.key !== key || hover()?.source !== this.id) hover.set({ key, source: this.id });\n  }\n\n  /** Publish this chart's window; `null` for \"showing everything\", which resets the group too. */\n  publishZoom(range: { start: string; end: string } | null): void {\n    if (!this.syncZoom()) return;\n    this.group().zoom.set({ start: range?.start ?? null, end: range?.end ?? null, source: this.id });\n  }\n}\n\n/** What a chart hands `injectSvChartSync` — its categories, and how to show the group's state. */\nexport interface SvChartSyncFollower {\n  /** The chart's category labels — the group's shared vocabulary. */\n  readonly categories: () => readonly string[];\n  /** Show another chart's hovered category, by this chart's index; `null` = it left, or this chart lacks it. */\n  readonly hover: (index: number | null) => void;\n  /** Show another chart's window by index (both `null` = the full range). Charts that do not zoom leave it out. */\n  readonly zoom?: (start: number | null, end: number | null) => void;\n}\n\n/** What a chart gets back — how to tell the group, by this chart's own indices. */\nexport interface SvChartSyncHandle {\n  publishHover(index: number | null): void;\n  publishZoom(range: { start: number; end: number } | null): void;\n}\n\n/**\n * Join the `svChartSync` group on this chart's own element, if it has one —\n * call in a field initializer. Returns `null` when the chart is in no group,\n * so an unsynchronised chart pays for nothing. The helper turns indices into\n * category labels and back, so a chart never handles the group's vocabulary.\n *\n * ```ts\n * private readonly sync = injectSvChartSync({\n *   categories: () => this.categories(),\n *   hover: (i) => (i === null ? this.hideTip() : this.showTipAt(i)),\n * });\n * // on pointer move:  this.sync?.publishHover(index);\n * ```\n */\nexport function injectSvChartSync(follower: SvChartSyncFollower): SvChartSyncHandle | null {\n  const dir = inject(SvChartSyncDirective, { self: true, optional: true });\n  if (!dir) return null;\n  const indexOf = (key: string | null): number => (key === null ? -1 : follower.categories().indexOf(key));\n  effect(() => {\n    const key = dir.remoteHover();\n    untracked(() => {\n      const i = indexOf(key);\n      follower.hover(i < 0 ? null : i);\n    });\n  });\n  const zoom = follower.zoom;\n  if (zoom) {\n    effect(() => {\n      const z = dir.remoteZoom();\n      if (!z) return;\n      untracked(() => {\n        if (z.start === null || z.end === null) return zoom(null, null);\n        const start = indexOf(z.start);\n        const end = indexOf(z.end);\n        // A window this chart cannot show (a label it lacks) is left alone, not guessed.\n        if (start >= 0 && end >= start) zoom(start, end);\n      });\n    });\n  }\n  const label = (i: number): string | null => follower.categories()[i] ?? null;\n  return {\n    publishHover: (i) => dir.publishHover(i === null ? null : label(i)),\n    publishZoom: (range) => {\n      const start = range ? label(range.start) : null;\n      const end = range ? label(range.end) : null;\n      dir.publishZoom(start !== null && end !== null ? { start, end } : null);\n    },\n  };\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport type { SvConnectionState } from '../types';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\n\n/**\n * ConnectionStatus — says out loud whether a live feed is still live.\n *\n * A streamed list that stops growing looks identical whether the agent is\n * thinking, has finished, or the socket died four minutes ago. Users resolve\n * that ambiguity by reloading the page, which on a stream means losing\n * everything that already arrived. This badge removes the guess.\n *\n * It renders nothing at all for `idle` and `connecting` — a badge that flashes\n * on every page load is noise, and the skeleton already covers the first fetch.\n * `open` gets a quiet dot. `reconnecting` and `closed` are the states worth\n * interrupting for, so they are announced politely and, for `reconnecting`,\n * carry the retry the host may want to expose.\n */\n@Component({\n  selector: 'sv-connection-status',\n  standalone: true,\n  templateUrl: './connection-status.component.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SvConnectionStatusComponent {\n  protected readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /** The host's feed state. @default 'idle' */\n  readonly state = input<SvConnectionState>('idle');\n\n  /** Overrides the label for the current state. @default '' */\n  readonly label = input<string>('');\n\n  /**\n   * Offer a reconnect button while `reconnecting` or `closed`. Off by default:\n   * most hosts retry automatically and a second manual trigger opens a second\n   * socket.\n   * @default false\n   */\n  readonly reconnectable = input<boolean>(false);\n\n  /** Extra classes for the wrapper. @default '' */\n  readonly customClass = input<string>('');\n\n  /** The user asked to re-open the feed. */\n  readonly reconnect = output<void>();\n\n  /** `idle` and `connecting` render nothing — see the class comment. */\n  protected readonly visible = computed(\n    () => this.state() === 'open' || this.state() === 'reconnecting' || this.state() === 'closed',\n  );\n\n  /** Only a degraded feed is worth announcing; a healthy one is just a dot. */\n  protected readonly announce = computed(() => this.state() !== 'open');\n\n  protected readonly resolvedLabel = computed(() => {\n    if (this.label()) return this.label();\n    switch (this.state()) {\n      case 'open':         return this.labels.connectionLive;\n      case 'reconnecting': return this.labels.connectionReconnecting;\n      case 'closed':       return this.labels.connectionClosed;\n      default:             return '';\n    }\n  });\n\n  protected readonly dotClass = computed(() => {\n    switch (this.state()) {\n      case 'open':         return 'bg-accent-500';\n      case 'reconnecting': return 'bg-warning-500 animate-pulse';\n      case 'closed':       return 'bg-gray-400 dark:bg-gray-500';\n      default:             return 'bg-transparent';\n    }\n  });\n\n  protected readonly wrapperClass = computed(() => {\n    switch (this.state()) {\n      case 'open':\n        return 'bg-accent-50 text-accent-700 dark:bg-accent-900/30 dark:text-accent-300';\n      case 'reconnecting':\n        return 'bg-warning-50 text-warning-700 dark:bg-warning-900/30 dark:text-warning-300';\n      case 'closed':\n        return 'bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400';\n      default:\n        return '';\n    }\n  });\n}\n","@if (visible()) {\n  <span\n    class=\"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold\"\n    [class]=\"wrapperClass() + ' ' + customClass()\"\n    [attr.role]=\"announce() ? 'status' : null\"\n    [attr.aria-live]=\"announce() ? 'polite' : null\"\n    data-sv-connection\n    [attr.data-sv-connection-state]=\"state()\"\n  >\n    <span class=\"h-1.5 w-1.5 shrink-0 rounded-full\" [class]=\"dotClass()\" aria-hidden=\"true\"></span>\n    {{ resolvedLabel() }}\n    @if (reconnectable() && state() !== 'open') {\n      <button\n        type=\"button\"\n        (click)=\"reconnect.emit()\"\n        class=\"ms-0.5 rounded underline underline-offset-2 focus:outline-none\n               focus-visible:ring-2 focus-visible:ring-current\"\n        data-sv-reconnect\n      >\n        {{ labels.reconnect }}\n      </button>\n    }\n  </span>\n}\n","/**\n * ============================================================================\n *  `X-4` — one scale contract for every list-shaped surface\n * ============================================================================\n *\n * ★★★ A DEGRADED VIEW MUST NEVER BE SILENTLY DEGRADED, and that is the whole\n *     contract. A transcript, a registry, a task queue, an event feed and a\n *     case table all have the same failure: the host hands over five thousand\n *     rows, the component renders every one of them, and either the page dies\n *     or somebody quietly adds a `slice(0, 100)` — after which the surface is\n *     showing a hundred rows and saying it is showing everything. The second\n *     outcome is worse than the first, because a page that freezes is at least\n *     honest about being in trouble.\n *\n * ★★ THE CEILING IS PART OF THE COMPONENT'S CONTRACT, NOT AN IMPLEMENTATION\n *    DETAIL. `sv-artifact-panel` and `sv-ai-writing-assistant` already had this\n *    right — past a line or token cap they degrade to counts and MARK the\n *    result `approximate` — so this generalises their pattern rather than\n *    inventing one, which is why the wording here echoes theirs: say what is\n *    missing and why, not merely \"100 of 5,000\".\n *\n * ★ WHAT THIS IS NOT. It is not virtualization. A window plus an honest label\n *   is what a component can guarantee in every host, on the server, and inside\n *   an `OnPush` change detector; a virtual scroller is a choice a host makes\n *   about its own layout. The ceiling is the floor of correct behaviour, and it\n *   leaves the door open.\n */\nimport { svFormatCount } from '@styloviz/core/i18n';\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n\n/** Which end of an over-long list survives the window. */\nexport type SvScaleKeep =\n  /** The host's order, from the top: registries, catalogues, case tables. */\n  | 'first'\n  /**\n   * The newest rows: transcripts, feeds, logs.\n   *\n   * ★★★ TRUNCATING A TRANSCRIPT FROM THE TOP IS THE ONLY CORRECT DIRECTION,\n   *     and `slice(0, n)` does the opposite. A conversation cut at its first\n   *     hundred messages hides the part the user is having right now, and the\n   *     reply they are reading is the one that vanished.\n   */\n  | 'last';\n\nexport interface SvScaleWindow<T> {\n  /** The rows to render. */\n  readonly items: readonly T[];\n  /**\n   * How many rows the HOST supplied.\n   *\n   * ★★ The total is a fact about the data, never about the window. Every count\n   *    a surface shows beside a truncated list — \"1,240 tasks\" — has to come\n   *    from here, or the page reports the size of its own truncation as the\n   *    size of the queue.\n   */\n  readonly total: number;\n  /** `items.length`. */\n  readonly shown: number;\n  /** How many rows are not on screen. `0` when nothing was dropped. */\n  readonly hidden: number;\n  /** The ceiling in force, or `0` when there is none. */\n  readonly ceiling: number;\n  /** True when rows were dropped — the flag a surface must render. */\n  readonly truncated: boolean;\n  /** Which end survived. */\n  readonly keep: SvScaleKeep;\n}\n\n/**\n * Window an over-long list, and say so.\n *\n * `ceiling` of `0` or less means no ceiling — the kit's convention for \"never\"\n * on every other threshold, and the opt-out a host with a virtual scroller of\n * its own needs.\n *\n * ★ A non-integer ceiling is floored rather than refused: 100.5 rows is not a\n *   thing, and a host computing a ceiling from a viewport height will produce\n *   fractions.\n *\n * @example\n * ```ts\n * readonly window = computed(() => svScaleWindow(this.messages(), this.maxMessages(), 'last'));\n * // template: @for (m of window().items; …) and <sv-scale-notice [window]=\"window()\" noun=\"message\" />\n * ```\n */\nexport function svScaleWindow<T>(\n  items: readonly T[] | null | undefined,\n  ceiling: number,\n  keep: SvScaleKeep = 'first',\n): SvScaleWindow<T> {\n  const all = items ?? [];\n  const total = all.length;\n  const cap =\n    Number.isFinite(ceiling) && ceiling > 0 ? Math.floor(ceiling) : 0;\n\n  if (cap === 0 || total <= cap) {\n    return { items: all, total, shown: total, hidden: 0, ceiling: cap, truncated: false, keep };\n  }\n\n  const windowed = keep === 'last' ? all.slice(total - cap) : all.slice(0, cap);\n  return {\n    items: windowed,\n    total,\n    shown: windowed.length,\n    hidden: total - windowed.length,\n    ceiling: cap,\n    truncated: true,\n    keep,\n  };\n}\n\n/**\n * The sentence a truncated surface shows, or `null` when nothing was dropped.\n *\n * ★★ IT NAMES THE MISSING ROWS AND WHICH END THEY WERE AT. \"Showing 100 of\n *    5,000\" leaves the reader to work out whether they are looking at the\n *    beginning or the end of their own data, and in a transcript or a feed that\n *    is the only question that matters.\n *\n * @param noun singular noun for a row — `message`, `task`, `tool`, `event`.\n * @param locale the locale the counts are grouped in (`svLocale()`); `''` for plain digits.\n * @param wording the plural noun and the sentence templates, from the calling package and core's labels.\n *   Without `nouns` the plural is the English `noun + 's'`.\n */\n/** What `svScaleLabel` words its sentence with. */\nexport interface SvScaleWording {\n  /** The row noun's plural (`'messages'`), from the calling package's labels. */\n  readonly nouns?: string;\n  /** The sentence templates. @default core's English (`SV_CORE_LABELS`) */\n  readonly labels?: Pick<SvCoreLabels, 'scaleHiddenOlder' | 'scaleHiddenFurther'>;\n}\n\nexport function svScaleLabel<T>(\n  window: SvScaleWindow<T>,\n  noun: string,\n  locale: string,\n  wording: SvScaleWording = {},\n): string | null {\n  if (!window.truncated) return null;\n  const labels = wording.labels ?? SV_CORE_LABELS;\n  // ★ `older` for a transcript or a feed, where the window kept the newest and\n  //   the dropped rows are behind the reader; `further` for a list in the\n  //   host's own order, where they are simply beyond the end of the window.\n  const template = window.keep === 'last' ? labels.scaleHiddenOlder : labels.scaleHiddenFurther;\n  return svFormatLabel(\n    template,\n    {\n      count: window.hidden,\n      hidden: svFormatCount(window.hidden, locale),\n      noun,\n      nouns: wording.nouns ?? `${noun}s`, // sv-i18n-ignore: English fallback for a caller that names no plural\n      total: svFormatCount(window.total, locale),\n      ceiling: svFormatCount(window.ceiling, locale),\n    },\n    locale,\n  );\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { svScaleLabel, type SvScaleWindow } from '../scale-ceiling';\nimport { svLocale } from '@styloviz/core/i18n';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\n\n/**\n * ScaleNotice — the row that says a list is not all of the list (`X-4`).\n *\n * ★★★ IT EXISTS SO THE WORDING CANNOT DRIFT. Six surfaces need this sentence,\n *     and six hand-written versions is how one of them ends up saying \"showing\n *     100 of 5,000\" while another says nothing at all — and the one that says\n *     nothing is the defect. One component, one sentence, one place to fix it.\n *\n * ★★ IT RENDERS NOTHING WHEN THE WINDOW IS COMPLETE. A surface can bind it\n *    unconditionally, which is the point: a notice a host has to remember to\n *    show is a notice that will be missing on the screen where it matters.\n *\n * ★ NOT a live region. The list did not change under the reader — it was never\n *   complete — so this is a statement about what they are looking at, read in\n *   place, and an announcement would interrupt them to say the page is behaving\n *   as documented. It IS in the reading order and reachable, which is what the\n *   `sr-only` alternatives in this kit's charts are not allowed to be.\n *\n * @example\n * ```html\n * <sv-scale-notice [window]=\"visible()\" [noun]=\"labels.scaleNounMessage\" [nouns]=\"labels.scaleNounMessages\" />\n * ```\n */\n@Component({\n  selector: 'sv-scale-notice',\n  standalone: true,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  template: `\n    @if (message(); as text) {\n      <p\n        data-sv-state=\"truncated\"\n        [attr.data-sv-hidden-count]=\"window().hidden\"\n        [class]=\"\n          'flex items-start gap-1.5 border-t border-gray-200 px-4 py-2 text-[11px] leading-relaxed ' +\n          'text-gray-600 dark:border-gray-800 dark:text-gray-400 ' + customClass()\n        \"\n      >{{ text }}</p>\n    }\n  `,\n})\nexport class SvScaleNoticeComponent {\n  private readonly labels = injectSvLabels('core', SV_CORE_LABELS);\n\n  /** The window this surface is rendering. */\n  readonly window = input.required<SvScaleWindow<unknown>>();\n\n  /** Singular noun for a row — `message`, `task`, `tool`, `event`. @default 'row' */\n  readonly noun = input<string>(this.labels.scaleNounRow);\n\n  /** The noun's plural — pass your package's label so it translates. @default `noun` + 's' */\n  readonly nouns = input<string | null>(null);\n\n  /**\n   * Replaces the generated sentence outright, for wording or another language.\n   * `''` renders nothing even when the window IS truncated — for a surface\n   * whose own layout already says so.\n   * @default null\n   */\n  readonly label = input<string | null>(null);\n\n  /** Locale the counts are grouped in. @default the kit's locale (`SV_LOCALE`) */\n  readonly locale = input<string>(svLocale());\n\n  /** Extra classes on the notice. @default '' */\n  readonly customClass = input<string>('');\n\n  /** The sentence, or `null` when there is nothing to disclose. */\n  protected readonly message = computed<string | null>(() => {\n    const custom = this.label();\n    if (custom !== null) return custom.trim() === '' ? null : custom;\n    return svScaleLabel(this.window(), this.noun(), this.locale(), {\n      nouns: this.nouns() ?? (this.noun() === this.labels.scaleNounRow ? this.labels.scaleNounRows : undefined),\n      labels: this.labels,\n    });\n  });\n}\n"],"mappings":";;;;;;;AA2FA,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAI1B,SAAS,UAAU,MAAc,SAAsB;CACrD,IAAI,MAAM;CACV,IAAI,QAAQ,kBAAkB,MAAM,IAAI,KAAI;CAC5C,IAAI,QAAQ,YAAY,MAAM,IAAI,YAAW;CAC7C,OAAO;AACT;AASA,SAAS,MAAM,GAAsB,GAAsB,UAAgB;CACzE,MAAM,IAAI,EAAE;CACZ,MAAM,IAAI,EAAE;CACZ,MAAM,MAAM,KAAK,IAAI,IAAI,GAAG,QAAQ;CACp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