@bettercms-ai/kit 4.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/adapters/lossy.d.ts +4 -0
  2. package/dist/adapters/lossy.js +4 -0
  3. package/dist/adapters/lossy.js.map +1 -1
  4. package/dist/adapters/prod-types.d.ts +4 -0
  5. package/dist/adapters/prod-types.js +4 -1
  6. package/dist/adapters/prod-types.js.map +1 -1
  7. package/dist/adapters/schema.js +7 -0
  8. package/dist/adapters/schema.js.map +1 -1
  9. package/dist/context.d.ts +83 -0
  10. package/dist/context.js +58 -1
  11. package/dist/context.js.map +1 -1
  12. package/dist/controls/choice.d.ts +1 -1
  13. package/dist/controls/choice.js +21 -2
  14. package/dist/controls/choice.js.map +1 -1
  15. package/dist/controls/index.d.ts +1 -0
  16. package/dist/controls/index.js +3 -2
  17. package/dist/controls/index.js.map +1 -1
  18. package/dist/controls/link.d.ts +23 -2
  19. package/dist/controls/link.js +456 -4
  20. package/dist/controls/link.js.map +1 -1
  21. package/dist/controls/media-v16.d.ts +27 -0
  22. package/dist/controls/media-v16.js +261 -0
  23. package/dist/controls/media-v16.js.map +1 -0
  24. package/dist/controls/media.js +63 -1
  25. package/dist/controls/media.js.map +1 -1
  26. package/dist/controls/reference-services.d.ts +8 -0
  27. package/dist/controls/reference.js +78 -2
  28. package/dist/controls/reference.js.map +1 -1
  29. package/dist/controls/rich-text/ai-runs.d.ts +13 -0
  30. package/dist/controls/rich-text/ai-runs.js +71 -0
  31. package/dist/controls/rich-text/ai-runs.js.map +1 -0
  32. package/dist/controls/rich-text/block-tool.d.ts +31 -0
  33. package/dist/controls/rich-text/block-tool.js +62 -0
  34. package/dist/controls/rich-text/block-tool.js.map +1 -0
  35. package/dist/controls/rich-text/blocks.d.ts +6 -1
  36. package/dist/controls/rich-text/blocks.js +404 -24
  37. package/dist/controls/rich-text/blocks.js.map +1 -1
  38. package/dist/controls/rich-text/catalog.d.ts +21 -6
  39. package/dist/controls/rich-text/catalog.js +312 -23
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/code-head.d.ts +30 -0
  42. package/dist/controls/rich-text/code-head.js +230 -0
  43. package/dist/controls/rich-text/code-head.js.map +1 -0
  44. package/dist/controls/rich-text/codec.d.ts +1 -1
  45. package/dist/controls/rich-text/codec.js +3 -1
  46. package/dist/controls/rich-text/codec.js.map +1 -1
  47. package/dist/controls/rich-text/dom.d.ts +27 -0
  48. package/dist/controls/rich-text/dom.js +69 -4
  49. package/dist/controls/rich-text/dom.js.map +1 -1
  50. package/dist/controls/rich-text/editor.js +212 -50
  51. package/dist/controls/rich-text/editor.js.map +1 -1
  52. package/dist/controls/rich-text/ops.js +1 -0
  53. package/dist/controls/rich-text/ops.js.map +1 -1
  54. package/dist/controls/rich-text/slash-preview.d.ts +8 -0
  55. package/dist/controls/rich-text/slash-preview.js +287 -0
  56. package/dist/controls/rich-text/slash-preview.js.map +1 -0
  57. package/dist/controls/rich-text/table-grid.d.ts +22 -0
  58. package/dist/controls/rich-text/table-grid.js +1052 -0
  59. package/dist/controls/rich-text/table-grid.js.map +1 -0
  60. package/dist/controls/rich-text/toolbar.js +60 -18
  61. package/dist/controls/rich-text/toolbar.js.map +1 -1
  62. package/dist/controls/text.d.ts +6 -0
  63. package/dist/controls/text.js +95 -5
  64. package/dist/controls/text.js.map +1 -1
  65. package/dist/core/facets.d.ts +1 -0
  66. package/dist/core/facets.js +1 -0
  67. package/dist/core/facets.js.map +1 -1
  68. package/dist/engine/array.d.ts +7 -0
  69. package/dist/engine/array.js +164 -45
  70. package/dist/engine/array.js.map +1 -1
  71. package/dist/engine/field-shell.d.ts +12 -0
  72. package/dist/engine/field-shell.js +217 -63
  73. package/dist/engine/field-shell.js.map +1 -1
  74. package/dist/engine/frame.js +39 -2
  75. package/dist/engine/frame.js.map +1 -1
  76. package/dist/engine/grouping.d.ts +71 -10
  77. package/dist/engine/grouping.js +223 -26
  78. package/dist/engine/grouping.js.map +1 -1
  79. package/dist/engine/kit-field.js +38 -4
  80. package/dist/engine/kit-field.js.map +1 -1
  81. package/dist/engine/schema-form.js +7 -2
  82. package/dist/engine/schema-form.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +13 -6
  85. package/dist/index.js.map +1 -1
  86. package/dist/kit.css +85 -0
  87. package/dist/schema/table.d.ts +2 -1
  88. package/dist/schema/table.js +5 -0
  89. package/dist/schema/table.js.map +1 -1
  90. package/dist/schema/types.d.ts +6 -0
  91. package/dist/schema/types.js.map +1 -1
  92. package/dist/styles.css +1 -1
  93. package/dist/theme.css +115 -0
  94. package/dist/tokens.css +268 -0
  95. package/dist/ui/block-icon-picker.d.ts +38 -0
  96. package/dist/ui/block-icon-picker.js +141 -0
  97. package/dist/ui/block-icon-picker.js.map +1 -0
  98. package/dist/ui/button.js +1 -0
  99. package/dist/ui/button.js.map +1 -1
  100. package/dist/ui/code-language-menu.d.ts +24 -0
  101. package/dist/ui/code-language-menu.js +123 -0
  102. package/dist/ui/code-language-menu.js.map +1 -0
  103. package/dist/ui/content-fields.d.ts +47 -0
  104. package/dist/ui/content-fields.js +278 -0
  105. package/dist/ui/content-fields.js.map +1 -0
  106. package/dist/ui/foundations.d.ts +118 -0
  107. package/dist/ui/foundations.js +564 -0
  108. package/dist/ui/foundations.js.map +1 -0
  109. package/dist/ui/index.d.ts +6 -0
  110. package/dist/ui/index.js +7 -1
  111. package/dist/ui/inspector.d.ts +394 -0
  112. package/dist/ui/inspector.js +1173 -0
  113. package/dist/ui/inspector.js.map +1 -0
  114. package/dist/ui/overlay.d.ts +7 -2
  115. package/dist/ui/overlay.js +55 -20
  116. package/dist/ui/overlay.js.map +1 -1
  117. package/dist/ui/shortcut-hint.js +1 -1
  118. package/dist/ui/shortcut-hint.js.map +1 -1
  119. package/dist/ui/toast.d.ts +5 -3
  120. package/dist/ui/toast.js +83 -11
  121. package/dist/ui/toast.js.map +1 -1
  122. package/dist/ui/tooltip-card.d.ts +45 -0
  123. package/dist/ui/tooltip-card.js +135 -0
  124. package/dist/ui/tooltip-card.js.map +1 -0
  125. package/package.json +1 -1
@@ -133,7 +133,8 @@ export interface TableValue {
133
133
  sticky?: boolean;
134
134
  striped?: boolean;
135
135
  density?: "compact" | "comfortable";
136
- hideCaption?: boolean;
136
+ hideCaption?: boolean; /** "Fit to width": the table spans the column (REQ-KIT-3; kept only when true) */
137
+ fit?: boolean;
137
138
  };
138
139
  /** Structured data from the table. Off by default: JSON-LD must describe what the page really offers. */
