@alfadocs/ui-kit-debug 1.62.0 → 1.63.0

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 (86) hide show
  1. package/dist/_chunks/{balance-badge-cell-F7p_ZKEg.js → balance-badge-cell-tB4u0Nr4.js} +2 -2
  2. package/dist/_chunks/{balance-badge-cell-F7p_ZKEg.js.map → balance-badge-cell-tB4u0Nr4.js.map} +1 -1
  3. package/dist/_chunks/{calendar-workspace-Dvfl9Vf6.js → calendar-workspace-BgcqB0PI.js} +5 -5
  4. package/dist/_chunks/{calendar-workspace-Dvfl9Vf6.js.map → calendar-workspace-BgcqB0PI.js.map} +1 -1
  5. package/dist/_chunks/{care-plan-card-BU3p5cLr.js → care-plan-card-DJzbwJLl.js} +2 -2
  6. package/dist/_chunks/{care-plan-card-BU3p5cLr.js.map → care-plan-card-DJzbwJLl.js.map} +1 -1
  7. package/dist/_chunks/{care-plan-header-CgFjQLBd.js → care-plan-header-1HzbkYcR.js} +2 -2
  8. package/dist/_chunks/{care-plan-header-CgFjQLBd.js.map → care-plan-header-1HzbkYcR.js.map} +1 -1
  9. package/dist/_chunks/chart-BAeJ7pvD.js +1120 -0
  10. package/dist/_chunks/chart-BAeJ7pvD.js.map +1 -0
  11. package/dist/_chunks/{clinical-note-card-BgURrgL5.js → clinical-note-card-D2bbWksq.js} +2 -2
  12. package/dist/_chunks/{clinical-note-card-BgURrgL5.js.map → clinical-note-card-D2bbWksq.js.map} +1 -1
  13. package/dist/_chunks/{contact-card-C8rEsC4Q.js → contact-card-Czu60UvU.js} +2 -2
  14. package/dist/_chunks/{contact-card-C8rEsC4Q.js.map → contact-card-Czu60UvU.js.map} +1 -1
  15. package/dist/_chunks/{contact-profile-card-VTCAmQqj.js → contact-profile-card-B4sjoIqf.js} +2 -2
  16. package/dist/_chunks/{contact-profile-card-VTCAmQqj.js.map → contact-profile-card-B4sjoIqf.js.map} +1 -1
  17. package/dist/_chunks/{data-table-m7GbLJZy.js → data-table-Ck2rIwWF.js} +1 -1
  18. package/dist/_chunks/{data-table-m7GbLJZy.js.map → data-table-Ck2rIwWF.js.map} +1 -1
  19. package/dist/_chunks/{entity-summary-DXIr5_x2.js → entity-summary-BQ9_KA8S.js} +2 -2
  20. package/dist/_chunks/{entity-summary-DXIr5_x2.js.map → entity-summary-BQ9_KA8S.js.map} +1 -1
  21. package/dist/_chunks/{file-manager-G0t8MWbE.js → file-manager-k85OOFr4.js} +2 -2
  22. package/dist/_chunks/{file-manager-G0t8MWbE.js.map → file-manager-k85OOFr4.js.map} +1 -1
  23. package/dist/_chunks/{heatmap-Bb0-M88T.js → heatmap-Cp8Gn9q-.js} +2 -2
  24. package/dist/_chunks/{heatmap-Bb0-M88T.js.map → heatmap-Cp8Gn9q-.js.map} +1 -1
  25. package/dist/_chunks/{link-gRw3NtOt.js → link-N5_YpLtm.js} +7 -6
  26. package/dist/_chunks/link-N5_YpLtm.js.map +1 -0
  27. package/dist/_chunks/{nav-grid-Byx8PxuB.js → nav-grid-Oc4aCPrg.js} +2 -2
  28. package/dist/_chunks/{nav-grid-Byx8PxuB.js.map → nav-grid-Oc4aCPrg.js.map} +1 -1
  29. package/dist/_chunks/{note-attachment-DoVWvjWR.js → note-attachment-D8V7PUiR.js} +2 -2
  30. package/dist/_chunks/{note-attachment-DoVWvjWR.js.map → note-attachment-D8V7PUiR.js.map} +1 -1
  31. package/dist/_chunks/{note-timeline-B7l3t5DZ.js → note-timeline-CwxPQ2Ak.js} +2 -2
  32. package/dist/_chunks/{note-timeline-B7l3t5DZ.js.map → note-timeline-CwxPQ2Ak.js.map} +1 -1
  33. package/dist/_chunks/{notes-panel-CTmvrqQn.js → notes-panel-BRLc2ozF.js} +2 -2
  34. package/dist/_chunks/{notes-panel-CTmvrqQn.js.map → notes-panel-BRLc2ozF.js.map} +1 -1
  35. package/dist/_chunks/{patient-details-BNDS69Zx.js → patient-details-BY8Rwwpi.js} +2 -2
  36. package/dist/_chunks/{patient-details-BNDS69Zx.js.map → patient-details-BY8Rwwpi.js.map} +1 -1
  37. package/dist/_chunks/{patient-field-row-BLBi-PjO.js → patient-field-row-C8ymfffP.js} +2 -2
  38. package/dist/_chunks/{patient-field-row-BLBi-PjO.js.map → patient-field-row-C8ymfffP.js.map} +1 -1
  39. package/dist/_chunks/{patient-summary-card-T9umuZJF.js → patient-summary-card-cmqjIXMk.js} +3 -3
  40. package/dist/_chunks/{patient-summary-card-T9umuZJF.js.map → patient-summary-card-cmqjIXMk.js.map} +1 -1
  41. package/dist/_chunks/{payment-request-card-BmzNMY2a.js → payment-request-card-0DjQgVgX.js} +2 -2
  42. package/dist/_chunks/{payment-request-card-BmzNMY2a.js.map → payment-request-card-0DjQgVgX.js.map} +1 -1
  43. package/dist/_chunks/{product-hub-panel-D-UELdo0.js → product-hub-panel-C_ZosrBt.js} +2 -2
  44. package/dist/_chunks/{product-hub-panel-D-UELdo0.js.map → product-hub-panel-C_ZosrBt.js.map} +1 -1
  45. package/dist/_chunks/{public-footer-ZWTEG1Rq.js → public-footer-CXOrdAaS.js} +2 -2
  46. package/dist/_chunks/{public-footer-ZWTEG1Rq.js.map → public-footer-CXOrdAaS.js.map} +1 -1
  47. package/dist/_chunks/{signed-out-frame-D5DzqATh.js → signed-out-frame-Rg_GVDnl.js} +2 -2
  48. package/dist/_chunks/{signed-out-frame-D5DzqATh.js.map → signed-out-frame-Rg_GVDnl.js.map} +1 -1
  49. package/dist/_chunks/{use-appointment-details-read-Gu0ehyxj.js → use-appointment-details-read-D6Gb_OuN.js} +4 -4
  50. package/dist/_chunks/{use-appointment-details-read-Gu0ehyxj.js.map → use-appointment-details-read-D6Gb_OuN.js.map} +1 -1
  51. package/dist/agent-catalog.json +1 -1
  52. package/dist/components/_shared/use-apex-legend-scroll.d.ts +7 -3
  53. package/dist/components/_shared/use-apex-legend-scroll.d.ts.map +1 -1
  54. package/dist/components/_shared/use-apex-x-label-spacing.d.ts +11 -0
  55. package/dist/components/_shared/use-apex-x-label-spacing.d.ts.map +1 -0
  56. package/dist/components/appointment-details-panel/index.js +1 -1
  57. package/dist/components/care-plan-card/index.js +1 -1
  58. package/dist/components/care-plan-header/index.js +1 -1
  59. package/dist/components/chart/chart.d.ts.map +1 -1
  60. package/dist/components/chart/index.js +1 -1
  61. package/dist/components/clinical-note-card/index.js +1 -1
  62. package/dist/components/contact-card/index.js +1 -1
  63. package/dist/components/contact-profile-card/index.js +1 -1
  64. package/dist/components/data-table/index.js +1 -1
  65. package/dist/components/entity-summary/index.js +1 -1
  66. package/dist/components/file-manager/index.js +1 -1
  67. package/dist/components/heatmap/index.js +1 -1
  68. package/dist/components/link/index.js +1 -1
  69. package/dist/components/link/link.d.ts.map +1 -1
  70. package/dist/components/nav-grid/index.js +1 -1
  71. package/dist/components/note-timeline/index.js +1 -1
  72. package/dist/components/notes-panel/index.js +1 -1
  73. package/dist/components/patient-details/index.js +1 -1
  74. package/dist/components/patient-summary-card/index.js +1 -1
  75. package/dist/components/patient-table/index.js +1 -1
  76. package/dist/components/payment-card/index.js +1 -1
  77. package/dist/components/product-hub-tray/index.js +1 -1
  78. package/dist/components/public-footer/index.js +1 -1
  79. package/dist/index.js +23 -23
  80. package/dist/patterns/calendar/index.js +1 -1
  81. package/dist/patterns/signed-out-frame/index.js +1 -1
  82. package/dist/tokens.css +6 -4
  83. package/package.json +1 -1
  84. package/dist/_chunks/chart-DgYHN8Xq.js +0 -991
  85. package/dist/_chunks/chart-DgYHN8Xq.js.map +0 -1
  86. package/dist/_chunks/link-gRw3NtOt.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-BAeJ7pvD.js","sources":["../../node_modules/lucide-react/dist/esm/icons/chart-area.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-column.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-line.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-pie.mjs","../../node_modules/lucide-react/dist/esm/icons/donut.mjs","../../src/components/_shared/use-apex-chart-semantics.ts","../../src/components/_shared/use-apex-legend-scroll.ts","../../src/components/_shared/use-apex-x-label-spacing.ts","../../src/components/chart/chart.agent.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\n \"path\",\n {\n d: \"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z\",\n key: \"q0gr47\"\n }\n ]\n];\nconst ChartArea = createLucideIcon(\"chart-area\", __iconNode);\n\nexport { __iconNode, ChartArea as default };\n//# sourceMappingURL=chart-area.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"M18 17V9\", key: \"2bz60n\" }],\n [\"path\", { d: \"M13 17V5\", key: \"1frdt8\" }],\n [\"path\", { d: \"M8 17v-3\", key: \"17ska0\" }]\n];\nconst ChartColumn = createLucideIcon(\"chart-column\", __iconNode);\n\nexport { __iconNode, ChartColumn as default };\n//# sourceMappingURL=chart-column.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"m19 9-5 5-4-4-3 3\", key: \"2osh9i\" }]\n];\nconst ChartLine = createLucideIcon(\"chart-line\", __iconNode);\n\nexport { __iconNode, ChartLine as default };\n//# sourceMappingURL=chart-line.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z\",\n key: \"pzmjnu\"\n }\n ],\n [\"path\", { d: \"M21.21 15.89A10 10 0 1 1 8 2.83\", key: \"k2fpak\" }]\n];\nconst ChartPie = createLucideIcon(\"chart-pie\", __iconNode);\n\nexport { __iconNode, ChartPie as default };\n//# sourceMappingURL=chart-pie.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3\",\n key: \"19sr3x\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Donut = createLucideIcon(\"donut\", __iconNode);\n\nexport { __iconNode, Donut as default };\n//# sourceMappingURL=donut.mjs.map\n","import { useEffect } from 'react';\n\n// ApexCharts puts its plot, hover aids and its legend/toolbar buttons in one\n// container. Hide every layer but the controls from assistive technology, so\n// no button sits in a hidden subtree, and the host's data table speaks for the plot.\nconst CONTROL_LAYERS = '.apexcharts-legend, .apexcharts-toolbar';\n\nfunction setAttr(el: Element | null, name: string, value: string | null) {\n if (!el || el.getAttribute(name) === value) return;\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * `legendToggles`: whether a legend press hides its series. It does on axis\n * charts and radialBar; on pie and donut it selects the slice instead.\n */\nexport function useApexChartSemantics(\n root: HTMLElement | null,\n legendToggles: boolean,\n): void {\n useEffect(() => {\n if (!root) return undefined;\n\n // Re-run on every mutation: Apex rebuilds the legend on each toggle and\n // update. Only a real change writes, so the observer settles at once.\n const apply = () => {\n root\n .querySelectorAll<HTMLElement>('.apexcharts-canvas')\n .forEach((canvas) => {\n Array.from(canvas.children).forEach((layer) => {\n if (!layer.matches(CONTROL_LAYERS)) {\n setAttr(layer, 'aria-hidden', 'true');\n }\n });\n });\n // Apex hides the closed export menu with opacity only. `inert`, not\n // aria-hidden, so nothing rewrites its items' tabindex while it is shut.\n root\n .querySelectorAll<HTMLElement>('.apexcharts-toolbar')\n .forEach((toolbar) => {\n const open =\n toolbar\n .querySelector('.apexcharts-menu-icon')\n ?.getAttribute('aria-expanded') === 'true';\n setAttr(\n toolbar.querySelector('.apexcharts-menu'),\n 'inert',\n open ? null : '',\n );\n });\n root\n .querySelectorAll<HTMLElement>(\n '.apexcharts-legend-series[role=\"button\"]',\n )\n .forEach((item) => {\n // Apex's label is fixed English (\"X, visible. Press Enter…\"); without\n // it the visible series name is the name. `aria-pressed` then has to\n // mean \"shown\": Apex sets it for \"hidden\" and lets the label explain.\n setAttr(item, 'aria-label', null);\n const shown =\n item.getAttribute('data:collapsed') === 'true' ? 'false' : 'true';\n setAttr(item, 'aria-pressed', legendToggles ? shown : null);\n });\n };\n\n // A toggle rebuilds the legend. Apex refocuses the item after a key press\n // only, so do the same after a click (a screen reader's browse-mode press).\n let frame = 0;\n const onClick = (event: MouseEvent) => {\n const item =\n event.target instanceof Element\n ? event.target.closest('.apexcharts-legend-series')\n : null;\n const rel = item?.getAttribute('rel');\n if (!rel) return;\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n const active = document.activeElement;\n if (active && active !== document.body) return;\n root\n .querySelector<HTMLElement>(\n `.apexcharts-legend-series[rel=\"${CSS.escape(rel)}\"]`,\n )\n ?.focus();\n });\n };\n\n apply();\n const observer = new MutationObserver(apply);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\n 'aria-hidden',\n 'aria-label',\n 'aria-pressed',\n 'aria-expanded',\n ],\n });\n root.addEventListener('click', onClick);\n return () => {\n observer.disconnect();\n root.removeEventListener('click', onClick);\n cancelAnimationFrame(frame);\n };\n }, [root, legendToggles]);\n}\n","import { useEffect } from 'react';\n\nconst ITEM = '.apexcharts-legend-series[role=\"button\"]';\nconst TEXT = '.apexcharts-legend-text';\n/** Read by apexcharts-theme.css: every item's size while the row overflows. */\nconst ITEM_SIZE = '--chart-legend-item-size';\n/**\n * The longest a tap's click can trail its pointerup: the double-tap wait,\n * 300ms in Chromium and 350ms in WebKit. A mouse or pen sends its click in\n * the same task as the pointerup.\n */\nconst TAP_CLICK_MS = 350;\n\nfunction setFlag(el: HTMLElement, name: string, on: boolean) {\n if (on && el.getAttribute(name) !== 'true') el.setAttribute(name, 'true');\n else if (!on && el.hasAttribute(name)) el.removeAttribute(name);\n}\n\nconst px = (style: CSSStyleDeclaration, property: string) =>\n Number.parseFloat(style.getPropertyValue(property)) || 0;\n\n/**\n * For a legend kept to one row (apexcharts-theme.css): flags the edges that\n * hide items (`data-fade-start` / `-end`) for the TabBar-style fade; once the\n * row overflows, sizes the items so it ends halfway through one; names a cut\n * label in a `title` as the pointer reaches it; moves the row (never the\n * page) to bring a focused item fully into view, unless a pointer press\n * focused it; and keeps the row where it was through ApexCharts' rebuilds.\n * Off when not `enabled`.\n */\nexport function useApexLegendScroll(\n root: HTMLElement | null,\n enabled: boolean,\n): void {\n useEffect(() => {\n if (!root || !enabled) return undefined;\n let legend: HTMLElement | null = null;\n let frame = 0;\n // Where the row was last seen, so a rebuild or a press keeps it there.\n let fromStartSeen = 0;\n\n // |scrollLeft| is the distance from the start in LTR and in RTL alike.\n const measure = () => {\n if (!legend) return;\n const fromStart = Math.abs(legend.scrollLeft);\n const maxScroll = legend.scrollWidth - legend.clientWidth;\n fromStartSeen = fromStart;\n setFlag(legend, 'data-fade-start', fromStart > 1);\n setFlag(legend, 'data-fade-end', maxScroll - fromStart > 1);\n };\n\n const restore = () => {\n if (!legend) return;\n const sign = getComputedStyle(legend).direction === 'rtl' ? -1 : 1;\n if (Math.abs(Math.abs(legend.scrollLeft) - fromStartSeen) > 1) {\n legend.scrollLeft = sign * fromStartSeen;\n }\n };\n\n // A row that overflows even with every item at its floor could end in\n // the gap between two items, which looks complete where there is no fade.\n // Size every item so the row ends halfway through one instead. Everything\n // laid out is read first: after the size is cleared only styles are read,\n // so no in-between layout can pull the row's scroll back.\n const fit = () => {\n if (!legend) return;\n const view = legend.clientWidth;\n const items = Array.from(\n legend.querySelectorAll<HTMLElement>(`:scope > ${ITEM}`),\n ).filter((item) => item.getClientRects().length > 0);\n const box = getComputedStyle(legend);\n const start = px(box, 'padding-inline-start');\n const end = px(box, 'padding-inline-end');\n const before = legend.style.getPropertyValue(ITEM_SIZE);\n legend.style.removeProperty(ITEM_SIZE);\n if (items.length === 0) return;\n const item = getComputedStyle(items[0]);\n const floor = px(item, 'min-inline-size');\n const gap =\n px(item, 'margin-inline-start') + px(item, 'margin-inline-end');\n if (floor <= 0 || start + end + items.length * (floor + gap) <= view) {\n return;\n }\n // The most whole items before one that sits across the edge.\n const whole = Math.floor(\n (view - start - gap / 2 - floor / 2) / (floor + gap),\n );\n if (whole < 1) return;\n const size = (view - start - gap / 2 - whole * gap) / (whole + 0.5);\n legend.style.setProperty(\n ITEM_SIZE,\n before && Math.abs(Number.parseFloat(before) - size) < 0.5\n ? before\n : `${Math.floor(size * 100) / 100}px`,\n );\n };\n\n const sized = new ResizeObserver(() => {\n fit();\n measure();\n });\n\n // ApexCharts rebuilds the legend on every update, a series toggle too:\n // follow the current one, kept where the row was.\n const bind = () => {\n const current = root.querySelector<HTMLElement>('.apexcharts-legend');\n const rebuilt = current !== legend;\n if (rebuilt) {\n if (legend) {\n legend.removeEventListener('scroll', measure);\n sized.unobserve(legend);\n }\n legend = current;\n if (legend) {\n legend.addEventListener('scroll', measure, { passive: true });\n sized.observe(legend);\n }\n }\n fit();\n if (rebuilt) restore();\n measure();\n };\n\n // A pointer press on the row lasts through its click until a frame after\n // the kit refocuses the item it toggled, which it does one frame after\n // the click (use-apex-chart-semantics). A press that ends without a\n // click ends once one can no longer come: the next task for a mouse or\n // pen, TAP_CLICK_MS for a touch. One that ends off the row, a cancelled\n // one, a key press or the window losing focus ends it at once.\n let pressed = false;\n let pressFrame = 0;\n let pressTimer: ReturnType<typeof setTimeout> | undefined;\n const onRow = (event: Event) =>\n legend !== null &&\n event.target instanceof Node &&\n legend.contains(event.target);\n const unpress = () => {\n cancelAnimationFrame(pressFrame);\n clearTimeout(pressTimer);\n pressed = false;\n };\n const press = (event: PointerEvent) => {\n unpress();\n pressed = onRow(event);\n };\n const lift = (event: PointerEvent) => {\n if (!pressed) return;\n if (!onRow(event)) {\n unpress();\n return;\n }\n clearTimeout(pressTimer);\n pressTimer = setTimeout(\n unpress,\n event.pointerType === 'touch' ? TAP_CLICK_MS : 0,\n );\n };\n const clicked = () => {\n if (!pressed) return;\n clearTimeout(pressTimer);\n cancelAnimationFrame(pressFrame);\n pressFrame = requestAnimationFrame(() => {\n pressFrame = requestAnimationFrame(() => {\n pressed = false;\n });\n });\n };\n\n // Moves the row, never the page, until the item sits inside its scroll\n // padding: clear of the fade, ring included.\n const bringIn = (item: HTMLElement) => {\n if (!legend) return;\n const row = legend.getBoundingClientRect();\n const box = item.getBoundingClientRect();\n const style = getComputedStyle(legend);\n const left = row.left + px(style, 'scroll-padding-left');\n const right = row.right - px(style, 'scroll-padding-right');\n if (box.left < left || box.width > right - left) {\n legend.scrollLeft -= left - box.left;\n } else if (box.right > right) {\n legend.scrollLeft += box.right - right;\n }\n };\n\n // The browser's own focus scroll would leave a half-hidden item under the\n // fade, so focus brings the item fully into view. Focus from a press, or\n // the refocus after the toggle it made, leaves the row where it was: a\n // click lands where it began. A keyboard-focused item shows its whole\n // name, so the overflow may change.\n const reveal = (event: FocusEvent) => {\n const { target } = event;\n if (!legend || !(target instanceof HTMLElement)) return;\n if (!legend.contains(target)) return;\n if (pressed && !target.matches(':focus-visible')) restore();\n else bringIn(target);\n measure();\n };\n const settle = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(measure);\n };\n\n // A cut name is the label's `title`, so the pointer can read it whole.\n // The text, not the button: a title there would repeat the button's name.\n const name = (event: MouseEvent) => {\n const { target } = event;\n const text =\n target instanceof Element\n ? target.closest(ITEM)?.querySelector<HTMLElement>(TEXT)\n : null;\n if (!text || !legend?.contains(text)) return;\n if (text.scrollWidth > text.clientWidth) {\n const full = text.textContent ?? '';\n if (text.title !== full) text.title = full;\n } else if (text.hasAttribute('title')) {\n text.removeAttribute('title');\n }\n };\n\n // Only a legend rebuild re-binds, not ApexCharts' tooltip and plot redraws.\n const inLegend = (node: Node) =>\n node instanceof Element &&\n (node.closest('.apexcharts-legend') !== null ||\n node.querySelector('.apexcharts-legend') !== null);\n const rebuilds = new MutationObserver((records) => {\n const touched = records.some((record) =>\n [record.target, ...record.addedNodes, ...record.removedNodes].some(\n inLegend,\n ),\n );\n if (touched) bind();\n });\n\n // On the window: a press can end outside the chart.\n const view = root.ownerDocument.defaultView ?? window;\n\n bind();\n rebuilds.observe(root, { childList: true, subtree: true });\n view.addEventListener('pointerdown', press, true);\n view.addEventListener('pointerup', lift, true);\n view.addEventListener('pointercancel', unpress, true);\n view.addEventListener('click', clicked, true);\n view.addEventListener('blur', unpress);\n root.addEventListener('keydown', unpress);\n root.addEventListener('focusin', reveal);\n root.addEventListener('focusout', settle);\n root.addEventListener('mouseover', name);\n return () => {\n rebuilds.disconnect();\n sized.disconnect();\n cancelAnimationFrame(frame);\n unpress();\n view.removeEventListener('pointerdown', press, true);\n view.removeEventListener('pointerup', lift, true);\n view.removeEventListener('pointercancel', unpress, true);\n view.removeEventListener('click', clicked, true);\n view.removeEventListener('blur', unpress);\n root.removeEventListener('keydown', unpress);\n root.removeEventListener('focusin', reveal);\n root.removeEventListener('focusout', settle);\n root.removeEventListener('mouseover', name);\n root\n .querySelectorAll<HTMLElement>(`${TEXT}[title]`)\n .forEach((text) => text.removeAttribute('title'));\n if (!legend) return;\n legend.removeEventListener('scroll', measure);\n legend.style.removeProperty(ITEM_SIZE);\n setFlag(legend, 'data-fade-start', false);\n setFlag(legend, 'data-fade-end', false);\n };\n }, [root, enabled]);\n}\n","import { useEffect } from 'react';\n\nconst LABEL = '.apexcharts-xaxis-texts-g > text.apexcharts-xaxis-label';\n/** The least clear space between two shown x labels, in ems of their font. */\nconst GAP_EM = 0.5;\n\ntype Point = { x: number; y: number };\n\n/** A drawn label's corners in the chart's SVG space, turned or not. */\nfunction cornersOf(label: SVGTextElement): Point[] | null {\n const matrix = label.getCTM();\n if (!matrix) return null;\n const { x, y, width, height } = label.getBBox();\n if (width === 0 && height === 0) return null;\n return [\n [x, y],\n [x + width, y],\n [x + width, y + height],\n [x, y + height],\n ].map(([px, py]) => {\n const point = new DOMPoint(px, py).matrixTransform(matrix);\n return { x: point.x, y: point.y };\n });\n}\n\n/**\n * Whether two labels stand at least `gap` apart: some edge normal of either\n * separates them by that much (the separating axis test on two rectangles).\n */\nfunction apart(a: Point[], b: Point[], gap: number): boolean {\n return [a, b].some((shape) =>\n shape.some((corner, i) => {\n const next = shape[(i + 1) % shape.length];\n const nx = corner.y - next.y;\n const ny = next.x - corner.x;\n const length = Math.hypot(nx, ny);\n if (length === 0) return false;\n const project = (points: Point[]) =>\n points.map((p) => (p.x * nx + p.y * ny) / length);\n const pa = project(a);\n const pb = project(b);\n return (\n Math.min(...pb) - Math.max(...pa) >= gap ||\n Math.min(...pa) - Math.max(...pb) >= gap\n );\n }),\n );\n}\n\n/**\n * ApexCharts' own x-label thinning keeps a label once its centre is the\n * previous label's width away, whatever its own width, so two labels can touch\n * or overlap. Chart has ApexCharts draw every label, and this shows every k-th\n * one instead, for the smallest k at which no two shown labels come within\n * half an em of each other. It measures the drawn labels, turned or not, in\n * either direction, and runs on every redraw before the page paints, and\n * again once a web font has loaded.\n */\nexport function useApexXLabelSpacing(root: HTMLElement | null): void {\n useEffect(() => {\n if (!root) return undefined;\n\n const space = () => {\n const labels = Array.from(\n root.querySelectorAll<SVGTextElement>(LABEL),\n ).filter((label) => (label.textContent ?? '').trim() !== '');\n if (labels.length === 0 || typeof labels[0].getBBox !== 'function') {\n return;\n }\n const shapes = labels.map(cornersOf);\n const gap =\n GAP_EM * (Number.parseFloat(getComputedStyle(labels[0]).fontSize) || 0);\n const fits = (step: number) => {\n for (let i = step; i < labels.length; i += step) {\n const a = shapes[i - step];\n const b = shapes[i];\n if (a && b && !apart(a, b, gap)) return false;\n }\n return true;\n };\n let step = 1;\n while (step < labels.length && !fits(step)) step += 1;\n labels.forEach((label, i) => {\n const shown = i % step === 0;\n if (shown && label.hasAttribute('visibility')) {\n label.removeAttribute('visibility');\n } else if (!shown && label.getAttribute('visibility') !== 'hidden') {\n label.setAttribute('visibility', 'hidden');\n }\n });\n };\n\n // ApexCharts redraws its axes on every update and resize.\n const inXAxis = (node: Node) =>\n node instanceof Element &&\n (node.closest('.apexcharts-xaxis') !== null ||\n node.querySelector('.apexcharts-xaxis') !== null);\n const redraws = new MutationObserver((records) => {\n if (\n records.some((record) =>\n [record.target, ...record.addedNodes].some(inXAxis),\n )\n ) {\n space();\n }\n });\n\n // A web font that arrives after the draw widens the labels in place.\n const { fonts } = root.ownerDocument;\n\n space();\n redraws.observe(root, { childList: true, subtree: true });\n fonts?.addEventListener('loadingdone', space);\n return () => {\n redraws.disconnect();\n fonts?.removeEventListener('loadingdone', space);\n };\n }, [root]);\n}\n","import type { AgentAdapter } from '../../agent/types';\nimport type { ChartHandle } from './chart';\n\nexport const chartAgent: AgentAdapter<ChartHandle> = {\n id: 'chart',\n // view_change backs the opt-in type switcher (`switchableTypes` prop):\n // the same chart re-presented as line / bar / area / pie / donut.\n capabilities: ['view_change'],\n state: {\n declaredType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.declaredType',\n description:\n 'The consumer-declared chart type — the shape `update_series` expects.',\n read: (handle) => handle.getTypeState().declaredType,\n },\n effectiveType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.effectiveType',\n description:\n 'The type currently rendered — differs from declaredType after a type-switcher pick.',\n read: (handle) => handle.getTypeState().effectiveType,\n },\n availableTypes: {\n type: 'ChartType[]',\n descriptionKey: 'ui.agent.chart.state.availableTypes',\n description:\n 'Types the switcher offers. Empty when the chart has no type switcher.',\n read: (handle) => handle.getTypeState().availableTypes,\n },\n },\n actions: {\n change_view: {\n // Switching the presentation is a write (it changes what the user\n // sees) but is trivially reversible by switching back.\n safety: 'write',\n argsType: 'type',\n argsSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['line', 'bar', 'area', 'pie', 'donut'],\n description: 'The chart type to render.',\n },\n },\n required: ['type'],\n },\n returns: 'boolean (accepted)',\n returnsSchema: {\n type: 'boolean',\n description:\n 'True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first).',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.changeView',\n description:\n 'Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.',\n invoke: (handle, args: { type: string }) =>\n handle.setType(args.type as Parameters<ChartHandle['setType']>[0]),\n },\n update_series: {\n // Replacing the rendered series mutates what the chart displays — it\n // is a write, reversible by pushing the prior series back.\n safety: 'write',\n argsType: 'series',\n // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`\n // (pie/donut/radialBar). Both shapes are accepted; the handle routes\n // by chart type internally.\n argsSchema: {\n type: 'object',\n properties: {\n series: {\n oneOf: [\n {\n type: 'array',\n description: 'Categorical series for line / bar / area charts.',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n data: { type: 'array', items: { type: 'number' } },\n role: {\n type: 'string',\n enum: ['primary', 'compare'],\n description:\n \"Optional. 'compare' renders this series as a secondary, colour-blind-safe overlay (e.g. the previous period) — a dotted stroke in its paired primary's colour for line/area, a tinted bar with a dotted outline for bar. Omit for a normal primary series.\",\n },\n },\n required: ['name', 'data'],\n },\n },\n {\n type: 'array',\n description: 'Flat values for pie / donut / radialBar charts.',\n items: { type: 'number' },\n },\n ],\n },\n },\n required: ['series'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.updateSeries',\n description:\n 'Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state); when the user has switched the view cross-shape the values are converted to the rendered shape. The data and its summary table persist across type switches, resizes and theme changes until the host passes a new series prop.',\n invoke: (\n handle,\n args: { series: Parameters<ChartHandle['updateSeries']>[0] },\n ) => {\n handle.updateSeries(args.series);\n },\n },\n export_png: {\n safety: 'read',\n returns: 'string (PNG data URI)',\n returnsSchema: {\n type: 'string',\n description: 'A `data:image/png;base64,…` URI of the rendered chart.',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.exportPng',\n description:\n 'Return a PNG data URI of the chart for export or screenshotting. Waits until series pushed with update_series are drawn.',\n invoke: (handle) => handle.dataURI(),\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'chart' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Chart — thin, typed wrapper over ApexCharts (react-apexcharts). */\n/* */\n/* - All chrome, colours, and fonts flow from */\n/* `src/tokens/apexcharts-theme.ts` — never hex literals in user */\n/* code. A MutationObserver on `<html class>` re-reads the bridge so */\n/* theme changes repaint without remount. */\n/* - A ResizeObserver on the wrapper keeps the chart responsive */\n/* without listening on `window.resize`. */\n/* - Accessibility: the wrapper is a `role=\"figure\"` named by `title`, */\n/* described by a visually-hidden series × categories `<table>`; the */\n/* plot is hidden, the legend/toolbar buttons stay keyboard-operable. */\n/* - Colour-blind users: `patterns` prop flips `fill.type` to pattern */\n/* using ApexCharts' built-in pattern presets. */\n/* - Numbers format via `Intl.NumberFormat(locale)` — no hand-rolled */\n/* `toFixed()`. */\n/* ------------------------------------------------------------------ */\n\nimport {\n type CSSProperties,\n type RefObject,\n forwardRef,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport {\n ChartArea,\n ChartColumn,\n ChartLine,\n ChartPie,\n Donut,\n} from 'lucide-react';\nimport {\n getApexChartsTheme,\n getCompareFillOpacity,\n resolveCompareTint,\n type ApexChartsTheme,\n} from '../../tokens/apexcharts-theme';\nimport '../../tokens/apexcharts-theme.css';\nimport {\n useIsomorphicLayoutEffect,\n usePrefersReducedMotion,\n} from '../../hooks';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { useKeepApexTooltipInside } from '../_shared/use-keep-apex-tooltip-inside';\nimport { useApexChartSemantics } from '../_shared/use-apex-chart-semantics';\nimport { useApexLegendScroll } from '../_shared/use-apex-legend-scroll';\nimport { useApexXLabelSpacing } from '../_shared/use-apex-x-label-spacing';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { chartAgent } from './chart.agent';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\n// `apex-theme-alfadocs` scopes the token focus ring and target sizes in\n// apexcharts-theme.css.\nconst chartVariants = cva(\n 'ds:relative ds:block ds:w-full apex-theme-alfadocs',\n {\n variants: {\n density: {\n compact: 'ds:min-h-[var(--chart-min-height-compact)]',\n comfortable: 'ds:min-h-[var(--chart-min-height-comfortable)]',\n // Applied when an explicit `height` prop is given and no density was\n // requested: the wrapper must not exceed the caller's height (a 96px\n // KPI chart inside a card must not reserve 320px).\n none: '',\n },\n },\n defaultVariants: { density: 'comfortable' },\n },\n);\n\n// A `%` height: the Chart's root takes that share of its parent through\n// --chart-fill-size, and never less than --chart-min-height-fill, so what\n// ApexCharts draws always fits the root. Kept out of chartVariants, which\n// types public props.\nconst chartFillVariants = cva('', {\n variants: {\n fill: {\n none: '',\n // The figure is the root: it takes the share itself.\n root: 'ds:h-[var(--chart-fill-size)] ds:min-h-[var(--chart-min-height-fill)]',\n // Below the switcher row: the rest.\n rest: 'ds:min-h-[var(--chart-min-height-fill)] ds:flex-1',\n },\n },\n defaultVariants: { fill: 'none' },\n});\n\n// ApexCharts' box in a filled figure: out of flow, so what it last drew never\n// sizes the figure, and the root's floor is the switcher row plus the figure's.\nconst chartPlotVariants = cva('', {\n variants: {\n fill: { false: '', true: 'ds:absolute ds:inset-0' },\n },\n defaultVariants: { fill: false },\n});\n\n// The root that holds the switcher row above the figure.\nconst chartFrameVariants = cva('ds:w-full', {\n variants: {\n fill: {\n false: 'ds:block',\n true: 'ds:flex ds:flex-col ds:h-[var(--chart-fill-size)] ds:min-h-min',\n },\n },\n defaultVariants: { fill: false },\n});\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type ChartType = 'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar';\n\nexport interface ChartSeries {\n name: string;\n data: number[];\n /**\n * Marks this series as a secondary \"compare\" overlay — e.g. the previous\n * period in a current-vs-previous financial view. Rendered visually\n * subordinate and colour-blind-safe, distinguished from primary series by\n * BOTH a non-colour cue AND a lighter shade of the SAME hue (never colour\n * alone). The compare series inherits its PAIRED primary's colour (k-th\n * compare pairs with the k-th primary, by order), then:\n * - line / area: a round-DOTTED stroke in the paired-primary colour (the\n * dotted-vs-solid pattern is the non-colour cue); area also gets a tinted\n * fill at `--chart-compare-fill-opacity`.\n * - bar: a tinted fill (paired-primary hue at `--chart-compare-fill-opacity`)\n * under a full-strength DOTTED outline that is OPEN at the baseline — so a\n * compare bar reads as an outlined \"ghost\" of its solid primary.\n * The legend swatch shows the lighter tint (via `legend.markers.fillColors`),\n * and the series name (e.g. \"Revenue (previous period)\") remains the primary\n * signal in the legend and the screen-reader table.\n * Only meaningful on axis types (line / area / bar); it is structurally\n * impossible on pie / donut / radialBar (their `series` is `number[]`, which\n * cannot carry this field), so the axis-only invariant is enforced by the\n * type system with no runtime guard. On an axis→slice type switch the compare\n * series are dropped from the slice (a previous-period total is not a slice of\n * the current whole; DEV warn). Omit (or `'primary'`) to render normally — a\n * chart with NO compare series renders as before this field existed, and\n * removing or moving the role through `series` clears it from the old series.\n * @default 'primary'\n */\n role?: 'primary' | 'compare';\n}\n\n/** Bar orientation. `'horizontal'` renders a ranking sideways. Default `'vertical'`. */\nexport type ChartOrientation = 'vertical' | 'horizontal';\n\n/** Line / area stroke interpolation. Default `'smooth'`. */\nexport type ChartCurve = 'smooth' | 'straight' | 'stepline';\n\nexport interface ChartProps extends VariantProps<typeof chartVariants> {\n /** Required — drives aria-label and sr-only table caption. */\n title: string;\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Chart visual type. */\n type: ChartType;\n /**\n * For `line` / `bar` / `area`: an array of `ChartSeries`.\n * For `pie` / `donut` / `radialBar`: an array of numbers matched to `labels`.\n */\n series: ChartSeries[] | number[];\n /** Category axis labels (line / bar / area). */\n categories?: string[];\n /** Slice labels (pie / donut / radialBar). */\n labels?: string[];\n /** Defaults to 320px. A number or `px` is the plot area's ApexCharts height; a\n * `%` sizes the whole Chart (switcher row, legend, plot) to that share of its\n * parent's height, at least 160px: `\"100%\"` fills a definite-height parent. */\n height?: number | string;\n /** Width override. Defaults to 100% of container. */\n width?: number | string;\n /** Opt-in pattern fills for colour-blind users. */\n patterns?: boolean;\n /**\n * Stack multiple `bar` / `area` series into a composition-over-time view.\n * Maps to ApexCharts `chart.stacked`. Only applies to the axis types\n * (`line` / `bar` / `area`); slice types (`pie` / `donut` / `radialBar`)\n * have no axis to stack against and ignore it. Default `false`: an\n * unstacked chart renders as before this prop existed, and turning it off\n * after the first render unstacks the bars in place.\n */\n stacked?: boolean;\n /**\n * Orientation for the `bar` type. `'horizontal'` renders the bars sideways\n * (ApexCharts `plotOptions.bar.horizontal`) for ranking-style charts where\n * the category is a name and the value runs across the horizontal axis.\n * Still an axis chart — pass `series` as `ChartSeries[]` with `categories`.\n * Ignored for every non-`bar` type. Default `'vertical'`.\n */\n orientation?: ChartOrientation;\n /**\n * Stroke interpolation for `line` / `area` charts (ApexCharts\n * `stroke.curve`). `'straight'` avoids the overshoot a smoothed spline\n * introduces on spiky monthly financials — where a `'smooth'` curve can dip\n * visually below zero between two positive points. Inert on `bar` (stroke\n * width is 0) and ignored on slice types. Default `'smooth'` — existing\n * charts are unaffected.\n */\n curve?: ChartCurve;\n /**\n * Override the series colour ramp. Pass **already-resolved** colour strings\n * (e.g. the live value of `var(--success)` sampled by the consumer) — these\n * are handed straight to ApexCharts, which can't read CSS custom properties.\n * When omitted, the theme bridge's `colors` ramp from `apexcharts-theme.ts`\n * is used, so existing consumers are unaffected. Typical use: a single-arc\n * `radialBar` gauge (e.g. BMI) that must change hue with the value —\n * green in the healthy band, amber/red outside it.\n */\n colors?: string[];\n /**\n * Show the ApexCharts toolbar. Its buttons are --min-target-size boxes in a\n * band reserved above the plot; zoomable types need about 300px of width.\n * Defaults to false.\n */\n toolbar?: boolean;\n /** Locale override — defaults to the active i18next language. */\n locale?: string;\n /**\n * radialBar only. Formats the value printed in the ring centre. Use when the\n * gauge represents a non-percentage figure: pass the arc fill (0–100) as the\n * single `series` value and return the real figure here (e.g. `(_, ) => '22.4'`).\n * Ignored for every other chart type. Defaults to ApexCharts' `${value}%`.\n */\n radialValueFormatter?: (value: number) => string;\n /**\n * Formats the numeric value of each data point wherever it is surfaced as\n * text — the tooltip, the value (y) axis on categorical charts, and the\n * screen-reader summary table. Use it to append a unit or currency symbol,\n * e.g. `(v) => new Intl.NumberFormat(locale, { style: 'currency', currency:\n * 'EUR' }).format(v)`. Defaults to `Intl.NumberFormat(locale)` (grouped\n * number, no unit). Does not apply to a `radialBar` ring centre — use\n * `radialValueFormatter` for that.\n */\n valueFormatter?: (value: number) => string;\n /**\n * Opt-in type switcher. Pass two or more of `'line' | 'bar' | 'area' |\n * 'pie' | 'donut'` to render an icon radiogroup (an `IconButtonGroup`)\n * above the plot that lets the user flip the chart between those types.\n * `type` is the initial selection and is always offered; the user's pick\n * then sticks across re-renders (remount with a new `key` to reset it).\n * When the picked type reads the other data shape, the data adapts: axis\n * series collapse to one slice per series (that series' total) for `pie` /\n * `donut`, and slice values become a single-series axis chart with\n * `labels` as the categories. `radialBar` cannot participate — such\n * entries are ignored (DEV warning) and a `radialBar` chart never shows\n * the switcher.\n */\n switchableTypes?: ChartType[];\n /** Called when the user picks a different type via the switcher. */\n onTypeChange?: (type: ChartType) => void;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport interface ChartHandle {\n /** Returns a PNG data URI for the chart, after any pushed series is drawn. */\n dataURI: () => Promise<string>;\n /**\n * Updates series without remounting. Always pass the DECLARED `type`'s\n * shape — while the user has switched the view across the axis/slice\n * boundary the values (and, for axis→slice, the slice labels) are\n * converted to the rendered shape; for slice→axis the categories stay\n * the `labels` prop, so keep the value count stable. The update also\n * reaches the summary table, and holds until the `series` prop changes;\n * `dataURI` waits for it to be drawn.\n */\n updateSeries: (next: ChartProps['series']) => void;\n /**\n * Switches the rendered type via the type switcher. Returns `false`\n * (no-op) when the switcher is not enabled or the type is not offered.\n */\n setType: (next: ChartType) => boolean;\n /** Declared vs rendered type plus the types the switcher offers ([] when disabled). */\n getTypeState: () => {\n declaredType: ChartType;\n effectiveType: ChartType;\n availableTypes: ChartType[];\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst PATTERN_STYLES = [\n 'verticalLines',\n 'horizontalLines',\n 'slantedLines',\n 'squares',\n 'circles',\n] as const;\n\n/** Types where `categories` belong on an x-axis. */\nconst CATEGORICAL_TYPES: ReadonlyArray<ChartType> = ['line', 'bar', 'area'];\n\n/** Types where `series` is a flat `number[]` paired with `labels`. */\nconst SLICE_TYPES: ReadonlyArray<ChartType> = ['pie', 'donut', 'radialBar'];\n\n/** Types the switcher may offer. `radialBar` is excluded — its series are\n * synthetic arc percents that cannot be re-plotted on an axis or as slices. */\nconst SWITCHABLE_TYPES: ReadonlyArray<ChartType> = [\n 'line',\n 'bar',\n 'area',\n 'pie',\n 'donut',\n];\n\ntype SwitchableType = Exclude<ChartType, 'radialBar'>;\n\n/* Static key map (not template-built) so the i18n coverage tooling can see\n every key literally. */\nconst TYPE_SWITCHER_LABEL_KEYS: Record<SwitchableType, string> = {\n line: 'chart.typeSwitcher.line',\n bar: 'chart.typeSwitcher.bar',\n area: 'chart.typeSwitcher.area',\n pie: 'chart.typeSwitcher.pie',\n donut: 'chart.typeSwitcher.donut',\n};\n\nconst TYPE_SWITCHER_ICONS: Record<SwitchableType, React.ReactNode> = {\n line: <ChartLine />,\n bar: <ChartColumn />,\n area: <ChartArea />,\n pie: <ChartPie />,\n donut: <Donut />,\n};\n\n/* Compare-overlay geometry. Colours come only from tokens (via the bridge);\n these are pure numeric/dash literals, consistent with the pre-existing\n stroke width:2 / dashArray literals the component already used. */\nconst COMPARE_OUTLINE_WIDTH = 2; // dotted outline / stroke width (~1.5–2px)\nconst COMPARE_DOT_DASH = '0 6'; // 0-length dash + round cap ⇒ round dots, 6px pitch\n\n/** ApexCharts' default `title.margin`, sent when the toolbar is off. */\nconst APEX_TITLE_MARGIN = 5;\n\n/**\n * Px ApexCharts keeps above an axis chart's plot for a title and subtitle\n * (10, then 5 for each), which Chart never draws. A short chart takes it back.\n */\nconst APEX_TITLE_ALLOWANCE = 20;\n\n/** ApexCharts' default `xaxis.labels.rotate`, for crowded labels on a wide chart. */\nconst APEX_LABEL_ROTATE = -45;\n\n/** Below `--breakpoint-sm` (640px) a chart is narrow: crowded labels thin out. */\nconst NARROW_CHART_WIDTH = 640;\n\n/**\n * Below this a two-row legend is as tall as the plot or taller (measured: from\n * 280px, about 304px accessible), so it keeps to one row that scrolls sideways.\n */\nconst SHORT_CHART_HEIGHT = 300;\n\n/**\n * What a `%` height draws at before its first measure: the figure's own CSS\n * floor, --chart-min-height-fill. A one-row legend (52px) and the axes (about\n * 52px) still leave a 56px plot, 48px accessible. A shorter parent sees the\n * root overflow it.\n */\nconst MIN_FILL_HEIGHT = 160;\n\n/**\n * Rewrite each COMPARE bar into a 3-sided OPEN path (drop the baseline edge and\n * the implicit close) and round-dot its outline. A bar is natively one closed\n * path, so \"open at the bottom\" is impossible via config — this post-render DOM\n * patch is the only way. Verified safe against ApexCharts 5.10.6: animation\n * continuity is read from a separate `pathTo`/`pathFrom` attribute, never the\n * live `d`, so overwriting `d` never corrupts entrance/update animation or\n * `previousPaths`; the same element is kept so tooltips/crosshair still bind.\n * Idempotent (re-running writes the same `d`).\n *\n * Only applied to VERTICAL, positive-valued bars: the open edge is assumed to be\n * the bbox bottom. A horizontal or negative compare bar keeps the native\n * 4-sided dotted outline (still a valid non-colour cue) — see the guard in the\n * component. jsdom lacks `getBBox`, so the per-path guard makes this a no-op in\n * unit tests (exercised in the real-browser story run instead).\n */\nfunction patchCompareBars(\n root: HTMLElement | null,\n compareRealIndexes: number[],\n): void {\n if (!root || compareRealIndexes.length === 0) return;\n root\n .querySelectorAll<SVGGElement>(\n '.apexcharts-bar-series > .apexcharts-series',\n )\n .forEach((g) => {\n const ri = Number(g.getAttribute('data:realIndex'));\n if (!compareRealIndexes.includes(ri)) return;\n g.querySelectorAll<SVGPathElement>('path.apexcharts-bar-area').forEach(\n (p) => {\n if (typeof p.getBBox !== 'function') return; // jsdom guard\n const b = p.getBBox(); // final rendered box, stroke-excluded\n // 3-sided OPEN path: bottom-left → up left → across top → down right.\n // SVG fills the implicit close (bottom-right → bottom-left), so the\n // tint fill stays full-height; the stroke omits the baseline edge.\n p.setAttribute(\n 'd',\n `M ${b.x} ${b.y + b.height} L ${b.x} ${b.y} ` +\n `L ${b.x + b.width} ${b.y} L ${b.x + b.width} ${b.y + b.height}`,\n );\n p.setAttribute('stroke-dasharray', COMPARE_DOT_DASH); // round-dot rhythm\n p.setAttribute('stroke-linecap', 'round');\n },\n );\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\n/** Px kept clear above the plot for the toolbar, from the tokens at `el`. */\nfunction toolbarBandOf(el: Element): number {\n const styles = getComputedStyle(el);\n const px = (token: string) =>\n Number.parseFloat(styles.getPropertyValue(token)) || 0;\n return (\n px('--min-target-size') +\n px('--focus-ring-offset') +\n px('--focus-ring-width')\n );\n}\n\n/**\n * The px width ApexCharts draws at, by its own rule: a number or `px` as is,\n * a `%` of the element it draws into. Any other unit gives NaN, as it does there.\n */\nfunction drawnWidth(width: number | string | undefined, into: number): number {\n if (width === undefined) return into;\n if (typeof width === 'number') return width;\n // parseInt, not parseFloat: ApexCharts drops the fraction too, so this\n // matches the width it actually draws.\n const value = Number.parseInt(width, 10);\n return width.trim().endsWith('%') ? (into * value) / 100 : value;\n}\n\n/** The px height ApexCharts draws at for a number or `px`; NaN for a `%`. */\nfunction drawnHeight(height: number | string): number {\n if (typeof height === 'number') return height;\n return height.trim().endsWith('%') ? Number.NaN : Number.parseInt(height, 10);\n}\n\n/**\n * The series, categories and labels the rendered type reads. Axis series\n * collapse to one slice per series (its total) on a slice view; slice\n * values become one axis series with `labels` as the categories.\n */\nfunction adaptSeries(\n series: ChartSeries[] | number[],\n categories: string[] | undefined,\n labels: string[] | undefined,\n declaredIsSlice: boolean,\n effectiveIsSlice: boolean,\n valueName: string,\n): {\n effectiveSeries: ChartSeries[] | number[];\n effectiveCategories: string[] | undefined;\n effectiveLabels: string[] | undefined;\n} {\n if (declaredIsSlice === effectiveIsSlice) {\n return {\n effectiveSeries: series,\n effectiveCategories: categories,\n effectiveLabels: labels,\n };\n }\n if (!declaredIsSlice) {\n const allRows = series as ChartSeries[];\n // A previous-period total is not a slice of the current whole, so\n // compare overlays are dropped from the axis→slice collapse (their\n // grey \"prev\" slice would misread as part of the current mix). This\n // also makes compareFlags naturally [] on the slice side.\n const rows = allRows.filter((row) => row.role !== 'compare');\n if (import.meta.env.DEV && rows.length !== allRows.length) {\n console.warn(\n 'Chart: compare series are dropped on an axis→slice switch — a previous-period total is not a slice of the current whole.',\n );\n }\n const totals = rows.map((row) => row.data.reduce((sum, v) => sum + v, 0));\n if (import.meta.env.DEV && totals.some((v) => v < 0)) {\n console.warn(\n 'Chart: the axis→slice adaptation produced a negative series total — pie/donut cannot represent negative values. Offer only axis types in `switchableTypes` for delta-style data.',\n );\n }\n return {\n effectiveSeries: totals,\n effectiveCategories: undefined,\n effectiveLabels: rows.map((row) => row.name),\n };\n }\n const values = series as number[];\n return {\n effectiveSeries: [{ name: valueName, data: values }] as ChartSeries[],\n effectiveCategories: labels ?? [],\n effectiveLabels: undefined,\n };\n}\n\ntype ApexLocaleOption = NonNullable<\n NonNullable<ApexCharts.ApexOptions['chart']>['locales']\n>[number];\n\n/** Everything the ApexCharts options are built from, for one rendered view. */\ninterface ChartOptionInputs {\n themeOptions: ApexChartsTheme;\n toolbarBand: number;\n chartId: string;\n toolbar: boolean;\n reducedMotion: boolean;\n toolbarLocale: ApexLocaleOption;\n locale: string;\n effectiveLabels: string[] | undefined;\n formatValue: (value: number) => string;\n noDataText: string;\n effectiveType: ChartType;\n effectiveSeries: ChartSeries[] | number[];\n effectiveCategories: string[] | undefined;\n isRtl: boolean;\n patterns: boolean;\n stacked: boolean;\n orientation: ChartOrientation;\n curve: ChartCurve;\n colors: string[] | undefined;\n radialValueFormatter: ((value: number) => string) | undefined;\n /** Narrower than NARROW_CHART_WIDTH. */\n narrow: boolean;\n /** Shorter than SHORT_CHART_HEIGHT. */\n short: boolean;\n wrapperRef: RefObject<HTMLDivElement | null>;\n}\n\n/** The ApexCharts options for one view: used by render and by the handle. */\nfunction buildChartOptions({\n themeOptions,\n toolbarBand,\n chartId,\n toolbar,\n reducedMotion,\n toolbarLocale,\n locale,\n effectiveLabels,\n formatValue,\n noDataText,\n effectiveType,\n effectiveSeries,\n effectiveCategories,\n isRtl,\n patterns,\n stacked,\n orientation,\n curve,\n colors,\n radialValueFormatter,\n narrow,\n short,\n wrapperRef,\n}: ChartOptionInputs): ApexCharts.ApexOptions {\n // Split the resolved compare colours off the theme object BEFORE spread:\n // `base` is exactly today's theme shape (colours / chart / grid), so\n // `...base` emits the same keys as before. The theme no longer carries a\n // `compare` object — the redesign never uses grey; the compare fill is a\n // tint of the paired-primary hue, resolved below from a token.\n const base = themeOptions;\n\n // Per-series compare flags, derived at build time from the EFFECTIVE\n // series/type so the type switcher composes: only axis types carry the\n // `role` field (slice `series` is `number[]`), so a slice view yields [].\n const compareFlags =\n isCategoricalType(effectiveType) && Array.isArray(effectiveSeries)\n ? (effectiveSeries as ChartSeries[]).map((s) => s.role === 'compare')\n : [];\n const hasCompare = compareFlags.some(Boolean);\n const barCompare = hasCompare && effectiveType === 'bar';\n // The open-at-the-baseline bar rewrite (patchCompareBars) assumes the\n // baseline is the bbox BOTTOM — true only for vertical, non-negative bars.\n // A horizontal or negative compare bar keeps the native 4-sided dotted\n // outline (still a valid non-colour cue), so the hook is gated off for it.\n const compareHasNegative =\n barCompare &&\n (effectiveSeries as ChartSeries[]).some(\n (s) => s.role === 'compare' && s.data.some((v) => v < 0),\n );\n const openBottomBars =\n barCompare && orientation === 'vertical' && !compareHasNegative;\n // Compare fill opacity + per-series tints (legend swatch), resolved from\n // the token via the bridge so no hex literal lives in component code.\n const compareFillOpacity = hasCompare ? getCompareFillOpacity() : 0.3;\n\n if (\n import.meta.env.DEV &&\n hasCompare &&\n stacked &&\n isCategoricalType(effectiveType)\n ) {\n console.warn(\n 'Chart: `stacked` with a compare series — a compare overlay is normally a grouped, not stacked, series. It will be stacked with the primaries.',\n );\n }\n\n const options: ApexCharts.ApexOptions = {\n ...base,\n chart: {\n ...base.chart,\n id: chartId,\n toolbar: { show: toolbar },\n zoom: { enabled: toolbar },\n animations: {\n enabled: !reducedMotion,\n dynamicAnimation: { enabled: !reducedMotion },\n },\n locales: [toolbarLocale],\n defaultLocale: locale,\n parentHeightOffset: 0,\n // Keep the keyboard-operable legend; drop Apex's data-point navigation\n // and live announcements (English-only, and the summary table covers them).\n accessibility: {\n enabled: true,\n announcements: { enabled: false },\n keyboard: { enabled: true, navigation: { enabled: false } },\n },\n // Stacking is axis-only, so a slice or radial chart never receives it.\n // Sent as false too: ApexCharts merges an update into its config, so\n // leaving it out would keep an earlier `true`.\n ...(isCategoricalType(effectiveType) ? { stacked } : {}),\n },\n // Only set `labels` when the effective type actually has them (slice\n // charts). Emitting `labels: undefined` crashes ApexCharts' bar\n // renderer — `parseDataAxisCharts` reads `labels.length` and throws\n // \"Cannot read properties of undefined (reading 'length')\", which\n // aborts the render and leaves a blank chart. Absent is safe; area /\n // line tolerate the undefined but bar does not, so never pass it.\n ...(effectiveLabels ? { labels: effectiveLabels } : {}),\n legend: {\n ...base.legend,\n position: 'bottom',\n // ApexCharts legend.horizontalAlign is a physical prop mapped internally\n // to the chart's own text flow. For RTL we flip via `yaxis.opposite`\n // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored\n // to the inline-start by asking for 'left' on LTR and 'right' on RTL.\n horizontalAlign: isRtl ? 'right' : 'left',\n fontFamily: 'inherit',\n // apexcharts-theme.css sizes the legend hit areas and ring room from\n // this 4px; pinned so an ApexCharts default change cannot break them.\n itemMargin: { horizontal: 5, vertical: 4 },\n },\n tooltip: {\n ...base.tooltip,\n y: {\n formatter: (value: number) => formatValue(value),\n },\n },\n noData: {\n text: noDataText,\n },\n };\n\n // Room above the plot. ApexCharts reads grid.padding only on creation but a\n // title's margin on every update, so no remount. An empty title's margin\n // keeps the toolbar band clear and, on a short axis chart, takes back the\n // title allowance. Otherwise the title's defaults are sent, or an update\n // would keep the band.\n const band = toolbar && toolbarBand ? toolbarBand : 0;\n const reclaim =\n short && isCategoricalType(effectiveType) ? APEX_TITLE_ALLOWANCE : 0;\n options.title =\n band || reclaim\n ? { ...options.title, text: '', margin: band - reclaim }\n : { ...options.title, text: undefined, margin: APEX_TITLE_MARGIN };\n\n // Consumer-supplied, already-resolved colour ramp wins over the theme\n // bridge's `colors`. Ignored when absent so existing charts keep the\n // tokenised ramp. ApexCharts can't read `var(--…)`, so the consumer is\n // responsible for sampling the live token value before passing it in.\n if (colors && colors.length > 0) {\n options.colors = colors;\n }\n\n // Step 1 (compare) — pair each compare series with a primary and inherit\n // its colour. The k-th `role:'compare'` pairs with the k-th `role:'primary'`\n // by order (clamped to the last primary; falls back to its own index when\n // there are zero primaries). Primaries keep ApexCharts' own %-cycled ramp\n // colour, so after this `options.colors[i]` is the full paired-primary\n // colour for EVERY series — used directly by the bar fill/outline and the\n // line stroke. The compare fill is tinted separately (fill.opacity); only\n // the LEGEND swatch shows the lighter tint (legend.markers.fillColors).\n if (hasCompare) {\n const ramp = (options.colors ?? base.colors ?? []) as string[];\n const rampAt = (i: number) => ramp[i % Math.max(ramp.length, 1)];\n const primaryIdx = (effectiveSeries as ChartSeries[])\n .map((s, i) => (s.role === 'compare' ? -1 : i))\n .filter((i) => i >= 0);\n let seen = 0;\n options.colors = (effectiveSeries as ChartSeries[]).map((s, i) => {\n if (s.role !== 'compare') return rampAt(i);\n const pair = primaryIdx.length\n ? primaryIdx[Math.min(seen++, primaryIdx.length - 1)]\n : i;\n return rampAt(pair); // inherit the paired primary's colour\n });\n // Legend swatch: compare shows the lighter tint (a shade of its paired\n // primary), primaries show their own colour. Decoupled from the mark\n // colour so the swatch reads as \"lighter = compare\".\n const compareTints = (options.colors as string[]).map((c, i) =>\n compareFlags[i] ? resolveCompareTint(c) : c,\n );\n options.legend = {\n ...options.legend,\n markers: {\n ...(options.legend?.markers ?? {}),\n fillColors: compareTints,\n },\n };\n }\n\n if (isCategoricalType(effectiveType)) {\n // A horizontal bar makes ApexCharts swap axes: the numeric axis\n // becomes the x-axis and the categories move to the y-axis. The value\n // formatter must follow the numbers, so on a horizontal bar it lives\n // on `xaxis.labels` and the category y-axis keeps its default (string)\n // labels; every other categorical chart keeps the formatter on `yaxis`.\n const horizontalBar =\n effectiveType === 'bar' && orientation === 'horizontal';\n // The x formatter is sent as undefined too, or an update turning a bar\n // vertical would keep the number formatter on its categories.\n options.xaxis = {\n ...base.xaxis,\n categories: effectiveCategories ?? [],\n labels: {\n ...base.xaxis?.labels,\n formatter: horizontalBar\n ? (value: string | number) => formatValue(Number(value))\n : undefined,\n // A narrow chart thins crowded labels rather than turning them sideways.\n // Sent both ways, so a widened chart rotates. ApexCharts draws every\n // label and useApexXLabelSpacing thins them: its own test keeps two\n // labels that touch, or overlap when the second is wider.\n rotate: narrow ? 0 : APEX_LABEL_ROTATE,\n hideOverlappingLabels: false,\n },\n };\n options.yaxis = {\n ...base.yaxis,\n opposite: isRtl,\n ...(horizontalBar\n ? {}\n : { labels: { formatter: (value: number) => formatValue(value) } }),\n };\n // Step 2 (compare) — the non-colour cue is a round-DOTTED stroke on the\n // compare indices (dotted-vs-solid, greyscale/print-safe). It works on\n // bars too: unlike a fill hatch, a per-series bar stroke width + dash\n // renders a dotted OUTLINE in the paired-primary colour. Line/area keep\n // width 2; a bar's outline width is COMPARE_OUTLINE_WIDTH on compare\n // indices and 0 on primaries (solid, fill-only). `lineCap:'round'` turns\n // the 0-length dash into round dots. With no compare series,\n // withCompareKeys sends ApexCharts' default lineCap and dashArray.\n options.stroke = {\n curve,\n width:\n effectiveType === 'bar'\n ? hasCompare\n ? compareFlags.map((c) => (c ? COMPARE_OUTLINE_WIDTH : 0))\n : 0\n : 2,\n ...(hasCompare\n ? {\n lineCap: 'round' as const,\n // Runtime accepts a string dash; the published types say\n // `number` → one documented cast. `'0 6'` + round cap ⇒ dots.\n dashArray: compareFlags.map((c) =>\n c ? COMPARE_DOT_DASH : 0,\n ) as unknown as number[],\n }\n : {}),\n };\n options.dataLabels = { enabled: false };\n }\n\n if (effectiveType === 'radialBar' && radialValueFormatter) {\n // ApexCharts treats a radialBar series value as a 0–100 percent and\n // renders it verbatim in the ring centre. When the displayed value is\n // NOT a percentage (e.g. a BMI), the consumer scales the series to a\n // percent for the arc and supplies `radialValueFormatter` to print the\n // real value in the centre. Without this, the gauge would read \"56%\"\n // for a BMI of 22.4 — misleading. Default behaviour is untouched.\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n radialBar: {\n ...(basePlot.radialBar ?? {}),\n dataLabels: {\n ...(basePlot.radialBar?.dataLabels ?? {}),\n value: {\n ...(basePlot.radialBar?.dataLabels?.value ?? {}),\n formatter: (val: number) => radialValueFormatter(Number(val)),\n },\n },\n },\n };\n }\n\n // Horizontal bars for rankings; `bar` and `radialBar` never share a chart.\n // Sent as false too, or an update turning a bar vertical would keep an\n // earlier `true`.\n if (effectiveType === 'bar') {\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n bar: {\n ...(basePlot.bar ?? {}),\n horizontal: orientation === 'horizontal',\n },\n };\n }\n\n // Step 3 (fill) — the compare branches sit between the global `patterns`\n // branch and the area-gradient branch. Each is gated on hasCompare /\n // barCompare; a fill left unset here gets ApexCharts' default from\n // withCompareKeys.\n if (patterns) {\n // Colour-blind pattern mode. With a compare overlay the compare indices\n // drop the hatch and use a plain tinted solid fill (their dotted outline\n // / stroke from Step 2 is already the non-colour cue), so they read as a\n // lighter ghost of the primary; the primaries keep the cycled hatch.\n options.fill = {\n type: hasCompare\n ? compareFlags.map((c) => (c ? 'solid' : 'pattern'))\n : 'pattern',\n opacity: hasCompare\n ? compareFlags.map((c) =>\n c ? compareFillOpacity : effectiveType === 'area' ? 0.3 : 1,\n )\n : effectiveType === 'area'\n ? 0.3\n : 1,\n pattern: {\n style: [...PATTERN_STYLES],\n strokeWidth: 2,\n },\n };\n } else if (barCompare) {\n // Tinted solid fill: compare bars are their paired-primary hue at\n // `--chart-compare-fill-opacity`; primaries stay solid at full opacity.\n // The dotted outline (Step 2 stroke width) + open-bottom rewrite\n // (patchCompareBars, wired via chart.events below) supply the shape.\n options.fill = {\n type: 'solid',\n opacity: compareFlags.map((c) => (c ? compareFillOpacity : 1)),\n };\n } else if (effectiveType === 'area') {\n // Area gradient. With a compare overlay the compare fill drops to the\n // tint opacity so it sits under the dotted paired-primary stroke without\n // fighting the primary; primaries keep the default gradient. No grey —\n // the tint is a shade of the same (paired-primary) hue from Step 1.\n options.fill = hasCompare\n ? {\n type: 'gradient',\n opacity: compareFlags.map((c) => (c ? compareFillOpacity : 0.3)),\n }\n : {\n type: 'gradient',\n opacity: 0.3,\n };\n }\n\n // Open-at-the-baseline bar outline (progressive enhancement over the\n // native dotted 4-sided border). Attached ONLY for vertical, non-negative\n // compare bars; horizontal / negative bars keep the closed dotted outline.\n // Added inside this branch, and cleared by withCompareKeys, so a chart\n // without open-bottom bars never runs it. Re-fires on mount, update and\n // animation end: together they cover resize, theme and series changes.\n if (openBottomBars) {\n const compareRealIndexes = compareFlags\n .map((c, i) => (c ? i : -1))\n .filter((i) => i >= 0);\n const run = () => patchCompareBars(wrapperRef.current, compareRealIndexes);\n const raf = () =>\n typeof requestAnimationFrame === 'function'\n ? requestAnimationFrame(run)\n : run();\n options.chart = {\n ...options.chart,\n events: {\n ...(options.chart?.events ?? {}),\n mounted: () => raf(),\n updated: () => raf(),\n animationEnd: () => run(),\n },\n };\n }\n\n return withCompareKeys(options, effectiveType);\n}\n\n/**\n * ApexCharts merges an update into its config, so a key left out keeps its old\n * value. Every key a compare series sets is sent on every build: the builder's\n * per-series arrays, else ApexCharts' own defaults. Only axis types take one.\n */\nfunction withCompareKeys(\n options: ApexCharts.ApexOptions,\n type: ChartType,\n): ApexCharts.ApexOptions {\n if (!isCategoricalType(type)) return options;\n const events = options.chart?.events;\n return {\n ...options,\n colors: options.colors,\n chart: {\n ...options.chart,\n events: {\n ...events,\n mounted: events?.mounted,\n updated: events?.updated,\n animationEnd: events?.animationEnd,\n },\n },\n stroke: {\n ...options.stroke,\n lineCap: options.stroke?.lineCap ?? (type === 'bar' ? 'square' : 'butt'),\n dashArray: options.stroke?.dashArray ?? 0,\n },\n legend: {\n ...options.legend,\n markers: {\n ...options.legend?.markers,\n fillColors: options.legend?.markers?.fillColors,\n },\n },\n fill: options.fill ?? { type: 'solid', opacity: 0.85 },\n };\n}\n\nfunction isSliceType(type: ChartType): boolean {\n return SLICE_TYPES.includes(type);\n}\n\nfunction isCategoricalType(type: ChartType): boolean {\n return CATEGORICAL_TYPES.includes(type);\n}\n\n/** Coerce `series` into `ChartSeries[]` for shared logic (table, aria). */\nfunction normaliseSeries(\n series: ChartSeries[] | number[],\n type: ChartType,\n): ChartSeries[] {\n if (isSliceType(type)) {\n const nums = series as number[];\n return [\n {\n name: '',\n data: nums,\n },\n ];\n }\n return series as ChartSeries[];\n}\n\n/* ------------------------------------------------------------------ */\n/* Chart component */\n/* ------------------------------------------------------------------ */\n\nexport const Chart = forwardRef<ChartHandle, ChartProps>(\n (\n {\n title,\n id,\n type,\n series,\n categories,\n labels,\n height,\n width,\n patterns = false,\n stacked = false,\n orientation = 'vertical',\n curve = 'smooth',\n colors,\n toolbar = false,\n locale: localeProp,\n radialValueFormatter,\n valueFormatter,\n switchableTypes,\n onTypeChange,\n density,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const rawId = useId();\n const chartId = useMemo(\n () => `chart-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const summaryId = `${chartId}-summary`;\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n // Also held as state: the wrapper remounts when the switcher turns on or\n // off, and the observers below must follow it to the new element.\n const [wrapperEl, setWrapperEl] = useState<HTMLDivElement | null>(null);\n const wrapperCallbackRef = useMemo(\n () => composeRefs(wrapperRef, setWrapperEl),\n [],\n );\n const liveWrapperRef = useMemo(() => ({ current: wrapperEl }), [wrapperEl]);\n const [containerWidth, setContainerWidth] = useState(0);\n // A `%` height sizes the whole Chart against its parent (see `height`);\n // the figure's measured height is then what ApexCharts may draw.\n const fillShare =\n typeof height === 'string' && height.trim().endsWith('%')\n ? height.trim()\n : undefined;\n const [fillHeight, setFillHeight] = useState(0);\n const fillsRef = useRef(false);\n fillsRef.current = fillShare !== undefined;\n // Measure before paint as a `%` height starts, so the first draw is the\n // real height and a switch from a number with an unchanged box is seen.\n useIsomorphicLayoutEffect(() => {\n if (fillShare && wrapperEl) {\n setFillHeight(Math.floor(wrapperEl.clientHeight));\n }\n }, [fillShare, wrapperEl]);\n\n // Anything focusable left in a layer `useApexChartSemantics` hides gets\n // tabindex -1.\n useNeutraliseHiddenFocus(liveWrapperRef);\n // A clipping parent (a Card) would cut off a tooltip Apex places\n // outside the chart.\n useKeepApexTooltipInside(liveWrapperRef);\n\n const locale = localeProp ?? i18n.language ?? 'en';\n\n /* ---- dev warning if title missing ------------------------------ */\n if (import.meta.env.DEV && !title) {\n console.warn(\n 'Chart: `title` prop is required. It drives aria-label and the screen-reader summary table.',\n );\n }\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexChartsTheme>(() => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n });\n\n /* ---- MutationObserver: re-read theme on class change ------------ */\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- toolbar band ----------------------------------------------- */\n // The toolbar buttons are --min-target-size boxes under a focus-ring gap\n // (apexcharts-theme.css); this many px stay clear above the plot. Read\n // from <html> first so the first render is already right.\n const [toolbarBand, setToolbarBand] = useState(() =>\n typeof document === 'undefined'\n ? 0\n : toolbarBandOf(document.documentElement),\n );\n useEffect(() => {\n if (!wrapperEl || !toolbar) return undefined;\n // A narrow chart wraps the toolbar onto more rows: reserve what it takes.\n const sized = new ResizeObserver(() => measure());\n const measure = () => {\n const bar = wrapperEl.querySelector<HTMLElement>('.apexcharts-toolbar');\n if (bar) sized.observe(bar);\n setToolbarBand(\n Math.max(toolbarBandOf(wrapperEl), bar?.offsetHeight ?? 0),\n );\n };\n measure();\n // A theme class can change on any ancestor (a nested ThemeRoot), and\n // ApexCharts rebuilds the toolbar on every update.\n const themes = new MutationObserver(measure);\n for (\n let node = wrapperEl.parentElement;\n node;\n node = node.parentElement\n ) {\n themes.observe(node, { attributes: true, attributeFilter: ['class'] });\n }\n const rebuilds = new MutationObserver((records) => {\n const added = records.flatMap((record) => [...record.addedNodes]);\n if (\n added.some(\n (node) =>\n node instanceof Element &&\n (node.matches('.apexcharts-toolbar') ||\n node.querySelector('.apexcharts-toolbar')),\n )\n ) {\n measure();\n }\n });\n rebuilds.observe(wrapperEl, { childList: true, subtree: true });\n return () => {\n sized.disconnect();\n themes.disconnect();\n rebuilds.disconnect();\n };\n }, [wrapperEl, toolbar]);\n\n /* ---- ResizeObserver: track container width --------------------- */\n useEffect(() => {\n const el = wrapperEl;\n if (!el || typeof ResizeObserver === 'undefined') return undefined;\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (!entry) return;\n setContainerWidth(Math.floor(entry.contentRect.width));\n // A filled figure's height is set by its parent, never by what\n // ApexCharts draws inside it, so this cannot feed back.\n if (fillsRef.current) {\n setFillHeight(Math.floor(entry.contentRect.height));\n }\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [wrapperEl]);\n\n /* ---- type switcher ---------------------------------------------- */\n const switcherTypes = useMemo<SwitchableType[]>(() => {\n if (!switchableTypes || switchableTypes.length === 0) return [];\n const valid = switchableTypes.filter((entry): entry is SwitchableType =>\n SWITCHABLE_TYPES.includes(entry),\n );\n if (import.meta.env.DEV && valid.length !== switchableTypes.length) {\n console.warn(\n \"Chart: `switchableTypes` accepts 'line' | 'bar' | 'area' | 'pie' | 'donut' — other entries are ignored.\",\n );\n }\n if (!SWITCHABLE_TYPES.includes(type)) {\n if (import.meta.env.DEV && valid.length > 0) {\n console.warn(\n 'Chart: the type switcher is unavailable when `type` is \"radialBar\".',\n );\n }\n return [];\n }\n const withCurrent = valid.includes(type as SwitchableType)\n ? valid\n : [type as SwitchableType, ...valid];\n return [...new Set(withCurrent)];\n }, [switchableTypes, type]);\n const switcherEnabled = switcherTypes.length >= 2;\n\n const [pickedType, setPickedType] = useState<SwitchableType | null>(null);\n const effectiveType: ChartType =\n switcherEnabled && pickedType && switcherTypes.includes(pickedType)\n ? pickedType\n : type;\n\n // Hide the plot and hover aids; keep the legend and toolbar buttons\n // reachable. Pie and donut legend items select a slice, not hide it.\n useApexChartSemantics(\n wrapperEl,\n effectiveType !== 'pie' && effectiveType !== 'donut',\n );\n\n /* ---- data adaptation for the switcher --------------------------- */\n /* Axis and slice types read different `series` shapes. When the user */\n /* switches across that boundary the data adapts: each axis series */\n /* becomes one slice (its total across the categories), and slice */\n /* values become one axis series with `labels` as the categories. */\n /* Same-shape switches (line/bar/area, pie/donut) pass through as-is. */\n const declaredIsSlice = isSliceType(type);\n const effectiveIsSlice = isSliceType(effectiveType);\n // Series pushed through the handle, held in state because react-apexcharts\n // re-sends the props' series on every option or size update.\n const [pushed, setPushed] = useState<{\n base: ChartProps['series'];\n next: ChartProps['series'];\n } | null>(null);\n // A new `series` prop always wins and forgets the pushed data, so a host\n // that later passes an earlier array again sees that array, not data it\n // pushed while that array was last on screen (reset during render, the\n // React pattern for state derived from a prop).\n const [pushedFor, setPushedFor] = useState(series);\n if (pushedFor !== series) {\n setPushedFor(series);\n if (pushed) setPushed(null);\n }\n const liveSeries =\n pushed && pushed.base === series && pushedFor === series\n ? pushed.next\n : series;\n const seriesPropRef = useRef(series);\n seriesPropRef.current = series;\n const { effectiveSeries, effectiveCategories, effectiveLabels } = useMemo(\n () =>\n adaptSeries(\n liveSeries,\n categories,\n labels,\n declaredIsSlice,\n effectiveIsSlice,\n t('chart.table.value'),\n ),\n [liveSeries, categories, labels, declaredIsSlice, effectiveIsSlice, t],\n );\n // The same adaptation for the handle, with this render's inputs.\n const adapt = (next: ChartProps['series']) =>\n adaptSeries(\n next,\n categories,\n labels,\n declaredIsSlice,\n effectiveIsSlice,\n t('chart.table.value'),\n );\n const adaptRef = useRef(adapt);\n adaptRef.current = adapt;\n // The draw a pushed series started, so an export in the same turn waits.\n const pendingDraw = useRef<Promise<unknown>>(Promise.resolve());\n\n /* ---- imperative handle ----------------------------------------- */\n const agentHandle = useMemo<ChartHandle>(\n () => ({\n async dataURI(): Promise<string> {\n await pendingDraw.current;\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n updateSeries(next) {\n // React state keeps it for later renders. Draw it now as well, with\n // the options that view takes (compare styling, slice labels), so an\n // export in the same turn sees both.\n setPushed({ base: seriesPropRef.current, next });\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return;\n const view = adaptRef.current(next);\n const inputs = { ...optionInputsRef.current, ...view };\n pendingDraw.current = instance\n .updateOptions(\n { ...buildChartOptions(inputs), series: view.effectiveSeries },\n false,\n true,\n )\n .catch(() => undefined);\n },\n setType(next: ChartType): boolean {\n if (!switcherEnabled) return false;\n if (!switcherTypes.includes(next as SwitchableType)) return false;\n setPickedType(next as SwitchableType);\n return true;\n },\n getTypeState() {\n return {\n declaredType: type,\n effectiveType,\n availableTypes: switcherEnabled\n ? ([...switcherTypes] as ChartType[])\n : [],\n };\n },\n }),\n [chartId, type, effectiveType, switcherEnabled, switcherTypes],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(chartAgent, agentHandle, id);\n\n /* ---- RTL detection --------------------------------------------- */\n const isRtl =\n typeof document !== 'undefined' && document.documentElement.dir === 'rtl';\n\n /* ---- normalised series for sr-only table ----------------------- */\n const tableSeries = useMemo(\n () => normaliseSeries(effectiveSeries, effectiveType),\n [effectiveSeries, effectiveType],\n );\n\n /* ---- Intl formatter -------------------------------------------- */\n const numberFormatter = useMemo(\n () => new Intl.NumberFormat(locale),\n [locale],\n );\n\n /* ---- resolved value formatter ---------------------------------- */\n /* The consumer's `valueFormatter` (e.g. a currency formatter) wins */\n /* everywhere a data-point value is surfaced as text; otherwise we */\n /* fall back to the locale-aware grouped number. */\n const formatValue = useMemo(\n () =>\n valueFormatter ?? ((value: number) => numberFormatter.format(value)),\n [valueFormatter, numberFormatter],\n );\n\n /* ---- toolbar localisation -------------------------------------- */\n const toolbarLocale = useMemo(\n () => ({\n name: locale,\n options: {\n toolbar: {\n download: t('chart.toolbar.download'),\n // Names the button that opens the export menu (Apex: \"Menu\").\n menu: t('chart.toolbar.download'),\n selection: t('chart.toolbar.selection'),\n selectionZoom: t('chart.toolbar.selectionZoom'),\n zoomIn: t('chart.toolbar.zoomIn'),\n zoomOut: t('chart.toolbar.zoomOut'),\n pan: t('chart.toolbar.pan'),\n reset: t('chart.toolbar.reset'),\n exportToSVG: t('chart.toolbar.exportToSVG'),\n exportToPNG: t('chart.toolbar.exportToPNG'),\n exportToCSV: t('chart.toolbar.exportToCSV'),\n },\n },\n }),\n [locale, t],\n );\n\n /* ---- build ApexOptions ----------------------------------------- */\n const reducedMotion = usePrefersReducedMotion();\n\n const noDataText = t('chart.noData');\n // The chart's own width, so `width=\"50%\"` of a wide wrapper can be narrow.\n // ApexCharts draws into a full-width block in the measured wrapper.\n const chartWidth = drawnWidth(width, containerWidth);\n const narrow = chartWidth > 0 && chartWidth < NARROW_CHART_WIDTH;\n\n /* ---- resolved dimensions --------------------------------------- */\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n // A filled figure is never shorter than its CSS floor, so once measured\n // it is drawn at exactly its height.\n const resolvedHeight = fillShare\n ? fillHeight > 0\n ? fillHeight\n : MIN_FILL_HEIGHT\n : (height ?? 320);\n // A short chart's legend keeps to one row, faded where it hides items,\n // and its plot takes back ApexCharts' title allowance.\n const chartHeight = drawnHeight(resolvedHeight);\n const shortChart = chartHeight > 0 && chartHeight < SHORT_CHART_HEIGHT;\n useApexLegendScroll(wrapperEl, shortChart);\n useApexXLabelSpacing(wrapperEl);\n\n const optionInputs = useMemo<ChartOptionInputs>(\n () => ({\n themeOptions,\n toolbarBand,\n chartId,\n toolbar,\n reducedMotion,\n toolbarLocale,\n locale,\n effectiveLabels,\n formatValue,\n noDataText,\n effectiveType,\n effectiveSeries,\n effectiveCategories,\n isRtl,\n patterns,\n stacked,\n orientation,\n curve,\n colors,\n radialValueFormatter,\n narrow,\n short: shortChart,\n wrapperRef,\n }),\n [\n themeOptions,\n toolbarBand,\n chartId,\n toolbar,\n reducedMotion,\n toolbarLocale,\n locale,\n effectiveLabels,\n formatValue,\n noDataText,\n effectiveType,\n effectiveSeries,\n effectiveCategories,\n isRtl,\n patterns,\n stacked,\n orientation,\n curve,\n colors,\n radialValueFormatter,\n narrow,\n shortChart,\n ],\n );\n const chartOptions = useMemo(\n () => buildChartOptions(optionInputs),\n [optionInputs],\n );\n // This render's inputs, for the handle to build options for pushed series.\n const optionInputsRef = useRef(optionInputs);\n optionInputsRef.current = optionInputs;\n\n /* ---- sr-only data table --------------------------------------- */\n const srTable = useMemo(() => {\n const columnLabels = isSliceType(effectiveType)\n ? (effectiveLabels ?? [])\n : (effectiveCategories ?? []);\n const rows = tableSeries;\n // `sr-only` goes on a wrapper: a table ignores its 1px size and overflow,\n // so on the table itself it grew to every header's width and scrolled.\n return (\n <div className=\"ds:sr-only\">\n <table id={summaryId}>\n <caption>{title}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{t('chart.table.series')}</th>\n {columnLabels.map((col, i) => (\n <th key={`${col}-${i}`} scope=\"col\">\n {col}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={`${row.name}-${rowIndex}`}>\n <th scope=\"row\">{row.name || t('chart.table.value')}</th>\n {row.data.map((value, colIndex) => (\n <td key={`${rowIndex}-${colIndex}`}>\n {/* For a radialBar gauge the series is a synthetic arc\n percent — announce the consumer's display value (e.g.\n the real BMI) instead of the raw fill so AT users get\n the same figure sighted users see in the ring. */}\n {effectiveType === 'radialBar' && radialValueFormatter\n ? radialValueFormatter(value)\n : formatValue(value)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n }, [\n effectiveType,\n tableSeries,\n effectiveLabels,\n effectiveCategories,\n summaryId,\n title,\n t,\n formatValue,\n radialValueFormatter,\n ]);\n\n /* ---- ApexCharts `series` prop shape ----------------------------- */\n const apexSeries = useMemo(() => {\n if (isSliceType(effectiveType)) {\n return effectiveSeries as number[];\n }\n return effectiveSeries as ChartSeries[];\n }, [effectiveSeries, effectiveType]);\n\n // Inline style permitted per 23-constraints §Runtime-computed dimensions:\n // a custom property setter; the block-size rule lives in the CVA classes.\n const fillStyle = fillShare\n ? ({\n ['--chart-fill-size' as unknown as keyof CSSProperties]: fillShare,\n } as CSSProperties)\n : undefined;\n\n /* A figure, not `role=\"img\"`, whose children are presentational and so may\n not hold the legend and toolbar buttons. `key={effectiveType}` remounts\n ApexCharts on a type switch: in-place axis↔slice changes are unreliable. */\n const chartRegion = (\n <div\n ref={wrapperCallbackRef}\n role=\"figure\"\n aria-label={title}\n aria-describedby={summaryId}\n data-legend-layout={shortChart ? 'row' : undefined}\n className={chartVariants({\n // Explicit height wins over the density min-height unless the\n // caller also asked for a density explicitly.\n // A `%` height takes its height from the parent, never a density.\n density: fillShare\n ? 'none'\n : (density ?? (height !== undefined ? 'none' : undefined)),\n className: [\n chartFillVariants({\n fill: fillShare ? (switcherEnabled ? 'rest' : 'root') : 'none',\n }),\n switcherEnabled ? undefined : className,\n ]\n .filter(Boolean)\n .join(' '),\n })}\n // eslint-disable-next-line react/forbid-dom-props -- the `%` height share\n style={switcherEnabled ? undefined : fillStyle}\n {...(switcherEnabled\n ? {}\n : { 'data-component': 'chart', 'data-component-id': id })}\n >\n {srTable}\n <ReactApexChart\n key={effectiveType}\n className={chartPlotVariants({ fill: fillShare !== undefined })}\n type={effectiveType}\n series={apexSeries as ApexCharts.ApexOptions['series']}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n />\n </div>\n );\n\n if (!switcherEnabled) return chartRegion;\n\n /* The switcher renders as a sibling above the figure, and the bounding\n `data-component` marker moves to this shared wrapper so the component\n boundary still encloses everything. */\n return (\n <div\n data-component=\"chart\"\n data-component-id={id}\n className={chartFrameVariants({\n fill: fillShare !== undefined,\n className,\n })}\n // eslint-disable-next-line react/forbid-dom-props -- the `%` height share\n style={fillStyle}\n >\n <div className=\"ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end\">\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('chart.typeSwitcher.label')}\n value={effectiveType}\n onValueChange={(next) => {\n // Guard: keyboard paths can re-commit the current value; the\n // contract is \"called when the user picks a DIFFERENT type\".\n if (next === effectiveType) return;\n setPickedType(next as SwitchableType);\n onTypeChange?.(next as ChartType);\n }}\n >\n {switcherTypes.map((entry) => (\n <IconButton\n key={entry}\n value={entry}\n // Explicit — the default (submit) would post a surrounding\n // consumer <form> on click/Space.\n type=\"button\"\n icon={TYPE_SWITCHER_ICONS[entry]}\n aria-label={t(TYPE_SWITCHER_LABEL_KEYS[entry])}\n />\n ))}\n </IconButtonGroup>\n </div>\n {chartRegion}\n </div>\n );\n },\n);\n\nChart.displayName = 'Chart';\n\n/* ------------------------------------------------------------------ */\n/* Re-export internal helper for downstream theming (kept narrow). */\n/* ------------------------------------------------------------------ */\n\nexport { chartVariants };\n"],"names":["__iconNode","ChartArea","createLucideIcon","ChartColumn","ChartLine","ChartPie","Donut","CONTROL_LAYERS","setAttr","el","name","value","useApexChartSemantics","root","legendToggles","useEffect","apply","canvas","layer","toolbar","open","_a","item","shown","frame","onClick","event","rel","active","observer","ITEM","TEXT","ITEM_SIZE","TAP_CLICK_MS","setFlag","on","px","style","property","useApexLegendScroll","enabled","legend","fromStartSeen","measure","fromStart","maxScroll","restore","sign","fit","view","items","box","start","end","before","floor","gap","whole","size","sized","bind","current","rebuilt","pressed","pressFrame","pressTimer","onRow","unpress","press","lift","clicked","bringIn","row","left","right","reveal","target","settle","text","full","inLegend","node","rebuilds","records","record","LABEL","GAP_EM","cornersOf","label","matrix","x","y","width","height","py","point","apart","a","b","shape","corner","i","next","nx","ny","length","project","points","p","pa","pb","useApexXLabelSpacing","space","labels","shapes","fits","step","inXAxis","redraws","fonts","chartAgent","handle","args","chartVariants","cva","chartFillVariants","chartPlotVariants","chartFrameVariants","PATTERN_STYLES","CATEGORICAL_TYPES","SLICE_TYPES","SWITCHABLE_TYPES","TYPE_SWITCHER_LABEL_KEYS","TYPE_SWITCHER_ICONS","COMPARE_OUTLINE_WIDTH","COMPARE_DOT_DASH","APEX_TITLE_MARGIN","APEX_TITLE_ALLOWANCE","APEX_LABEL_ROTATE","NARROW_CHART_WIDTH","SHORT_CHART_HEIGHT","MIN_FILL_HEIGHT","patchCompareBars","compareRealIndexes","g","ri","toolbarBandOf","styles","token","drawnWidth","into","drawnHeight","adaptSeries","series","categories","declaredIsSlice","effectiveIsSlice","valueName","rows","sum","v","buildChartOptions","themeOptions","toolbarBand","chartId","reducedMotion","toolbarLocale","locale","effectiveLabels","formatValue","noDataText","effectiveType","effectiveSeries","effectiveCategories","isRtl","patterns","stacked","orientation","curve","colors","radialValueFormatter","narrow","short","wrapperRef","base","compareFlags","isCategoricalType","s","hasCompare","barCompare","compareHasNegative","openBottomBars","compareFillOpacity","getCompareFillOpacity","options","band","reclaim","ramp","rampAt","primaryIdx","seen","pair","compareTints","c","resolveCompareTint","horizontalBar","_b","basePlot","_c","_e","_d","val","run","raf","_f","withCompareKeys","type","events","isSliceType","normaliseSeries","Chart","forwardRef","title","id","localeProp","valueFormatter","switchableTypes","onTypeChange","density","className","ref","t","i18n","useTranslation","rawId","useId","useMemo","summaryId","useRef","wrapperEl","setWrapperEl","useState","wrapperCallbackRef","composeRefs","liveWrapperRef","containerWidth","setContainerWidth","fillShare","fillHeight","setFillHeight","fillsRef","useIsomorphicLayoutEffect","useNeutraliseHiddenFocus","useKeepApexTooltipInside","setThemeOptions","getApexChartsTheme","timer","setToolbarBand","bar","themes","ro","entries","entry","switcherTypes","valid","withCurrent","switcherEnabled","pickedType","setPickedType","pushed","setPushed","pushedFor","setPushedFor","liveSeries","seriesPropRef","adapt","adaptRef","pendingDraw","agentHandle","instance","ApexCharts","inputs","optionInputsRef","useImperativeHandle","useAgentRegistration","tableSeries","numberFormatter","usePrefersReducedMotion","chartWidth","resolvedWidth","resolvedHeight","chartHeight","shortChart","optionInputs","chartOptions","srTable","columnLabels","jsxs","jsx","col","rowIndex","colIndex","apexSeries","fillStyle","chartRegion","ReactApexChart","IconButtonGroup","IconButton"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAYC,GAAiB,cAAcF,EAAU;ACnB3D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,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BAACS;AAAA,gBAAA;AAAA,kBAEC,OAAO7C;AAAA,kBAGP,MAAK;AAAA,kBACL,MAAMjI,GAAoBiI,CAAK;AAAA,kBAC/B,cAAY/B,EAAEnG,GAAyBkI,CAAK,CAAC;AAAA,gBAAA;AAAA,gBANxCA;AAAA,cAAA,CAQR;AAAA,YAAA;AAAA,UAAA,GAEL;AAAA,UACC0C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,IA5CwBA;AAAA,EA+C/B;AACF;AAEApF,GAAM,cAAc;","x_google_ignoreList":[0,1,2,3,4]}
@@ -7,7 +7,7 @@ import { B as b } from "./badge-BUk4RjTS.js";
7
7
  import { C as S } from "./card-BA4Ig_kn.js";
8
8
  import { T as B } from "./timestamp-DPLDWdxA.js";
9
9
  import { SafeHtml as ie } from "../safe-html/index.js";
10
- import { n as te, P as I, F as O, N as re } from "./note-attachment-DoVWvjWR.js";
10
+ import { n as te, P as I, F as O, N as re } from "./note-attachment-D8V7PUiR.js";
11
11
  import { u as de } from "./use-clamp-overflow-DQE2kwZ9.js";
12
12
  import { u as ne } from "./registry-DvAUVLHh.js";
13
13
  const oe = {
@@ -337,4 +337,4 @@ export {
337
337
  ue as C,
338
338
  oe as c
339
339
  };
340
- //# sourceMappingURL=clinical-note-card-BgURrgL5.js.map
340
+ //# sourceMappingURL=clinical-note-card-D2bbWksq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clinical-note-card-BgURrgL5.js","sources":["../../src/components/clinical-note-card/clinical-note-card.agent.ts","../../src/components/clinical-note-card/clinical-note-card.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ClinicalNoteCard. */\n/* */\n/* Read-only presentation surface. Exposes the note's id + structural */\n/* flags (pinned / flagged / attachment kind) so a future MCP UI bridge */\n/* can locate and describe a rendered note. NEVER reads the note body or */\n/* any author identity — those are PHI and stay out of the agent layer. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ClinicalNoteCardHandle } from './clinical-note-card';\n\nexport const clinicalNoteCardAgent: AgentAdapter<ClinicalNoteCardHandle> = {\n id: 'clinical-note-card',\n capabilities: [],\n state: {\n noteId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.noteId',\n description: 'Stable identifier of the rendered note, when supplied.',\n read: (handle) => handle.getNoteId(),\n },\n pinned: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.pinned',\n description: 'Whether the note is pinned to the top of the timeline.',\n read: (handle) => handle.isPinned(),\n },\n flagged: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.flagged',\n description: 'Whether the note is flagged for follow-up.',\n read: (handle) => handle.isFlagged(),\n },\n attachmentKind: {\n type: \"'patient' | 'carePlan' | 'carePlanEntry' | 'phase' | 'xray' | undefined\",\n descriptionKey: 'ui.agent.clinicalNoteCard.state.attachmentKind',\n description:\n 'Structural kind the note is attached to. Never the attachment identity or content.',\n read: (handle) => handle.getAttachmentKind(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'clinical-note-card',\n description:\n 'Marks the ClinicalNoteCard root. Also emits data-pinned / data-flagged / data-attached-to structural hooks; the pin / flag toggles carry data-note-action=\"pin\" | \"flag\".',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop — addresses a specific note.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Flag, Pin } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { Timestamp } from '../timestamp';\nimport { SafeHtml } from '../_shared/safe-html';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { clinicalNoteCardAgent } from './clinical-note-card.agent';\n\n// The attachment type moved to `_shared` when NoteTimeline began rendering the\n// same chip; re-exported here so this component's public API is unchanged.\nexport type { NoteAttachment };\n\n/* -------------------------------------------------------------------- */\n/* ClinicalNoteCard */\n/* */\n/* A single clinical note — the free-text annotation an operator writes */\n/* against a patient, care plan, treatment phase, or x-ray. Replaces the */\n/* bespoke \"nota clinica\" rows scattered across the platform patient */\n/* timeline. Composes Card + Avatar (author) + Timestamp + Badge/Tag */\n/* (clinical / pinned / flagged) + Link (attachment) and renders the */\n/* markdown body through the shared SafeHtml helper — the only sanctioned */\n/* carrier of dangerouslySetInnerHTML (constraint §8). */\n/* */\n/* All visible text flows through useTranslation('ui') against the */\n/* `clinicalNoteCard.*` namespace. No PHI is read by the agent adapter — */\n/* only the note id and structural flags are exposed. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/** Author identity — drives the avatar + visible byline. */\nexport interface ClinicalNoteAuthor {\n /** Display name. */\n name: string;\n /** Optional avatar image URL. */\n avatarUrl?: string;\n}\n\n/** Imperative handle exposed to the agent runtime — identifiers / flags only. */\nexport interface ClinicalNoteCardHandle {\n /** The note's stable id, when supplied. */\n getNoteId: () => string | undefined;\n /** Whether the note is currently pinned. */\n isPinned: () => boolean;\n /** Whether the note is currently flagged. */\n isFlagged: () => boolean;\n /** The attachment kind the note is bound to. */\n getAttachmentKind: () => NoteAttachment['kind'] | undefined;\n}\n\nexport interface ClinicalNoteCardProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'aria-label' | 'children' | 'content' | 'title'\n> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /**\n * ISO-8601 timestamp the note refers to (the clinical date). Drives the\n * primary `<Timestamp>`. An empty string renders no timestamp (an undated\n * imported note).\n */\n dateIso: string;\n /**\n * ISO-8601 timestamp the note was authored, when it differs from\n * `dateIso`. Rendered as a secondary \"added\" line.\n */\n createdAtIso?: string;\n /** Author identity — avatar + byline. Optional for system notes. */\n author?: ClinicalNoteAuthor;\n /** The operator the note is credited to: a secondary \"Operator: …\" byline. */\n operatorName?: string;\n /**\n * A deleted note kept for the record. Shows a \"Deleted\" badge and keeps the\n * body out of the DOM until the reader presses \"Show deleted note\". Not an\n * access control: the body is one press away.\n */\n deleted?: boolean;\n /**\n * Whether this is a clinical note (vs. an administrative one). When true a\n * \"Clinical\" badge is shown so the note's nature is unambiguous at a glance.\n */\n clinical?: boolean;\n /** What the note is attached to — drives a contextual chip + optional link. */\n attachedTo?: NoteAttachment;\n /**\n * The note body, authored in a small, safe subset of Markdown (bold,\n * italic, inline code, links, line breaks, simple lists). Rendered through\n * the shared `SafeHtml` helper with the `markdown` sanitiser profile —\n * raw HTML and unsafe link schemes are stripped.\n */\n content: string;\n /**\n * How `content` is authored. `'markdown'` (default) runs the small Markdown\n * subset through the converter; `'html'` treats `content` as rich HTML\n * (e.g. Redactor output) and renders it through SafeHtml's `rich-text`\n * profile, so colours, sizes, tables and images survive sanitisation.\n */\n contentFormat?: 'markdown' | 'html';\n /** Pin the note to the top of a timeline — shows a \"Pinned\" chip. */\n pinned?: boolean;\n /** Flag the note for follow-up / attention — shows a \"Flagged\" chip. */\n flagged?: boolean;\n /**\n * Host-owned actions for this note (edit, delete, share …), rendered\n * beside the pin and flag. They belong in the same cluster: a reader\n * looking for what they can do to a note should find every affordance\n * in one place, not some in the card and the rest below it.\n */\n headerActions?: ReactNode;\n /**\n * When provided, the pinned chip becomes an `aria-pressed` toggle button so\n * the note can be (un)pinned in place — the pin glyph fills and tints to the\n * accent when pinned (no button fill). Omit for a static, display-only card.\n */\n onTogglePin?: () => void;\n /** As `onTogglePin`, for the flagged state (warning-tinted when flagged). */\n onToggleFlag?: () => void;\n /**\n * A pin write is in flight. The toggle keeps showing `pinned`, is\n * `aria-disabled`, dims and ignores clicks until the host answers. Only\n * with `onTogglePin`.\n */\n pinPending?: boolean;\n /** As `pinPending`, for the flag toggle. */\n flagPending?: boolean;\n /**\n * Clamp the rendered body to five lines. When the body is taller than the\n * clamp, a \"Read more\" / \"Read less\" disclosure toggles the full text in\n * place — the note stays a read-only display surface, so this is the\n * sighted-user escape hatch (assistive tech reads the full body regardless).\n */\n truncate?: boolean;\n /**\n * `'elevated'` (default) wraps the note in `<Card variant=\"elevated\">`.\n * `'flat'` drops the chrome for use inside an existing Card / timeline rail.\n */\n surface?: 'flat' | 'elevated';\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n surface: { flat: '', elevated: '' },\n },\n defaultVariants: { surface: 'elevated' },\n});\n\n/* Body clamp — applied only when `truncate` is set. Logical-safe. */\nconst bodyVariants = cva(\n [\n 'type-body-sm ds:text-[color:var(--foreground)]',\n 'ds:break-words',\n '[&_a]:ds:underline [&_a]:ds:underline-offset-2',\n '[&_code]:ds:rounded-[var(--radius-sm)] [&_code]:ds:bg-muted/30 [&_code]:ds:ps-[var(--spacing-xs)] [&_code]:ds:pe-[var(--spacing-xs)] [&_code]:ds:font-[family-name:var(--font-mono)]',\n '[&_p]:ds:m-0 [&_p+p]:ds:mt-[var(--spacing-sm)]',\n // `list-disc` / `list-decimal` are load-bearing: the card renders host\n // HTML inside `[data-component]`, where preflight's `list-style: none`\n // still applies. Without them the indent lands but the markers do not.\n 'ds:[&_ul]:m-0 ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ul]:list-disc ds:[&_ol]:m-0 ds:[&_ol]:ps-[var(--spacing-md)] ds:[&_ol]:list-decimal',\n // Rich-text (Redactor) extras — harmless on markdown notes, which carry\n // none of these tags. Headings, inline images and tables stay readable.\n '[&_h2]:type-title-item [&_h3]:type-title-item [&_h2]:ds:m-0 [&_h3]:ds:m-0',\n '[&_img]:ds:max-w-full [&_img]:ds:h-auto [&_img]:ds:rounded-[var(--radius-sm)]',\n '[&_table]:ds:my-[var(--spacing-sm)] [&_table]:ds:w-full [&_table]:ds:border-collapse',\n '[&_th]:ds:border [&_th]:ds:border-[color:var(--border)] [&_th]:ds:ps-[var(--spacing-xs)] [&_th]:ds:pe-[var(--spacing-xs)] [&_th]:ds:py-[var(--spacing-2xs)] [&_th]:ds:text-start',\n '[&_td]:ds:border [&_td]:ds:border-[color:var(--border)] [&_td]:ds:ps-[var(--spacing-xs)] [&_td]:ds:pe-[var(--spacing-xs)] [&_td]:ds:py-[var(--spacing-2xs)]',\n ].join(' '),\n {\n variants: {\n truncate: {\n true: 'ds:[overflow:hidden] ds:[display:-webkit-box] ds:[-webkit-box-orient:vertical] ds:[-webkit-line-clamp:5]',\n false: '',\n },\n },\n defaultVariants: { truncate: false },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* Inline affordances — pin / flag toggle + read-more disclosure */\n/* -------------------------------------------------------------------- */\n\n/* Pin / flag toggle. A raw button (not IconButton) so the pressed state\n reads as a FILLED glyph + colour tint rather than a filled button — the\n same treatment as the Sidebar favourite star. The compact box keeps a\n --min-target-size hit area on touch via the ::before expansion. */\nconst noteToggleBase = [\n 'ds:relative ds:inline-flex ds:items-center ds:justify-center ds:shrink-0',\n 'ds:size-7 ds:rounded-[var(--radius-sm)]',\n 'ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:hidden',\n 'ds:hover:bg-[color:var(--muted)]/20',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:transition-[color,background-color] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n // A write in flight: the toggle stays focusable, says it is busy and\n // dims as a waiting Button does, so a keyboard reader sees it too.\n 'ds:aria-disabled:cursor-progress ds:aria-disabled:opacity-50',\n].join(' ');\n\n/* Read-more / read-less disclosure — an inline text toggle in the flow of\n the body copy (exempt from target-size the same way an inline link is). */\nconst readMoreClasses = [\n 'ds:mt-[var(--spacing-2xs)] ds:inline-flex ds:items-center ds:self-start',\n 'ds:text-[length:var(--font-size-xs)] ds:font-semibold',\n 'ds:underline ds:underline-offset-2 ds:text-[color:var(--primary)] ds:hover:no-underline',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nconst deletedDisclosure = cva([\n readMoreClasses,\n 'ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]',\n]);\n\ninterface NoteToggleProps {\n /** The lucide glyph, pre-configured with `fill` + size by the caller. */\n icon: ReactNode;\n /** Current pressed state. */\n pressed: boolean;\n /** Accessible label (flips between the on / off verb). */\n label: string;\n /** Colour class applied while pressed (accent for pin, warning for flag). */\n activeClassName: string;\n /** Stable hook for hosts, agents and focus rescue: `pin` or `flag`. */\n action: 'pin' | 'flag';\n /** A write is in flight: aria-disabled, and clicks do nothing. */\n pending: boolean;\n onToggle: () => void;\n}\n\nfunction NoteToggle({\n icon,\n pressed,\n label,\n activeClassName,\n action,\n pending,\n onToggle,\n}: NoteToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-label={label}\n // aria-disabled, not disabled: the toggle keeps its focus while the\n // host answers, so a keyboard reader is not dropped onto the page.\n aria-disabled={pending || undefined}\n data-note-action={action}\n onClick={() => {\n if (!pending) onToggle();\n }}\n className={[\n noteToggleBase,\n pressed\n ? activeClassName\n : 'ds:text-[color:var(--muted-foreground)] ds:hover:text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {icon}\n </button>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ClinicalNoteCard = forwardRef<\n HTMLDivElement,\n ClinicalNoteCardProps\n>(\n (\n {\n id,\n dateIso,\n createdAtIso,\n author,\n operatorName,\n deleted,\n clinical,\n attachedTo,\n content,\n contentFormat = 'markdown',\n pinned,\n flagged,\n headerActions,\n onTogglePin,\n onToggleFlag,\n pinPending = false,\n flagPending = false,\n truncate = false,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n const [deletedOpen, setDeletedOpen] = useState(false);\n const [previousDeleted, setPreviousDeleted] = useState(!!deleted);\n if (previousDeleted !== !!deleted) {\n setPreviousDeleted(!!deleted);\n setDeletedOpen(false);\n }\n // A deleted note's body stays empty and hidden until the reader reveals it.\n const bodyHidden = !!deleted && !deletedOpen;\n\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } = useClampOverflow<HTMLDivElement>(\n truncate && !expanded && !bodyHidden,\n );\n // Show the disclosure once the body overflows; keep it while expanded so\n // the user can collapse again.\n const showReadMore = truncate && !bodyHidden && (isOverflowing || expanded);\n\n // Markdown notes are converted to a safe HTML subset; rich-text (Redactor)\n // notes are passed through verbatim and sanitised by SafeHtml's broader\n // `rich-text` profile at render. Either way SafeHtml is the only carrier.\n const bodyHtml = useMemo(\n () => (contentFormat === 'html' ? content : noteMarkdownToHtml(content)),\n [content, contentFormat],\n );\n\n const resolvedAriaLabel = ariaLabel ?? t('clinicalNoteCard.regionLabel');\n\n useAgentRegistration(\n clinicalNoteCardAgent,\n {\n getNoteId: () => id,\n isPinned: () => !!pinned,\n isFlagged: () => !!flagged,\n getAttachmentKind: () => attachedTo?.kind,\n },\n id,\n );\n\n const attachmentNode = <NoteAttachmentChip attachedTo={attachedTo} />;\n\n const inner = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {/* Header: author + date + status chips */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {author ? (\n <Avatar\n name={author.name}\n src={author.avatarUrl}\n size=\"sm\"\n className=\"ds:shrink-0\"\n aria-hidden=\"true\"\n role=\"presentation\"\n aria-label={undefined}\n />\n ) : null}\n <div className=\"ds:flex-1 ds:min-w-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n {author ? (\n <span\n id={headingId}\n className=\"type-title-item ds:text-[color:var(--foreground)] ds:truncate\"\n >\n {author.name}\n </span>\n ) : (\n <span id={headingId} className=\"ds:sr-only\">\n {resolvedAriaLabel}\n </span>\n )}\n {operatorName ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)] ds:break-words\">\n {t('clinicalNoteCard.operator', { name: operatorName })}\n </span>\n ) : null}\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)] ds:empty:hidden\">\n {dateIso ? (\n <Timestamp value={dateIso} shape=\"bare\" size=\"sm\" />\n ) : null}\n {createdAtIso && createdAtIso !== dateIso ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {t('clinicalNoteCard.added')}{' '}\n <Timestamp value={createdAtIso} shape=\"bare\" size=\"sm\" />\n </span>\n ) : null}\n </span>\n </div>\n {deleted ||\n clinical ||\n headerActions ||\n onTogglePin ||\n onToggleFlag ||\n pinned ||\n flagged ? (\n <span className=\"ds:ms-auto ds:flex ds:shrink-0 ds:flex-wrap ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)]\">\n {deleted ? (\n <Badge variant=\"error\" size=\"sm\">\n {t('clinicalNoteCard.deleted')}\n </Badge>\n ) : null}\n {clinical ? (\n <Badge variant=\"brand\" size=\"sm\">\n {t('clinicalNoteCard.clinical')}\n </Badge>\n ) : null}\n {/* Pin + flag — grouped tightly together, kept clear of the\n clinical badge by the cluster's larger gap. Each is an\n interactive toggle when a handler is supplied (filled glyph +\n tint when active, no button fill), else a static chip. */}\n {onTogglePin || onToggleFlag || pinned || flagged ? (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]\">\n {onTogglePin ? (\n <NoteToggle\n action=\"pin\"\n pending={pinPending}\n pressed={!!pinned}\n onToggle={onTogglePin}\n label={\n pinned\n ? t('clinicalNoteCard.unpin')\n : t('clinicalNoteCard.pin')\n }\n activeClassName=\"ds:text-[color:var(--accent)]\"\n icon={\n <Pin\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={pinned ? 'currentColor' : 'none'}\n />\n }\n />\n ) : pinned ? (\n <Badge\n variant=\"accent\"\n size=\"sm\"\n leading={<Pin aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.pinned')}\n </Badge>\n ) : null}\n {onToggleFlag ? (\n <NoteToggle\n action=\"flag\"\n pending={flagPending}\n pressed={!!flagged}\n onToggle={onToggleFlag}\n label={\n flagged\n ? t('clinicalNoteCard.unflag')\n : t('clinicalNoteCard.flag')\n }\n activeClassName=\"ds:text-[color:var(--warning-readable)]\"\n icon={\n <Flag\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={flagged ? 'currentColor' : 'none'}\n />\n }\n />\n ) : flagged ? (\n <Badge\n variant=\"warning\"\n size=\"sm\"\n leading={<Flag aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.flagged')}\n </Badge>\n ) : null}\n </span>\n ) : null}\n {/* Sibling of the pin/flag cluster, not inside it: a note with\n neither would otherwise drop the host's actions entirely. */}\n {headerActions}\n </span>\n ) : null}\n </div>\n\n {deleted ? (\n <button\n type=\"button\"\n aria-expanded={deletedOpen}\n aria-controls={bodyId}\n onClick={() => setDeletedOpen((prev) => !prev)}\n className={deletedDisclosure()}\n >\n {deletedOpen\n ? t('clinicalNoteCard.hideDeleted')\n : t('clinicalNoteCard.showDeleted')}\n </button>\n ) : null}\n {/* Body — rendered via the sanctioned SafeHtml carrier. Markdown notes\n use the tight markdown profile; rich-text notes the broader one.\n When `truncate`, the body clamps to five lines with a read-more\n disclosure once it overflows. */}\n <SafeHtml\n ref={clampRef}\n id={truncate || deleted ? bodyId : undefined}\n hidden={bodyHidden}\n html={bodyHidden ? '' : bodyHtml}\n profile={contentFormat === 'html' ? 'rich-text' : 'markdown'}\n className={bodyVariants({ truncate: truncate && !expanded })}\n />\n {showReadMore ? (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((prev) => !prev)}\n className={readMoreClasses}\n >\n {expanded\n ? t('clinicalNoteCard.readLess')\n : t('clinicalNoteCard.readMore')}\n </button>\n ) : null}\n\n {/* Attachment context */}\n {attachmentNode ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {attachmentNode}\n </div>\n ) : null}\n </div>\n );\n\n return (\n <div\n ref={ref}\n role=\"article\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"clinical-note-card\"\n data-component-id={id}\n data-pinned={pinned ? 'true' : undefined}\n data-flagged={flagged ? 'true' : undefined}\n data-deleted={deleted ? 'true' : undefined}\n data-attached-to={attachedTo?.kind}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body>{inner}</Card.Body>\n </Card>\n ) : (\n inner\n )}\n </div>\n );\n },\n);\n\nClinicalNoteCard.displayName = 'ClinicalNoteCard';\n\n/** Re-export of the surface variant union for downstream typing. */\nexport type ClinicalNoteCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n"],"names":["clinicalNoteCardAgent","handle","rootVariants","cva","bodyVariants","noteToggleBase","readMoreClasses","deletedDisclosure","NoteToggle","icon","pressed","label","activeClassName","action","pending","onToggle","jsx","ClinicalNoteCard","forwardRef","id","dateIso","createdAtIso","author","operatorName","deleted","clinical","attachedTo","content","contentFormat","pinned","flagged","headerActions","onTogglePin","onToggleFlag","pinPending","flagPending","truncate","surface","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","bodyId","expanded","setExpanded","useState","deletedOpen","setDeletedOpen","previousDeleted","setPreviousDeleted","bodyHidden","clampRef","isOverflowing","useClampOverflow","showReadMore","bodyHtml","useMemo","noteMarkdownToHtml","resolvedAriaLabel","useAgentRegistration","attachmentNode","NoteAttachmentChip","inner","jsxs","Avatar","Timestamp","Badge","Pin","Flag","prev","SafeHtml","Card"],"mappings":";;;;;;;;;;;;AAYO,MAAMA,KAA8D;AAAA,EACzE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,kBAAA;AAAA,IAAkB;AAAA,EAC7C;AAAA,EAEF,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aACE;AAAA,IAAA;AAAA,IAEJ,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ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ClD,WAAWxB,GAAa,EAAE,UAAUgC,KAAY,CAACW,GAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAE5DW,IACC,gBAAA1C;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,iBAAe+B;AAAA,UACf,iBAAeD;AAAA,UACf,SAAS,MAAME,EAAY,CAACyB,MAAS,CAACA,CAAI;AAAA,UAC1C,WAAWnE;AAAA,UAEV,UACGoC,EADHK,IACK,8BACA,2BAD2B;AAAA,QACA;AAAA,MAAA,IAEjC;AAAA,MAGHiB,IACC,gBAAAhD,EAAC,OAAA,EAAI,WAAU,mEACZ,aACH,IACE;AAAA,IAAA,GACN;AAGF,WACE,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAyB;AAAA,QACA,MAAK;AAAA,QACL,cAAYqB;AAAA,QACZ,mBAAiBlB;AAAA,QACjB,kBAAe;AAAA,QACf,qBAAmBzB;AAAA,QACnB,eAAaU,IAAS,SAAS;AAAA,QAC/B,gBAAcC,IAAU,SAAS;AAAA,QACjC,gBAAcN,IAAU,SAAS;AAAA,QACjC,oBAAkBE,KAAA,gBAAAA,EAAY;AAAA,QAC9B,IAAAP;AAAA,QACA,WAAWjB,GAAa,EAAE,SAAAmC,GAAS,WAAAE,GAAW;AAAA,QAC7C,GAAGC;AAAA,QAEH,UAAAH,MAAY,aACX,gBAAArB,EAAC2D,GAAA,EAAK,SAAQ,YACZ,UAAA,gBAAA3D,EAAC2D,EAAK,MAAL,EAAW,UAAAT,EAAA,CAAM,EAAA,CACpB,IAEAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAjD,GAAiB,cAAc;"}
1
+ {"version":3,"file":"clinical-note-card-D2bbWksq.js","sources":["../../src/components/clinical-note-card/clinical-note-card.agent.ts","../../src/components/clinical-note-card/clinical-note-card.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ClinicalNoteCard. */\n/* */\n/* Read-only presentation surface. Exposes the note's id + structural */\n/* flags (pinned / flagged / attachment kind) so a future MCP UI bridge */\n/* can locate and describe a rendered note. NEVER reads the note body or */\n/* any author identity — those are PHI and stay out of the agent layer. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ClinicalNoteCardHandle } from './clinical-note-card';\n\nexport const clinicalNoteCardAgent: AgentAdapter<ClinicalNoteCardHandle> = {\n id: 'clinical-note-card',\n capabilities: [],\n state: {\n noteId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.noteId',\n description: 'Stable identifier of the rendered note, when supplied.',\n read: (handle) => handle.getNoteId(),\n },\n pinned: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.pinned',\n description: 'Whether the note is pinned to the top of the timeline.',\n read: (handle) => handle.isPinned(),\n },\n flagged: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.flagged',\n description: 'Whether the note is flagged for follow-up.',\n read: (handle) => handle.isFlagged(),\n },\n attachmentKind: {\n type: \"'patient' | 'carePlan' | 'carePlanEntry' | 'phase' | 'xray' | undefined\",\n descriptionKey: 'ui.agent.clinicalNoteCard.state.attachmentKind',\n description:\n 'Structural kind the note is attached to. Never the attachment identity or content.',\n read: (handle) => handle.getAttachmentKind(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'clinical-note-card',\n description:\n 'Marks the ClinicalNoteCard root. Also emits data-pinned / data-flagged / data-attached-to structural hooks; the pin / flag toggles carry data-note-action=\"pin\" | \"flag\".',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop — addresses a specific note.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Flag, Pin } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { Timestamp } from '../timestamp';\nimport { SafeHtml } from '../_shared/safe-html';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { clinicalNoteCardAgent } from './clinical-note-card.agent';\n\n// The attachment type moved to `_shared` when NoteTimeline began rendering the\n// same chip; re-exported here so this component's public API is unchanged.\nexport type { NoteAttachment };\n\n/* -------------------------------------------------------------------- */\n/* ClinicalNoteCard */\n/* */\n/* A single clinical note — the free-text annotation an operator writes */\n/* against a patient, care plan, treatment phase, or x-ray. Replaces the */\n/* bespoke \"nota clinica\" rows scattered across the platform patient */\n/* timeline. Composes Card + Avatar (author) + Timestamp + Badge/Tag */\n/* (clinical / pinned / flagged) + Link (attachment) and renders the */\n/* markdown body through the shared SafeHtml helper — the only sanctioned */\n/* carrier of dangerouslySetInnerHTML (constraint §8). */\n/* */\n/* All visible text flows through useTranslation('ui') against the */\n/* `clinicalNoteCard.*` namespace. No PHI is read by the agent adapter — */\n/* only the note id and structural flags are exposed. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/** Author identity — drives the avatar + visible byline. */\nexport interface ClinicalNoteAuthor {\n /** Display name. */\n name: string;\n /** Optional avatar image URL. */\n avatarUrl?: string;\n}\n\n/** Imperative handle exposed to the agent runtime — identifiers / flags only. */\nexport interface ClinicalNoteCardHandle {\n /** The note's stable id, when supplied. */\n getNoteId: () => string | undefined;\n /** Whether the note is currently pinned. */\n isPinned: () => boolean;\n /** Whether the note is currently flagged. */\n isFlagged: () => boolean;\n /** The attachment kind the note is bound to. */\n getAttachmentKind: () => NoteAttachment['kind'] | undefined;\n}\n\nexport interface ClinicalNoteCardProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'aria-label' | 'children' | 'content' | 'title'\n> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /**\n * ISO-8601 timestamp the note refers to (the clinical date). Drives the\n * primary `<Timestamp>`. An empty string renders no timestamp (an undated\n * imported note).\n */\n dateIso: string;\n /**\n * ISO-8601 timestamp the note was authored, when it differs from\n * `dateIso`. Rendered as a secondary \"added\" line.\n */\n createdAtIso?: string;\n /** Author identity — avatar + byline. Optional for system notes. */\n author?: ClinicalNoteAuthor;\n /** The operator the note is credited to: a secondary \"Operator: …\" byline. */\n operatorName?: string;\n /**\n * A deleted note kept for the record. Shows a \"Deleted\" badge and keeps the\n * body out of the DOM until the reader presses \"Show deleted note\". Not an\n * access control: the body is one press away.\n */\n deleted?: boolean;\n /**\n * Whether this is a clinical note (vs. an administrative one). When true a\n * \"Clinical\" badge is shown so the note's nature is unambiguous at a glance.\n */\n clinical?: boolean;\n /** What the note is attached to — drives a contextual chip + optional link. */\n attachedTo?: NoteAttachment;\n /**\n * The note body, authored in a small, safe subset of Markdown (bold,\n * italic, inline code, links, line breaks, simple lists). Rendered through\n * the shared `SafeHtml` helper with the `markdown` sanitiser profile —\n * raw HTML and unsafe link schemes are stripped.\n */\n content: string;\n /**\n * How `content` is authored. `'markdown'` (default) runs the small Markdown\n * subset through the converter; `'html'` treats `content` as rich HTML\n * (e.g. Redactor output) and renders it through SafeHtml's `rich-text`\n * profile, so colours, sizes, tables and images survive sanitisation.\n */\n contentFormat?: 'markdown' | 'html';\n /** Pin the note to the top of a timeline — shows a \"Pinned\" chip. */\n pinned?: boolean;\n /** Flag the note for follow-up / attention — shows a \"Flagged\" chip. */\n flagged?: boolean;\n /**\n * Host-owned actions for this note (edit, delete, share …), rendered\n * beside the pin and flag. They belong in the same cluster: a reader\n * looking for what they can do to a note should find every affordance\n * in one place, not some in the card and the rest below it.\n */\n headerActions?: ReactNode;\n /**\n * When provided, the pinned chip becomes an `aria-pressed` toggle button so\n * the note can be (un)pinned in place — the pin glyph fills and tints to the\n * accent when pinned (no button fill). Omit for a static, display-only card.\n */\n onTogglePin?: () => void;\n /** As `onTogglePin`, for the flagged state (warning-tinted when flagged). */\n onToggleFlag?: () => void;\n /**\n * A pin write is in flight. The toggle keeps showing `pinned`, is\n * `aria-disabled`, dims and ignores clicks until the host answers. Only\n * with `onTogglePin`.\n */\n pinPending?: boolean;\n /** As `pinPending`, for the flag toggle. */\n flagPending?: boolean;\n /**\n * Clamp the rendered body to five lines. When the body is taller than the\n * clamp, a \"Read more\" / \"Read less\" disclosure toggles the full text in\n * place — the note stays a read-only display surface, so this is the\n * sighted-user escape hatch (assistive tech reads the full body regardless).\n */\n truncate?: boolean;\n /**\n * `'elevated'` (default) wraps the note in `<Card variant=\"elevated\">`.\n * `'flat'` drops the chrome for use inside an existing Card / timeline rail.\n */\n surface?: 'flat' | 'elevated';\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n surface: { flat: '', elevated: '' },\n },\n defaultVariants: { surface: 'elevated' },\n});\n\n/* Body clamp — applied only when `truncate` is set. Logical-safe. */\nconst bodyVariants = cva(\n [\n 'type-body-sm ds:text-[color:var(--foreground)]',\n 'ds:break-words',\n '[&_a]:ds:underline [&_a]:ds:underline-offset-2',\n '[&_code]:ds:rounded-[var(--radius-sm)] [&_code]:ds:bg-muted/30 [&_code]:ds:ps-[var(--spacing-xs)] [&_code]:ds:pe-[var(--spacing-xs)] [&_code]:ds:font-[family-name:var(--font-mono)]',\n '[&_p]:ds:m-0 [&_p+p]:ds:mt-[var(--spacing-sm)]',\n // `list-disc` / `list-decimal` are load-bearing: the card renders host\n // HTML inside `[data-component]`, where preflight's `list-style: none`\n // still applies. Without them the indent lands but the markers do not.\n 'ds:[&_ul]:m-0 ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ul]:list-disc ds:[&_ol]:m-0 ds:[&_ol]:ps-[var(--spacing-md)] ds:[&_ol]:list-decimal',\n // Rich-text (Redactor) extras — harmless on markdown notes, which carry\n // none of these tags. Headings, inline images and tables stay readable.\n '[&_h2]:type-title-item [&_h3]:type-title-item [&_h2]:ds:m-0 [&_h3]:ds:m-0',\n '[&_img]:ds:max-w-full [&_img]:ds:h-auto [&_img]:ds:rounded-[var(--radius-sm)]',\n '[&_table]:ds:my-[var(--spacing-sm)] [&_table]:ds:w-full [&_table]:ds:border-collapse',\n '[&_th]:ds:border [&_th]:ds:border-[color:var(--border)] [&_th]:ds:ps-[var(--spacing-xs)] [&_th]:ds:pe-[var(--spacing-xs)] [&_th]:ds:py-[var(--spacing-2xs)] [&_th]:ds:text-start',\n '[&_td]:ds:border [&_td]:ds:border-[color:var(--border)] [&_td]:ds:ps-[var(--spacing-xs)] [&_td]:ds:pe-[var(--spacing-xs)] [&_td]:ds:py-[var(--spacing-2xs)]',\n ].join(' '),\n {\n variants: {\n truncate: {\n true: 'ds:[overflow:hidden] ds:[display:-webkit-box] ds:[-webkit-box-orient:vertical] ds:[-webkit-line-clamp:5]',\n false: '',\n },\n },\n defaultVariants: { truncate: false },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* Inline affordances — pin / flag toggle + read-more disclosure */\n/* -------------------------------------------------------------------- */\n\n/* Pin / flag toggle. A raw button (not IconButton) so the pressed state\n reads as a FILLED glyph + colour tint rather than a filled button — the\n same treatment as the Sidebar favourite star. The compact box keeps a\n --min-target-size hit area on touch via the ::before expansion. */\nconst noteToggleBase = [\n 'ds:relative ds:inline-flex ds:items-center ds:justify-center ds:shrink-0',\n 'ds:size-7 ds:rounded-[var(--radius-sm)]',\n 'ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:hidden',\n 'ds:hover:bg-[color:var(--muted)]/20',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:transition-[color,background-color] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n // A write in flight: the toggle stays focusable, says it is busy and\n // dims as a waiting Button does, so a keyboard reader sees it too.\n 'ds:aria-disabled:cursor-progress ds:aria-disabled:opacity-50',\n].join(' ');\n\n/* Read-more / read-less disclosure — an inline text toggle in the flow of\n the body copy (exempt from target-size the same way an inline link is). */\nconst readMoreClasses = [\n 'ds:mt-[var(--spacing-2xs)] ds:inline-flex ds:items-center ds:self-start',\n 'ds:text-[length:var(--font-size-xs)] ds:font-semibold',\n 'ds:underline ds:underline-offset-2 ds:text-[color:var(--primary)] ds:hover:no-underline',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nconst deletedDisclosure = cva([\n readMoreClasses,\n 'ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]',\n]);\n\ninterface NoteToggleProps {\n /** The lucide glyph, pre-configured with `fill` + size by the caller. */\n icon: ReactNode;\n /** Current pressed state. */\n pressed: boolean;\n /** Accessible label (flips between the on / off verb). */\n label: string;\n /** Colour class applied while pressed (accent for pin, warning for flag). */\n activeClassName: string;\n /** Stable hook for hosts, agents and focus rescue: `pin` or `flag`. */\n action: 'pin' | 'flag';\n /** A write is in flight: aria-disabled, and clicks do nothing. */\n pending: boolean;\n onToggle: () => void;\n}\n\nfunction NoteToggle({\n icon,\n pressed,\n label,\n activeClassName,\n action,\n pending,\n onToggle,\n}: NoteToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-label={label}\n // aria-disabled, not disabled: the toggle keeps its focus while the\n // host answers, so a keyboard reader is not dropped onto the page.\n aria-disabled={pending || undefined}\n data-note-action={action}\n onClick={() => {\n if (!pending) onToggle();\n }}\n className={[\n noteToggleBase,\n pressed\n ? activeClassName\n : 'ds:text-[color:var(--muted-foreground)] ds:hover:text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {icon}\n </button>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ClinicalNoteCard = forwardRef<\n HTMLDivElement,\n ClinicalNoteCardProps\n>(\n (\n {\n id,\n dateIso,\n createdAtIso,\n author,\n operatorName,\n deleted,\n clinical,\n attachedTo,\n content,\n contentFormat = 'markdown',\n pinned,\n flagged,\n headerActions,\n onTogglePin,\n onToggleFlag,\n pinPending = false,\n flagPending = false,\n truncate = false,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n const [deletedOpen, setDeletedOpen] = useState(false);\n const [previousDeleted, setPreviousDeleted] = useState(!!deleted);\n if (previousDeleted !== !!deleted) {\n setPreviousDeleted(!!deleted);\n setDeletedOpen(false);\n }\n // A deleted note's body stays empty and hidden until the reader reveals it.\n const bodyHidden = !!deleted && !deletedOpen;\n\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } = useClampOverflow<HTMLDivElement>(\n truncate && !expanded && !bodyHidden,\n );\n // Show the disclosure once the body overflows; keep it while expanded so\n // the user can collapse again.\n const showReadMore = truncate && !bodyHidden && (isOverflowing || expanded);\n\n // Markdown notes are converted to a safe HTML subset; rich-text (Redactor)\n // notes are passed through verbatim and sanitised by SafeHtml's broader\n // `rich-text` profile at render. Either way SafeHtml is the only carrier.\n const bodyHtml = useMemo(\n () => (contentFormat === 'html' ? content : noteMarkdownToHtml(content)),\n [content, contentFormat],\n );\n\n const resolvedAriaLabel = ariaLabel ?? t('clinicalNoteCard.regionLabel');\n\n useAgentRegistration(\n clinicalNoteCardAgent,\n {\n getNoteId: () => id,\n isPinned: () => !!pinned,\n isFlagged: () => !!flagged,\n getAttachmentKind: () => attachedTo?.kind,\n },\n id,\n );\n\n const attachmentNode = <NoteAttachmentChip attachedTo={attachedTo} />;\n\n const inner = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {/* Header: author + date + status chips */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {author ? (\n <Avatar\n name={author.name}\n src={author.avatarUrl}\n size=\"sm\"\n className=\"ds:shrink-0\"\n aria-hidden=\"true\"\n role=\"presentation\"\n aria-label={undefined}\n />\n ) : null}\n <div className=\"ds:flex-1 ds:min-w-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n {author ? (\n <span\n id={headingId}\n className=\"type-title-item ds:text-[color:var(--foreground)] ds:truncate\"\n >\n {author.name}\n </span>\n ) : (\n <span id={headingId} className=\"ds:sr-only\">\n {resolvedAriaLabel}\n </span>\n )}\n {operatorName ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)] ds:break-words\">\n {t('clinicalNoteCard.operator', { name: operatorName })}\n </span>\n ) : null}\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)] ds:empty:hidden\">\n {dateIso ? (\n <Timestamp value={dateIso} shape=\"bare\" size=\"sm\" />\n ) : null}\n {createdAtIso && createdAtIso !== dateIso ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {t('clinicalNoteCard.added')}{' '}\n <Timestamp value={createdAtIso} shape=\"bare\" size=\"sm\" />\n </span>\n ) : null}\n </span>\n </div>\n {deleted ||\n clinical ||\n headerActions ||\n onTogglePin ||\n onToggleFlag ||\n pinned ||\n flagged ? (\n <span className=\"ds:ms-auto ds:flex ds:shrink-0 ds:flex-wrap ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)]\">\n {deleted ? (\n <Badge variant=\"error\" size=\"sm\">\n {t('clinicalNoteCard.deleted')}\n </Badge>\n ) : null}\n {clinical ? (\n <Badge variant=\"brand\" size=\"sm\">\n {t('clinicalNoteCard.clinical')}\n </Badge>\n ) : null}\n {/* Pin + flag — grouped tightly together, kept clear of the\n clinical badge by the cluster's larger gap. Each is an\n interactive toggle when a handler is supplied (filled glyph +\n tint when active, no button fill), else a static chip. */}\n {onTogglePin || onToggleFlag || pinned || flagged ? (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]\">\n {onTogglePin ? (\n <NoteToggle\n action=\"pin\"\n pending={pinPending}\n pressed={!!pinned}\n onToggle={onTogglePin}\n label={\n pinned\n ? t('clinicalNoteCard.unpin')\n : t('clinicalNoteCard.pin')\n }\n activeClassName=\"ds:text-[color:var(--accent)]\"\n icon={\n <Pin\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={pinned ? 'currentColor' : 'none'}\n />\n }\n />\n ) : pinned ? (\n <Badge\n variant=\"accent\"\n size=\"sm\"\n leading={<Pin aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.pinned')}\n </Badge>\n ) : null}\n {onToggleFlag ? (\n <NoteToggle\n action=\"flag\"\n pending={flagPending}\n pressed={!!flagged}\n onToggle={onToggleFlag}\n label={\n flagged\n ? t('clinicalNoteCard.unflag')\n : t('clinicalNoteCard.flag')\n }\n activeClassName=\"ds:text-[color:var(--warning-readable)]\"\n icon={\n <Flag\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={flagged ? 'currentColor' : 'none'}\n />\n }\n />\n ) : flagged ? (\n <Badge\n variant=\"warning\"\n size=\"sm\"\n leading={<Flag aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.flagged')}\n </Badge>\n ) : null}\n </span>\n ) : null}\n {/* Sibling of the pin/flag cluster, not inside it: a note with\n neither would otherwise drop the host's actions entirely. */}\n {headerActions}\n </span>\n ) : null}\n </div>\n\n {deleted ? (\n <button\n type=\"button\"\n aria-expanded={deletedOpen}\n aria-controls={bodyId}\n onClick={() => setDeletedOpen((prev) => !prev)}\n className={deletedDisclosure()}\n >\n {deletedOpen\n ? t('clinicalNoteCard.hideDeleted')\n : t('clinicalNoteCard.showDeleted')}\n </button>\n ) : null}\n {/* Body — rendered via the sanctioned SafeHtml carrier. Markdown notes\n use the tight markdown profile; rich-text notes the broader one.\n When `truncate`, the body clamps to five lines with a read-more\n disclosure once it overflows. */}\n <SafeHtml\n ref={clampRef}\n id={truncate || deleted ? bodyId : undefined}\n hidden={bodyHidden}\n html={bodyHidden ? '' : bodyHtml}\n profile={contentFormat === 'html' ? 'rich-text' : 'markdown'}\n className={bodyVariants({ truncate: truncate && !expanded })}\n />\n {showReadMore ? (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((prev) => !prev)}\n className={readMoreClasses}\n >\n {expanded\n ? t('clinicalNoteCard.readLess')\n : t('clinicalNoteCard.readMore')}\n </button>\n ) : null}\n\n {/* Attachment context */}\n {attachmentNode ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {attachmentNode}\n </div>\n ) : null}\n </div>\n );\n\n return (\n <div\n ref={ref}\n role=\"article\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"clinical-note-card\"\n data-component-id={id}\n data-pinned={pinned ? 'true' : undefined}\n data-flagged={flagged ? 'true' : undefined}\n data-deleted={deleted ? 'true' : undefined}\n data-attached-to={attachedTo?.kind}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body>{inner}</Card.Body>\n </Card>\n ) : (\n inner\n )}\n </div>\n );\n },\n);\n\nClinicalNoteCard.displayName = 'ClinicalNoteCard';\n\n/** Re-export of the surface variant union for downstream typing. */\nexport type ClinicalNoteCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n"],"names":["clinicalNoteCardAgent","handle","rootVariants","cva","bodyVariants","noteToggleBase","readMoreClasses","deletedDisclosure","NoteToggle","icon","pressed","label","activeClassName","action","pending","onToggle","jsx","ClinicalNoteCard","forwardRef","id","dateIso","createdAtIso","author","operatorName","deleted","clinical","attachedTo","content","contentFormat","pinned","flagged","headerActions","onTogglePin","onToggleFlag","pinPending","flagPending","truncate","surface","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","bodyId","expanded","setExpanded","useState","deletedOpen","setDeletedOpen","previousDeleted","setPreviousDeleted","bodyHidden","clampRef","isOverflowing","useClampOverflow","showReadMore","bodyHtml","useMemo","noteMarkdownToHtml","resolvedAriaLabel","useAgentRegistration","attachmentNode","NoteAttachmentChip","inner","jsxs","Avatar","Timestamp","Badge","Pin","Flag","prev","SafeHtml","Card"],"mappings":";;;;;;;;;;;;AAYO,MAAMA,KAA8D;AAAA,EACzE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,kBAAA;AAAA,IAAkB;AAAA,EAC7C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2,7 +2,7 @@ import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
2
  import { forwardRef as r, Fragment as b } from "react";
3
3
  import { useTranslation as k } from "react-i18next";
4
4
  import { C as o } from "./card-BA4Ig_kn.js";
5
- import { L as p } from "./link-gRw3NtOt.js";
5
+ import { L as p } from "./link-N5_YpLtm.js";
6
6
  import { M as v } from "./map-pin-BaY37-Km.js";
7
7
  function L(s) {
8
8
  return `tel:${s.replace(/\(0\)/g, "").replace(/[^\d+]/g, "")}`;
@@ -118,4 +118,4 @@ const M = Object.assign(f, {
118
118
  export {
119
119
  M as C
120
120
  };
121
- //# sourceMappingURL=contact-card-C8rEsC4Q.js.map
121
+ //# sourceMappingURL=contact-card-Czu60UvU.js.map