139
140
  jsonLd?: {
@@ -413,6 +413,7 @@ function renderTableHtml(input, o = {}) {
413
413
  t.headerColumn ? `data-header-col="true"` : "",
414
414
  `data-responsive="${t.design?.responsive ?? "scroll"}"`,
415
415
  t.design?.sticky ? `data-sticky="true"` : "",
416
+ t.design?.fit ? `data-fit="true"` : "",
416
417
  t.design?.striped ? `data-striped="true"` : "",
417
418
  t.design?.density === "compact" ? `data-density="compact"` : "",
418
419
  t.design?.hideCaption ? `data-caption="hidden"` : "",
@@ -829,6 +830,10 @@ function parseTableElement(el) {
829
830
  ...out.design,
830
831
  sticky: true
831
832
  };
833
+ if (ds.fit === "true") out.design = {
834
+ ...out.design,
835
+ fit: true
836
+ };
832
837
  if (ds.striped === "true") out.design = {
833
838
  ...out.design,
834
839
  striped: true
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","names":[],"sources":["../../src/schema/table.ts"],"sourcesContent":["/**\n * TABLE — the first-class `table` value of the schema language (CPO D42, SCHEMA_GAPS gap 12).\n *\n * One model, three places: a Table block on a page, a table island inside rich text, a Table block inside a slot.\n * One renderer: `renderTableHtml()` writes the semantic HTML every surface shows (site canvas, Journal body, published\n * preview, stored rich text); `<TableView>` (src/components/table) wraps it for live pages with visitor sort/filter.\n *\n * Why this shape (vs. Sanity's rows › cells › value, Storyblok's thead/tbody strings, Prismic's head/body):\n * - Columns are TYPED and KEYED (`_key`). Cells are keyed by column key, so reordering a column never misaligns a row.\n * - A cell is a bare value (string, number, boolean, link, reference) or `{ value, type?, note? }` when it needs a\n * per-cell type (a \"limit\" in a boolean pricing column) or a footnote.\n * - Header row + optional header column (row headers), column groups (`colgroup` headers), row groups (`tbody` with a\n * `rowgroup` header), footer rows (`tfoot`), caption (required), notes, footnotes. Body cells never merge: merged body\n * cells break sorting, Markdown and screen readers. Only group headers span (`colspan` + `scope=\"colgroup\"`).\n *\n * Stored rich-text form (lossless, so the HTML IS the model — no JSON blob to drift):\n * <figure data-rt=\"table\" data-id data-header-row data-header-col data-responsive data-sticky data-filter data-jsonld…>\n * <table aria-describedby=\"…-notes\">\n * <caption>…</caption>\n * <colgroup><col data-key data-type data-unit data-currency …></colgroup>\n * <thead>[<tr data-groups><th scope=\"colgroup\" colspan data-group>…</th>…</tr>]<tr><th scope=\"col\" data-col>…</th>…</tr></thead>\n * <tbody [data-key data-label]>[<tr data-group-row><th scope=\"rowgroup\" colspan>…</th></tr>]\n * <tr data-key><th scope=\"row\" data-col>…</th><td data-col data-label [data-value] [data-type] [data-note]>…</td></tr></tbody>\n * <tfoot>…</tfoot>\n * </table>\n * <p data-notes id=\"…-notes\">…</p><ol data-footnotes><li id=\"…-fn-1\" data-key>…</li></ol>\n * </figure>\n * Pure string work (no DOM) except `parseTableElement`, which reads a DOM element (ours or any site's).\n */\n\n/* ── Types ─────────────────────────────────────────────────────────── */\nexport type TableColumnType = \"text\" | \"number\" | \"money\" | \"boolean\" | \"rating\" | \"link\" | \"richtext-inline\" | \"reference\";\nexport const TABLE_COLUMN_TYPES: { value: TableColumnType; label: string; description: string }[] = [\n { value: \"text\", label: \"Text\", description: \"Plain words\" },\n { value: \"number\", label: \"Number\", description: \"With an optional unit (kg, %, min)\" },\n { value: \"money\", label: \"Money\", description: \"An amount in one currency\" },\n { value: \"boolean\", label: \"Yes / no\", description: \"Written as Included / Not included\" },\n { value: \"rating\", label: \"Rating\", description: \"Out of 5\" },\n { value: \"link\", label: \"Link\", description: \"Label + URL\" },\n { value: \"richtext-inline\", label: \"Rich text\", description: \"Bold, italic, links, code\" },\n { value: \"reference\", label: \"Reference\", description: \"A page or entry, by id\" },\n];\n\nexport interface TableColumn {\n _key: string;\n /** Header text (plain). Required when the header row is on. */\n label: string;\n type: TableColumnType;\n /** Explains the column; written as the header's title and in the notes of the Markdown twin. */\n description?: string;\n /** number: unit after the value (\"kg\", \"%\", \"min\"). */\n unit?: string;\n /** money: ISO 4217 code. Default USD. */\n currency?: string;\n /** number / money: fixed decimals. */\n decimals?: number;\n /** Default: numbers, money and ratings align end, everything else start (WAI: right-align numbers). */\n align?: \"start\" | \"center\" | \"end\";\n /** Visitors may sort by this column (live pages only). */\n sortable?: boolean;\n /** Column group key (a spanning header above this column). */\n group?: string;\n /** boolean: what the words say. Defaults \"Included\" / \"Not included\". */\n trueLabel?: string;\n falseLabel?: string;\n /** rating: scale. Default 5. */\n max?: number;\n /** reference: allowed targets (collection ids or \"page\"). */\n refTo?: string[];\n /** Tint the column (the recommended plan). Visual only. */\n highlight?: boolean;\n}\nexport interface TableGroup {\n _key: string;\n label: string;\n}\nexport interface TableLink {\n label: string;\n href: string;\n /** set by the global link element (D57) */\n newTab?: boolean;\n rel?: \"follow\" | \"nofollow\" | \"ugc\" | \"sponsored\";\n}\nexport interface TableRef {\n ref: string;\n label?: string;\n href?: string;\n}\nexport type TableCellValue = string | number | boolean | null | TableLink | TableRef;\nexport interface TableCellObject {\n value: TableCellValue;\n /** Per-cell type (wins over the row's and the column's). */\n type?: TableColumnType;\n /** Footnote key. */\n note?: string;\n /**\n * The body's own footnote markers after the cell's text (`<sup data-footnote=\"key\">n</sup>`, a rich-text table's),\n * kept as written: the table editor does not edit them, and the cell writes them back after its text.\n */\n marks?: string;\n}\nexport type TableCell = TableCellValue | TableCellObject;\nexport interface TableRow {\n _key: string;\n cells: Record<string, TableCell | undefined>;\n /** Row group key. */\n group?: string;\n /** Totals / summary rows → <tfoot>. */\n footer?: boolean;\n /** Per-row type: pricing matrices mix yes/no rows with limit rows in the same plan columns. */\n type?: TableColumnType;\n /** Tint the row (the bestseller). Visual only — say WHY in a footnote, colour alone means nothing to a reader. */\n highlight?: boolean;\n}\nexport interface TableFootnote {\n _key: string;\n text: string;\n}\nexport type TableResponsive = \"scroll\" | \"stack\" | \"cards\";\nexport type TableJsonLdType = \"none\" | \"ItemList\" | \"Dataset\" | \"Offers\";\nexport interface TableValue {\n /** Stable id for anchors (footnotes, aria). */\n id?: string;\n /** What the table shows. Required: it names the table for screen readers, crawlers and AI answers. */\n caption: string;\n /** One or two sentences under the table: source, method, date. Linked with aria-describedby. */\n notes?: string;\n headerRow: boolean;\n /** First column holds row headers (th scope=row). */\n headerColumn: boolean;\n columns: TableColumn[];\n columnGroups?: TableGroup[];\n rowGroups?: TableGroup[];\n rows: TableRow[];\n footnotes?: TableFootnote[];\n /** Visitor UI on live pages: a filter box above the table. */\n filterable?: boolean;\n /** hideCaption: the caption stays in the HTML (screen readers, crawlers) but isn't drawn — when a heading above says it. */\n design?: { responsive?: TableResponsive; sticky?: boolean; striped?: boolean; density?: \"compact\" | \"comfortable\"; hideCaption?: boolean };\n /** Structured data from the table. Off by default: JSON-LD must describe what the page really offers. */\n jsonLd?: { type: TableJsonLdType; axis?: \"rows\" | \"columns\"; priceRow?: string };\n}\n\n/** Field-level settings (`FieldSchema.table`). */\nexport interface TableFieldOptions {\n /** Column types an editor may choose. Default: all. */\n columnTypes?: TableColumnType[];\n /** Developer-defined columns: editors fill rows but can't add, remove, retype or reorder columns. */\n lockColumns?: boolean;\n minRows?: number;\n maxRows?: number;\n maxColumns?: number;\n /** Default true. */\n requireCaption?: boolean;\n /** Row groups: \"Add group\" in the row list. Default true. */\n allowGroups?: boolean;\n /** Footnotes on cells, edited at the cell. Default true. */\n allowFootnotes?: boolean;\n /**\n * CPO D52: what Table settings offers. Each key turns one setting on or off for this table kind, so the editor only sees\n * what applies. Defaults: header row + first column, totals row, on phones (all three), highlight column ON; visitor\n * sort and search OFF; JSON-LD only when `jsonLd` lists types.\n */\n settings?: TableSettingsOptions;\n /** \"Note under the table\" (the source line, `notes`). Default true. Turn off when the block has its own source field. */\n allowNote?: boolean;\n /** JSON-LD types offered in Table settings (\"Help search engines read this as\"). Default: none offered. */\n jsonLd?: TableJsonLdType[];\n}\n\n/**\n * CPO D52: a table with no `table` options (a rich-text table, the Visuals Table block, a schema field without `table`) is a\n * general table of any kind, so every setting is offered. Setting `table` on a field narrows it to that kind.\n */\nexport const GENERAL_TABLE: TableFieldOptions = { jsonLd: [\"ItemList\", \"Dataset\", \"Offers\"], settings: { sort: true, search: true } };\n\n/** CPO D52: the settings a table kind offers (`FieldSchema.table.settings`). */\nexport interface TableSettingsOptions {\n /** \"Show column names\" (header row) and \"First column names each row\" (row headers). Default true. */\n headers?: boolean;\n /** \"Totals row\": a footer row group at the end of the row list. Default true. */\n totals?: boolean;\n /** \"On phones\": the layouts offered. Default all three; one value fixes it, [] hides the setting. */\n phones?: TableResponsive[];\n /** \"Highlight column\": one column stands out (the recommended plan, your product). Default true. */\n highlight?: boolean;\n /** \"Keep column names in view\" (developer-only, `design.sticky`). Default true; off when the block owns a sticky-header field. */\n sticky?: boolean;\n /** \"Visitors can sort columns\". Default false (data tables turn it on). */\n sort?: boolean;\n /** \"Visitors can search rows\". Default false (long data tables turn it on). */\n search?: boolean;\n}\n\n/* ── Keys + defaults ───────────────────────────────────────────────── */\nlet seq = 0;\nexport const tkey = (p: string) => `${p}${Date.now().toString(36).slice(-4)}${(seq++).toString(36)}${Math.random().toString(36).slice(2, 5)}`;\n\nexport function emptyTable(cols = 3, rows = 2): TableValue {\n const columns = Array.from({ length: cols }, () => ({ _key: tkey(\"c\"), label: \"\", type: \"text\" as const }));\n return {\n id: tkey(\"tbl\"),\n caption: \"\",\n headerRow: true,\n headerColumn: false,\n columns,\n rows: Array.from({ length: rows }, () => ({ _key: tkey(\"r\"), cells: {} })),\n design: { responsive: \"scroll\" },\n };\n}\n\nexport const isObjLike = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nexport const isCellObject = (c: unknown): c is TableCellObject => isObjLike(c) && \"value\" in c;\nexport const isTableValue = (v: unknown): v is TableValue => isObjLike(v) && Array.isArray(v.columns) && Array.isArray(v.rows);\n\n/** Repair anything loaded (missing keys, missing arrays) so editors and renderers can trust the shape. */\nexport function normalizeTable(v: unknown): TableValue {\n if (!isTableValue(v)) return emptyTable();\n const used = new Set<string>();\n const uniq = (k: unknown, p: string) => {\n let key = typeof k === \"string\" && k ? k : tkey(p);\n while (used.has(key)) key = tkey(p);\n used.add(key);\n return key;\n };\n const columns = v.columns.filter(isObjLike).map((c) => ({ ...c, _key: uniq(c._key, \"c\"), label: String(c.label ?? \"\"), type: (TABLE_COLUMN_TYPES.some((t) => t.value === c.type) ? c.type : \"text\") as TableColumnType }));\n const rows = v.rows.filter(isObjLike).map((r) => ({ ...r, _key: uniq(r._key, \"r\"), cells: isObjLike(r.cells) ? (r.cells as TableRow[\"cells\"]) : {} }));\n return {\n ...v,\n id: typeof v.id === \"string\" && v.id ? v.id : tkey(\"tbl\"),\n caption: String(v.caption ?? \"\"),\n headerRow: v.headerRow !== false,\n headerColumn: !!v.headerColumn,\n columns,\n rows,\n columnGroups: (v.columnGroups ?? []).filter(isObjLike).map((g) => ({ ...g, _key: uniq(g._key, \"g\") })),\n rowGroups: (v.rowGroups ?? []).filter(isObjLike).map((g) => ({ ...g, _key: uniq(g._key, \"rg\") })),\n footnotes: (v.footnotes ?? []).filter(isObjLike).map((f) => ({ ...f, _key: uniq(f._key, \"f\") })),\n };\n}\n\n/* ── Cells: type, value, text ──────────────────────────────────────── */\nexport const cellValue = (c: TableCell | undefined): TableCellValue => (c === undefined ? null : isCellObject(c) ? c.value : c);\nexport const cellNote = (c: TableCell | undefined): string | undefined => (isCellObject(c) ? c.note : undefined);\nexport const cellType = (col: TableColumn, row?: TableRow, c?: TableCell): TableColumnType => (isCellObject(c) && c.type) || row?.type || col.type;\n\n/** Write a value back, keeping the cell's per-cell type and footnote. */\nexport function withValue(c: TableCell | undefined, value: TableCellValue): TableCell {\n if (isCellObject(c)) return { ...c, value };\n return value;\n}\n\nexport const isEmptyCell = (v: TableCellValue) => v == null || v === \"\" || (isObjLike(v) && !(\"ref\" in v ? v.ref : (v as TableLink).label || (v as TableLink).href));\n\nconst strip = (s: string) => s.replace(/<[^>]*>/g, \"\").replace(/&nbsp;/g, \" \").replace(/&amp;/g, \"&\").replace(/&lt;/g, \"<\").replace(/&gt;/g, \">\").replace(/&quot;/g, '\"').replace(/&#39;/g, \"'\");\n\nexport function boolLabels(col: TableColumn) {\n return { yes: col.trueLabel || \"Included\", no: col.falseLabel || \"Not included\" };\n}\n// V2 also had an unused `symbol(currency)` helper here; dropped because the dashboard compiles with noUnusedLocals.\nexport function formatNumber(n: number, decimals?: number) {\n return new Intl.NumberFormat(\"en-US\", decimals != null ? { minimumFractionDigits: decimals, maximumFractionDigits: decimals } : { maximumFractionDigits: 6 }).format(n);\n}\nexport function formatMoney(n: number, currency = \"USD\", decimals?: number) {\n try {\n const whole = Number.isInteger(n) && decimals == null;\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency, minimumFractionDigits: whole ? 0 : decimals ?? 2, maximumFractionDigits: whole ? 0 : decimals ?? 2 }).format(n);\n } catch {\n return `${formatNumber(n, decimals)} ${currency}`;\n }\n}\nexport const toNumber = (v: unknown): number | null => {\n if (typeof v === \"number\") return Number.isFinite(v) ? v : null;\n if (typeof v !== \"string\") return null;\n const s = v.replace(/[,\\s]/g, \"\").replace(/[^\\d.+-]/g, \"\");\n if (!s || !/^[+-]?\\d*\\.?\\d+$/.test(s)) return null;\n return Number(s);\n};\n\n/** The words a cell says, for Markdown, CSV, sorting, search and screen readers. Empty → \"\". */\nexport function cellText(col: TableColumn, row: TableRow | undefined, c: TableCell | undefined, resolveRef?: RefResolver): string {\n const v = cellValue(c);\n if (isEmptyCell(v)) return \"\";\n const t = cellType(col, row, c);\n switch (t) {\n case \"boolean\": {\n const b = toBool(v);\n return b == null ? strip(String(v)) : b ? boolLabels(col).yes : boolLabels(col).no;\n }\n case \"number\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : `${formatNumber(n, col.decimals)}${col.unit ? (/^[%°]/.test(col.unit) ? col.unit : ` ${col.unit}`) : \"\"}`;\n }\n case \"money\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : formatMoney(n, col.currency || \"USD\", col.decimals);\n }\n case \"rating\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : `${formatNumber(n, 1).replace(/\\.0$/, \"\")} out of ${col.max ?? 5}`;\n }\n case \"link\":\n return isObjLike(v) ? String((v as TableLink).label || (v as TableLink).href || \"\") : strip(String(v));\n case \"reference\": {\n if (!isObjLike(v)) return strip(String(v));\n const r = v as TableRef;\n return resolveRef?.(r.ref)?.label ?? r.label ?? r.ref;\n }\n default:\n return isObjLike(v) ? String((v as TableLink).label ?? \"\") : strip(String(v)).replace(/\\s+/g, \" \").trim();\n }\n}\n\nexport function toBool(v: unknown): boolean | null {\n if (typeof v === \"boolean\") return v;\n if (typeof v !== \"string\") return null;\n const s = strip(v).trim().toLowerCase();\n if (TRUE_WORDS.has(s)) return true;\n if (FALSE_WORDS.has(s)) return false;\n return null;\n}\nconst TRUE_WORDS = new Set([\"✓\", \"✔\", \"✔️\", \"☑\", \"✅\", \"yes\", \"y\", \"true\", \"included\", \"available\", \"supported\", \"x ✓\", \"check\", \"●\"]);\nconst FALSE_WORDS = new Set([\"✗\", \"✕\", \"✖\", \"❌\", \"×\", \"x\", \"no\", \"n\", \"false\", \"not included\", \"unavailable\", \"not available\", \"unsupported\", \"—\", \"–\", \"-\", \"○\"]);\n\n/* ── Render (the ONE renderer) ─────────────────────────────────────── */\nexport type RefResolver = (id: string) => { label: string; href?: string } | undefined;\nexport interface RenderOptions {\n /** Resolve reference cells to their current label + URL. */\n resolveRef?: RefResolver;\n /** Live-page visitor UI: sortable headers become buttons with aria-sort. Never stored. */\n sort?: { key: string; dir: 1 | -1 } | null;\n interactive?: boolean;\n /** Rows to show (filter). Keys. */\n visibleRows?: Set<string>;\n /** Write the editing marks (`data-*` model attributes). Off for clean published HTML. Default true. */\n marks?: boolean;\n}\n\nconst esc = (s: string) => s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\nconst escAttr = (s: string) => esc(s).replace(/\"/g, \"&quot;\");\nconst safeHref = (h: string) => (/^\\s*(javascript|vbscript|data):/i.test(h) ? \"#\" : h);\nconst INLINE_TAGS = new Set([\"strong\", \"b\", \"em\", \"i\", \"u\", \"s\", \"del\", \"code\", \"a\", \"br\", \"sup\", \"sub\", \"mark\", \"small\", \"abbr\"]);\n/** Inline rich text in a cell: only inline marks and safe links survive (string-based, no DOM). */\nexport function sanitizeInline(html: string): string {\n return html\n .replace(/<(script|style|iframe|object|embed|template)\\b[\\s\\S]*?<\\/\\1>/gi, \"\")\n .replace(/<\\/?([a-z][a-z0-9]*)\\b([^>]*)>/gi, (m, tag: string, attrs: string) => {\n const t = tag.toLowerCase();\n if (!INLINE_TAGS.has(t)) return \"\";\n if (m.startsWith(\"</\")) return `</${t === \"b\" ? \"strong\" : t === \"i\" ? \"em\" : t}>`;\n if (t === \"a\") {\n const href = attrs.match(/href\\s*=\\s*(\"([^\"]*)\"|'([^']*)')/i);\n const h = href ? href[2] ?? href[3] ?? \"\" : \"\";\n return `<a href=\"${escAttr(safeHref(h))}\">`;\n }\n if (t === \"abbr\") {\n const title = attrs.match(/title\\s*=\\s*\"([^\"]*)\"/i);\n return title ? `<abbr title=\"${escAttr(title[1])}\">` : \"<abbr>\";\n }\n return `<${t === \"b\" ? \"strong\" : t === \"i\" ? \"em\" : t}>`;\n });\n}\n\nconst alignOf = (col: TableColumn, t: TableColumnType) => col.align ?? (t === \"number\" || t === \"money\" || t === \"rating\" ? \"end\" : \"start\");\nconst footnoteIndex = (t: TableValue) => new Map((t.footnotes ?? []).map((f, i) => [f._key, i + 1]));\n\n/** Inner HTML of one cell + its typed attributes. */\nfunction cellHtml(t: TableValue, col: TableColumn, row: TableRow | undefined, c: TableCell | undefined, o: RenderOptions, fn: Map<string, number>, asHeader: boolean): { inner: string; attrs: string } {\n const v = cellValue(c);\n const type = cellType(col, row, c);\n const marks = o.marks !== false;\n const typeAttr = marks && isCellObject(c) && c.type ? ` data-type=\"${c.type}\"` : \"\";\n const note = cellNote(c);\n const n = note ? fn.get(note) : undefined;\n const sup = n ? `<sup><a href=\"#${escAttr(t.id ?? \"tbl\")}-fn-${n}\" aria-label=\"Note ${n}\">${n}</a></sup>` : \"\";\n const noteAttr = marks && note ? ` data-note=\"${escAttr(note)}\"` : \"\";\n let inner = \"\";\n let valueAttr = \"\";\n if (isEmptyCell(v)) {\n inner = asHeader ? \"\" : `<span aria-hidden=\"true\" class=\"bt-dash\">—</span><span class=\"bt-sr\">No value</span>`;\n valueAttr = marks ? ` data-empty=\"\"` : \"\";\n } else\n switch (type) {\n case \"boolean\": {\n const b = toBool(v);\n if (b == null) inner = esc(strip(String(v)));\n else {\n const { yes, no } = boolLabels(col);\n inner = `<span aria-hidden=\"true\" class=\"bt-bool\" data-bool=\"${b}\">${b ? \"✓\" : \"–\"}</span><span class=\"bt-sr\">${esc(b ? yes : no)}</span>`;\n valueAttr = marks ? ` data-value=\"${b}\"` : \"\";\n }\n break;\n }\n case \"number\":\n case \"money\": {\n const num = toNumber(v);\n inner = esc(cellText(col, row, c));\n if (num != null && marks) valueAttr = ` data-value=\"${num}\"`;\n break;\n }\n case \"rating\": {\n const num = toNumber(v);\n if (num == null) inner = esc(strip(String(v)));\n else {\n const max = col.max ?? 5;\n // one reading for everyone: \"4.7 / 5\" (the star is decoration)\n inner = `<span aria-hidden=\"true\" class=\"bt-star\">★</span> ${esc(formatNumber(num, 1).replace(/\\.0$/, \"\"))}<span class=\"bt-dim\"> / ${max}</span>`;\n if (marks) valueAttr = ` data-value=\"${num}\"`;\n }\n break;\n }\n case \"link\": {\n const l = isObjLike(v) ? (v as TableLink) : { label: String(v), href: \"\" };\n const rel = [l.newTab ? \"noopener\" : \"\", l.rel && l.rel !== \"follow\" ? l.rel : \"\"].filter(Boolean).join(\" \");\n inner = l.href ? `<a href=\"${escAttr(safeHref(l.href))}\"${l.newTab ? ' target=\"_blank\"' : \"\"}${rel ? ` rel=\"${rel}\"` : \"\"}>${esc(l.label || l.href)}</a>` : esc(l.label);\n break;\n }\n case \"reference\": {\n const r: TableRef = isObjLike(v) ? (v as TableRef) : { ref: String(v) };\n const live = o.resolveRef?.(r.ref);\n const label = live?.label ?? r.label ?? r.ref;\n const href = live?.href ?? r.href;\n inner = href ? `<a href=\"${escAttr(safeHref(href))}\">${esc(label)}</a>` : esc(label);\n if (marks) valueAttr = ` data-ref=\"${escAttr(r.ref)}\"`;\n break;\n }\n case \"richtext-inline\":\n inner = sanitizeInline(String(isObjLike(v) ? (v as TableLink).label ?? \"\" : v));\n break;\n default:\n inner = esc(isObjLike(v) ? String((v as TableLink).label ?? \"\") : strip(String(v)));\n }\n const align = alignOf(col, type);\n const alignAttr = align !== \"start\" ? ` data-align=\"${align}\"` : \"\";\n return { inner: inner + sup, attrs: `${typeAttr}${valueAttr}${noteAttr}${alignAttr}` };\n}\n\n/** Rows in display order: body rows (ungrouped first, then each row group in its order), footer rows. */\nexport function orderedRows(t: TableValue) {\n const groups = t.rowGroups ?? [];\n const known = new Set(groups.map((g) => g._key));\n const body = t.rows.filter((r) => !r.footer);\n const loose = body.filter((r) => !r.group || !known.has(r.group));\n const bodies: { group?: TableGroup; rows: TableRow[] }[] = [];\n if (loose.length || !groups.length) bodies.push({ rows: loose });\n for (const g of groups) {\n const rows = body.filter((r) => r.group === g._key);\n if (rows.length) bodies.push({ group: g, rows });\n }\n return { bodies, foot: t.rows.filter((r) => r.footer) };\n}\n\n/** Sort comparator over a column (numbers numerically, booleans true first, text by locale). */\nexport function sortRows(t: TableValue, rows: TableRow[], key: string, dir: 1 | -1): TableRow[] {\n const col = t.columns.find((c) => c._key === key);\n if (!col) return rows;\n const val = (r: TableRow) => {\n const c = r.cells[key];\n const ty = cellType(col, r, c);\n const v = cellValue(c);\n if (ty === \"number\" || ty === \"money\" || ty === \"rating\") return toNumber(v);\n if (ty === \"boolean\") return toBool(v) == null ? null : toBool(v) ? 1 : 0;\n return cellText(col, r, c).toLowerCase() || null;\n };\n return [...rows].sort((a, b) => {\n const x = val(a);\n const y = val(b);\n if (x == null && y == null) return 0;\n if (x == null) return 1; // empty last, whichever direction\n if (y == null) return -1;\n return (typeof x === \"number\" && typeof y === \"number\" ? x - y : String(x).localeCompare(String(y), \"en\", { numeric: true })) * dir;\n });\n}\n\n/** The table as semantic HTML: <figure data-rt=\"table\"> › <table> (caption, colgroup, thead, tbody…, tfoot) + notes. */\nexport function renderTableHtml(input: TableValue, o: RenderOptions = {}): string {\n const t = normalizeTable(input);\n const marks = o.marks !== false;\n const id = t.id!;\n const cols = t.columns;\n const n = cols.length;\n const fn = footnoteIndex(t);\n const groups = (t.columnGroups ?? []).filter((g) => cols.some((c) => c.group === g._key));\n const describedBy = t.notes || (t.footnotes ?? []).length ? ` aria-describedby=\"${escAttr(id)}-notes\"` : \"\";\n const fig: string[] = [];\n const figAttrs = [\n `data-rt=\"table\"`,\n `data-id=\"${escAttr(id)}\"`,\n `class=\"bt-table\"`,\n marks ? `data-header-row=\"${t.headerRow}\"` : \"\",\n t.headerColumn ? `data-header-col=\"true\"` : \"\",\n `data-responsive=\"${t.design?.responsive ?? \"scroll\"}\"`,\n t.design?.sticky ? `data-sticky=\"true\"` : \"\",\n t.design?.striped ? `data-striped=\"true\"` : \"\",\n t.design?.density === \"compact\" ? `data-density=\"compact\"` : \"\",\n t.design?.hideCaption ? `data-caption=\"hidden\"` : \"\",\n marks && t.filterable ? `data-filter=\"true\"` : \"\",\n marks && t.jsonLd && t.jsonLd.type !== \"none\" ? `data-jsonld=\"${t.jsonLd.type}\"${t.jsonLd.axis ? ` data-jsonld-axis=\"${t.jsonLd.axis}\"` : \"\"}${t.jsonLd.priceRow ? ` data-jsonld-price=\"${escAttr(t.jsonLd.priceRow)}\"` : \"\"}` : \"\",\n ].filter(Boolean);\n fig.push(`<figure ${figAttrs.join(\" \")}>`);\n // the scroll region names itself after the caption; the table keeps its own (implicit) role\n fig.push(`<div class=\"bt-scroll\" role=\"region\" tabindex=\"0\" aria-labelledby=\"${escAttr(id)}-caption\">`);\n fig.push(`<table${describedBy}>`);\n fig.push(`<caption id=\"${escAttr(id)}-caption\"${t.design?.hideCaption ? ` class=\"bt-sr\"` : \"\"}>${esc(t.caption || \"Table\")}</caption>`);\n if (marks || groups.length) {\n fig.push(\n `<colgroup>${cols\n .map((c) => {\n if (!marks) return \"<col>\";\n const a = [\n `data-key=\"${escAttr(c._key)}\"`,\n `data-type=\"${c.type}\"`,\n c.unit ? `data-unit=\"${escAttr(c.unit)}\"` : \"\",\n c.currency ? `data-currency=\"${escAttr(c.currency)}\"` : \"\",\n c.decimals != null ? `data-decimals=\"${c.decimals}\"` : \"\",\n c.align ? `data-align=\"${c.align}\"` : \"\",\n c.sortable ? `data-sortable=\"true\"` : \"\",\n c.group ? `data-group=\"${escAttr(c.group)}\"` : \"\",\n c.trueLabel ? `data-true=\"${escAttr(c.trueLabel)}\"` : \"\",\n c.falseLabel ? `data-false=\"${escAttr(c.falseLabel)}\"` : \"\",\n c.max != null ? `data-max=\"${c.max}\"` : \"\",\n c.refTo?.length ? `data-ref-to=\"${escAttr(c.refTo.join(\",\"))}\"` : \"\",\n c.description ? `data-description=\"${escAttr(c.description)}\"` : \"\",\n c.highlight ? `data-highlight=\"true\"` : \"\",\n ].filter(Boolean);\n return `<col ${a.join(\" \")}>`;\n })\n .join(\"\")}</colgroup>`,\n );\n }\n // header\n if (t.headerRow) {\n fig.push(\"<thead>\");\n if (groups.length) {\n const cells: string[] = [];\n for (let i = 0; i < n; ) {\n const g = cols[i].group && groups.find((x) => x._key === cols[i].group);\n if (!g) {\n cells.push(`<td></td>`);\n i++;\n continue;\n }\n let span = 1;\n while (i + span < n && cols[i + span].group === g._key) span++;\n cells.push(`<th scope=\"colgroup\"${span > 1 ? ` colspan=\"${span}\"` : \"\"}${marks ? ` data-group=\"${escAttr(g._key)}\"` : \"\"}>${esc(g.label)}</th>`);\n i += span;\n }\n fig.push(`<tr${marks ? \" data-groups\" : \"\"}>${cells.join(\"\")}</tr>`);\n }\n fig.push(\n `<tr>${cols\n .map((c, i) => {\n const type = c.type;\n const align = alignOf(c, type);\n const sortable = o.interactive && c.sortable;\n const dir = o.sort?.key === c._key ? o.sort.dir : 0;\n const ariaSort = sortable ? ` aria-sort=\"${dir === 1 ? \"ascending\" : dir === -1 ? \"descending\" : \"none\"}\"` : \"\";\n // an unnamed corner over the row headers is a plain cell, not an empty header\n if (i === 0 && t.headerColumn && !c.label.trim()) return `<td${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}></td>`;\n const label = esc(c.label || `Column ${i + 1}`);\n const title = c.description ? ` title=\"${escAttr(c.description)}\"` : \"\";\n const content = sortable ? `<button type=\"button\" class=\"bt-sort\" data-sort-key=\"${escAttr(c._key)}\">${label}<span aria-hidden=\"true\" class=\"bt-sort-icon\">${dir === 1 ? \"↑\" : dir === -1 ? \"↓\" : \"↕\"}</span></button>` : label;\n return `<th scope=\"col\"${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${align !== \"start\" ? ` data-align=\"${align}\"` : \"\"}${c.highlight ? ` data-highlight=\"true\"` : \"\"}${title}${ariaSort}>${content}</th>`;\n })\n .join(\"\")}</tr>`,\n );\n fig.push(\"</thead>\");\n }\n const rowHtml = (r: TableRow) => {\n const cells = cols.map((c, i) => {\n const asTh = t.headerColumn && i === 0;\n const { inner, attrs } = cellHtml(t, c, r, r.cells[c._key], o, fn, asTh);\n const label = ` data-label=\"${escAttr(c.label || `Column ${i + 1}`)}\"${c.highlight ? ` data-highlight=\"true\"` : \"\"}`;\n return asTh ? `<th scope=\"row\"${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${attrs}>${inner}</th>` : `<td${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${label}${attrs}>${inner}</td>`;\n });\n return `<tr${marks ? ` data-key=\"${escAttr(r._key)}\"` : \"\"}${marks && r.type ? ` data-type=\"${r.type}\"` : \"\"}${r.highlight ? ` data-highlight=\"true\"` : \"\"}>${cells.join(\"\")}</tr>`;\n };\n const { bodies, foot } = orderedRows(t);\n const vis = (rows: TableRow[]) => {\n const kept = o.visibleRows ? rows.filter((r) => o.visibleRows!.has(r._key)) : rows;\n return o.sort ? sortRows(t, kept, o.sort.key, o.sort.dir) : kept;\n };\n for (const b of bodies) {\n const rows = vis(b.rows);\n if (b.group) {\n fig.push(`<tbody${marks ? ` data-key=\"${escAttr(b.group._key)}\" data-label=\"${escAttr(b.group.label)}\"` : \"\"}>`);\n fig.push(`<tr class=\"bt-group\"${marks ? \" data-group-row\" : \"\"}><th scope=\"rowgroup\" colspan=\"${n}\">${esc(b.group.label)}</th></tr>`);\n } else fig.push(\"<tbody>\");\n fig.push(rows.map(rowHtml).join(\"\"));\n fig.push(\"</tbody>\");\n }\n if (foot.length) fig.push(`<tfoot>${foot.map(rowHtml).join(\"\")}</tfoot>`);\n fig.push(\"</table></div>\");\n if (t.notes || (t.footnotes ?? []).length) {\n fig.push(`<div class=\"bt-notes\" id=\"${escAttr(id)}-notes\">`);\n if (t.notes) fig.push(`<p${marks ? \" data-notes\" : \"\"}>${esc(t.notes)}</p>`);\n if ((t.footnotes ?? []).length)\n fig.push(`<ol${marks ? \" data-footnotes\" : \"\"}>${t.footnotes!.map((f, i) => `<li id=\"${escAttr(id)}-fn-${i + 1}\"${marks ? ` data-key=\"${escAttr(f._key)}\"` : \"\"}>${esc(f.text)}</li>`).join(\"\")}</ol>`);\n fig.push(\"</div>\");\n }\n fig.push(\"</figure>\");\n const html = fig.join(\"\");\n return t.design?.responsive === \"stack\" || t.design?.responsive === \"cards\" ? withTableRoles(html) : html;\n}\n\n/**\n * Stack / Cards change `display` on table parts, which makes some engines drop table semantics. The fix (Adrian\n * Roselli, \"Tables, CSS Display Properties, and ARIA\") restates the SAME roles explicitly — semantics unchanged.\n * Cell contents are sanitized inline HTML, so these tag patterns only ever match the table's own structure.\n */\nfunction withTableRoles(html: string) {\n return html\n .replace(/<table(?=[\\s>])/, '<table role=\"table\"')\n .replace(/<(thead|tbody|tfoot)(?=[\\s>])/g, '<$1 role=\"rowgroup\"')\n .replace(/<tr(?=[\\s>])/g, '<tr role=\"row\"')\n .replace(/<th scope=\"(col|colgroup)\"/g, '<th role=\"columnheader\" scope=\"$1\"')\n .replace(/<th scope=\"(row|rowgroup)\"/g, '<th role=\"rowheader\" scope=\"$1\"')\n .replace(/<td(?=[\\s>])/g, '<td role=\"cell\"');\n}\n\n/* ── Markdown (GFM) ────────────────────────────────────────────────── */\nconst mdCell = (s: string) => s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\|/g, \"\\\\|\").replace(/\\s*\\n\\s*/g, \" \").trim();\nfunction inlineMd(html: string): string {\n return strip(\n sanitizeInline(html)\n .replace(/<(strong)>([\\s\\S]*?)<\\/\\1>/g, \"**$2**\")\n .replace(/<(em)>([\\s\\S]*?)<\\/\\1>/g, \"_$2_\")\n .replace(/<code>([\\s\\S]*?)<\\/code>/g, \"`$1`\")\n .replace(/<a href=\"([^\"]*)\">([\\s\\S]*?)<\\/a>/g, (_m, h: string, l: string) => `[${l}](${h.replace(/&amp;/g, \"&\")})`)\n .replace(/<br>/g, \" \"),\n );\n}\n/**\n * GFM has one header row and no spans, so: column groups prefix their columns (\"Sizes · Chest\"), row groups become a\n * bold label row, the caption is a bold line above, notes and footnotes follow. Booleans say their words, never ✓.\n */\nexport function tableToMarkdown(input: TableValue, o: { resolveRef?: RefResolver; abs?: (href: string) => string } = {}): string {\n const t = normalizeTable(input);\n const cols = t.columns;\n if (!cols.length) return \"\";\n const groups = new Map((t.columnGroups ?? []).map((g) => [g._key, g.label]));\n const fn = footnoteIndex(t);\n const pfx = (t.id ?? \"t\").replace(/[^\\w-]/g, \"\");\n const head = cols.map((c, i) => mdCell([c.group && groups.get(c.group), c.label || (i === 0 && t.headerColumn ? \"\" : `Column ${i + 1}`)].filter(Boolean).join(\" · \")) || \" \");\n const sep = cols.map((c) => (alignOf(c, c.type) === \"end\" ? \"---:\" : alignOf(c, c.type) === \"center\" ? \":---:\" : \"---\"));\n const line = (cells: string[]) => `| ${cells.join(\" | \")} |`;\n const row = (r: TableRow) =>\n line(\n cols.map((c, i) => {\n const cell = r.cells[c._key];\n const v = cellValue(cell);\n const ty = cellType(c, r, cell);\n let s = ty === \"richtext-inline\" && typeof v === \"string\" ? inlineMd(v) : cellText(c, r, cell, o.resolveRef);\n if (ty === \"link\" && isObjLike(v) && (v as TableLink).href) s = `[${s}](${o.abs ? o.abs((v as TableLink).href) : (v as TableLink).href})`;\n if (ty === \"reference\" && isObjLike(v)) {\n const href = o.resolveRef?.((v as TableRef).ref)?.href ?? (v as TableRef).href;\n if (href) s = `[${s}](${o.abs ? o.abs(href) : href})`;\n }\n if (!s && !(t.headerColumn && i === 0)) s = \"—\";\n if (t.headerColumn && i === 0 && s) s = `**${s}**`;\n const note = cellNote(cell);\n if (note && fn.get(note)) s += `[^${pfx}-${fn.get(note)}]`;\n return mdCell(s) || \" \";\n }),\n );\n const out: string[] = [];\n out.push(`**${mdCell(t.caption || \"Table\")}**`, \"\");\n out.push(line(head), line(sep));\n const { bodies, foot } = orderedRows(t);\n for (const b of bodies) {\n if (b.group) out.push(line([`**${mdCell(b.group.label)}**`, ...cols.slice(1).map(() => \" \")]));\n b.rows.forEach((r) => out.push(row(r)));\n }\n foot.forEach((r) => out.push(row(r)));\n const after: string[] = [];\n if (t.notes) after.push(t.notes);\n const described = cols.filter((c) => c.description);\n if (described.length) after.push(described.map((c) => `${c.label}: ${c.description}`).join(\". \") + \".\");\n if ((t.footnotes ?? []).length) after.push(t.footnotes!.map((f, i) => `[^${pfx}-${i + 1}]: ${f.text}`).join(\"\\n\"));\n return [out.join(\"\\n\"), ...after].join(\"\\n\\n\");\n}\n\n/* ── CSV / TSV ─────────────────────────────────────────────────────── */\n/** RFC 4180 parser; the delimiter is a tab when the text has one (Excel / Sheets copy), else `;` or `,` by count. */\nexport function parseDelimited(text: string, delim?: string): string[][] {\n const src = text.replace(/\\r\\n?/g, \"\\n\").replace(/\\n+$/, \"\");\n if (!src.trim()) return [];\n const firstLine = src.split(\"\\n\")[0];\n const d = delim ?? (firstLine.includes(\"\\t\") ? \"\\t\" : (firstLine.match(/;/g)?.length ?? 0) > (firstLine.match(/,/g)?.length ?? 0) ? \";\" : \",\");\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let q = false;\n for (let i = 0; i < src.length; i++) {\n const ch = src[i];\n if (q) {\n if (ch === '\"' && src[i + 1] === '\"') {\n cell += '\"';\n i++;\n } else if (ch === '\"') q = false;\n else cell += ch;\n } else if (ch === '\"' && cell === \"\") q = true;\n else if (ch === d) {\n row.push(cell);\n cell = \"\";\n } else if (ch === \"\\n\") {\n row.push(cell);\n rows.push(row);\n row = [];\n cell = \"\";\n } else cell += ch;\n }\n row.push(cell);\n rows.push(row);\n const w = Math.max(...rows.map((r) => r.length));\n return rows.map((r) => [...r.map((c) => c.trim()), ...Array(w - r.length).fill(\"\")]);\n}\nexport function toDelimited(rows: string[][], delim = \",\"): string {\n return rows.map((r) => r.map((c) => (/[\",\\n\\t;]/.test(c) ? `\"${c.replace(/\"/g, '\"\"')}\"` : c)).join(delim)).join(\"\\n\");\n}\n/** Header + body rows as text (CSV export, \"Copy as CSV\"). */\nexport function tableToRows(input: TableValue, resolveRef?: RefResolver): string[][] {\n const t = normalizeTable(input);\n const { bodies, foot } = orderedRows(t);\n const all = [...bodies.flatMap((b) => b.rows), ...foot];\n return [t.columns.map((c) => c.label), ...all.map((r) => t.columns.map((c) => cellText(c, r, r.cells[c._key], resolveRef)))];\n}\n\n/* ── Type inference (CSV, paste, HTML import) ──────────────────────── */\nconst CURRENCY: Record<string, string> = { $: \"USD\", \"€\": \"EUR\", \"£\": \"GBP\", \"¥\": \"JPY\", \"₹\": \"INR\", \"A$\": \"AUD\", \"C$\": \"CAD\", \"CHF\": \"CHF\" };\nconst MONEY_RX = /^(A\\$|C\\$|CHF|[$€£¥₹])\\s?-?[\\d,]*\\.?\\d+$|^-?[\\d,]*\\.?\\d+\\s?(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i;\nconst NUM_RX = /^([+-]?[\\d,]*\\.?\\d+)\\s?([a-zA-Z%°][a-zA-Z%°²³/]*)?$/;\nconst RATING_RX = /^(\\d(?:\\.\\d)?)\\s?(?:\\/\\s?(5|10)|★|stars?|out of (5|10))$/i;\n\nexport interface InferredColumn {\n type: TableColumnType;\n unit?: string;\n currency?: string;\n max?: number;\n}\n/** Look at a column's non-empty values and pick the narrowest type every value fits. */\nexport function inferColumn(values: string[]): InferredColumn {\n const vs = values.map((v) => v.trim()).filter(Boolean);\n if (!vs.length) return { type: \"text\" };\n const txt = vs.map((v) => strip(v).trim());\n if (txt.every((v) => toBool(v) != null) && txt.some((v) => toBool(v) === true)) return { type: \"boolean\" };\n if (txt.every((v) => MONEY_RX.test(v))) {\n const sym = txt[0].match(/^(A\\$|C\\$|CHF|[$€£¥₹])/)?.[1] ?? txt[0].match(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i)?.[1]?.toUpperCase();\n const cur = sym ? CURRENCY[sym] ?? sym : \"USD\";\n if (txt.every((v) => (v.match(/^(A\\$|C\\$|CHF|[$€£¥₹])/)?.[1] ?? v.match(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i)?.[1]?.toUpperCase()) === sym)) return { type: \"money\", currency: cur };\n }\n const rating = txt.map((v) => v.match(RATING_RX));\n if (rating.every(Boolean)) return { type: \"rating\", max: Number(rating[0]![2] || rating[0]![3] || 5) };\n const nums = txt.map((v) => v.match(NUM_RX));\n if (nums.every(Boolean)) {\n const units = new Set(nums.map((m) => m![2] ?? \"\"));\n if (units.size === 1) return { type: \"number\", ...([...units][0] ? { unit: [...units][0] } : {}) };\n }\n if (vs.every((v) => /^<a\\s[^>]*href=/i.test(v) && /<\\/a>\\s*$/i.test(v) && (v.match(/<a\\s/gi)?.length ?? 0) === 1)) return { type: \"link\" };\n if (vs.some((v) => /<(strong|b|em|i|a|code|sup|sub|br)\\b/i.test(v))) return { type: \"richtext-inline\" };\n return { type: \"text\" };\n}\n/** A raw string (CSV / paste / HTML cell) → a value of `type`. */\nexport function coerce(raw: string, col: Pick<TableColumn, \"type\" | \"max\">): TableCellValue {\n const s = raw.trim();\n const plain = strip(s).trim();\n if (!plain && col.type !== \"richtext-inline\") return null;\n switch (col.type) {\n case \"boolean\":\n return toBool(plain) ?? plain;\n case \"number\":\n case \"money\":\n return toNumber(plain.replace(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i, \"\")) ?? plain;\n case \"rating\": {\n const m = plain.match(/(\\d+(?:\\.\\d+)?)/);\n return m ? Number(m[1]) : plain;\n }\n case \"link\": {\n const m = s.match(/<a\\s[^>]*href\\s*=\\s*\"([^\"]*)\"[^>]*>([\\s\\S]*?)<\\/a>/i);\n if (m) return { label: strip(m[2]).trim(), href: m[1].replace(/&amp;/g, \"&\") };\n return /^(https?:|\\/|mailto:)/.test(plain) ? { label: plain, href: plain } : { label: plain, href: \"\" };\n }\n case \"richtext-inline\":\n return sanitizeInline(s);\n default:\n return plain;\n }\n}\n\n/** Text rows (CSV, TSV, a pasted range) → a table. `header`: first row holds the column labels. */\nexport function tableFromRows(rows: string[][], opts: { header?: boolean; caption?: string } = {}): TableValue {\n const header = opts.header ?? true;\n const width = Math.max(1, ...rows.map((r) => r.length));\n const labels = header ? rows[0] ?? [] : [];\n const body = header ? rows.slice(1) : rows;\n const columns: TableColumn[] = Array.from({ length: width }, (_, i) => {\n const inf = inferColumn(body.map((r) => r[i] ?? \"\"));\n return { _key: tkey(\"c\"), label: strip(labels[i] ?? \"\").trim(), ...inf };\n });\n const out = emptyTable(0, 0);\n out.caption = opts.caption ?? \"\";\n out.columns = columns;\n // an empty top-left header over a text column = the first column names the rows (\"\", Carbon steel, Cast iron)\n out.headerColumn = header && !!rows.length && !strip(labels[0] ?? \"\").trim() && columns[0]?.type === \"text\" && width > 1;\n out.rows = body.filter((r) => r.some((c) => c.trim())).map((r) => ({ _key: tkey(\"r\"), cells: Object.fromEntries(columns.map((c, i) => [c._key, coerce(r[i] ?? \"\", c)])) }));\n return out;\n}\n\n/**\n * GAP-203: a pasted cell as the number a number, money or rating column stores, or null when it is not one. Digits with\n * a sign and one decimal point, thousands in groups of three (\"1,234.5\"), with a currency symbol or code, a percent sign\n * or the column's own unit around them; a rating may name its scale (\"4.5/5\"). Letters among the digits (\"z5c5\") are no\n * number: their digits are never run together (it stored $55).\n */\nexport function pastedNumber(raw: string, col: Pick<TableColumn, \"type\" | \"unit\">): number | null {\n let s = strip(raw).trim().replace(/\\s+/g, \" \");\n if (col.unit) s = s.replace(new RegExp(`\\\\s?${col.unit.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}$`, \"i\"), \"\");\n s = s.replace(/\\s?(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF|%)$/i, \"\").replace(/^(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)\\s?/i, \"\");\n if (col.type === \"rating\") s = s.replace(/\\s?(\\/|out of)\\s?\\d+(\\.\\d+)?$/i, \"\");\n s = s.replace(/^([+-]?)\\s?[$€£¥₹]\\s?/, \"$1\").replace(/\\s?[$€£¥₹]$/, \"\");\n return /\\d/.test(s) && /^[+-]?(\\d+|\\d{1,3}(,\\d{3})+)?(\\.\\d+)?$/.test(s) ? Number(s.replace(/,/g, \"\")) : null;\n}\n\n/** A pasted cell a number, money or rating column did not take (GAP-203): the text, and the column's label. */\nexport interface PasteRefusal {\n text: string;\n column: string;\n}\n\n/**\n * Paste a text range into a table at (row, col), growing rows / columns as needed. Values coerce to column types; a\n * number, money or rating cell takes only a number (`pastedNumber`), else it keeps its value and the text is added to\n * `refused`.\n */\nexport function pasteRange(input: TableValue, at: { row: number; col: number }, grid: string[][], opts: { lockColumns?: boolean; refused?: PasteRefusal[] } = {}): TableValue {\n const t = normalizeTable(input);\n const columns = [...t.columns];\n const rows = t.rows.map((r) => ({ ...r, cells: { ...r.cells } }));\n let r0 = at.row;\n let g = grid;\n if (r0 < 0) {\n // pasted on the header row: the first line is labels\n const labels = g[0] ?? [];\n labels.forEach((l, j) => {\n const ci = at.col + j;\n if (ci >= columns.length) {\n if (opts.lockColumns) return;\n columns.push({ _key: tkey(\"c\"), label: \"\", type: \"text\" });\n }\n columns[ci] = { ...columns[ci], label: strip(l).trim() };\n });\n g = g.slice(1);\n r0 = 0;\n }\n const need = at.col + Math.max(0, ...g.map((r) => r.length));\n while (!opts.lockColumns && columns.length < need) columns.push({ _key: tkey(\"c\"), label: \"\", type: \"text\" });\n g.forEach((line, i) => {\n const ri = r0 + i;\n while (rows.length <= ri) rows.push({ _key: tkey(\"r\"), cells: {} });\n line.forEach((raw, j) => {\n const col = columns[at.col + j];\n if (!col) return;\n const prev = rows[ri].cells[col._key];\n const type = cellType(col, rows[ri], prev);\n const plain = strip(raw).trim();\n if ((type === \"number\" || type === \"money\" || type === \"rating\") && plain) {\n const n = pastedNumber(raw, { type, unit: col.unit });\n if (n === null) opts.refused?.push({ text: plain, column: col.label });\n else rows[ri].cells[col._key] = withValue(prev, n);\n return;\n }\n rows[ri].cells[col._key] = withValue(prev, coerce(raw, { type, max: col.max }));\n });\n });\n return { ...t, columns, rows };\n}\n\n/* ── HTML → table (ours, or any site's) ────────────────────────────── */\n/**\n * Read a DOM <table> (or our <figure data-rt=\"table\">) into the model. Our own data-* marks round-trip losslessly;\n * any other table is inferred: header rows from thead / th, row headers from tbody th[scope=row] or a th first cell,\n * caption from <caption> / figcaption / aria-label, groups from thead colspans and multiple <tbody> / rowgroup rows,\n * footer from <tfoot>, types from cell text (✓/✗ → boolean, $ → money, 4.5/5 → rating), footnote marks kept as notes.\n * Body cells with colspan/rowspan are expanded (copied) — the model has no merged body cells.\n */\nexport function parseTableElement(el: Element): TableValue {\n const fig = el.matches(\"figure\") ? el : el.closest(\"figure[data-rt=table]\");\n const table = (el.matches(\"table\") ? el : el.querySelector(\"table\")) as HTMLTableElement | null;\n const out = emptyTable(0, 0);\n if (!table) return emptyTable();\n const ds = (fig as HTMLElement | null)?.dataset ?? {};\n out.id = ds.id || out.id;\n out.caption = (table.querySelector(\":scope > caption\")?.textContent ?? fig?.querySelector(\":scope > figcaption\")?.textContent ?? table.getAttribute(\"aria-label\") ?? \"\").trim();\n out.notes = (fig?.querySelector(\"[data-notes]\")?.textContent ?? \"\").trim() || undefined;\n const fnEls = Array.from(fig?.querySelectorAll(\"[data-footnotes] > li\") ?? []);\n out.footnotes = fnEls.map((li) => ({ _key: (li as HTMLElement).dataset.key || tkey(\"f\"), text: (li.textContent ?? \"\").trim() }));\n if (!out.footnotes.length) delete out.footnotes;\n const fnByIndex = new Map((out.footnotes ?? []).map((f, i) => [i + 1, f._key]));\n if (ds.responsive === \"stack\" || ds.responsive === \"cards\") out.design = { ...out.design, responsive: ds.responsive };\n if (ds.sticky === \"true\") out.design = { ...out.design, sticky: true };\n if (ds.striped === \"true\") out.design = { ...out.design, striped: true };\n if (ds.density === \"compact\") out.design = { ...out.design, density: \"compact\" };\n if (ds.caption === \"hidden\") out.design = { ...out.design, hideCaption: true };\n if (ds.filter === \"true\") out.filterable = true;\n if (ds.jsonld) out.jsonLd = { type: ds.jsonld as TableJsonLdType, ...(ds.jsonldAxis ? { axis: ds.jsonldAxis as \"rows\" | \"columns\" } : {}), ...(ds.jsonldPrice ? { priceRow: ds.jsonldPrice } : {}) };\n\n // grid expansion (handles colspan / rowspan in any section)\n type Cell = { el: HTMLTableCellElement; th: boolean; origin: boolean };\n const expand = (trs: HTMLTableRowElement[]) => {\n const grid: Cell[][] = [];\n trs.forEach((tr, ri) => {\n grid[ri] ??= [];\n let ci = 0;\n for (const c of Array.from(tr.cells)) {\n while (grid[ri][ci]) ci++;\n const cs = Math.max(1, Math.min(50, c.colSpan || 1));\n const rs = Math.max(1, Math.min(200, c.rowSpan || 1));\n for (let dr = 0; dr < rs; dr++)\n for (let dc = 0; dc < cs; dc++) {\n grid[ri + dr] ??= [];\n grid[ri + dr][ci + dc] = { el: c, th: c.tagName === \"TH\", origin: dr === 0 && dc === 0 };\n }\n ci += cs;\n }\n });\n return grid;\n };\n const theadRows = Array.from(table.tHead?.rows ?? []);\n const bodies = Array.from(table.tBodies);\n const footRows = Array.from(table.tFoot?.rows ?? []);\n let bodyRows = bodies.flatMap((b) => Array.from(b.rows).map((tr) => ({ tr, body: b })));\n // no thead: leading rows made only of th are the header\n const head = [...theadRows];\n if (!head.length) {\n while (bodyRows.length && Array.from(bodyRows[0].tr.cells).every((c) => c.tagName === \"TH\") && bodyRows[0].tr.cells.length > 1) {\n head.push(bodyRows[0].tr);\n bodyRows = bodyRows.slice(1);\n }\n }\n const hgrid = expand(head);\n const width = Math.max(1, ...hgrid.map((r) => r.length), ...expand(bodyRows.map((b) => b.tr)).map((r) => r.length));\n out.headerRow = head.length > 0;\n const cols = Array.from(table.querySelectorAll(\":scope > colgroup > col\"));\n const lastHead = hgrid[hgrid.length - 1] ?? [];\n const columns: TableColumn[] = Array.from({ length: width }, (_, i) => {\n const col = cols[i] as HTMLElement | undefined;\n const d = col?.dataset ?? {};\n const hc = lastHead[i]?.el;\n const label = hc ? cleanText(hc) : \"\";\n const c: TableColumn = { _key: d.key || (hc as HTMLElement | undefined)?.dataset?.col || tkey(\"c\"), label, type: (d.type as TableColumnType) || \"text\" };\n if (d.unit) c.unit = d.unit;\n if (d.currency) c.currency = d.currency;\n if (d.decimals) c.decimals = Number(d.decimals);\n if (d.align) c.align = d.align as TableColumn[\"align\"];\n if (d.sortable === \"true\") c.sortable = true;\n if (d.true) c.trueLabel = d.true;\n if (d.false) c.falseLabel = d.false;\n if (d.max) c.max = Number(d.max);\n if (d.refTo) c.refTo = d.refTo.split(\",\");\n if (d.highlight === \"true\") c.highlight = true;\n if (d.description) c.description = d.description;\n else if (hc?.getAttribute(\"title\")) c.description = hc.getAttribute(\"title\")!;\n return c;\n });\n // column groups: a header row above the last whose cells span several columns\n if (hgrid.length > 1) {\n const top = hgrid[0];\n const groups: TableGroup[] = [];\n for (let i = 0; i < width; ) {\n const cell = top[i];\n let span = 1;\n while (cell && i + span < width && top[i + span]?.el === cell.el) span++;\n const text = cell && cell.el !== lastHead[i]?.el ? cleanText(cell.el) : \"\";\n if (text) {\n const key = (cell.el as HTMLElement).dataset.group || tkey(\"g\");\n groups.push({ _key: key, label: text });\n for (let k = 0; k < span; k++) columns[i + k].group = key;\n }\n i += span;\n }\n if (groups.length) out.columnGroups = groups;\n }\n // body\n const rowGroups: TableGroup[] = [];\n const known = !!cols.length && cols.some((c) => (c as HTMLElement).dataset.type);\n const rawRows: { key: string; group?: string; footer?: boolean; type?: TableColumnType; highlight?: boolean; cells: (Cell | undefined)[] }[] = [];\n let currentGroup: string | undefined;\n let lastBody: HTMLTableSectionElement | null = null;\n const bgrid = expand(bodyRows.map((b) => b.tr));\n bodyRows.forEach(({ tr, body }, ri) => {\n if (body !== lastBody) {\n lastBody = body;\n const label = (body as HTMLElement).dataset.label;\n currentGroup = label ? ((body as HTMLElement).dataset.key || tkey(\"rg\")) : undefined;\n if (label && currentGroup) rowGroups.push({ _key: currentGroup, label });\n }\n const cells = bgrid[ri] ?? [];\n // a row that is one cell spanning the table (th scope=rowgroup, or a lone th/td colspan=all) opens a row group\n const only = tr.cells.length === 1 && (tr.cells[0].colSpan >= width || tr.cells[0].getAttribute(\"scope\") === \"rowgroup\");\n if (only || tr.hasAttribute(\"data-group-row\")) {\n // our own group row repeats its <tbody data-label>; anyone else's opens a new group\n if (!(tr.hasAttribute(\"data-group-row\") && (body as HTMLElement).dataset.label)) {\n currentGroup = tkey(\"rg\");\n rowGroups.push({ _key: currentGroup, label: cleanText(tr.cells[0]) });\n }\n return;\n }\n rawRows.push({ key: (tr as HTMLElement).dataset.key || tkey(\"r\"), group: currentGroup, type: ((tr as HTMLElement).dataset.type as TableColumnType) || undefined, highlight: (tr as HTMLElement).dataset.highlight === \"true\", cells });\n });\n expand(footRows).forEach((cells, i) => rawRows.push({ key: (footRows[i] as HTMLElement).dataset.key || tkey(\"r\"), footer: true, cells }));\n // header column: our mark, or every body row starts with a th\n out.headerColumn = ds.headerCol === \"true\" || (rawRows.length > 0 && rawRows.every((r) => r.cells[0]?.th && r.cells[0].el.getAttribute(\"scope\") !== \"col\"));\n // infer types for unmarked columns\n if (!known) {\n columns.forEach((c, i) => {\n if (out.headerColumn && i === 0) return;\n const inf = inferColumn(rawRows.map((r) => (r.cells[i] ? cellSource(r.cells[i]!.el) : \"\")));\n Object.assign(c, inf);\n });\n }\n out.columns = columns;\n out.rows = rawRows.map((r) => ({\n _key: r.key,\n ...(r.group ? { group: r.group } : {}),\n ...(r.footer ? { footer: true } : {}),\n ...(r.type ? { type: r.type } : {}),\n ...(r.highlight ? { highlight: true } : {}),\n cells: Object.fromEntries(\n columns.map((c, i) => {\n const cell = r.cells[i];\n if (!cell) return [c._key, null];\n return [c._key, readCell(cell.el, c, r.type, fnByIndex)];\n }),\n ),\n }));\n if (rowGroups.length) out.rowGroups = rowGroups;\n return out;\n}\n\n/** Visible text of a header/cell minus visually-hidden helpers and footnote marks. */\nfunction cleanText(el: Element): string {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup, .bt-sort-icon, [aria-hidden=true]\").forEach((n) => n.remove());\n return (c.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n}\n/** A cell's source for inference: inner HTML minus footnote marks, decorative icons and sr helpers kept as words. */\nfunction cellSource(el: Element): string {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup\").forEach((n) => n.remove());\n // an icon-only cell with a visually-hidden label reads as its label (\"Included\"); an svg/img with aria-label too\n const sr = c.querySelector(\".bt-sr, .sr-only, .visually-hidden, .screen-reader-text\");\n if (sr && !(c.textContent ?? \"\").replace(sr.textContent ?? \"\", \"\").replace(/[✓✔✗✕–—\\s]/g, \"\")) return (sr.textContent ?? \"\").trim();\n const labelled = c.querySelector(\"[aria-label]\");\n if (labelled && !(c.textContent ?? \"\").trim()) return labelled.getAttribute(\"aria-label\") ?? \"\";\n const img = c.querySelector(\"img[alt]\");\n if (img && !(c.textContent ?? \"\").trim()) return img.getAttribute(\"alt\") ?? \"\";\n c.querySelectorAll(\"[aria-hidden=true]\").forEach((n) => n.remove());\n const html = c.innerHTML.trim();\n return /<(a|strong|b|em|i|code|br)\\b/i.test(html) ? html : (c.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n}\nfunction readCell(el: HTMLTableCellElement, col: TableColumn, rowType: TableColumnType | undefined, fn: Map<number, string>): TableCell {\n const d = (el as HTMLElement).dataset;\n const type = (d.type as TableColumnType) || rowType || col.type;\n let value: TableCellValue;\n if (d.empty != null) value = null;\n else if (d.ref) value = { ref: d.ref, label: cleanText(el) || undefined, href: el.querySelector(\"a\")?.getAttribute(\"href\") ?? undefined };\n else if (d.value != null && (type === \"boolean\" || type === \"number\" || type === \"money\" || type === \"rating\")) value = type === \"boolean\" ? d.value === \"true\" : Number(d.value);\n else if (type === \"richtext-inline\") {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup\").forEach((n) => n.remove());\n value = sanitizeInline(c.innerHTML.trim());\n } else value = coerce(cellSource(el), { type, max: col.max });\n const supN = Number(el.querySelector(\"sup a, sup\")?.textContent?.trim());\n const note = d.note || (supN ? fn.get(supN) : undefined);\n if (d.type || note) return { value, ...(d.type ? { type: d.type as TableColumnType } : {}), ...(note ? { note } : {}) };\n return value;\n}\n\n/* ── JSON-LD (opt-in) ──────────────────────────────────────────────── */\n/**\n * Dataset — a report or spec table (name = caption, description = notes, variableMeasured = columns).\n * ItemList — a comparison: the things compared (row headers, or column labels) in order.\n * Offers — a pricing matrix: one Offer per plan (columns), price from the money row `priceRow`.\n * Returns null when the table can't honestly support the type (no caption, no items, no prices).\n */\nexport function tableJsonLd(input: TableValue, o: { url?: string; resolveRef?: RefResolver } = {}): Record<string, unknown> | null {\n const t = normalizeTable(input);\n const kind = t.jsonLd?.type ?? \"none\";\n if (kind === \"none\" || !t.caption.trim()) return null;\n const body = t.rows.filter((r) => !r.footer);\n if (kind === \"Dataset\") {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Dataset\",\n name: t.caption,\n description: t.notes || t.caption,\n ...(o.url ? { url: o.url } : {}),\n variableMeasured: t.columns.filter((_c, i) => !(t.headerColumn && i === 0)).map((c) => ({ \"@type\": \"PropertyValue\", name: c.label, ...(c.unit ? { unitText: c.unit } : {}), ...(c.description ? { description: c.description } : {}) })),\n };\n }\n const axis = t.jsonLd?.axis ?? \"rows\";\n if (kind === \"ItemList\") {\n const names = axis === \"rows\" ? body.map((r) => cellText(t.columns[0], r, r.cells[t.columns[0]._key], o.resolveRef)) : t.columns.slice(t.headerColumn ? 1 : 0).map((c) => c.label);\n const items = names.filter(Boolean);\n if (!items.length) return null;\n return { \"@context\": \"https://schema.org\", \"@type\": \"ItemList\", name: t.caption, numberOfItems: items.length, itemListElement: items.map((name, i) => ({ \"@type\": \"ListItem\", position: i + 1, name })) };\n }\n // Offers: plans are columns; the price row holds money\n const priceRow = t.rows.find((r) => r._key === t.jsonLd?.priceRow) ?? body.find((r) => t.columns.some((c) => cellType(c, r, r.cells[c._key]) === \"money\"));\n if (!priceRow) return null;\n const offers = t.columns\n .slice(t.headerColumn ? 1 : 0)\n .map((c) => {\n const cell = priceRow.cells[c._key];\n const n = toNumber(cellValue(cell));\n return n == null ? null : { \"@type\": \"Offer\", name: c.label, price: n, priceCurrency: c.currency || \"USD\", ...(o.url ? { url: o.url } : {}) };\n })\n .filter(Boolean) as { price: number; priceCurrency: string }[];\n if (!offers.length) return null;\n const prices = offers.map((x) => x.price);\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n name: t.caption,\n ...(t.notes ? { description: t.notes } : {}),\n offers: { \"@type\": \"AggregateOffer\", lowPrice: Math.min(...prices), highPrice: Math.max(...prices), priceCurrency: offers[0].priceCurrency, offerCount: offers.length, offers },\n };\n}\n\n/* ── Validation (the kit engine + docs + MCP all use these words) ──── */\nexport interface TableIssue {\n level: \"error\" | \"warning\";\n message: string;\n /** where: \"caption\" · \"col:<key>\" · \"row:<key>\" · \"cell:<row>:<col>\" */\n at?: string;\n}\nexport function tableIssues(input: unknown, opts: TableFieldOptions = {}): TableIssue[] {\n if (!isTableValue(input)) return [];\n const t = input;\n const out: TableIssue[] = [];\n if (!t.caption?.trim() && opts.requireCaption !== false) out.push({ level: \"error\", message: \"Give the table a title that says what it compares.\", at: \"caption\" });\n if (!t.headerRow) out.push({ level: \"warning\", message: \"Show the column names: turn on Show column names in Table settings.\" });\n if (t.headerRow) {\n const empty = t.columns.filter((c, i) => !c.label.trim() && !(t.headerColumn && i === 0));\n if (empty.length) out.push({ level: \"error\", message: `Name ${empty.length === 1 ? \"the empty column\" : `the ${empty.length} empty columns`}.`, at: `col:${empty[0]._key}` });\n }\n const keys = new Set<string>();\n for (const c of t.columns) {\n if (keys.has(c._key)) out.push({ level: \"error\", message: \"Two columns are the same column. Delete one and add it again.\", at: `col:${c._key}` });\n keys.add(c._key);\n }\n if (opts.maxColumns && t.columns.length > opts.maxColumns) out.push({ level: \"error\", message: `Use at most ${opts.maxColumns} columns.` });\n const body = t.rows.filter((r) => !r.footer);\n if (opts.minRows && body.length < opts.minRows) out.push({ level: \"error\", message: `Add at least ${opts.minRows} rows.` });\n if (opts.maxRows && body.length > opts.maxRows) out.push({ level: \"error\", message: `Use at most ${opts.maxRows} rows.` });\n let mismatch: { row: string; col: string; label: string } | null = null;\n let mismatches = 0;\n for (const r of t.rows)\n for (const c of t.columns) {\n const cell = r.cells?.[c._key];\n const v = cellValue(cell);\n if (isEmptyCell(v)) continue;\n const ty = cellType(c, r, cell);\n const bad = ((ty === \"number\" || ty === \"money\" || ty === \"rating\") && toNumber(v) == null) || (ty === \"boolean\" && toBool(v) == null);\n if (bad) {\n mismatches++;\n mismatch ??= { row: r._key, col: c._key, label: c.label };\n }\n }\n if (mismatch)\n out.push({ level: \"warning\", message: `${mismatches} ${mismatches === 1 ? \"cell doesn't\" : \"cells don't\"} match the column type (first in “${mismatch.label || \"a column\"}”). Change the column type or set the cell's own type.`, at: `cell:${mismatch.row}:${mismatch.col}` });\n if (t.headerColumn && body.some((r) => isEmptyCell(cellValue(r.cells?.[t.columns[0]?._key])))) out.push({ level: \"warning\", message: \"Every row needs a name in the first column.\" });\n if (t.jsonLd?.type === \"Dataset\" && (t.notes ?? \"\").length < 50) out.push({ level: \"warning\", message: \"To be read as a data report, write a note under the table (a sentence or two).\" });\n if (t.jsonLd?.type === \"Offers\" && !tableJsonLd(t)) out.push({ level: \"warning\", message: \"To be read as a price list, add a row of prices, one per plan column.\" });\n if (t.columns.length > 8 && t.design?.responsive !== \"scroll\") out.push({ level: \"warning\", message: \"More than 8 columns don't fit on phones as a list. In Table settings, set On phones to Scroll.\" });\n return out;\n}\n\n/** \"4 rows × 3 columns\" (array rows, summaries, breadcrumbs). */\nexport function tableSummary(v: unknown): string {\n if (!isTableValue(v)) return \"\";\n const r = v.rows.length;\n const c = v.columns.length;\n return [v.caption?.trim(), `${r} ${r === 1 ? \"row\" : \"rows\"} × ${c} ${c === 1 ? \"column\" : \"columns\"}`].filter(Boolean).join(\" · \");\n}\n\n/** Build a table in code (seed data, Kit Library, migrations): header labels + rows of display strings. */\nexport function tableFrom(\n caption: string,\n columns: (Partial<TableColumn> & { label: string })[],\n rows: (TableCell[] | { cells: TableCell[]; group?: string; footer?: boolean; type?: TableColumnType; highlight?: boolean })[],\n extra: Partial<Omit<TableValue, \"columns\" | \"rows\" | \"caption\">> = {},\n): TableValue {\n const cols: TableColumn[] = columns.map((c, i) => ({ type: \"text\", ...c, _key: c._key ?? `c${i + 1}` }));\n return {\n id: extra.id ?? `tbl_${caption.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").slice(0, 32).replace(/-$/, \"\")}`,\n caption,\n headerRow: true,\n headerColumn: false,\n design: { responsive: \"scroll\" },\n ...extra,\n columns: cols,\n rows: rows.map((r, ri) => {\n const def = Array.isArray(r) ? { cells: r } : r;\n return {\n _key: `r${ri + 1}`,\n ...(def.group ? { group: def.group } : {}),\n ...(def.footer ? { footer: true } : {}),\n ...(def.type ? { type: def.type } : {}),\n ...(def.highlight ? { highlight: true } : {}),\n cells: Object.fromEntries(cols.map((c, ci) => [c._key, def.cells[ci] ?? null])),\n };\n }),\n };\n}\n"],"mappings":";AAgCA,IAAa,qBAAuF;CAClG;EAAE,OAAO;EAAQ,OAAO;EAAQ,aAAa;CAAc;CAC3D;EAAE,OAAO;EAAU,OAAO;EAAU,aAAa;CAAqC;CACtF;EAAE,OAAO;EAAS,OAAO;EAAS,aAAa;CAA4B;CAC3E;EAAE,OAAO;EAAW,OAAO;EAAY,aAAa;CAAqC;CACzF;EAAE,OAAO;EAAU,OAAO;EAAU,aAAa;CAAW;CAC5D;EAAE,OAAO;EAAQ,OAAO;EAAQ,aAAa;CAAc;CAC3D;EAAE,OAAO;EAAmB,OAAO;EAAa,aAAa;CAA4B;CACzF;EAAE,OAAO;EAAa,OAAO;EAAa,aAAa;CAAyB;AAClF;;;;;AAqIA,IAAa,gBAAmC;CAAE,QAAQ;EAAC;EAAY;EAAW;CAAQ;CAAG,UAAU;EAAE,MAAM;EAAM,QAAQ;CAAK;AAAE;AAqBpI,IAAI,MAAM;AACV,IAAa,QAAQ,MAAc,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,MAAA,CAAO,SAAS,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;AAE1I,SAAgB,WAAW,OAAO,GAAG,OAAO,GAAe;CACzD,MAAM,UAAU,MAAM,KAAK,EAAE,QAAQ,KAAK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AAE,YAAY,SAAS;EAC/B,GAAG;EACH,SAAS;EACT,MAAM,KAAK,KAAK,GAAG,OAAO;GACxB,MAAM,MAAM,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI;GAC9C,OAAO;IACL,MAAM,IAAI,KAAK;IACf,GAAI,IAAI,QAAQ,EAAE,OAAO,IAAI,MAAM,IAAI,CAAC;IACxC,GAAI,IAAI,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;IACrC,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACrC,GAAI,IAAI,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,OAAO,OAAO,YAAY,KAAK,KAAK,GAAG,OAAO,CAAC,EAAE,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;GAChF;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"table.js","names":[],"sources":["../../src/schema/table.ts"],"sourcesContent":["/**\n * TABLE — the first-class `table` value of the schema language (CPO D42, SCHEMA_GAPS gap 12).\n *\n * One model, three places: a Table block on a page, a table island inside rich text, a Table block inside a slot.\n * One renderer: `renderTableHtml()` writes the semantic HTML every surface shows (site canvas, Journal body, published\n * preview, stored rich text); `<TableView>` (src/components/table) wraps it for live pages with visitor sort/filter.\n *\n * Why this shape (vs. Sanity's rows › cells › value, Storyblok's thead/tbody strings, Prismic's head/body):\n * - Columns are TYPED and KEYED (`_key`). Cells are keyed by column key, so reordering a column never misaligns a row.\n * - A cell is a bare value (string, number, boolean, link, reference) or `{ value, type?, note? }` when it needs a\n * per-cell type (a \"limit\" in a boolean pricing column) or a footnote.\n * - Header row + optional header column (row headers), column groups (`colgroup` headers), row groups (`tbody` with a\n * `rowgroup` header), footer rows (`tfoot`), caption (required), notes, footnotes. Body cells never merge: merged body\n * cells break sorting, Markdown and screen readers. Only group headers span (`colspan` + `scope=\"colgroup\"`).\n *\n * Stored rich-text form (lossless, so the HTML IS the model — no JSON blob to drift):\n * <figure data-rt=\"table\" data-id data-header-row data-header-col data-responsive data-sticky data-filter data-jsonld…>\n * <table aria-describedby=\"…-notes\">\n * <caption>…</caption>\n * <colgroup><col data-key data-type data-unit data-currency …></colgroup>\n * <thead>[<tr data-groups><th scope=\"colgroup\" colspan data-group>…</th>…</tr>]<tr><th scope=\"col\" data-col>…</th>…</tr></thead>\n * <tbody [data-key data-label]>[<tr data-group-row><th scope=\"rowgroup\" colspan>…</th></tr>]\n * <tr data-key><th scope=\"row\" data-col>…</th><td data-col data-label [data-value] [data-type] [data-note]>…</td></tr></tbody>\n * <tfoot>…</tfoot>\n * </table>\n * <p data-notes id=\"…-notes\">…</p><ol data-footnotes><li id=\"…-fn-1\" data-key>…</li></ol>\n * </figure>\n * Pure string work (no DOM) except `parseTableElement`, which reads a DOM element (ours or any site's).\n */\n\n/* ── Types ─────────────────────────────────────────────────────────── */\nexport type TableColumnType = \"text\" | \"number\" | \"money\" | \"boolean\" | \"rating\" | \"link\" | \"richtext-inline\" | \"reference\";\nexport const TABLE_COLUMN_TYPES: { value: TableColumnType; label: string; description: string }[] = [\n { value: \"text\", label: \"Text\", description: \"Plain words\" },\n { value: \"number\", label: \"Number\", description: \"With an optional unit (kg, %, min)\" },\n { value: \"money\", label: \"Money\", description: \"An amount in one currency\" },\n { value: \"boolean\", label: \"Yes / no\", description: \"Written as Included / Not included\" },\n { value: \"rating\", label: \"Rating\", description: \"Out of 5\" },\n { value: \"link\", label: \"Link\", description: \"Label + URL\" },\n { value: \"richtext-inline\", label: \"Rich text\", description: \"Bold, italic, links, code\" },\n { value: \"reference\", label: \"Reference\", description: \"A page or entry, by id\" },\n];\n\nexport interface TableColumn {\n _key: string;\n /** Header text (plain). Required when the header row is on. */\n label: string;\n type: TableColumnType;\n /** Explains the column; written as the header's title and in the notes of the Markdown twin. */\n description?: string;\n /** number: unit after the value (\"kg\", \"%\", \"min\"). */\n unit?: string;\n /** money: ISO 4217 code. Default USD. */\n currency?: string;\n /** number / money: fixed decimals. */\n decimals?: number;\n /** Default: numbers, money and ratings align end, everything else start (WAI: right-align numbers). */\n align?: \"start\" | \"center\" | \"end\";\n /** Visitors may sort by this column (live pages only). */\n sortable?: boolean;\n /** Column group key (a spanning header above this column). */\n group?: string;\n /** boolean: what the words say. Defaults \"Included\" / \"Not included\". */\n trueLabel?: string;\n falseLabel?: string;\n /** rating: scale. Default 5. */\n max?: number;\n /** reference: allowed targets (collection ids or \"page\"). */\n refTo?: string[];\n /** Tint the column (the recommended plan). Visual only. */\n highlight?: boolean;\n}\nexport interface TableGroup {\n _key: string;\n label: string;\n}\nexport interface TableLink {\n label: string;\n href: string;\n /** set by the global link element (D57) */\n newTab?: boolean;\n rel?: \"follow\" | \"nofollow\" | \"ugc\" | \"sponsored\";\n}\nexport interface TableRef {\n ref: string;\n label?: string;\n href?: string;\n}\nexport type TableCellValue = string | number | boolean | null | TableLink | TableRef;\nexport interface TableCellObject {\n value: TableCellValue;\n /** Per-cell type (wins over the row's and the column's). */\n type?: TableColumnType;\n /** Footnote key. */\n note?: string;\n /**\n * The body's own footnote markers after the cell's text (`<sup data-footnote=\"key\">n</sup>`, a rich-text table's),\n * kept as written: the table editor does not edit them, and the cell writes them back after its text.\n */\n marks?: string;\n}\nexport type TableCell = TableCellValue | TableCellObject;\nexport interface TableRow {\n _key: string;\n cells: Record<string, TableCell | undefined>;\n /** Row group key. */\n group?: string;\n /** Totals / summary rows → <tfoot>. */\n footer?: boolean;\n /** Per-row type: pricing matrices mix yes/no rows with limit rows in the same plan columns. */\n type?: TableColumnType;\n /** Tint the row (the bestseller). Visual only — say WHY in a footnote, colour alone means nothing to a reader. */\n highlight?: boolean;\n}\nexport interface TableFootnote {\n _key: string;\n text: string;\n}\nexport type TableResponsive = \"scroll\" | \"stack\" | \"cards\";\nexport type TableJsonLdType = \"none\" | \"ItemList\" | \"Dataset\" | \"Offers\";\nexport interface TableValue {\n /** Stable id for anchors (footnotes, aria). */\n id?: string;\n /** What the table shows. Required: it names the table for screen readers, crawlers and AI answers. */\n caption: string;\n /** One or two sentences under the table: source, method, date. Linked with aria-describedby. */\n notes?: string;\n headerRow: boolean;\n /** First column holds row headers (th scope=row). */\n headerColumn: boolean;\n columns: TableColumn[];\n columnGroups?: TableGroup[];\n rowGroups?: TableGroup[];\n rows: TableRow[];\n footnotes?: TableFootnote[];\n /** Visitor UI on live pages: a filter box above the table. */\n filterable?: boolean;\n /** hideCaption: the caption stays in the HTML (screen readers, crawlers) but isn't drawn — when a heading above says it. */\n design?: { responsive?: TableResponsive; sticky?: boolean; striped?: boolean; density?: \"compact\" | \"comfortable\"; hideCaption?: boolean; /** \"Fit to width\": the table spans the column (REQ-KIT-3; kept only when true) */ fit?: boolean };\n /** Structured data from the table. Off by default: JSON-LD must describe what the page really offers. */\n jsonLd?: { type: TableJsonLdType; axis?: \"rows\" | \"columns\"; priceRow?: string };\n}\n\n/** Field-level settings (`FieldSchema.table`). */\nexport interface TableFieldOptions {\n /** Column types an editor may choose. Default: all. */\n columnTypes?: TableColumnType[];\n /** Developer-defined columns: editors fill rows but can't add, remove, retype or reorder columns. */\n lockColumns?: boolean;\n minRows?: number;\n maxRows?: number;\n maxColumns?: number;\n /** Default true. */\n requireCaption?: boolean;\n /** Row groups: \"Add group\" in the row list. Default true. */\n allowGroups?: boolean;\n /** Footnotes on cells, edited at the cell. Default true. */\n allowFootnotes?: boolean;\n /**\n * CPO D52: what Table settings offers. Each key turns one setting on or off for this table kind, so the editor only sees\n * what applies. Defaults: header row + first column, totals row, on phones (all three), highlight column ON; visitor\n * sort and search OFF; JSON-LD only when `jsonLd` lists types.\n */\n settings?: TableSettingsOptions;\n /** \"Note under the table\" (the source line, `notes`). Default true. Turn off when the block has its own source field. */\n allowNote?: boolean;\n /** JSON-LD types offered in Table settings (\"Help search engines read this as\"). Default: none offered. */\n jsonLd?: TableJsonLdType[];\n}\n\n/**\n * CPO D52: a table with no `table` options (a rich-text table, the Visuals Table block, a schema field without `table`) is a\n * general table of any kind, so every setting is offered. Setting `table` on a field narrows it to that kind.\n */\nexport const GENERAL_TABLE: TableFieldOptions = { jsonLd: [\"ItemList\", \"Dataset\", \"Offers\"], settings: { sort: true, search: true } };\n\n/** CPO D52: the settings a table kind offers (`FieldSchema.table.settings`). */\nexport interface TableSettingsOptions {\n /** \"Show column names\" (header row) and \"First column names each row\" (row headers). Default true. */\n headers?: boolean;\n /** \"Totals row\": a footer row group at the end of the row list. Default true. */\n totals?: boolean;\n /** \"On phones\": the layouts offered. Default all three; one value fixes it, [] hides the setting. */\n phones?: TableResponsive[];\n /** \"Highlight column\": one column stands out (the recommended plan, your product). Default true. */\n highlight?: boolean;\n /** \"Keep column names in view\" (developer-only, `design.sticky`). Default true; off when the block owns a sticky-header field. */\n sticky?: boolean;\n /** \"Visitors can sort columns\". Default false (data tables turn it on). */\n sort?: boolean;\n /** \"Visitors can search rows\". Default false (long data tables turn it on). */\n search?: boolean;\n}\n\n/* ── Keys + defaults ───────────────────────────────────────────────── */\nlet seq = 0;\nexport const tkey = (p: string) => `${p}${Date.now().toString(36).slice(-4)}${(seq++).toString(36)}${Math.random().toString(36).slice(2, 5)}`;\n\nexport function emptyTable(cols = 3, rows = 2): TableValue {\n const columns = Array.from({ length: cols }, () => ({ _key: tkey(\"c\"), label: \"\", type: \"text\" as const }));\n return {\n id: tkey(\"tbl\"),\n caption: \"\",\n headerRow: true,\n headerColumn: false,\n columns,\n rows: Array.from({ length: rows }, () => ({ _key: tkey(\"r\"), cells: {} })),\n design: { responsive: \"scroll\" },\n };\n}\n\nexport const isObjLike = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nexport const isCellObject = (c: unknown): c is TableCellObject => isObjLike(c) && \"value\" in c;\nexport const isTableValue = (v: unknown): v is TableValue => isObjLike(v) && Array.isArray(v.columns) && Array.isArray(v.rows);\n\n/** Repair anything loaded (missing keys, missing arrays) so editors and renderers can trust the shape. */\nexport function normalizeTable(v: unknown): TableValue {\n if (!isTableValue(v)) return emptyTable();\n const used = new Set<string>();\n const uniq = (k: unknown, p: string) => {\n let key = typeof k === \"string\" && k ? k : tkey(p);\n while (used.has(key)) key = tkey(p);\n used.add(key);\n return key;\n };\n const columns = v.columns.filter(isObjLike).map((c) => ({ ...c, _key: uniq(c._key, \"c\"), label: String(c.label ?? \"\"), type: (TABLE_COLUMN_TYPES.some((t) => t.value === c.type) ? c.type : \"text\") as TableColumnType }));\n const rows = v.rows.filter(isObjLike).map((r) => ({ ...r, _key: uniq(r._key, \"r\"), cells: isObjLike(r.cells) ? (r.cells as TableRow[\"cells\"]) : {} }));\n return {\n ...v,\n id: typeof v.id === \"string\" && v.id ? v.id : tkey(\"tbl\"),\n caption: String(v.caption ?? \"\"),\n headerRow: v.headerRow !== false,\n headerColumn: !!v.headerColumn,\n columns,\n rows,\n columnGroups: (v.columnGroups ?? []).filter(isObjLike).map((g) => ({ ...g, _key: uniq(g._key, \"g\") })),\n rowGroups: (v.rowGroups ?? []).filter(isObjLike).map((g) => ({ ...g, _key: uniq(g._key, \"rg\") })),\n footnotes: (v.footnotes ?? []).filter(isObjLike).map((f) => ({ ...f, _key: uniq(f._key, \"f\") })),\n };\n}\n\n/* ── Cells: type, value, text ──────────────────────────────────────── */\nexport const cellValue = (c: TableCell | undefined): TableCellValue => (c === undefined ? null : isCellObject(c) ? c.value : c);\nexport const cellNote = (c: TableCell | undefined): string | undefined => (isCellObject(c) ? c.note : undefined);\nexport const cellType = (col: TableColumn, row?: TableRow, c?: TableCell): TableColumnType => (isCellObject(c) && c.type) || row?.type || col.type;\n\n/** Write a value back, keeping the cell's per-cell type and footnote. */\nexport function withValue(c: TableCell | undefined, value: TableCellValue): TableCell {\n if (isCellObject(c)) return { ...c, value };\n return value;\n}\n\nexport const isEmptyCell = (v: TableCellValue) => v == null || v === \"\" || (isObjLike(v) && !(\"ref\" in v ? v.ref : (v as TableLink).label || (v as TableLink).href));\n\nconst strip = (s: string) => s.replace(/<[^>]*>/g, \"\").replace(/&nbsp;/g, \" \").replace(/&amp;/g, \"&\").replace(/&lt;/g, \"<\").replace(/&gt;/g, \">\").replace(/&quot;/g, '\"').replace(/&#39;/g, \"'\");\n\nexport function boolLabels(col: TableColumn) {\n return { yes: col.trueLabel || \"Included\", no: col.falseLabel || \"Not included\" };\n}\n// V2 also had an unused `symbol(currency)` helper here; dropped because the dashboard compiles with noUnusedLocals.\nexport function formatNumber(n: number, decimals?: number) {\n return new Intl.NumberFormat(\"en-US\", decimals != null ? { minimumFractionDigits: decimals, maximumFractionDigits: decimals } : { maximumFractionDigits: 6 }).format(n);\n}\nexport function formatMoney(n: number, currency = \"USD\", decimals?: number) {\n try {\n const whole = Number.isInteger(n) && decimals == null;\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency, minimumFractionDigits: whole ? 0 : decimals ?? 2, maximumFractionDigits: whole ? 0 : decimals ?? 2 }).format(n);\n } catch {\n return `${formatNumber(n, decimals)} ${currency}`;\n }\n}\nexport const toNumber = (v: unknown): number | null => {\n if (typeof v === \"number\") return Number.isFinite(v) ? v : null;\n if (typeof v !== \"string\") return null;\n const s = v.replace(/[,\\s]/g, \"\").replace(/[^\\d.+-]/g, \"\");\n if (!s || !/^[+-]?\\d*\\.?\\d+$/.test(s)) return null;\n return Number(s);\n};\n\n/** The words a cell says, for Markdown, CSV, sorting, search and screen readers. Empty → \"\". */\nexport function cellText(col: TableColumn, row: TableRow | undefined, c: TableCell | undefined, resolveRef?: RefResolver): string {\n const v = cellValue(c);\n if (isEmptyCell(v)) return \"\";\n const t = cellType(col, row, c);\n switch (t) {\n case \"boolean\": {\n const b = toBool(v);\n return b == null ? strip(String(v)) : b ? boolLabels(col).yes : boolLabels(col).no;\n }\n case \"number\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : `${formatNumber(n, col.decimals)}${col.unit ? (/^[%°]/.test(col.unit) ? col.unit : ` ${col.unit}`) : \"\"}`;\n }\n case \"money\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : formatMoney(n, col.currency || \"USD\", col.decimals);\n }\n case \"rating\": {\n const n = toNumber(v);\n return n == null ? strip(String(v)) : `${formatNumber(n, 1).replace(/\\.0$/, \"\")} out of ${col.max ?? 5}`;\n }\n case \"link\":\n return isObjLike(v) ? String((v as TableLink).label || (v as TableLink).href || \"\") : strip(String(v));\n case \"reference\": {\n if (!isObjLike(v)) return strip(String(v));\n const r = v as TableRef;\n return resolveRef?.(r.ref)?.label ?? r.label ?? r.ref;\n }\n default:\n return isObjLike(v) ? String((v as TableLink).label ?? \"\") : strip(String(v)).replace(/\\s+/g, \" \").trim();\n }\n}\n\nexport function toBool(v: unknown): boolean | null {\n if (typeof v === \"boolean\") return v;\n if (typeof v !== \"string\") return null;\n const s = strip(v).trim().toLowerCase();\n if (TRUE_WORDS.has(s)) return true;\n if (FALSE_WORDS.has(s)) return false;\n return null;\n}\nconst TRUE_WORDS = new Set([\"✓\", \"✔\", \"✔️\", \"☑\", \"✅\", \"yes\", \"y\", \"true\", \"included\", \"available\", \"supported\", \"x ✓\", \"check\", \"●\"]);\nconst FALSE_WORDS = new Set([\"✗\", \"✕\", \"✖\", \"❌\", \"×\", \"x\", \"no\", \"n\", \"false\", \"not included\", \"unavailable\", \"not available\", \"unsupported\", \"—\", \"–\", \"-\", \"○\"]);\n\n/* ── Render (the ONE renderer) ─────────────────────────────────────── */\nexport type RefResolver = (id: string) => { label: string; href?: string } | undefined;\nexport interface RenderOptions {\n /** Resolve reference cells to their current label + URL. */\n resolveRef?: RefResolver;\n /** Live-page visitor UI: sortable headers become buttons with aria-sort. Never stored. */\n sort?: { key: string; dir: 1 | -1 } | null;\n interactive?: boolean;\n /** Rows to show (filter). Keys. */\n visibleRows?: Set<string>;\n /** Write the editing marks (`data-*` model attributes). Off for clean published HTML. Default true. */\n marks?: boolean;\n}\n\nconst esc = (s: string) => s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\nconst escAttr = (s: string) => esc(s).replace(/\"/g, \"&quot;\");\nconst safeHref = (h: string) => (/^\\s*(javascript|vbscript|data):/i.test(h) ? \"#\" : h);\nconst INLINE_TAGS = new Set([\"strong\", \"b\", \"em\", \"i\", \"u\", \"s\", \"del\", \"code\", \"a\", \"br\", \"sup\", \"sub\", \"mark\", \"small\", \"abbr\"]);\n/** Inline rich text in a cell: only inline marks and safe links survive (string-based, no DOM). */\nexport function sanitizeInline(html: string): string {\n return html\n .replace(/<(script|style|iframe|object|embed|template)\\b[\\s\\S]*?<\\/\\1>/gi, \"\")\n .replace(/<\\/?([a-z][a-z0-9]*)\\b([^>]*)>/gi, (m, tag: string, attrs: string) => {\n const t = tag.toLowerCase();\n if (!INLINE_TAGS.has(t)) return \"\";\n if (m.startsWith(\"</\")) return `</${t === \"b\" ? \"strong\" : t === \"i\" ? \"em\" : t}>`;\n if (t === \"a\") {\n const href = attrs.match(/href\\s*=\\s*(\"([^\"]*)\"|'([^']*)')/i);\n const h = href ? href[2] ?? href[3] ?? \"\" : \"\";\n return `<a href=\"${escAttr(safeHref(h))}\">`;\n }\n if (t === \"abbr\") {\n const title = attrs.match(/title\\s*=\\s*\"([^\"]*)\"/i);\n return title ? `<abbr title=\"${escAttr(title[1])}\">` : \"<abbr>\";\n }\n return `<${t === \"b\" ? \"strong\" : t === \"i\" ? \"em\" : t}>`;\n });\n}\n\nconst alignOf = (col: TableColumn, t: TableColumnType) => col.align ?? (t === \"number\" || t === \"money\" || t === \"rating\" ? \"end\" : \"start\");\nconst footnoteIndex = (t: TableValue) => new Map((t.footnotes ?? []).map((f, i) => [f._key, i + 1]));\n\n/** Inner HTML of one cell + its typed attributes. */\nfunction cellHtml(t: TableValue, col: TableColumn, row: TableRow | undefined, c: TableCell | undefined, o: RenderOptions, fn: Map<string, number>, asHeader: boolean): { inner: string; attrs: string } {\n const v = cellValue(c);\n const type = cellType(col, row, c);\n const marks = o.marks !== false;\n const typeAttr = marks && isCellObject(c) && c.type ? ` data-type=\"${c.type}\"` : \"\";\n const note = cellNote(c);\n const n = note ? fn.get(note) : undefined;\n const sup = n ? `<sup><a href=\"#${escAttr(t.id ?? \"tbl\")}-fn-${n}\" aria-label=\"Note ${n}\">${n}</a></sup>` : \"\";\n const noteAttr = marks && note ? ` data-note=\"${escAttr(note)}\"` : \"\";\n let inner = \"\";\n let valueAttr = \"\";\n if (isEmptyCell(v)) {\n inner = asHeader ? \"\" : `<span aria-hidden=\"true\" class=\"bt-dash\">—</span><span class=\"bt-sr\">No value</span>`;\n valueAttr = marks ? ` data-empty=\"\"` : \"\";\n } else\n switch (type) {\n case \"boolean\": {\n const b = toBool(v);\n if (b == null) inner = esc(strip(String(v)));\n else {\n const { yes, no } = boolLabels(col);\n inner = `<span aria-hidden=\"true\" class=\"bt-bool\" data-bool=\"${b}\">${b ? \"✓\" : \"–\"}</span><span class=\"bt-sr\">${esc(b ? yes : no)}</span>`;\n valueAttr = marks ? ` data-value=\"${b}\"` : \"\";\n }\n break;\n }\n case \"number\":\n case \"money\": {\n const num = toNumber(v);\n inner = esc(cellText(col, row, c));\n if (num != null && marks) valueAttr = ` data-value=\"${num}\"`;\n break;\n }\n case \"rating\": {\n const num = toNumber(v);\n if (num == null) inner = esc(strip(String(v)));\n else {\n const max = col.max ?? 5;\n // one reading for everyone: \"4.7 / 5\" (the star is decoration)\n inner = `<span aria-hidden=\"true\" class=\"bt-star\">★</span> ${esc(formatNumber(num, 1).replace(/\\.0$/, \"\"))}<span class=\"bt-dim\"> / ${max}</span>`;\n if (marks) valueAttr = ` data-value=\"${num}\"`;\n }\n break;\n }\n case \"link\": {\n const l = isObjLike(v) ? (v as TableLink) : { label: String(v), href: \"\" };\n const rel = [l.newTab ? \"noopener\" : \"\", l.rel && l.rel !== \"follow\" ? l.rel : \"\"].filter(Boolean).join(\" \");\n inner = l.href ? `<a href=\"${escAttr(safeHref(l.href))}\"${l.newTab ? ' target=\"_blank\"' : \"\"}${rel ? ` rel=\"${rel}\"` : \"\"}>${esc(l.label || l.href)}</a>` : esc(l.label);\n break;\n }\n case \"reference\": {\n const r: TableRef = isObjLike(v) ? (v as TableRef) : { ref: String(v) };\n const live = o.resolveRef?.(r.ref);\n const label = live?.label ?? r.label ?? r.ref;\n const href = live?.href ?? r.href;\n inner = href ? `<a href=\"${escAttr(safeHref(href))}\">${esc(label)}</a>` : esc(label);\n if (marks) valueAttr = ` data-ref=\"${escAttr(r.ref)}\"`;\n break;\n }\n case \"richtext-inline\":\n inner = sanitizeInline(String(isObjLike(v) ? (v as TableLink).label ?? \"\" : v));\n break;\n default:\n inner = esc(isObjLike(v) ? String((v as TableLink).label ?? \"\") : strip(String(v)));\n }\n const align = alignOf(col, type);\n const alignAttr = align !== \"start\" ? ` data-align=\"${align}\"` : \"\";\n return { inner: inner + sup, attrs: `${typeAttr}${valueAttr}${noteAttr}${alignAttr}` };\n}\n\n/** Rows in display order: body rows (ungrouped first, then each row group in its order), footer rows. */\nexport function orderedRows(t: TableValue) {\n const groups = t.rowGroups ?? [];\n const known = new Set(groups.map((g) => g._key));\n const body = t.rows.filter((r) => !r.footer);\n const loose = body.filter((r) => !r.group || !known.has(r.group));\n const bodies: { group?: TableGroup; rows: TableRow[] }[] = [];\n if (loose.length || !groups.length) bodies.push({ rows: loose });\n for (const g of groups) {\n const rows = body.filter((r) => r.group === g._key);\n if (rows.length) bodies.push({ group: g, rows });\n }\n return { bodies, foot: t.rows.filter((r) => r.footer) };\n}\n\n/** Sort comparator over a column (numbers numerically, booleans true first, text by locale). */\nexport function sortRows(t: TableValue, rows: TableRow[], key: string, dir: 1 | -1): TableRow[] {\n const col = t.columns.find((c) => c._key === key);\n if (!col) return rows;\n const val = (r: TableRow) => {\n const c = r.cells[key];\n const ty = cellType(col, r, c);\n const v = cellValue(c);\n if (ty === \"number\" || ty === \"money\" || ty === \"rating\") return toNumber(v);\n if (ty === \"boolean\") return toBool(v) == null ? null : toBool(v) ? 1 : 0;\n return cellText(col, r, c).toLowerCase() || null;\n };\n return [...rows].sort((a, b) => {\n const x = val(a);\n const y = val(b);\n if (x == null && y == null) return 0;\n if (x == null) return 1; // empty last, whichever direction\n if (y == null) return -1;\n return (typeof x === \"number\" && typeof y === \"number\" ? x - y : String(x).localeCompare(String(y), \"en\", { numeric: true })) * dir;\n });\n}\n\n/** The table as semantic HTML: <figure data-rt=\"table\"> › <table> (caption, colgroup, thead, tbody…, tfoot) + notes. */\nexport function renderTableHtml(input: TableValue, o: RenderOptions = {}): string {\n const t = normalizeTable(input);\n const marks = o.marks !== false;\n const id = t.id!;\n const cols = t.columns;\n const n = cols.length;\n const fn = footnoteIndex(t);\n const groups = (t.columnGroups ?? []).filter((g) => cols.some((c) => c.group === g._key));\n const describedBy = t.notes || (t.footnotes ?? []).length ? ` aria-describedby=\"${escAttr(id)}-notes\"` : \"\";\n const fig: string[] = [];\n const figAttrs = [\n `data-rt=\"table\"`,\n `data-id=\"${escAttr(id)}\"`,\n `class=\"bt-table\"`,\n marks ? `data-header-row=\"${t.headerRow}\"` : \"\",\n t.headerColumn ? `data-header-col=\"true\"` : \"\",\n `data-responsive=\"${t.design?.responsive ?? \"scroll\"}\"`,\n t.design?.sticky ? `data-sticky=\"true\"` : \"\",\n t.design?.fit ? `data-fit=\"true\"` : \"\",\n t.design?.striped ? `data-striped=\"true\"` : \"\",\n t.design?.density === \"compact\" ? `data-density=\"compact\"` : \"\",\n t.design?.hideCaption ? `data-caption=\"hidden\"` : \"\",\n marks && t.filterable ? `data-filter=\"true\"` : \"\",\n marks && t.jsonLd && t.jsonLd.type !== \"none\" ? `data-jsonld=\"${t.jsonLd.type}\"${t.jsonLd.axis ? ` data-jsonld-axis=\"${t.jsonLd.axis}\"` : \"\"}${t.jsonLd.priceRow ? ` data-jsonld-price=\"${escAttr(t.jsonLd.priceRow)}\"` : \"\"}` : \"\",\n ].filter(Boolean);\n fig.push(`<figure ${figAttrs.join(\" \")}>`);\n // the scroll region names itself after the caption; the table keeps its own (implicit) role\n fig.push(`<div class=\"bt-scroll\" role=\"region\" tabindex=\"0\" aria-labelledby=\"${escAttr(id)}-caption\">`);\n fig.push(`<table${describedBy}>`);\n fig.push(`<caption id=\"${escAttr(id)}-caption\"${t.design?.hideCaption ? ` class=\"bt-sr\"` : \"\"}>${esc(t.caption || \"Table\")}</caption>`);\n if (marks || groups.length) {\n fig.push(\n `<colgroup>${cols\n .map((c) => {\n if (!marks) return \"<col>\";\n const a = [\n `data-key=\"${escAttr(c._key)}\"`,\n `data-type=\"${c.type}\"`,\n c.unit ? `data-unit=\"${escAttr(c.unit)}\"` : \"\",\n c.currency ? `data-currency=\"${escAttr(c.currency)}\"` : \"\",\n c.decimals != null ? `data-decimals=\"${c.decimals}\"` : \"\",\n c.align ? `data-align=\"${c.align}\"` : \"\",\n c.sortable ? `data-sortable=\"true\"` : \"\",\n c.group ? `data-group=\"${escAttr(c.group)}\"` : \"\",\n c.trueLabel ? `data-true=\"${escAttr(c.trueLabel)}\"` : \"\",\n c.falseLabel ? `data-false=\"${escAttr(c.falseLabel)}\"` : \"\",\n c.max != null ? `data-max=\"${c.max}\"` : \"\",\n c.refTo?.length ? `data-ref-to=\"${escAttr(c.refTo.join(\",\"))}\"` : \"\",\n c.description ? `data-description=\"${escAttr(c.description)}\"` : \"\",\n c.highlight ? `data-highlight=\"true\"` : \"\",\n ].filter(Boolean);\n return `<col ${a.join(\" \")}>`;\n })\n .join(\"\")}</colgroup>`,\n );\n }\n // header\n if (t.headerRow) {\n fig.push(\"<thead>\");\n if (groups.length) {\n const cells: string[] = [];\n for (let i = 0; i < n; ) {\n const g = cols[i].group && groups.find((x) => x._key === cols[i].group);\n if (!g) {\n cells.push(`<td></td>`);\n i++;\n continue;\n }\n let span = 1;\n while (i + span < n && cols[i + span].group === g._key) span++;\n cells.push(`<th scope=\"colgroup\"${span > 1 ? ` colspan=\"${span}\"` : \"\"}${marks ? ` data-group=\"${escAttr(g._key)}\"` : \"\"}>${esc(g.label)}</th>`);\n i += span;\n }\n fig.push(`<tr${marks ? \" data-groups\" : \"\"}>${cells.join(\"\")}</tr>`);\n }\n fig.push(\n `<tr>${cols\n .map((c, i) => {\n const type = c.type;\n const align = alignOf(c, type);\n const sortable = o.interactive && c.sortable;\n const dir = o.sort?.key === c._key ? o.sort.dir : 0;\n const ariaSort = sortable ? ` aria-sort=\"${dir === 1 ? \"ascending\" : dir === -1 ? \"descending\" : \"none\"}\"` : \"\";\n // an unnamed corner over the row headers is a plain cell, not an empty header\n if (i === 0 && t.headerColumn && !c.label.trim()) return `<td${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}></td>`;\n const label = esc(c.label || `Column ${i + 1}`);\n const title = c.description ? ` title=\"${escAttr(c.description)}\"` : \"\";\n const content = sortable ? `<button type=\"button\" class=\"bt-sort\" data-sort-key=\"${escAttr(c._key)}\">${label}<span aria-hidden=\"true\" class=\"bt-sort-icon\">${dir === 1 ? \"↑\" : dir === -1 ? \"↓\" : \"↕\"}</span></button>` : label;\n return `<th scope=\"col\"${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${align !== \"start\" ? ` data-align=\"${align}\"` : \"\"}${c.highlight ? ` data-highlight=\"true\"` : \"\"}${title}${ariaSort}>${content}</th>`;\n })\n .join(\"\")}</tr>`,\n );\n fig.push(\"</thead>\");\n }\n const rowHtml = (r: TableRow) => {\n const cells = cols.map((c, i) => {\n const asTh = t.headerColumn && i === 0;\n const { inner, attrs } = cellHtml(t, c, r, r.cells[c._key], o, fn, asTh);\n const label = ` data-label=\"${escAttr(c.label || `Column ${i + 1}`)}\"${c.highlight ? ` data-highlight=\"true\"` : \"\"}`;\n return asTh ? `<th scope=\"row\"${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${attrs}>${inner}</th>` : `<td${marks ? ` data-col=\"${escAttr(c._key)}\"` : \"\"}${label}${attrs}>${inner}</td>`;\n });\n return `<tr${marks ? ` data-key=\"${escAttr(r._key)}\"` : \"\"}${marks && r.type ? ` data-type=\"${r.type}\"` : \"\"}${r.highlight ? ` data-highlight=\"true\"` : \"\"}>${cells.join(\"\")}</tr>`;\n };\n const { bodies, foot } = orderedRows(t);\n const vis = (rows: TableRow[]) => {\n const kept = o.visibleRows ? rows.filter((r) => o.visibleRows!.has(r._key)) : rows;\n return o.sort ? sortRows(t, kept, o.sort.key, o.sort.dir) : kept;\n };\n for (const b of bodies) {\n const rows = vis(b.rows);\n if (b.group) {\n fig.push(`<tbody${marks ? ` data-key=\"${escAttr(b.group._key)}\" data-label=\"${escAttr(b.group.label)}\"` : \"\"}>`);\n fig.push(`<tr class=\"bt-group\"${marks ? \" data-group-row\" : \"\"}><th scope=\"rowgroup\" colspan=\"${n}\">${esc(b.group.label)}</th></tr>`);\n } else fig.push(\"<tbody>\");\n fig.push(rows.map(rowHtml).join(\"\"));\n fig.push(\"</tbody>\");\n }\n if (foot.length) fig.push(`<tfoot>${foot.map(rowHtml).join(\"\")}</tfoot>`);\n fig.push(\"</table></div>\");\n if (t.notes || (t.footnotes ?? []).length) {\n fig.push(`<div class=\"bt-notes\" id=\"${escAttr(id)}-notes\">`);\n if (t.notes) fig.push(`<p${marks ? \" data-notes\" : \"\"}>${esc(t.notes)}</p>`);\n if ((t.footnotes ?? []).length)\n fig.push(`<ol${marks ? \" data-footnotes\" : \"\"}>${t.footnotes!.map((f, i) => `<li id=\"${escAttr(id)}-fn-${i + 1}\"${marks ? ` data-key=\"${escAttr(f._key)}\"` : \"\"}>${esc(f.text)}</li>`).join(\"\")}</ol>`);\n fig.push(\"</div>\");\n }\n fig.push(\"</figure>\");\n const html = fig.join(\"\");\n return t.design?.responsive === \"stack\" || t.design?.responsive === \"cards\" ? withTableRoles(html) : html;\n}\n\n/**\n * Stack / Cards change `display` on table parts, which makes some engines drop table semantics. The fix (Adrian\n * Roselli, \"Tables, CSS Display Properties, and ARIA\") restates the SAME roles explicitly — semantics unchanged.\n * Cell contents are sanitized inline HTML, so these tag patterns only ever match the table's own structure.\n */\nfunction withTableRoles(html: string) {\n return html\n .replace(/<table(?=[\\s>])/, '<table role=\"table\"')\n .replace(/<(thead|tbody|tfoot)(?=[\\s>])/g, '<$1 role=\"rowgroup\"')\n .replace(/<tr(?=[\\s>])/g, '<tr role=\"row\"')\n .replace(/<th scope=\"(col|colgroup)\"/g, '<th role=\"columnheader\" scope=\"$1\"')\n .replace(/<th scope=\"(row|rowgroup)\"/g, '<th role=\"rowheader\" scope=\"$1\"')\n .replace(/<td(?=[\\s>])/g, '<td role=\"cell\"');\n}\n\n/* ── Markdown (GFM) ────────────────────────────────────────────────── */\nconst mdCell = (s: string) => s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\|/g, \"\\\\|\").replace(/\\s*\\n\\s*/g, \" \").trim();\nfunction inlineMd(html: string): string {\n return strip(\n sanitizeInline(html)\n .replace(/<(strong)>([\\s\\S]*?)<\\/\\1>/g, \"**$2**\")\n .replace(/<(em)>([\\s\\S]*?)<\\/\\1>/g, \"_$2_\")\n .replace(/<code>([\\s\\S]*?)<\\/code>/g, \"`$1`\")\n .replace(/<a href=\"([^\"]*)\">([\\s\\S]*?)<\\/a>/g, (_m, h: string, l: string) => `[${l}](${h.replace(/&amp;/g, \"&\")})`)\n .replace(/<br>/g, \" \"),\n );\n}\n/**\n * GFM has one header row and no spans, so: column groups prefix their columns (\"Sizes · Chest\"), row groups become a\n * bold label row, the caption is a bold line above, notes and footnotes follow. Booleans say their words, never ✓.\n */\nexport function tableToMarkdown(input: TableValue, o: { resolveRef?: RefResolver; abs?: (href: string) => string } = {}): string {\n const t = normalizeTable(input);\n const cols = t.columns;\n if (!cols.length) return \"\";\n const groups = new Map((t.columnGroups ?? []).map((g) => [g._key, g.label]));\n const fn = footnoteIndex(t);\n const pfx = (t.id ?? \"t\").replace(/[^\\w-]/g, \"\");\n const head = cols.map((c, i) => mdCell([c.group && groups.get(c.group), c.label || (i === 0 && t.headerColumn ? \"\" : `Column ${i + 1}`)].filter(Boolean).join(\" · \")) || \" \");\n const sep = cols.map((c) => (alignOf(c, c.type) === \"end\" ? \"---:\" : alignOf(c, c.type) === \"center\" ? \":---:\" : \"---\"));\n const line = (cells: string[]) => `| ${cells.join(\" | \")} |`;\n const row = (r: TableRow) =>\n line(\n cols.map((c, i) => {\n const cell = r.cells[c._key];\n const v = cellValue(cell);\n const ty = cellType(c, r, cell);\n let s = ty === \"richtext-inline\" && typeof v === \"string\" ? inlineMd(v) : cellText(c, r, cell, o.resolveRef);\n if (ty === \"link\" && isObjLike(v) && (v as TableLink).href) s = `[${s}](${o.abs ? o.abs((v as TableLink).href) : (v as TableLink).href})`;\n if (ty === \"reference\" && isObjLike(v)) {\n const href = o.resolveRef?.((v as TableRef).ref)?.href ?? (v as TableRef).href;\n if (href) s = `[${s}](${o.abs ? o.abs(href) : href})`;\n }\n if (!s && !(t.headerColumn && i === 0)) s = \"—\";\n if (t.headerColumn && i === 0 && s) s = `**${s}**`;\n const note = cellNote(cell);\n if (note && fn.get(note)) s += `[^${pfx}-${fn.get(note)}]`;\n return mdCell(s) || \" \";\n }),\n );\n const out: string[] = [];\n out.push(`**${mdCell(t.caption || \"Table\")}**`, \"\");\n out.push(line(head), line(sep));\n const { bodies, foot } = orderedRows(t);\n for (const b of bodies) {\n if (b.group) out.push(line([`**${mdCell(b.group.label)}**`, ...cols.slice(1).map(() => \" \")]));\n b.rows.forEach((r) => out.push(row(r)));\n }\n foot.forEach((r) => out.push(row(r)));\n const after: string[] = [];\n if (t.notes) after.push(t.notes);\n const described = cols.filter((c) => c.description);\n if (described.length) after.push(described.map((c) => `${c.label}: ${c.description}`).join(\". \") + \".\");\n if ((t.footnotes ?? []).length) after.push(t.footnotes!.map((f, i) => `[^${pfx}-${i + 1}]: ${f.text}`).join(\"\\n\"));\n return [out.join(\"\\n\"), ...after].join(\"\\n\\n\");\n}\n\n/* ── CSV / TSV ─────────────────────────────────────────────────────── */\n/** RFC 4180 parser; the delimiter is a tab when the text has one (Excel / Sheets copy), else `;` or `,` by count. */\nexport function parseDelimited(text: string, delim?: string): string[][] {\n const src = text.replace(/\\r\\n?/g, \"\\n\").replace(/\\n+$/, \"\");\n if (!src.trim()) return [];\n const firstLine = src.split(\"\\n\")[0];\n const d = delim ?? (firstLine.includes(\"\\t\") ? \"\\t\" : (firstLine.match(/;/g)?.length ?? 0) > (firstLine.match(/,/g)?.length ?? 0) ? \";\" : \",\");\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let q = false;\n for (let i = 0; i < src.length; i++) {\n const ch = src[i];\n if (q) {\n if (ch === '\"' && src[i + 1] === '\"') {\n cell += '\"';\n i++;\n } else if (ch === '\"') q = false;\n else cell += ch;\n } else if (ch === '\"' && cell === \"\") q = true;\n else if (ch === d) {\n row.push(cell);\n cell = \"\";\n } else if (ch === \"\\n\") {\n row.push(cell);\n rows.push(row);\n row = [];\n cell = \"\";\n } else cell += ch;\n }\n row.push(cell);\n rows.push(row);\n const w = Math.max(...rows.map((r) => r.length));\n return rows.map((r) => [...r.map((c) => c.trim()), ...Array(w - r.length).fill(\"\")]);\n}\nexport function toDelimited(rows: string[][], delim = \",\"): string {\n return rows.map((r) => r.map((c) => (/[\",\\n\\t;]/.test(c) ? `\"${c.replace(/\"/g, '\"\"')}\"` : c)).join(delim)).join(\"\\n\");\n}\n/** Header + body rows as text (CSV export, \"Copy as CSV\"). */\nexport function tableToRows(input: TableValue, resolveRef?: RefResolver): string[][] {\n const t = normalizeTable(input);\n const { bodies, foot } = orderedRows(t);\n const all = [...bodies.flatMap((b) => b.rows), ...foot];\n return [t.columns.map((c) => c.label), ...all.map((r) => t.columns.map((c) => cellText(c, r, r.cells[c._key], resolveRef)))];\n}\n\n/* ── Type inference (CSV, paste, HTML import) ──────────────────────── */\nconst CURRENCY: Record<string, string> = { $: \"USD\", \"€\": \"EUR\", \"£\": \"GBP\", \"¥\": \"JPY\", \"₹\": \"INR\", \"A$\": \"AUD\", \"C$\": \"CAD\", \"CHF\": \"CHF\" };\nconst MONEY_RX = /^(A\\$|C\\$|CHF|[$€£¥₹])\\s?-?[\\d,]*\\.?\\d+$|^-?[\\d,]*\\.?\\d+\\s?(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i;\nconst NUM_RX = /^([+-]?[\\d,]*\\.?\\d+)\\s?([a-zA-Z%°][a-zA-Z%°²³/]*)?$/;\nconst RATING_RX = /^(\\d(?:\\.\\d)?)\\s?(?:\\/\\s?(5|10)|★|stars?|out of (5|10))$/i;\n\nexport interface InferredColumn {\n type: TableColumnType;\n unit?: string;\n currency?: string;\n max?: number;\n}\n/** Look at a column's non-empty values and pick the narrowest type every value fits. */\nexport function inferColumn(values: string[]): InferredColumn {\n const vs = values.map((v) => v.trim()).filter(Boolean);\n if (!vs.length) return { type: \"text\" };\n const txt = vs.map((v) => strip(v).trim());\n if (txt.every((v) => toBool(v) != null) && txt.some((v) => toBool(v) === true)) return { type: \"boolean\" };\n if (txt.every((v) => MONEY_RX.test(v))) {\n const sym = txt[0].match(/^(A\\$|C\\$|CHF|[$€£¥₹])/)?.[1] ?? txt[0].match(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i)?.[1]?.toUpperCase();\n const cur = sym ? CURRENCY[sym] ?? sym : \"USD\";\n if (txt.every((v) => (v.match(/^(A\\$|C\\$|CHF|[$€£¥₹])/)?.[1] ?? v.match(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i)?.[1]?.toUpperCase()) === sym)) return { type: \"money\", currency: cur };\n }\n const rating = txt.map((v) => v.match(RATING_RX));\n if (rating.every(Boolean)) return { type: \"rating\", max: Number(rating[0]![2] || rating[0]![3] || 5) };\n const nums = txt.map((v) => v.match(NUM_RX));\n if (nums.every(Boolean)) {\n const units = new Set(nums.map((m) => m![2] ?? \"\"));\n if (units.size === 1) return { type: \"number\", ...([...units][0] ? { unit: [...units][0] } : {}) };\n }\n if (vs.every((v) => /^<a\\s[^>]*href=/i.test(v) && /<\\/a>\\s*$/i.test(v) && (v.match(/<a\\s/gi)?.length ?? 0) === 1)) return { type: \"link\" };\n if (vs.some((v) => /<(strong|b|em|i|a|code|sup|sub|br)\\b/i.test(v))) return { type: \"richtext-inline\" };\n return { type: \"text\" };\n}\n/** A raw string (CSV / paste / HTML cell) → a value of `type`. */\nexport function coerce(raw: string, col: Pick<TableColumn, \"type\" | \"max\">): TableCellValue {\n const s = raw.trim();\n const plain = strip(s).trim();\n if (!plain && col.type !== \"richtext-inline\") return null;\n switch (col.type) {\n case \"boolean\":\n return toBool(plain) ?? plain;\n case \"number\":\n case \"money\":\n return toNumber(plain.replace(/(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)$/i, \"\")) ?? plain;\n case \"rating\": {\n const m = plain.match(/(\\d+(?:\\.\\d+)?)/);\n return m ? Number(m[1]) : plain;\n }\n case \"link\": {\n const m = s.match(/<a\\s[^>]*href\\s*=\\s*\"([^\"]*)\"[^>]*>([\\s\\S]*?)<\\/a>/i);\n if (m) return { label: strip(m[2]).trim(), href: m[1].replace(/&amp;/g, \"&\") };\n return /^(https?:|\\/|mailto:)/.test(plain) ? { label: plain, href: plain } : { label: plain, href: \"\" };\n }\n case \"richtext-inline\":\n return sanitizeInline(s);\n default:\n return plain;\n }\n}\n\n/** Text rows (CSV, TSV, a pasted range) → a table. `header`: first row holds the column labels. */\nexport function tableFromRows(rows: string[][], opts: { header?: boolean; caption?: string } = {}): TableValue {\n const header = opts.header ?? true;\n const width = Math.max(1, ...rows.map((r) => r.length));\n const labels = header ? rows[0] ?? [] : [];\n const body = header ? rows.slice(1) : rows;\n const columns: TableColumn[] = Array.from({ length: width }, (_, i) => {\n const inf = inferColumn(body.map((r) => r[i] ?? \"\"));\n return { _key: tkey(\"c\"), label: strip(labels[i] ?? \"\").trim(), ...inf };\n });\n const out = emptyTable(0, 0);\n out.caption = opts.caption ?? \"\";\n out.columns = columns;\n // an empty top-left header over a text column = the first column names the rows (\"\", Carbon steel, Cast iron)\n out.headerColumn = header && !!rows.length && !strip(labels[0] ?? \"\").trim() && columns[0]?.type === \"text\" && width > 1;\n out.rows = body.filter((r) => r.some((c) => c.trim())).map((r) => ({ _key: tkey(\"r\"), cells: Object.fromEntries(columns.map((c, i) => [c._key, coerce(r[i] ?? \"\", c)])) }));\n return out;\n}\n\n/**\n * GAP-203: a pasted cell as the number a number, money or rating column stores, or null when it is not one. Digits with\n * a sign and one decimal point, thousands in groups of three (\"1,234.5\"), with a currency symbol or code, a percent sign\n * or the column's own unit around them; a rating may name its scale (\"4.5/5\"). Letters among the digits (\"z5c5\") are no\n * number: their digits are never run together (it stored $55).\n */\nexport function pastedNumber(raw: string, col: Pick<TableColumn, \"type\" | \"unit\">): number | null {\n let s = strip(raw).trim().replace(/\\s+/g, \" \");\n if (col.unit) s = s.replace(new RegExp(`\\\\s?${col.unit.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}$`, \"i\"), \"\");\n s = s.replace(/\\s?(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF|%)$/i, \"\").replace(/^(USD|EUR|GBP|JPY|INR|AUD|CAD|CHF)\\s?/i, \"\");\n if (col.type === \"rating\") s = s.replace(/\\s?(\\/|out of)\\s?\\d+(\\.\\d+)?$/i, \"\");\n s = s.replace(/^([+-]?)\\s?[$€£¥₹]\\s?/, \"$1\").replace(/\\s?[$€£¥₹]$/, \"\");\n return /\\d/.test(s) && /^[+-]?(\\d+|\\d{1,3}(,\\d{3})+)?(\\.\\d+)?$/.test(s) ? Number(s.replace(/,/g, \"\")) : null;\n}\n\n/** A pasted cell a number, money or rating column did not take (GAP-203): the text, and the column's label. */\nexport interface PasteRefusal {\n text: string;\n column: string;\n}\n\n/**\n * Paste a text range into a table at (row, col), growing rows / columns as needed. Values coerce to column types; a\n * number, money or rating cell takes only a number (`pastedNumber`), else it keeps its value and the text is added to\n * `refused`.\n */\nexport function pasteRange(input: TableValue, at: { row: number; col: number }, grid: string[][], opts: { lockColumns?: boolean; refused?: PasteRefusal[] } = {}): TableValue {\n const t = normalizeTable(input);\n const columns = [...t.columns];\n const rows = t.rows.map((r) => ({ ...r, cells: { ...r.cells } }));\n let r0 = at.row;\n let g = grid;\n if (r0 < 0) {\n // pasted on the header row: the first line is labels\n const labels = g[0] ?? [];\n labels.forEach((l, j) => {\n const ci = at.col + j;\n if (ci >= columns.length) {\n if (opts.lockColumns) return;\n columns.push({ _key: tkey(\"c\"), label: \"\", type: \"text\" });\n }\n columns[ci] = { ...columns[ci], label: strip(l).trim() };\n });\n g = g.slice(1);\n r0 = 0;\n }\n const need = at.col + Math.max(0, ...g.map((r) => r.length));\n while (!opts.lockColumns && columns.length < need) columns.push({ _key: tkey(\"c\"), label: \"\", type: \"text\" });\n g.forEach((line, i) => {\n const ri = r0 + i;\n while (rows.length <= ri) rows.push({ _key: tkey(\"r\"), cells: {} });\n line.forEach((raw, j) => {\n const col = columns[at.col + j];\n if (!col) return;\n const prev = rows[ri].cells[col._key];\n const type = cellType(col, rows[ri], prev);\n const plain = strip(raw).trim();\n if ((type === \"number\" || type === \"money\" || type === \"rating\") && plain) {\n const n = pastedNumber(raw, { type, unit: col.unit });\n if (n === null) opts.refused?.push({ text: plain, column: col.label });\n else rows[ri].cells[col._key] = withValue(prev, n);\n return;\n }\n rows[ri].cells[col._key] = withValue(prev, coerce(raw, { type, max: col.max }));\n });\n });\n return { ...t, columns, rows };\n}\n\n/* ── HTML → table (ours, or any site's) ────────────────────────────── */\n/**\n * Read a DOM <table> (or our <figure data-rt=\"table\">) into the model. Our own data-* marks round-trip losslessly;\n * any other table is inferred: header rows from thead / th, row headers from tbody th[scope=row] or a th first cell,\n * caption from <caption> / figcaption / aria-label, groups from thead colspans and multiple <tbody> / rowgroup rows,\n * footer from <tfoot>, types from cell text (✓/✗ → boolean, $ → money, 4.5/5 → rating), footnote marks kept as notes.\n * Body cells with colspan/rowspan are expanded (copied) — the model has no merged body cells.\n */\nexport function parseTableElement(el: Element): TableValue {\n const fig = el.matches(\"figure\") ? el : el.closest(\"figure[data-rt=table]\");\n const table = (el.matches(\"table\") ? el : el.querySelector(\"table\")) as HTMLTableElement | null;\n const out = emptyTable(0, 0);\n if (!table) return emptyTable();\n const ds = (fig as HTMLElement | null)?.dataset ?? {};\n out.id = ds.id || out.id;\n out.caption = (table.querySelector(\":scope > caption\")?.textContent ?? fig?.querySelector(\":scope > figcaption\")?.textContent ?? table.getAttribute(\"aria-label\") ?? \"\").trim();\n out.notes = (fig?.querySelector(\"[data-notes]\")?.textContent ?? \"\").trim() || undefined;\n const fnEls = Array.from(fig?.querySelectorAll(\"[data-footnotes] > li\") ?? []);\n out.footnotes = fnEls.map((li) => ({ _key: (li as HTMLElement).dataset.key || tkey(\"f\"), text: (li.textContent ?? \"\").trim() }));\n if (!out.footnotes.length) delete out.footnotes;\n const fnByIndex = new Map((out.footnotes ?? []).map((f, i) => [i + 1, f._key]));\n if (ds.responsive === \"stack\" || ds.responsive === \"cards\") out.design = { ...out.design, responsive: ds.responsive };\n if (ds.sticky === \"true\") out.design = { ...out.design, sticky: true };\n if (ds.fit === \"true\") out.design = { ...out.design, fit: true };\n if (ds.striped === \"true\") out.design = { ...out.design, striped: true };\n if (ds.density === \"compact\") out.design = { ...out.design, density: \"compact\" };\n if (ds.caption === \"hidden\") out.design = { ...out.design, hideCaption: true };\n if (ds.filter === \"true\") out.filterable = true;\n if (ds.jsonld) out.jsonLd = { type: ds.jsonld as TableJsonLdType, ...(ds.jsonldAxis ? { axis: ds.jsonldAxis as \"rows\" | \"columns\" } : {}), ...(ds.jsonldPrice ? { priceRow: ds.jsonldPrice } : {}) };\n\n // grid expansion (handles colspan / rowspan in any section)\n type Cell = { el: HTMLTableCellElement; th: boolean; origin: boolean };\n const expand = (trs: HTMLTableRowElement[]) => {\n const grid: Cell[][] = [];\n trs.forEach((tr, ri) => {\n grid[ri] ??= [];\n let ci = 0;\n for (const c of Array.from(tr.cells)) {\n while (grid[ri][ci]) ci++;\n const cs = Math.max(1, Math.min(50, c.colSpan || 1));\n const rs = Math.max(1, Math.min(200, c.rowSpan || 1));\n for (let dr = 0; dr < rs; dr++)\n for (let dc = 0; dc < cs; dc++) {\n grid[ri + dr] ??= [];\n grid[ri + dr][ci + dc] = { el: c, th: c.tagName === \"TH\", origin: dr === 0 && dc === 0 };\n }\n ci += cs;\n }\n });\n return grid;\n };\n const theadRows = Array.from(table.tHead?.rows ?? []);\n const bodies = Array.from(table.tBodies);\n const footRows = Array.from(table.tFoot?.rows ?? []);\n let bodyRows = bodies.flatMap((b) => Array.from(b.rows).map((tr) => ({ tr, body: b })));\n // no thead: leading rows made only of th are the header\n const head = [...theadRows];\n if (!head.length) {\n while (bodyRows.length && Array.from(bodyRows[0].tr.cells).every((c) => c.tagName === \"TH\") && bodyRows[0].tr.cells.length > 1) {\n head.push(bodyRows[0].tr);\n bodyRows = bodyRows.slice(1);\n }\n }\n const hgrid = expand(head);\n const width = Math.max(1, ...hgrid.map((r) => r.length), ...expand(bodyRows.map((b) => b.tr)).map((r) => r.length));\n out.headerRow = head.length > 0;\n const cols = Array.from(table.querySelectorAll(\":scope > colgroup > col\"));\n const lastHead = hgrid[hgrid.length - 1] ?? [];\n const columns: TableColumn[] = Array.from({ length: width }, (_, i) => {\n const col = cols[i] as HTMLElement | undefined;\n const d = col?.dataset ?? {};\n const hc = lastHead[i]?.el;\n const label = hc ? cleanText(hc) : \"\";\n const c: TableColumn = { _key: d.key || (hc as HTMLElement | undefined)?.dataset?.col || tkey(\"c\"), label, type: (d.type as TableColumnType) || \"text\" };\n if (d.unit) c.unit = d.unit;\n if (d.currency) c.currency = d.currency;\n if (d.decimals) c.decimals = Number(d.decimals);\n if (d.align) c.align = d.align as TableColumn[\"align\"];\n if (d.sortable === \"true\") c.sortable = true;\n if (d.true) c.trueLabel = d.true;\n if (d.false) c.falseLabel = d.false;\n if (d.max) c.max = Number(d.max);\n if (d.refTo) c.refTo = d.refTo.split(\",\");\n if (d.highlight === \"true\") c.highlight = true;\n if (d.description) c.description = d.description;\n else if (hc?.getAttribute(\"title\")) c.description = hc.getAttribute(\"title\")!;\n return c;\n });\n // column groups: a header row above the last whose cells span several columns\n if (hgrid.length > 1) {\n const top = hgrid[0];\n const groups: TableGroup[] = [];\n for (let i = 0; i < width; ) {\n const cell = top[i];\n let span = 1;\n while (cell && i + span < width && top[i + span]?.el === cell.el) span++;\n const text = cell && cell.el !== lastHead[i]?.el ? cleanText(cell.el) : \"\";\n if (text) {\n const key = (cell.el as HTMLElement).dataset.group || tkey(\"g\");\n groups.push({ _key: key, label: text });\n for (let k = 0; k < span; k++) columns[i + k].group = key;\n }\n i += span;\n }\n if (groups.length) out.columnGroups = groups;\n }\n // body\n const rowGroups: TableGroup[] = [];\n const known = !!cols.length && cols.some((c) => (c as HTMLElement).dataset.type);\n const rawRows: { key: string; group?: string; footer?: boolean; type?: TableColumnType; highlight?: boolean; cells: (Cell | undefined)[] }[] = [];\n let currentGroup: string | undefined;\n let lastBody: HTMLTableSectionElement | null = null;\n const bgrid = expand(bodyRows.map((b) => b.tr));\n bodyRows.forEach(({ tr, body }, ri) => {\n if (body !== lastBody) {\n lastBody = body;\n const label = (body as HTMLElement).dataset.label;\n currentGroup = label ? ((body as HTMLElement).dataset.key || tkey(\"rg\")) : undefined;\n if (label && currentGroup) rowGroups.push({ _key: currentGroup, label });\n }\n const cells = bgrid[ri] ?? [];\n // a row that is one cell spanning the table (th scope=rowgroup, or a lone th/td colspan=all) opens a row group\n const only = tr.cells.length === 1 && (tr.cells[0].colSpan >= width || tr.cells[0].getAttribute(\"scope\") === \"rowgroup\");\n if (only || tr.hasAttribute(\"data-group-row\")) {\n // our own group row repeats its <tbody data-label>; anyone else's opens a new group\n if (!(tr.hasAttribute(\"data-group-row\") && (body as HTMLElement).dataset.label)) {\n currentGroup = tkey(\"rg\");\n rowGroups.push({ _key: currentGroup, label: cleanText(tr.cells[0]) });\n }\n return;\n }\n rawRows.push({ key: (tr as HTMLElement).dataset.key || tkey(\"r\"), group: currentGroup, type: ((tr as HTMLElement).dataset.type as TableColumnType) || undefined, highlight: (tr as HTMLElement).dataset.highlight === \"true\", cells });\n });\n expand(footRows).forEach((cells, i) => rawRows.push({ key: (footRows[i] as HTMLElement).dataset.key || tkey(\"r\"), footer: true, cells }));\n // header column: our mark, or every body row starts with a th\n out.headerColumn = ds.headerCol === \"true\" || (rawRows.length > 0 && rawRows.every((r) => r.cells[0]?.th && r.cells[0].el.getAttribute(\"scope\") !== \"col\"));\n // infer types for unmarked columns\n if (!known) {\n columns.forEach((c, i) => {\n if (out.headerColumn && i === 0) return;\n const inf = inferColumn(rawRows.map((r) => (r.cells[i] ? cellSource(r.cells[i]!.el) : \"\")));\n Object.assign(c, inf);\n });\n }\n out.columns = columns;\n out.rows = rawRows.map((r) => ({\n _key: r.key,\n ...(r.group ? { group: r.group } : {}),\n ...(r.footer ? { footer: true } : {}),\n ...(r.type ? { type: r.type } : {}),\n ...(r.highlight ? { highlight: true } : {}),\n cells: Object.fromEntries(\n columns.map((c, i) => {\n const cell = r.cells[i];\n if (!cell) return [c._key, null];\n return [c._key, readCell(cell.el, c, r.type, fnByIndex)];\n }),\n ),\n }));\n if (rowGroups.length) out.rowGroups = rowGroups;\n return out;\n}\n\n/** Visible text of a header/cell minus visually-hidden helpers and footnote marks. */\nfunction cleanText(el: Element): string {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup, .bt-sort-icon, [aria-hidden=true]\").forEach((n) => n.remove());\n return (c.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n}\n/** A cell's source for inference: inner HTML minus footnote marks, decorative icons and sr helpers kept as words. */\nfunction cellSource(el: Element): string {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup\").forEach((n) => n.remove());\n // an icon-only cell with a visually-hidden label reads as its label (\"Included\"); an svg/img with aria-label too\n const sr = c.querySelector(\".bt-sr, .sr-only, .visually-hidden, .screen-reader-text\");\n if (sr && !(c.textContent ?? \"\").replace(sr.textContent ?? \"\", \"\").replace(/[✓✔✗✕–—\\s]/g, \"\")) return (sr.textContent ?? \"\").trim();\n const labelled = c.querySelector(\"[aria-label]\");\n if (labelled && !(c.textContent ?? \"\").trim()) return labelled.getAttribute(\"aria-label\") ?? \"\";\n const img = c.querySelector(\"img[alt]\");\n if (img && !(c.textContent ?? \"\").trim()) return img.getAttribute(\"alt\") ?? \"\";\n c.querySelectorAll(\"[aria-hidden=true]\").forEach((n) => n.remove());\n const html = c.innerHTML.trim();\n return /<(a|strong|b|em|i|code|br)\\b/i.test(html) ? html : (c.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n}\nfunction readCell(el: HTMLTableCellElement, col: TableColumn, rowType: TableColumnType | undefined, fn: Map<number, string>): TableCell {\n const d = (el as HTMLElement).dataset;\n const type = (d.type as TableColumnType) || rowType || col.type;\n let value: TableCellValue;\n if (d.empty != null) value = null;\n else if (d.ref) value = { ref: d.ref, label: cleanText(el) || undefined, href: el.querySelector(\"a\")?.getAttribute(\"href\") ?? undefined };\n else if (d.value != null && (type === \"boolean\" || type === \"number\" || type === \"money\" || type === \"rating\")) value = type === \"boolean\" ? d.value === \"true\" : Number(d.value);\n else if (type === \"richtext-inline\") {\n const c = el.cloneNode(true) as HTMLElement;\n c.querySelectorAll(\"sup\").forEach((n) => n.remove());\n value = sanitizeInline(c.innerHTML.trim());\n } else value = coerce(cellSource(el), { type, max: col.max });\n const supN = Number(el.querySelector(\"sup a, sup\")?.textContent?.trim());\n const note = d.note || (supN ? fn.get(supN) : undefined);\n if (d.type || note) return { value, ...(d.type ? { type: d.type as TableColumnType } : {}), ...(note ? { note } : {}) };\n return value;\n}\n\n/* ── JSON-LD (opt-in) ──────────────────────────────────────────────── */\n/**\n * Dataset — a report or spec table (name = caption, description = notes, variableMeasured = columns).\n * ItemList — a comparison: the things compared (row headers, or column labels) in order.\n * Offers — a pricing matrix: one Offer per plan (columns), price from the money row `priceRow`.\n * Returns null when the table can't honestly support the type (no caption, no items, no prices).\n */\nexport function tableJsonLd(input: TableValue, o: { url?: string; resolveRef?: RefResolver } = {}): Record<string, unknown> | null {\n const t = normalizeTable(input);\n const kind = t.jsonLd?.type ?? \"none\";\n if (kind === \"none\" || !t.caption.trim()) return null;\n const body = t.rows.filter((r) => !r.footer);\n if (kind === \"Dataset\") {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Dataset\",\n name: t.caption,\n description: t.notes || t.caption,\n ...(o.url ? { url: o.url } : {}),\n variableMeasured: t.columns.filter((_c, i) => !(t.headerColumn && i === 0)).map((c) => ({ \"@type\": \"PropertyValue\", name: c.label, ...(c.unit ? { unitText: c.unit } : {}), ...(c.description ? { description: c.description } : {}) })),\n };\n }\n const axis = t.jsonLd?.axis ?? \"rows\";\n if (kind === \"ItemList\") {\n const names = axis === \"rows\" ? body.map((r) => cellText(t.columns[0], r, r.cells[t.columns[0]._key], o.resolveRef)) : t.columns.slice(t.headerColumn ? 1 : 0).map((c) => c.label);\n const items = names.filter(Boolean);\n if (!items.length) return null;\n return { \"@context\": \"https://schema.org\", \"@type\": \"ItemList\", name: t.caption, numberOfItems: items.length, itemListElement: items.map((name, i) => ({ \"@type\": \"ListItem\", position: i + 1, name })) };\n }\n // Offers: plans are columns; the price row holds money\n const priceRow = t.rows.find((r) => r._key === t.jsonLd?.priceRow) ?? body.find((r) => t.columns.some((c) => cellType(c, r, r.cells[c._key]) === \"money\"));\n if (!priceRow) return null;\n const offers = t.columns\n .slice(t.headerColumn ? 1 : 0)\n .map((c) => {\n const cell = priceRow.cells[c._key];\n const n = toNumber(cellValue(cell));\n return n == null ? null : { \"@type\": \"Offer\", name: c.label, price: n, priceCurrency: c.currency || \"USD\", ...(o.url ? { url: o.url } : {}) };\n })\n .filter(Boolean) as { price: number; priceCurrency: string }[];\n if (!offers.length) return null;\n const prices = offers.map((x) => x.price);\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n name: t.caption,\n ...(t.notes ? { description: t.notes } : {}),\n offers: { \"@type\": \"AggregateOffer\", lowPrice: Math.min(...prices), highPrice: Math.max(...prices), priceCurrency: offers[0].priceCurrency, offerCount: offers.length, offers },\n };\n}\n\n/* ── Validation (the kit engine + docs + MCP all use these words) ──── */\nexport interface TableIssue {\n level: \"error\" | \"warning\";\n message: string;\n /** where: \"caption\" · \"col:<key>\" · \"row:<key>\" · \"cell:<row>:<col>\" */\n at?: string;\n}\nexport function tableIssues(input: unknown, opts: TableFieldOptions = {}): TableIssue[] {\n if (!isTableValue(input)) return [];\n const t = input;\n const out: TableIssue[] = [];\n if (!t.caption?.trim() && opts.requireCaption !== false) out.push({ level: \"error\", message: \"Give the table a title that says what it compares.\", at: \"caption\" });\n if (!t.headerRow) out.push({ level: \"warning\", message: \"Show the column names: turn on Show column names in Table settings.\" });\n if (t.headerRow) {\n const empty = t.columns.filter((c, i) => !c.label.trim() && !(t.headerColumn && i === 0));\n if (empty.length) out.push({ level: \"error\", message: `Name ${empty.length === 1 ? \"the empty column\" : `the ${empty.length} empty columns`}.`, at: `col:${empty[0]._key}` });\n }\n const keys = new Set<string>();\n for (const c of t.columns) {\n if (keys.has(c._key)) out.push({ level: \"error\", message: \"Two columns are the same column. Delete one and add it again.\", at: `col:${c._key}` });\n keys.add(c._key);\n }\n if (opts.maxColumns && t.columns.length > opts.maxColumns) out.push({ level: \"error\", message: `Use at most ${opts.maxColumns} columns.` });\n const body = t.rows.filter((r) => !r.footer);\n if (opts.minRows && body.length < opts.minRows) out.push({ level: \"error\", message: `Add at least ${opts.minRows} rows.` });\n if (opts.maxRows && body.length > opts.maxRows) out.push({ level: \"error\", message: `Use at most ${opts.maxRows} rows.` });\n let mismatch: { row: string; col: string; label: string } | null = null;\n let mismatches = 0;\n for (const r of t.rows)\n for (const c of t.columns) {\n const cell = r.cells?.[c._key];\n const v = cellValue(cell);\n if (isEmptyCell(v)) continue;\n const ty = cellType(c, r, cell);\n const bad = ((ty === \"number\" || ty === \"money\" || ty === \"rating\") && toNumber(v) == null) || (ty === \"boolean\" && toBool(v) == null);\n if (bad) {\n mismatches++;\n mismatch ??= { row: r._key, col: c._key, label: c.label };\n }\n }\n if (mismatch)\n out.push({ level: \"warning\", message: `${mismatches} ${mismatches === 1 ? \"cell doesn't\" : \"cells don't\"} match the column type (first in “${mismatch.label || \"a column\"}”). Change the column type or set the cell's own type.`, at: `cell:${mismatch.row}:${mismatch.col}` });\n if (t.headerColumn && body.some((r) => isEmptyCell(cellValue(r.cells?.[t.columns[0]?._key])))) out.push({ level: \"warning\", message: \"Every row needs a name in the first column.\" });\n if (t.jsonLd?.type === \"Dataset\" && (t.notes ?? \"\").length < 50) out.push({ level: \"warning\", message: \"To be read as a data report, write a note under the table (a sentence or two).\" });\n if (t.jsonLd?.type === \"Offers\" && !tableJsonLd(t)) out.push({ level: \"warning\", message: \"To be read as a price list, add a row of prices, one per plan column.\" });\n if (t.columns.length > 8 && t.design?.responsive !== \"scroll\") out.push({ level: \"warning\", message: \"More than 8 columns don't fit on phones as a list. In Table settings, set On phones to Scroll.\" });\n return out;\n}\n\n/** \"4 rows × 3 columns\" (array rows, summaries, breadcrumbs). */\nexport function tableSummary(v: unknown): string {\n if (!isTableValue(v)) return \"\";\n const r = v.rows.length;\n const c = v.columns.length;\n return [v.caption?.trim(), `${r} ${r === 1 ? \"row\" : \"rows\"} × ${c} ${c === 1 ? \"column\" : \"columns\"}`].filter(Boolean).join(\" · \");\n}\n\n/** Build a table in code (seed data, Kit Library, migrations): header labels + rows of display strings. */\nexport function tableFrom(\n caption: string,\n columns: (Partial<TableColumn> & { label: string })[],\n rows: (TableCell[] | { cells: TableCell[]; group?: string; footer?: boolean; type?: TableColumnType; highlight?: boolean })[],\n extra: Partial<Omit<TableValue, \"columns\" | \"rows\" | \"caption\">> = {},\n): TableValue {\n const cols: TableColumn[] = columns.map((c, i) => ({ type: \"text\", ...c, _key: c._key ?? `c${i + 1}` }));\n return {\n id: extra.id ?? `tbl_${caption.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").slice(0, 32).replace(/-$/, \"\")}`,\n caption,\n headerRow: true,\n headerColumn: false,\n design: { responsive: \"scroll\" },\n ...extra,\n columns: cols,\n rows: rows.map((r, ri) => {\n const def = Array.isArray(r) ? { cells: r } : r;\n return {\n _key: `r${ri + 1}`,\n ...(def.group ? { group: def.group } : {}),\n ...(def.footer ? { footer: true } : {}),\n ...(def.type ? { type: def.type } : {}),\n ...(def.highlight ? { highlight: true } : {}),\n cells: Object.fromEntries(cols.map((c, ci) => [c._key, def.cells[ci] ?? null])),\n };\n }),\n };\n}\n"],"mappings":";AAgCA,IAAa,qBAAuF;CAClG;EAAE,OAAO;EAAQ,OAAO;EAAQ,aAAa;CAAc;CAC3D;EAAE,OAAO;EAAU,OAAO;EAAU,aAAa;CAAqC;CACtF;EAAE,OAAO;EAAS,OAAO;EAAS,aAAa;CAA4B;CAC3E;EAAE,OAAO;EAAW,OAAO;EAAY,aAAa;CAAqC;CACzF;EAAE,OAAO;EAAU,OAAO;EAAU,aAAa;CAAW;CAC5D;EAAE,OAAO;EAAQ,OAAO;EAAQ,aAAa;CAAc;CAC3D;EAAE,OAAO;EAAmB,OAAO;EAAa,aAAa;CAA4B;CACzF;EAAE,OAAO;EAAa,OAAO;EAAa,aAAa;CAAyB;AAClF;;;;;AAqIA,IAAa,gBAAmC;CAAE,QAAQ;EAAC;EAAY;EAAW;CAAQ;CAAG,UAAU;EAAE,MAAM;EAAM,QAAQ;CAAK;AAAE;AAqBpI,IAAI,MAAM;AACV,IAAa,QAAQ,MAAc,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,MAAA,CAAO,SAAS,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;AAE1I,SAAgB,WAAW,OAAO,GAAG,OAAO,GAAe;CACzD,MAAM,UAAU,MAAM,KAAK,EAAE,QAAQ,KAAK,UAAU;EAAE,MAAM,KAAK,GAAG;EAAG,OAAO;EAAI,MAAM;CAAgB,EAAE;CAC1G,OAAO;EACL,IAAI,KAAK,KAAK;EACd,SAAS;EACT,WAAW;EACX,cAAc;EACd;EACA,MAAM,MAAM,KAAK,EAAE,QAAQ,KAAK,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G,OAAO;GACxB,MAAM,MAAM,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI;GAC9C,OAAO;IACL,MAAM,IAAI,KAAK;IACf,GAAI,IAAI,QAAQ,EAAE,OAAO,IAAI,MAAM,IAAI,CAAC;IACxC,GAAI,IAAI,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;IACrC,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACrC,GAAI,IAAI,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,OAAO,OAAO,YAAY,KAAK,KAAK,GAAG,OAAO,CAAC,EAAE,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;GAChF;EACF,CAAC;CACH;AACF"}
@@ -91,6 +91,12 @@ export interface FieldSchema {
91
91
  /** Longer explanation behind the ⓘ next to the label (tooltip). Use when one line can't carry it. */
92
92
  helpMore?: string;
93
93
  placeholder?: string;
94
+ /**
95
+ * Text drawn inside a string / url input before the value, grey and not part of it ("https://", "#", "$";
96
+ * prototype editor-v16 inspector.jsx:91, editor.css:419-422). A url field whose prefix is a scheme drops a typed or
97
+ * pasted scheme ("https://acme.com" stores "acme.com"; seo.jsx:62).
98
+ */
99
+ prefix?: string;
94
100
  initialValue?: unknown;
95
101
  validation?: Validation;
96
102
  options?: Option[];