@alfadocs/ui-kit-debug 0.84.0 → 0.85.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 (140) hide show
  1. package/dist/_chunks/actions-cell-renderer-DaL80uqL.js.map +1 -1
  2. package/dist/_chunks/{ai-consent-banner-DUhr1yNj.js → ai-consent-banner-BXD7W6FI.js} +2 -2
  3. package/dist/_chunks/{ai-consent-banner-DUhr1yNj.js.map → ai-consent-banner-BXD7W6FI.js.map} +1 -1
  4. package/dist/_chunks/{alert-KJbsPYkI.js → alert-Cxaqd-QO.js} +12 -12
  5. package/dist/_chunks/alert-Cxaqd-QO.js.map +1 -0
  6. package/dist/_chunks/anamnesis-card-CJ5MNbkc.js.map +1 -1
  7. package/dist/_chunks/{audio-recorder-Cc3KuL9y.js → audio-recorder-BjnB7V8n.js} +2 -2
  8. package/dist/_chunks/{audio-recorder-Cc3KuL9y.js.map → audio-recorder-BjnB7V8n.js.map} +1 -1
  9. package/dist/_chunks/{booking-CLmeXtGv.js → booking-BvCu2XWY.js} +2 -2
  10. package/dist/_chunks/{booking-CLmeXtGv.js.map → booking-BvCu2XWY.js.map} +1 -1
  11. package/dist/_chunks/breadcrumb-agut0PwN.js.map +1 -1
  12. package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +1 -1
  13. package/dist/_chunks/chat-input-QpHxBEnN.js.map +1 -1
  14. package/dist/_chunks/chat-message-CdjWqZjo.js.map +1 -1
  15. package/dist/_chunks/checkbox-group-CfqMv57d.js.map +1 -1
  16. package/dist/_chunks/dependent-selector-DyFpdzZV.js.map +1 -1
  17. package/dist/_chunks/{document-preview-nwfulDEs.js → document-preview-DXl9migE.js} +2 -2
  18. package/dist/_chunks/{document-preview-nwfulDEs.js.map → document-preview-DXl9migE.js.map} +1 -1
  19. package/dist/_chunks/{document-scanner-B6h1Ir56.js → document-scanner-cS_ispQs.js} +3 -3
  20. package/dist/_chunks/document-scanner-cS_ispQs.js.map +1 -0
  21. package/dist/_chunks/editable-currency-cell-renderer-Dus_sBvX.js.map +1 -1
  22. package/dist/_chunks/email-input-Dpe63k0K.js.map +1 -1
  23. package/dist/_chunks/{entity-summary--vP698Jn.js → entity-summary-BILN4wEG.js} +2 -2
  24. package/dist/_chunks/{entity-summary--vP698Jn.js.map → entity-summary-BILN4wEG.js.map} +1 -1
  25. package/dist/_chunks/{field-value-DHG6gEKS.js → field-value-BRVbZJej.js} +133 -144
  26. package/dist/_chunks/field-value-BRVbZJej.js.map +1 -0
  27. package/dist/_chunks/{file-manager-DLJlinIO.js → file-manager-B9LZzT5E.js} +129 -129
  28. package/dist/_chunks/file-manager-B9LZzT5E.js.map +1 -0
  29. package/dist/_chunks/{file-upload-DENvuhfs.js → file-upload-CwxdqkMK.js} +134 -146
  30. package/dist/_chunks/file-upload-CwxdqkMK.js.map +1 -0
  31. package/dist/_chunks/finished-terminal-C0_mefrf.js.map +1 -1
  32. package/dist/_chunks/fiscal-code-input-QP9gkyDE.js.map +1 -1
  33. package/dist/_chunks/form-field-M5UpX65Z.js.map +1 -1
  34. package/dist/_chunks/{freemium-paywall-CmV642PA.js → freemium-paywall-Dr2342_S.js} +2 -2
  35. package/dist/_chunks/{freemium-paywall-CmV642PA.js.map → freemium-paywall-Dr2342_S.js.map} +1 -1
  36. package/dist/_chunks/iban-input-DXIA8Ln_.js.map +1 -1
  37. package/dist/_chunks/{marketplace-app-shell-Br2yebEK.js → marketplace-app-shell-Chcj4q4z.js} +2 -2
  38. package/dist/_chunks/{marketplace-app-shell-Br2yebEK.js.map → marketplace-app-shell-Chcj4q4z.js.map} +1 -1
  39. package/dist/_chunks/message-square-Bye4ATvx.js +20 -0
  40. package/dist/_chunks/message-square-Bye4ATvx.js.map +1 -0
  41. package/dist/_chunks/{notes-panel-Cvdp818a.js → notes-panel-BLjlYBt-.js} +2 -2
  42. package/dist/_chunks/{notes-panel-Cvdp818a.js.map → notes-panel-BLjlYBt-.js.map} +1 -1
  43. package/dist/_chunks/pagination-EkD5SiCK.js.map +1 -1
  44. package/dist/_chunks/{patient-details-COvYWp2e.js → patient-details-B9LCdyWW.js} +2 -2
  45. package/dist/_chunks/{patient-details-COvYWp2e.js.map → patient-details-B9LCdyWW.js.map} +1 -1
  46. package/dist/_chunks/{patient-search-BaUJ_Y-N.js → patient-search-vtRTSdf6.js} +2 -2
  47. package/dist/_chunks/{patient-search-BaUJ_Y-N.js.map → patient-search-vtRTSdf6.js.map} +1 -1
  48. package/dist/_chunks/{patient-summary-card-D6kgdTNn.js → patient-summary-card-vn1H4xWj.js} +2 -2
  49. package/dist/_chunks/patient-summary-card-vn1H4xWj.js.map +1 -0
  50. package/dist/_chunks/{patient-table-BHzmUbzu.js → patient-table-B6AKMTm3.js} +182 -196
  51. package/dist/_chunks/patient-table-B6AKMTm3.js.map +1 -0
  52. package/dist/_chunks/{payment-form-DL9xk9BA.js → payment-form-BoGxEmGn.js} +2 -2
  53. package/dist/_chunks/{payment-form-DL9xk9BA.js.map → payment-form-BoGxEmGn.js.map} +1 -1
  54. package/dist/_chunks/{payment-request-card-d-RmzsUd.js → payment-request-card-CygO1anM.js} +72 -70
  55. package/dist/_chunks/payment-request-card-CygO1anM.js.map +1 -0
  56. package/dist/_chunks/{pdf-viewer-DF3VMaPo.js → pdf-viewer-CcOuR2wj.js} +2 -2
  57. package/dist/_chunks/{pdf-viewer-DF3VMaPo.js.map → pdf-viewer-CcOuR2wj.js.map} +1 -1
  58. package/dist/_chunks/postal-code-input-BznBxVxf.js.map +1 -1
  59. package/dist/_chunks/{practice-results-BCr7jMt1.js → practice-results-yKbwIxqa.js} +2 -2
  60. package/dist/_chunks/{practice-results-BCr7jMt1.js.map → practice-results-yKbwIxqa.js.map} +1 -1
  61. package/dist/_chunks/radio-group-CI-6SmSw.js.map +1 -1
  62. package/dist/_chunks/{radiograph-panel.agent-CxF9pVxd.js → radiograph-panel.agent-M9XD4ze4.js} +2 -2
  63. package/dist/_chunks/{radiograph-panel.agent-CxF9pVxd.js.map → radiograph-panel.agent-M9XD4ze4.js.map} +1 -1
  64. package/dist/_chunks/{rich-text-editor-CCWjNkbx.js → rich-text-editor-RRkBN_WB.js} +2 -2
  65. package/dist/_chunks/rich-text-editor-RRkBN_WB.js.map +1 -0
  66. package/dist/_chunks/select-BW5ecXlX.js.map +1 -1
  67. package/dist/_chunks/{session-countdown-C8AsE072.js → session-countdown-Bc70VXN1.js} +58 -48
  68. package/dist/_chunks/session-countdown-Bc70VXN1.js.map +1 -0
  69. package/dist/_chunks/{sign-document-Bfk0WpWV.js → sign-document-DI561d1C.js} +2 -2
  70. package/dist/_chunks/sign-document-DI561d1C.js.map +1 -0
  71. package/dist/_chunks/{signature-request-CEOrCDyk.js → signature-request-D_6jgDZd.js} +60 -77
  72. package/dist/_chunks/signature-request-D_6jgDZd.js.map +1 -0
  73. package/dist/_chunks/task-card-BUgK6yZT.js.map +1 -1
  74. package/dist/_chunks/{task-tray-Br3vc0O1.js → task-tray-CLIqIXUZ.js} +58 -70
  75. package/dist/_chunks/task-tray-CLIqIXUZ.js.map +1 -0
  76. package/dist/_chunks/tasks-panel-CjGAhIN8.js.map +1 -1
  77. package/dist/_chunks/timeline-r-8IUoBS.js.map +1 -1
  78. package/dist/_chunks/{toast.agent-uV8CeAy6.js → toast.agent-Iw2jWdce.js} +2 -2
  79. package/dist/_chunks/{toast.agent-uV8CeAy6.js.map → toast.agent-Iw2jWdce.js.map} +1 -1
  80. package/dist/_chunks/tooth-scheme-BzJ6rcte.js.map +1 -1
  81. package/dist/_chunks/use-password-requirements-Bwtqx1qN.js.map +1 -1
  82. package/dist/_chunks/{warning-stack-BlG_Ujy3.js → warning-stack-CAHQ0xxS.js} +2 -2
  83. package/dist/_chunks/{warning-stack-BlG_Ujy3.js.map → warning-stack-CAHQ0xxS.js.map} +1 -1
  84. package/dist/_chunks/{workflow-map-C643Q43h.js → workflow-map-SIfAhmWz.js} +2 -2
  85. package/dist/_chunks/workflow-map-SIfAhmWz.js.map +1 -0
  86. package/dist/agent-catalog.json +1 -1
  87. package/dist/components/ai-consent-banner/index.js +1 -1
  88. package/dist/components/alert/index.js +1 -1
  89. package/dist/components/audio-recorder/index.js +1 -1
  90. package/dist/components/booking/index.js +1 -1
  91. package/dist/components/document-preview/index.js +1 -1
  92. package/dist/components/document-scanner/index.js +1 -1
  93. package/dist/components/entity-summary/index.js +1 -1
  94. package/dist/components/file-manager/index.js +1 -1
  95. package/dist/components/file-upload/file-upload.d.ts.map +1 -1
  96. package/dist/components/file-upload/index.js +1 -1
  97. package/dist/components/freemium-paywall/index.js +1 -1
  98. package/dist/components/notes-panel/index.js +1 -1
  99. package/dist/components/patient-details/index.js +1 -1
  100. package/dist/components/patient-search/index.js +1 -1
  101. package/dist/components/patient-summary-card/index.js +1 -1
  102. package/dist/components/patient-table/index.js +1 -1
  103. package/dist/components/payment-card/index.js +1 -1
  104. package/dist/components/payment-form/index.js +1 -1
  105. package/dist/components/pdf-viewer/index.js +1 -1
  106. package/dist/components/practice-results/index.js +1 -1
  107. package/dist/components/radiograph-panel/index.js +1 -1
  108. package/dist/components/rich-text-editor/index.js +1 -1
  109. package/dist/components/select/select.d.ts +8 -5
  110. package/dist/components/select/select.d.ts.map +1 -1
  111. package/dist/components/session-countdown/index.js +1 -1
  112. package/dist/components/sign-document/index.js +1 -1
  113. package/dist/components/task-card/task-card.d.ts.map +1 -1
  114. package/dist/components/task-tray/index.js +1 -1
  115. package/dist/components/toast/index.js +1 -1
  116. package/dist/components/tooth-scheme/tooth-scheme.d.ts.map +1 -1
  117. package/dist/components/warning-stack/index.js +1 -1
  118. package/dist/components/workflow/index.js +1 -1
  119. package/dist/index.js +434 -445
  120. package/dist/index.js.map +1 -1
  121. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  122. package/dist/patterns/signature-request/index.js +1 -1
  123. package/dist/tokens.css +1 -1
  124. package/package.json +5 -3
  125. package/dist/_chunks/alert-KJbsPYkI.js.map +0 -1
  126. package/dist/_chunks/circle-x-W8Enq3i4.js +0 -16
  127. package/dist/_chunks/circle-x-W8Enq3i4.js.map +0 -1
  128. package/dist/_chunks/document-scanner-B6h1Ir56.js.map +0 -1
  129. package/dist/_chunks/field-value-DHG6gEKS.js.map +0 -1
  130. package/dist/_chunks/file-manager-DLJlinIO.js.map +0 -1
  131. package/dist/_chunks/file-upload-DENvuhfs.js.map +0 -1
  132. package/dist/_chunks/patient-summary-card-D6kgdTNn.js.map +0 -1
  133. package/dist/_chunks/patient-table-BHzmUbzu.js.map +0 -1
  134. package/dist/_chunks/payment-request-card-d-RmzsUd.js.map +0 -1
  135. package/dist/_chunks/rich-text-editor-CCWjNkbx.js.map +0 -1
  136. package/dist/_chunks/session-countdown-C8AsE072.js.map +0 -1
  137. package/dist/_chunks/sign-document-Bfk0WpWV.js.map +0 -1
  138. package/dist/_chunks/signature-request-CEOrCDyk.js.map +0 -1
  139. package/dist/_chunks/task-tray-Br3vc0O1.js.map +0 -1
  140. package/dist/_chunks/workflow-map-C643Q43h.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit-debug",
3
- "version": "0.84.0",
3
+ "version": "0.85.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).",
6
6
  "license": "BUSL-1.1",
@@ -858,10 +858,12 @@
858
858
  "build:agent-catalog": "node --experimental-strip-types scripts/build-agent-catalog.mjs dist/agent-catalog.json",
859
859
  "storybook": "LAUNCH_EDITOR=code storybook dev -p 6006",
860
860
  "build-storybook": "storybook build",
861
- "prestorybook": "npm run check:whats-new",
862
- "prebuild-storybook": "npm run check:whats-new",
861
+ "prestorybook": "npm run check:whats-new && npm run build:icon-map",
862
+ "prebuild-storybook": "npm run check:whats-new && npm run build:icon-map",
863
863
  "build:whats-new": "node scripts/build-whats-new.mjs",
864
864
  "check:whats-new": "node scripts/build-whats-new.mjs --check",
865
+ "build:icon-map": "node scripts/build-icon-map.mjs",
866
+ "check:icon-map": "node scripts/build-icon-map.mjs --check",
865
867
  "typecheck": "tsc -b",
866
868
  "test": "vitest run",
867
869
  "lint": "eslint .",
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert-KJbsPYkI.js","sources":["../../node_modules/lucide-react/dist/esm/icons/circle-arrow-up.mjs","../../src/components/alert/alert.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 [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"m16 12-4-4-4 4\", key: \"177agl\" }],\n [\"path\", { d: \"M12 16V8\", key: \"1sbj14\" }]\n];\nconst CircleArrowUp = createLucideIcon(\"circle-arrow-up\", __iconNode);\n\nexport { __iconNode, CircleArrowUp as default };\n//# sourceMappingURL=circle-arrow-up.mjs.map\n","import {\n Children,\n createContext,\n forwardRef,\n isValidElement,\n useCallback,\n useContext,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n CircleArrowUp,\n CircleCheck,\n CircleX,\n Info,\n TriangleAlert,\n X,\n} from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { Tooltip } from '../tooltip';\n\n/* ------------------------------------------------------------------ */\n/* Clamp context — opt-in compact mode propagated from the root Alert */\n/* to its Title / Description so a consumer enables it with one prop. */\n/* ------------------------------------------------------------------ */\n\nconst AlertClampContext = createContext(false);\n\n/** Inline \"Read more / Read less\" disclosure. Tinted with `text-current` so it\n * inherits the alert variant's foreground rather than the link palette. */\nconst DISCLOSURE_BUTTON_CLASSES = [\n // Full-opacity `text-current` so it matches the body text's contrast (an\n // `opacity` dim would drop the variant-tinted text below AA). Underline\n // carries the affordance instead. No `--min-target-size` floor: this is an\n // inline text disclosure sitting in the flow of the body copy, which is\n // exempt from WCAG 2.5.8 target-size the same way an inline link is.\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-current 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 alertVariants = cva(\n [\n // Default `items-center` keeps the icon + dismiss optically aligned\n // with a single-line description. The `data-[has-title=true]`\n // selector flips to `items-start` when an `<Alert.Title>` is\n // present so the icon anchors to the heading's top instead of\n // floating against the centre of the title+description block.\n // For multi-line descriptions without a title, `items-center` still\n // looks right at 2–3 lines and matches Toast / Notification.\n 'ds:flex ds:items-center ds:data-[has-title=true]:items-start ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-md)]',\n 'ds:border ds:border-[length:var(--border-width-sm)]',\n 'ds:p-[var(--spacing-md)]',\n 'ds:break-words',\n ].join(' '),\n {\n variants: {\n // Each variant paints `<Button intent=\"tonal\">` descendants via a\n // child selector — the button carries `data-intent=\"tonal\"`, the\n // Alert applies the matching tint (`*-foreground` for bg + the\n // surface `--background` for fg). Descendant selectors sidestep\n // custom-property inheritance and are rock-solid across themes.\n variant: {\n info: [\n 'ds:border-[color:var(--info)]',\n 'ds:bg-[color-mix(in_srgb,var(--info)_10%,transparent)]',\n 'ds:text-[var(--info-foreground)]',\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--info-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n success: [\n 'ds:border-[color:var(--success)]',\n 'ds:bg-[color-mix(in_srgb,var(--success)_10%,transparent)]',\n 'ds:text-[var(--success-foreground)]',\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--success-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n warning: [\n 'ds:border-[color:var(--warning)]',\n 'ds:bg-[color-mix(in_srgb,var(--warning)_10%,transparent)]',\n 'ds:text-[var(--warning-foreground)]',\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--warning-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n error: [\n 'ds:border-[color:var(--error)]',\n 'ds:bg-[color-mix(in_srgb,var(--error)_10%,transparent)]',\n 'ds:text-[var(--error-foreground)]',\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--error-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n // Sales / marketing upsell — accent magenta via the --promo\n // semantic pair so marketing pushes (product hub → warning\n // stack) read as offers, not operational warnings. Surface is\n // the same subtle accent gradient as SidebarUpgradeChip (it\n // flattens in the accessible themes and follows Canvas in\n // forced-colors), keeping the two upsell affordances kin.\n promo: [\n 'ds:border-[color:var(--promo)]',\n 'ds:bg-[image:var(--gradient-surface-subtle-accent)]',\n 'ds:text-[var(--promo-foreground)]',\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--promo-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n },\n);\n\n// Icon stays `mt-0.5` only when an `<Alert.Title>` is present — that\n// offset compensates for the title's cap-height vs. line-box origin so\n// the glyph aligns with the heading's caps. Without a title, the\n// container uses `items-center` and the offset would push the icon\n// 2px off the optical axis.\nconst ICON_BASE = 'ds:shrink-0 ds:size-5';\nconst ICON_WITH_TITLE = `${ICON_BASE} ds:mt-0.5`;\n\nconst CLOSE_BUTTON_CLASSES = [\n // Default (no title): the alert root uses `items-center` and the\n // button centres in the cross-axis. A centred 16×16 glyph inside a\n // 44×44 button aligns optically with a single-line description.\n // With a title: the root flips to `items-start` so the button's top\n // edge aligns with the title row top. A centred glyph would then\n // land ~11 px below the title's optical centre (button height is\n // --min-target-size, much taller than the title's line-height). The\n // `[data-has-title=true]` variant below flips the button to\n // `items-start` and adds a block-start padding that pulls the glyph\n // up onto the title row — same cap-height compensation idea as the\n // leading icon's `mt-0.5`.\n 'ds:ms-auto ds:shrink-0 ds:inline-flex ds:items-center ds:justify-center',\n 'ds:[[data-has-title=true]_&]:items-start',\n 'ds:[[data-has-title=true]_&]:pt-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]',\n 'ds:-mt-[var(--spacing-xs)] ds:-me-[var(--spacing-xs)]',\n 'ds:text-current ds:opacity-70',\n 'ds:hover:opacity-100',\n 'ds:transition-opacity ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\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 VARIANT_CONFIG = {\n info: { icon: <Info aria-hidden=\"true\" />, role: 'status', live: 'polite' },\n success: {\n icon: <CircleCheck aria-hidden=\"true\" />,\n role: 'status',\n live: 'polite',\n },\n warning: {\n icon: <TriangleAlert aria-hidden=\"true\" />,\n role: 'alert',\n live: 'assertive',\n },\n error: {\n icon: <CircleX aria-hidden=\"true\" />,\n role: 'alert',\n live: 'assertive',\n },\n // Promotions never interrupt — same polite semantics as info.\n promo: {\n icon: <CircleArrowUp aria-hidden=\"true\" />,\n role: 'status',\n live: 'polite',\n },\n} as const;\n\ninterface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';\n}\n\nconst AlertTitle = forwardRef<HTMLHeadingElement, AlertTitleProps>(\n ({ as: Tag = 'h5', className, children, ...props }, ref) => {\n const clamp = useContext(AlertClampContext);\n const { ref: clampRef, isOverflowing } =\n useClampOverflow<HTMLHeadingElement>(clamp);\n const setRefs = useCallback(\n (node: HTMLHeadingElement | null) => {\n (clampRef as MutableRefObject<HTMLHeadingElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as MutableRefObject<HTMLHeadingElement | null>).current = node;\n },\n [ref, clampRef],\n );\n\n // The full title stays in the DOM (line-clamp only clips it visually), so\n // screen readers always read it whole. The tooltip is a sighted-user\n // affordance, shown only when the title is actually cut — and only for\n // string titles, since the Tooltip label must be plain text.\n const tooltipReady = clamp && isOverflowing && typeof children === 'string';\n\n const heading = (\n <Tag\n ref={setRefs}\n // Focusable only when truncated, so keyboard users can surface the\n // tooltip too (otherwise it would be mouse/hover-only).\n tabIndex={tooltipReady ? 0 : undefined}\n className={[\n 'type-title-item',\n clamp ? 'ds:line-clamp-2' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n {...props}\n >\n {children}\n </Tag>\n );\n\n return tooltipReady ? (\n <Tooltip label={children as string}>{heading}</Tooltip>\n ) : (\n heading\n );\n },\n);\nAlertTitle.displayName = 'Alert.Title';\n\nconst AlertDescription = forwardRef<\n HTMLParagraphElement,\n HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const clamp = useContext(AlertClampContext);\n const { t } = useTranslation();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } =\n useClampOverflow<HTMLParagraphElement>(clamp && !expanded);\n const setRefs = useCallback(\n (node: HTMLParagraphElement | null) => {\n (clampRef as MutableRefObject<HTMLParagraphElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as MutableRefObject<HTMLParagraphElement | null>).current = node;\n },\n [ref, clampRef],\n );\n // Show the toggle once the body has overflowed; keep it while expanded so\n // the user can collapse again.\n const showToggle = clamp && (isOverflowing || expanded);\n\n return (\n <>\n <p\n ref={setRefs}\n id={clamp ? bodyId : undefined}\n // `mt` is gated on the root's `data-has-title=\"true\"` attribute so\n // the margin only paints when there's a Title above the\n // Description to separate from. Without this gate, a Description\n // rendered alone sits a few pixels below the icon + dismiss ×\n // optical centre — visible on the AlfaDocs marketing privacy\n // generator before HTP-4860's follow-up fix.\n className={[\n 'ds:[[data-has-title=true]_&]:mt-[var(--spacing-xs)] type-body-sm',\n clamp && !expanded ? 'ds:line-clamp-2' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n {...props}\n >\n {children}\n </p>\n {showToggle ? (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((prev) => !prev)}\n className={DISCLOSURE_BUTTON_CLASSES}\n >\n {expanded\n ? t('feedback.alert.readLess', 'Read less')\n : t('feedback.alert.readMore', 'Read more')}\n </button>\n ) : null}\n </>\n );\n});\nAlertDescription.displayName = 'Alert.Description';\n\nconst AlertAction = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={[\n 'ds:mt-[var(--spacing-sm)] ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n {...props}\n />\n ),\n);\nAlertAction.displayName = 'Alert.Action';\n\nexport interface AlertProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role'>,\n VariantProps<typeof alertVariants> {\n variant?: 'info' | 'success' | 'warning' | 'error' | 'promo';\n dismissible?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n icon?: ReactNode;\n live?: 'assertive' | 'polite' | 'off';\n /** Compact mode: clamps `Alert.Title` to 2 lines (with a tooltip when the\n * title is truncated) and `Alert.Description` to 2 lines (with a \"Read more\"\n * toggle). Opt-in — leave off for standalone alerts whose full message must\n * always be visible. */\n clamp?: boolean;\n}\n\nexport type { AlertTitleProps };\n\nconst AlertRoot = forwardRef<HTMLDivElement, AlertProps>(\n (\n {\n variant = 'info',\n dismissible = false,\n open: controlledOpen,\n onOpenChange,\n icon,\n live,\n clamp = false,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const [isOpenRaw, setOpen] = useControllableState<boolean>({\n value: controlledOpen,\n defaultValue: true,\n onChange: onOpenChange,\n });\n const isOpen = isOpenRaw ?? true;\n const [isClosing, setIsClosing] = useState(false);\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const animationDurationMs = useCallback((): number => {\n if (typeof window === 'undefined') return 200;\n const raw = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue('--animation-duration');\n if (!raw) return 200;\n const trimmed = raw.trim();\n const n = parseFloat(trimmed);\n if (!Number.isFinite(n)) return 200;\n return trimmed.endsWith('ms') ? n : n * 1000;\n }, []);\n\n if (!isOpen) return null;\n\n const config = VARIANT_CONFIG[variant];\n const effectiveIcon = icon !== undefined ? icon : config.icon;\n\n // Detect an `<Alert.Title>` anywhere in the immediate children so\n // the root can flip its cross-axis alignment. Nested wrappers\n // around a Title aren't supported — keep the API as flat as the\n // existing `Alert.Title` / `Alert.Description` convention.\n const hasTitle = Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === AlertTitle,\n );\n\n const handleDismiss = () => {\n if (isClosing) return;\n setIsClosing(true);\n if (closeTimerRef.current) clearTimeout(closeTimerRef.current);\n closeTimerRef.current = setTimeout(() => {\n setIsClosing(false);\n setOpen(false);\n }, animationDurationMs());\n };\n\n return (\n <div\n ref={ref}\n role={config.role}\n aria-live={live ?? config.live}\n data-component=\"alert\"\n data-has-title={hasTitle ? 'true' : 'false'}\n data-state={isClosing ? 'closing' : 'open'}\n className={[\n alertVariants({ variant, className }),\n // Entry: fade + slide-down on mount. Exit: fade + slide-up + slight\n // scale when dismissed. Driven by `tw-animate-css`. Respects\n // `prefers-reduced-motion` via `motion-safe:` and zeroes under the\n // accessible theme (`--animation-duration: 0ms`).\n 'ds:motion-safe:animate-in ds:motion-safe:fade-in-0 ds:motion-safe:slide-in-from-top-2',\n 'ds:motion-safe:data-[state=closing]:animate-out ds:motion-safe:data-[state=closing]:fade-out-0',\n 'ds:motion-safe:data-[state=closing]:slide-out-to-top-2 ds:motion-safe:data-[state=closing]:zoom-out-95',\n // Pin the exit's end-state until React unmounts. Without\n // `fill-mode-forwards` the element snaps back to opacity:1 for one\n // paint frame after the animation ends.\n 'ds:motion-safe:data-[state=closing]:fill-mode-forwards',\n 'ds:motion-safe:duration-[var(--animation-duration)]',\n ].join(' ')}\n {...props}\n >\n {effectiveIcon ? (\n <span className={hasTitle ? ICON_WITH_TITLE : ICON_BASE}>\n {effectiveIcon}\n </span>\n ) : null}\n\n <div className=\"ds:flex-1 ds:min-w-0\">\n <AlertClampContext.Provider value={clamp}>\n {children}\n </AlertClampContext.Provider>\n </div>\n\n {dismissible ? (\n <button\n type=\"button\"\n aria-label={t('common.close', 'Close')}\n onClick={handleDismiss}\n // Stable hook for containers (WarningStack) that hand focus to\n // a neighbouring dismiss control after this one unmounts.\n data-alert-dismiss=\"\"\n className={CLOSE_BUTTON_CLASSES}\n >\n <X aria-hidden=\"true\" className=\"ds:size-4\" />\n </button>\n ) : null}\n </div>\n );\n },\n);\n\nAlertRoot.displayName = 'Alert';\n\nexport const Alert = Object.assign(AlertRoot, {\n Title: AlertTitle,\n Description: AlertDescription,\n Action: AlertAction,\n});\n"],"names":["__iconNode","CircleArrowUp","createLucideIcon","AlertClampContext","createContext","DISCLOSURE_BUTTON_CLASSES","alertVariants","cva","ICON_BASE","ICON_WITH_TITLE","CLOSE_BUTTON_CLASSES","VARIANT_CONFIG","jsx","Info","CircleCheck","TriangleAlert","CircleX","AlertTitle","forwardRef","Tag","className","children","props","ref","clamp","useContext","clampRef","isOverflowing","useClampOverflow","setRefs","useCallback","node","tooltipReady","heading","Tooltip","AlertDescription","t","useTranslation","bodyId","useId","expanded","setExpanded","useState","showToggle","jsxs","Fragment","prev","AlertAction","AlertRoot","variant","dismissible","controlledOpen","onOpenChange","icon","live","isOpenRaw","setOpen","useControllableState","isOpen","isClosing","setIsClosing","closeTimerRef","useRef","animationDurationMs","raw","trimmed","n","config","effectiveIcon","hasTitle","Children","child","isValidElement","handleDismiss","X","Alert"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,kBAAkB,KAAK,SAAQ,CAAE;AAAA,EAC/C,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,GACMC,KAAgBC,EAAiB,mBAAmBF,EAAU,GCmB9DG,IAAoBC,EAAc,EAAK,GAIvCC,KAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG,GAEJC,KAAgBC;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMR,SAAS;AAAA,QACP,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA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 @@
1
- import { c } from "./createLucideIcon-DhHxpK9K.js";
2
- /**
3
- * @license lucide-react v1.22.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const e = [
9
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
10
- ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
11
- ["path", { d: "m9 9 6 6", key: "z0biqf" }]
12
- ], o = c("circle-x", e);
13
- export {
14
- o as C
15
- };
16
- //# sourceMappingURL=circle-x-W8Enq3i4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circle-x-W8Enq3i4.js","sources":["../../node_modules/lucide-react/dist/esm/icons/circle-x.mjs"],"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 [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"m15 9-6 6\", key: \"1uzhvr\" }],\n [\"path\", { d: \"m9 9 6 6\", key: \"z0biqf\" }]\n];\nconst CircleX = createLucideIcon(\"circle-x\", __iconNode);\n\nexport { __iconNode, CircleX as default };\n//# sourceMappingURL=circle-x.mjs.map\n"],"names":["__iconNode","CircleX","createLucideIcon"],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAAA,EAC1C,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,GACMC,IAAUC,EAAiB,YAAYF,CAAU;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"document-scanner-B6h1Ir56.js","sources":["../../src/components/document-scanner/document-scanner.agent.ts","../../src/components/document-scanner/document-scanner.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentScanner. */\n/* */\n/* State exposes only structural lifecycle info — never the captured */\n/* image bytes (PHI). Actions drive the camera + capture flow. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentScannerHandle } from './document-scanner';\n\nexport const documentScannerAgent: AgentAdapter<DocumentScannerHandle> = {\n id: 'document-scanner',\n capabilities: ['capture', 'submit'],\n state: {\n hasCapture: {\n type: 'boolean',\n descriptionKey: 'documentScanner.agent.state.hasCapture',\n description: 'True when a captured or uploaded image is available.',\n read: (handle) => handle.hasCapture(),\n },\n phase: {\n type: 'string',\n descriptionKey: 'documentScanner.agent.state.phase',\n description:\n \"Lifecycle phase: 'idle' | 'requesting' | 'streaming' | 'captured' | 'error'.\",\n read: (handle) => handle.getPhase(),\n },\n },\n actions: {\n start_camera: {\n safety: 'write',\n idempotent: true,\n descriptionKey: 'documentScanner.agent.actions.startCamera',\n description: 'Request camera permission and begin the live viewfinder.',\n errors: [\n 'permission-denied',\n 'no-camera',\n 'not-readable',\n 'insecure-context',\n ],\n invoke: (handle) => handle.startCamera(),\n },\n capture: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.capture',\n description: 'Freeze the current viewfinder frame as a captured image.',\n errors: ['capture-failed'],\n invoke: (handle) => handle.capture(),\n },\n submit: {\n safety: 'write',\n descriptionKey: 'documentScanner.agent.actions.confirm',\n description: 'Confirm the current capture, emitting it via onConfirm.',\n invoke: (handle) => {\n handle.confirm();\n },\n },\n retake: {\n safety: 'destructive',\n descriptionKey: 'documentScanner.agent.actions.retake',\n description:\n 'Discard the current capture and return to the capture path.',\n invoke: (handle) => {\n handle.retake();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-scanner',\n description: 'Marks the DocumentScanner wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DocumentScanner — patient check-in ID-document capture. */\n/* */\n/* - Native MediaDevices: a live <video autoplay playsinline muted> */\n/* viewfinder via getUserMedia({ video: { facingMode } }), an */\n/* offscreen <canvas> for the freeze-frame / crop draw, and an <img> */\n/* for the captured preview. No third-party dependency for capture. */\n/* - Upload fallback: the existing kit FileUpload (variant='button') */\n/* handles accept / maxSize / reject and is ALWAYS reachable — even */\n/* on a hard camera error it is the recovery path (per HTP-5113). */\n/* - Lifecycle: the camera starts only on an explicit user gesture and */\n/* every MediaStreamTrack is stopped on unmount, on capture, on */\n/* error, on Escape, and on document visibilitychange→hidden so the */\n/* camera LED is released (privacy + battery). Mirrors */\n/* audio-recorder's teardown pattern. */\n/* - Confirm payload: { dataUrl, blob, source, width, height, mimeType, */\n/* byteSize, capturedAt (ISO-8601), sha256 }. sha256 is the */\n/* SubtleCrypto digest of the encoded bytes — tamper-evident for */\n/* audit, matching signature-capture. Document-only: no selfie, no */\n/* liveness, no OCR / MRZ / auto-crop (out of scope, would need a */\n/* separate 08-third-party dependency). */\n/* - Security: no fetch / XHR / localStorage / sessionStorage / globals */\n/* in this file — the captured ID document is PHI and the consumer */\n/* owns persistence + the \"already on file → skip\" decision. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\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 { Camera, RotateCcw, Check, Loader2 } from 'lucide-react';\nimport { Button } from '../button';\nimport { Alert } from '../alert';\nimport { FileUpload, type FileUploadRejection } from '../file-upload';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useAgentRegistration } from '../../agent';\nimport { documentScannerAgent } from './document-scanner.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentScannerSource = 'camera' | 'upload';\n\nexport interface DocumentCapture {\n /** Data URL of the captured / uploaded image (encoded to `mimeType`). */\n dataUrl: string;\n /** Encoded bytes as a Blob — the consumer persists this. */\n blob: Blob;\n /** Where the image came from. */\n source: DocumentScannerSource;\n /** Intrinsic pixel width of the encoded image. */\n width: number;\n /** Intrinsic pixel height of the encoded image. */\n height: number;\n /** MIME of the encoded image. */\n mimeType: string;\n /** Encoded byte size. */\n byteSize: number;\n /** ISO-8601 UTC timestamp for when the capture was confirmed. */\n capturedAt: string;\n /** Hex-encoded SHA-256 digest of the encoded bytes. */\n sha256: string;\n}\n\nexport type DocumentScannerErrorKind =\n | 'permission-denied'\n | 'no-camera'\n | 'not-readable'\n | 'insecure-context'\n | 'capture-failed'\n | 'file-invalid-type'\n | 'file-too-large';\n\nexport interface DocumentScannerError {\n kind: DocumentScannerErrorKind;\n}\n\nexport type DocumentType = 'tessera-sanitaria' | 'cie' | 'id-card' | 'generic';\n\nexport type DocumentScannerPhase =\n | 'idle'\n | 'requesting'\n | 'streaming'\n | 'captured'\n | 'error';\n\n/** Curated imperative handle for agent / external automation. */\nexport interface DocumentScannerHandle {\n /** True when a captured or uploaded image is held. */\n hasCapture: () => boolean;\n /** Current lifecycle phase. */\n getPhase: () => DocumentScannerPhase;\n /** Request the camera and begin the viewfinder. */\n startCamera: () => Promise<void> | void;\n /** Freeze the current viewfinder frame. */\n capture: () => Promise<void> | void;\n /** Confirm the current capture, firing `onConfirm`. */\n confirm: () => void;\n /** Discard the current capture and return to the capture path. */\n retake: () => void;\n}\n\nexport interface DocumentScannerProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Controlled captured-image value. When defined the component is controlled. */\n value?: DocumentCapture | null;\n /** Initial captured image for uncontrolled use; seeds the `captured` preview. */\n defaultValue?: DocumentCapture | null;\n /** Fired when the user confirms a captured or uploaded image. */\n onConfirm?: (capture: DocumentCapture) => void;\n /** Fired when the user discards the current capture to retake / re-upload. */\n onRetake?: () => void;\n /** Fired on a permission / hardware / decode failure (telemetry). */\n onError?: (error: DocumentScannerError) => void;\n /** Drives the overlay frame aspect ratio + the translated hint copy. */\n documentType?: DocumentType;\n /** Camera-vs-upload strategy. `auto` falls back to upload on camera failure. */\n captureMode?: 'auto' | 'camera-only' | 'upload-only';\n /** react-dropzone accept map for the upload fallback. */\n accept?: Record<string, string[]>;\n /** Max upload byte size. Defaults to 10MB. */\n maxSize?: number;\n /** Camera to request. Defaults to the rear (`environment`) camera. */\n facingMode?: 'environment' | 'user';\n /** MIME of the encoded capture. */\n outputType?: 'image/jpeg' | 'image/webp' | 'image/png';\n /** 0..1 quality for lossy `outputType`. Ignored for image/png. */\n outputQuality?: number;\n /** Crop the confirmed image to the overlay frame rect. */\n cropToFrame?: boolean;\n /** Disable all controls and skip the camera request. */\n disabled?: boolean;\n /** Accessible label for the component's group region. */\n ariaLabel?: string;\n /** Extra classes merged onto the outermost wrapper. */\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rootVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:p-[var(--spacing-md)]',\n 'ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:[max-inline-size:20rem]',\n md: 'ds:[max-inline-size:28rem]',\n lg: 'ds:[max-inline-size:36rem]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n// The viewport is a positioned, neutral surface that holds the <video> /\n// <img> and the (absolutely-positioned, aria-hidden) frame overlay. The\n// document aspect ratio drives the box shape so the frame matches the card.\nconst viewportVariants = cva(\n [\n 'ds:relative ds:block ds:inline-size-full ds:overflow-hidden',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:bg-[var(--muted)]',\n ].join(' '),\n {\n variants: {\n // ID-1 cards (Tessera Sanitaria / CIE / id-card) are ~1.586:1; the\n // generic frame is a slightly squarer neutral card.\n frame: {\n 'tessera-sanitaria': 'ds:aspect-[1.586/1]',\n cie: 'ds:aspect-[1.586/1]',\n 'id-card': 'ds:aspect-[1.586/1]',\n generic: 'ds:aspect-[1.4/1]',\n },\n },\n defaultVariants: { frame: 'tessera-sanitaria' },\n },\n);\n\nconst mediaVariants = cva(\n [\n 'ds:absolute ds:inset-0 ds:block',\n 'ds:inline-size-full ds:block-size-full',\n 'ds:object-cover',\n ].join(' '),\n);\n\n// The alignment frame sits over arbitrary live video. It is a\n// high-contrast neutral stroke (var(--background) = white on light /\n// near-black on dark) backed by a tokenised scrim — NEVER the magenta\n// accent (fails AA over an unknown image). Decorative → aria-hidden.\nconst frameOverlayVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute',\n 'ds:inset-[12%]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:border-2 ds:border-[color:var(--background)]',\n 'ds:shadow-[0_0_0_100vmax_color-mix(in_srgb,var(--foreground)_45%,transparent)]',\n ].join(' '),\n);\n\nconst cornerVariants = cva(\n [\n 'ds:pointer-events-none ds:absolute ds:size-6',\n 'ds:border-[color:var(--background)]',\n ].join(' '),\n);\n\nconst controlBarVariants = cva(\n [\n // Phone: actions stack full-width; sm+: a wrapping row.\n 'ds:flex ds:flex-col ds:items-stretch ds:gap-[var(--spacing-sm)]',\n 'ds:sm:flex-row ds:sm:flex-wrap ds:sm:items-center',\n ].join(' '),\n);\n\nconst hintVariants = cva(\n ['type-body-sm ds:text-center', 'ds:text-[var(--muted-foreground)]'].join(\n ' ',\n ),\n);\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (let i = 0; i < bytes.length; i += 1) {\n out += bytes[i].toString(16).padStart(2, '0');\n }\n return out;\n}\n\nasync function sha256Hex(buffer: ArrayBuffer): Promise<string> {\n const g = globalThis as { crypto?: Crypto };\n if (g.crypto?.subtle) {\n // Copy into a fresh ArrayBuffer so the BufferSource is never a\n // SharedArrayBuffer (SubtleCrypto's narrowing rejects the latter).\n const copy = new Uint8Array(buffer.byteLength);\n copy.set(new Uint8Array(buffer));\n const digest = await g.crypto.subtle.digest('SHA-256', copy.buffer);\n return toHex(new Uint8Array(digest));\n }\n // No subtle crypto (older test env) — return empty so the rest of the\n // payload is still usable. Tests stub crypto.subtle.\n return '';\n}\n\n/** Map a getUserMedia rejection (a DOMException) to our error kind. */\nfunction classifyMediaError(err: unknown): DocumentScannerErrorKind {\n const name = err instanceof Error ? err.name : '';\n if (name === 'NotAllowedError' || name === 'SecurityError') {\n return 'permission-denied';\n }\n if (name === 'NotFoundError' || name === 'OverconstrainedError') {\n return 'no-camera';\n }\n if (name === 'NotReadableError' || name === 'AbortError') {\n return 'not-readable';\n }\n return 'capture-failed';\n}\n\n/** True when getUserMedia is actually reachable (HTTPS / localhost + API). */\nfunction mediaDevicesAvailable(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.mediaDevices !== 'undefined' &&\n typeof navigator.mediaDevices.getUserMedia === 'function'\n );\n}\n\nconst HINT_KEY: Record<DocumentType, string> = {\n 'tessera-sanitaria': 'documentScanner.hint.tesseraSanitaria',\n cie: 'documentScanner.hint.cie',\n 'id-card': 'documentScanner.hint.idCard',\n generic: 'documentScanner.hint.generic',\n};\n\nconst ERROR_KEY: Record<DocumentScannerErrorKind, string> = {\n 'permission-denied': 'documentScanner.error.permissionDenied',\n 'no-camera': 'documentScanner.error.noCamera',\n 'not-readable': 'documentScanner.error.notReadable',\n 'insecure-context': 'documentScanner.error.insecureContext',\n 'capture-failed': 'documentScanner.error.captureFailed',\n 'file-invalid-type': 'documentScanner.error.fileInvalidType',\n 'file-too-large': 'documentScanner.error.fileTooLarge',\n};\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\ntype SizeVariant = NonNullable<VariantProps<typeof rootVariants>['size']>;\n\ninterface DocumentScannerInternalProps extends DocumentScannerProps {\n /** Visual size variant (exposed via Controls). */\n size?: SizeVariant;\n}\n\nexport const DocumentScanner = forwardRef<\n DocumentScannerHandle,\n DocumentScannerInternalProps\n>(\n (\n {\n id,\n value,\n defaultValue = null,\n onConfirm,\n onRetake,\n onError,\n documentType = 'tessera-sanitaria',\n captureMode = 'auto',\n accept = {\n 'image/jpeg': ['.jpg', '.jpeg'],\n 'image/png': ['.png'],\n 'image/webp': ['.webp'],\n },\n maxSize = 10 * 1024 * 1024,\n facingMode = 'environment',\n outputType = 'image/jpeg',\n outputQuality = 0.92,\n cropToFrame = true,\n disabled = false,\n size = 'md',\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const rawId = useId();\n const hintId = `ds-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}-hint`;\n\n // Controlled / uncontrolled captured value. `value` defined → controlled.\n const [capture, setCapture] = useControllableState<DocumentCapture | null>({\n value,\n defaultValue,\n });\n\n // Whether the captured value was seeded by `defaultValue` (already on\n // file) — drives the \"Already on file\" badge + Retake-only chrome.\n const seededRef = useRef<boolean>(defaultValue != null || value != null);\n\n const [phase, setPhase] = useState<DocumentScannerPhase>(\n defaultValue != null || value != null ? 'captured' : 'idle',\n );\n const [errorKind, setErrorKind] = useState<DocumentScannerErrorKind | null>(\n null,\n );\n const [streamReady, setStreamReady] = useState(false);\n // True while an uploaded image is being decoded (distinct from the\n // camera-permission `requesting` so the live region announces the right\n // \"Processing image\" copy).\n const [decoding, setDecoding] = useState(false);\n\n const videoRef = useRef<HTMLVideoElement>(null);\n const viewportRef = useRef<HTMLDivElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const unmountedRef = useRef(false);\n\n const confirmBtnRef = useRef<HTMLButtonElement>(null);\n const shutterBtnRef = useRef<HTMLButtonElement>(null);\n const useCameraBtnRef = useRef<HTMLButtonElement>(null);\n const recoveryRef = useRef<HTMLButtonElement>(null);\n\n // Latest callbacks via refs so the async media path never closes over\n // a stale prop.\n const onErrorRef = useRef(onError);\n const onConfirmRef = useRef(onConfirm);\n const onRetakeRef = useRef(onRetake);\n useEffect(() => {\n onErrorRef.current = onError;\n onConfirmRef.current = onConfirm;\n onRetakeRef.current = onRetake;\n }, [onError, onConfirm, onRetake]);\n\n const isControlled = value !== undefined;\n const isUploadOnly = captureMode === 'upload-only';\n\n /* ---- Stream teardown — the single most important privacy path ---- */\n const stopStream = useCallback(() => {\n const held = streamRef.current;\n if (held) {\n held.getTracks().forEach((track) => track.stop());\n }\n streamRef.current = null;\n const video = videoRef.current;\n if (video) {\n // Detach so the element releases its reference to the (now-stopped)\n // stream and the browser drops the camera indicator.\n video.srcObject = null;\n }\n setStreamReady(false);\n }, []);\n\n const reportError = useCallback((kind: DocumentScannerErrorKind) => {\n setErrorKind(kind);\n setPhase('error');\n onErrorRef.current?.({ kind });\n }, []);\n\n /* ---- Start the camera — user gesture only, never auto on mount ---- */\n const startCamera = useCallback(async () => {\n if (disabled || isUploadOnly) return;\n if (!mediaDevicesAvailable()) {\n // No mediaDevices → insecure context (non-HTTPS) or unsupported.\n reportError('insecure-context');\n return;\n }\n setErrorKind(null);\n setPhase('requesting');\n try {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode },\n audio: false,\n });\n // Guard against an unmount between the permission prompt and\n // resolution — otherwise the freshly-acquired track leaks and the\n // camera LED stays live.\n if (unmountedRef.current) {\n stream.getTracks().forEach((track) => track.stop());\n return;\n }\n streamRef.current = stream;\n const video = videoRef.current;\n if (video) {\n try {\n video.srcObject = stream;\n } catch {\n // Some environments reject a non-native MediaStream on\n // srcObject; the stream is still held + torn down correctly.\n }\n // iOS Safari needs an explicit play() after attaching.\n const playResult = video.play?.();\n if (playResult && typeof playResult.catch === 'function') {\n playResult.catch(() => {\n /* autoplay can reject silently in some browsers; the\n loadedmetadata handler still enables the shutter */\n });\n }\n }\n setPhase('streaming');\n } catch (err: unknown) {\n stopStream();\n reportError(classifyMediaError(err));\n }\n }, [disabled, isUploadOnly, facingMode, stopStream, reportError]);\n\n /* ---- Shutter enablement: gate on the video actually playing ---- */\n const handleVideoReady = useCallback(() => {\n const video = videoRef.current;\n if (!video) return;\n // HAVE_CURRENT_DATA (2) means at least one frame is decodable.\n if (video.readyState >= 2) {\n setStreamReady(true);\n }\n }, []);\n\n /* ---- Poll readiness on entering streaming ---- */\n // The loadedmetadata / canplay events can fire before React attaches the\n // listeners (the metadata may already be decoded by the time the stream\n // is swapped onto the element). A short poll closes that race so the\n // shutter reliably enables.\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n handleVideoReady();\n const interval = window.setInterval(handleVideoReady, 100);\n const stopAfter = window.setTimeout(\n () => window.clearInterval(interval),\n 4000,\n );\n return () => {\n window.clearInterval(interval);\n window.clearTimeout(stopAfter);\n };\n }, [phase, handleVideoReady]);\n\n /* ---- Capture: freeze the current frame onto a canvas ---- */\n const capturePhoto = useCallback(async () => {\n const video = videoRef.current;\n if (!video || video.readyState < 2) {\n reportError('capture-failed');\n return;\n }\n const vw = video.videoWidth || video.clientWidth;\n const vh = video.videoHeight || video.clientHeight;\n if (vw === 0 || vh === 0) {\n reportError('capture-failed');\n return;\n }\n\n // Crop region in source-video pixel space. The overlay frame is\n // inset 12% on each edge of the viewport; mirror that onto the\n // source so the cropped image is the document, not the whole frame.\n let sx = 0;\n let sy = 0;\n let sw = vw;\n let sh = vh;\n if (cropToFrame) {\n const insetX = vw * 0.12;\n const insetY = vh * 0.12;\n sx = insetX;\n sy = insetY;\n sw = vw - insetX * 2;\n sh = vh - insetY * 2;\n }\n\n const canvas = document.createElement('canvas');\n canvas.width = Math.max(1, Math.round(sw));\n canvas.height = Math.max(1, Math.round(sh));\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n reportError('capture-failed');\n return;\n }\n try {\n ctx.drawImage(video, sx, sy, sw, sh, 0, 0, canvas.width, canvas.height);\n } catch {\n // A video element with no decoded frame throws InvalidStateError in\n // some browsers — surface it as a capture failure rather than crash.\n reportError('capture-failed');\n return;\n }\n\n // Release the camera as soon as the frame is frozen — we no longer\n // need the live stream and the LED should go dark immediately.\n stopStream();\n\n const blob = await new Promise<Blob | null>((resolve) => {\n if (typeof canvas.toBlob === 'function') {\n canvas.toBlob(\n (b) => resolve(b),\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n } else {\n resolve(null);\n }\n });\n if (!blob) {\n reportError('capture-failed');\n return;\n }\n const dataUrl = canvas.toDataURL(\n outputType,\n outputType === 'image/png' ? undefined : outputQuality,\n );\n const arrayBuffer = await blob.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n const next: DocumentCapture = {\n dataUrl,\n blob,\n source: 'camera',\n width: canvas.width,\n height: canvas.height,\n mimeType: outputType,\n byteSize: blob.size,\n capturedAt: new Date().toISOString(),\n sha256,\n };\n setCapture(next);\n setPhase('captured');\n }, [\n cropToFrame,\n outputType,\n outputQuality,\n stopStream,\n reportError,\n setCapture,\n ]);\n\n /* ---- Upload fallback → decode an image File into a capture ---- */\n const handleUploadDrop = useCallback(\n async (accepted: File[]) => {\n const file = accepted[0];\n if (!file) return;\n setDecoding(true);\n try {\n const objectUrl = URL.createObjectURL(file);\n const dimensions = await new Promise<{ w: number; h: number }>(\n (resolve, reject) => {\n const img = new Image();\n img.onload = () =>\n resolve({ w: img.naturalWidth, h: img.naturalHeight });\n img.onerror = () => reject(new Error('decode-failed'));\n img.src = objectUrl;\n },\n ).finally(() => {\n // The object URL is only needed to read intrinsic dimensions;\n // the persisted payload carries a data URL instead.\n URL.revokeObjectURL(objectUrl);\n });\n\n const dataUrl = await new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(new Error('read-failed'));\n reader.readAsDataURL(file);\n });\n\n const arrayBuffer = await file.arrayBuffer();\n const sha256 = await sha256Hex(arrayBuffer);\n\n seededRef.current = false;\n setErrorKind(null);\n setCapture({\n dataUrl,\n blob: file,\n source: 'upload',\n width: dimensions.w,\n height: dimensions.h,\n mimeType: file.type || outputType,\n byteSize: file.size,\n capturedAt: new Date().toISOString(),\n sha256,\n });\n setPhase('captured');\n } catch {\n reportError('capture-failed');\n } finally {\n setDecoding(false);\n }\n },\n [outputType, reportError, setCapture],\n );\n\n const handleUploadReject = useCallback(\n (rejections: FileUploadRejection[]) => {\n // FileUpload's reason enum is wider than our two error kinds. The\n // dropzone is locked to a single image (maxFiles:1, multiple:false),\n // so 'too-many-files' / 'file-too-small' are unreachable here; both\n // size/type problems fold into the matching inline message and\n // default to invalid-type for anything else.\n const reason = rejections[0]?.reason;\n const kind: DocumentScannerErrorKind =\n reason === 'file-too-large' ? 'file-too-large' : 'file-invalid-type';\n reportError(kind);\n },\n [reportError],\n );\n\n /* ---- Confirm / Retake ---- */\n const confirm = useCallback(() => {\n if (!capture) return;\n onConfirmRef.current?.(capture);\n }, [capture]);\n\n // Set when a user-initiated transition back to idle should move focus to\n // the Use-camera button (Retake). Distinguishes retake-to-idle from the\n // initial idle mount, so focus is never stolen on first paint.\n const focusUseCameraRef = useRef(false);\n\n const retake = useCallback(() => {\n // Controlled mode: retake is advisory only. The consumer owns `value`,\n // so we must NOT clear the capture, flip seededRef, or force a local\n // phase — doing so would race the controlled-value sync effect (which\n // re-asserts `captured` while value is still set), dropping the\n // \"already on file\" badge and surfacing a stray Confirm for an\n // already-persisted image. Emit onRetake and let the value drive phase.\n if (isControlled) {\n onRetakeRef.current?.();\n return;\n }\n seededRef.current = false;\n focusUseCameraRef.current = true;\n setCapture(null);\n setErrorKind(null);\n setDecoding(false);\n setPhase('idle');\n onRetakeRef.current?.();\n }, [isControlled, setCapture]);\n\n /* ---- Focus management on phase transitions ---- */\n useEffect(() => {\n if (phase === 'captured' && !seededRef.current) {\n // Land the keyboard / SR user on the next logical action.\n confirmBtnRef.current?.focus();\n } else if (phase === 'error') {\n recoveryRef.current?.focus();\n } else if (phase === 'idle' && focusUseCameraRef.current) {\n // After a Retake, return focus to the capture entry point. Never on\n // the initial idle mount (the flag is only set by retake()).\n focusUseCameraRef.current = false;\n useCameraBtnRef.current?.focus();\n }\n }, [phase]);\n\n /* ---- Escape from streaming returns to idle and stops the stream ---- */\n useEffect(() => {\n if (phase !== 'streaming') return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [phase, stopStream]);\n\n /* ---- Release the camera when the tab is hidden ---- */\n useEffect(() => {\n const onVisibility = () => {\n if (document.visibilityState === 'hidden' && streamRef.current) {\n stopStream();\n setPhase('idle');\n }\n };\n document.addEventListener('visibilitychange', onVisibility);\n return () =>\n document.removeEventListener('visibilitychange', onVisibility);\n }, [stopStream]);\n\n /* ---- Unmount cleanup: release the camera if still held ---- */\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n const held = streamRef.current;\n if (held) held.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n };\n }, []);\n\n /* ---- Sync controlled value → phase ---- */\n useEffect(() => {\n if (!isControlled) return;\n if (value != null) {\n setPhase('captured');\n } else if (phase === 'captured') {\n setPhase('idle');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, isControlled]);\n\n /* ---- Imperative handle + agent registration ---- */\n const agentHandle = useMemo<DocumentScannerHandle>(\n () => ({\n hasCapture: () => capture != null,\n getPhase: () => phase,\n startCamera: () => startCamera(),\n capture: () => capturePhoto(),\n confirm: () => confirm(),\n retake: () => retake(),\n }),\n [capture, phase, startCamera, capturePhoto, confirm, retake],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(documentScannerAgent, agentHandle, id);\n\n /* ---- Derived strings ---- */\n const regionLabel = ariaLabel ?? t('documentScanner.regionLabel');\n const hintText = t(HINT_KEY[documentType]);\n const maxSizeMb = Math.round(maxSize / (1024 * 1024));\n\n const statusText = (() => {\n if (decoding) return t('documentScanner.state.uploading');\n switch (phase) {\n case 'idle':\n return t('documentScanner.state.idle');\n case 'requesting':\n return t('documentScanner.state.requesting');\n case 'streaming':\n return t('documentScanner.state.streaming');\n case 'captured':\n return t('documentScanner.state.captured');\n case 'error':\n return errorKind\n ? t(ERROR_KEY[errorKind], { maxSizeMb })\n : t('documentScanner.error.captureFailed');\n }\n })();\n\n // A camera retry only makes sense for a hardware/permission failure —\n // not for upload-side rejections or an insecure (non-HTTPS) context.\n const canRetryCamera =\n !isUploadOnly &&\n errorKind !== 'file-invalid-type' &&\n errorKind !== 'file-too-large' &&\n errorKind !== 'insecure-context';\n\n // The upload affordance is always reachable: shown in idle/error for\n // auto + camera-only, primary in upload-only, and the recovery path on\n // any hard camera error.\n const showUploadFallback =\n !disabled &&\n (captureMode === 'auto' ||\n captureMode === 'upload-only' ||\n phase === 'error');\n\n const uploadAffordance = (\n <FileUpload\n variant=\"button\"\n accept={accept}\n maxSize={maxSize}\n multiple={false}\n maxFiles={1}\n disabled={disabled}\n showPreview={false}\n onDrop={(acceptedFiles) => {\n void handleUploadDrop(acceptedFiles);\n }}\n onReject={handleUploadReject}\n />\n );\n\n /* ---- Render ---- */\n const showViewport =\n phase === 'idle' ||\n phase === 'requesting' ||\n phase === 'streaming' ||\n phase === 'error';\n\n return (\n <div\n role=\"group\"\n aria-label={regionLabel}\n aria-disabled={disabled || undefined}\n className={[rootVariants({ size }), className]\n .filter(Boolean)\n .join(' ')}\n data-component=\"document-scanner\"\n data-component-id={id}\n data-phase={phase}\n >\n {/* Polite live region — announces every phase change to SR users. */}\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n data-testid=\"document-scanner-live\"\n >\n {statusText}\n </span>\n\n {phase === 'captured' && capture ? (\n /* ---- Captured preview ---- */\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className={viewportVariants({ frame: documentType })}>\n <img\n src={capture.dataUrl}\n alt={t('documentScanner.previewAlt')}\n className={mediaVariants()}\n data-testid=\"document-scanner-preview\"\n />\n {seededRef.current ? (\n <span className=\"ds:absolute ds:top-[var(--spacing-sm)] ds:start-[var(--spacing-sm)] ds:rounded-[var(--radius-full)] ds:border ds:border-[color:color-mix(in_srgb,var(--foreground)_15%,transparent)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] type-meta\">\n {t('documentScanner.onFileBadge')}\n </span>\n ) : null}\n </div>\n <div className={controlBarVariants()}>\n <Button\n intent=\"secondary\"\n size=\"md\"\n // Button's md variant is h-10 (40px) with no min-target\n // compensation — pin to --min-target-size (44/48px) to clear\n // WCAG 2.5.5, matching SignatureCapture's action buttons.\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<RotateCcw aria-hidden=\"true\" />}\n onClick={retake}\n disabled={disabled}\n >\n {t('documentScanner.retake')}\n </Button>\n {/* Seeded \"already on file\" images need no Confirm — they are\n already persisted; the only action is Retake. */}\n {seededRef.current ? null : (\n <Button\n ref={confirmBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n startIcon={<Check aria-hidden=\"true\" />}\n onClick={confirm}\n disabled={disabled || capture == null}\n >\n {t('documentScanner.confirm')}\n </Button>\n )}\n </div>\n </div>\n ) : null}\n\n {showViewport ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Viewport — only meaningful while streaming/requesting; in\n idle/error it is a neutral placeholder behind the controls. */}\n {!isUploadOnly && phase !== 'error' ? (\n <div\n ref={viewportRef}\n className={viewportVariants({ frame: documentType })}\n aria-busy={phase === 'requesting' || undefined}\n >\n <video\n ref={videoRef}\n autoPlay\n playsInline\n muted\n aria-label={t('documentScanner.videoLabel')}\n className={mediaVariants()}\n onLoadedMetadata={handleVideoReady}\n onCanPlay={handleVideoReady}\n data-testid=\"document-scanner-video\"\n />\n {phase === 'requesting' ? (\n <div className=\"ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-[color-mix(in_srgb,var(--foreground)_20%,transparent)]\">\n <Loader2\n aria-hidden=\"true\"\n className=\"ds:size-8 ds:animate-spin ds:text-[var(--background)] ds:motion-reduce:animate-none\"\n />\n </div>\n ) : null}\n {/* Decorative alignment frame + corner guides. */}\n <div\n aria-hidden=\"true\"\n className={frameOverlayVariants()}\n data-testid=\"document-scanner-frame\"\n >\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:start-0 ds:border-t-2 ds:border-s-2 ds:rounded-ss-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:top-0 ds:end-0 ds:border-t-2 ds:border-e-2 ds:rounded-se-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:start-0 ds:border-b-2 ds:border-s-2 ds:rounded-es-[var(--radius-sm)]',\n ].join(' ')}\n />\n <span\n className={[\n cornerVariants(),\n 'ds:bottom-0 ds:end-0 ds:border-b-2 ds:border-e-2 ds:rounded-ee-[var(--radius-sm)]',\n ].join(' ')}\n />\n </div>\n </div>\n ) : null}\n\n {phase === 'streaming' ? (\n <p id={hintId} className={hintVariants()}>\n {hintText}\n </p>\n ) : null}\n\n {/* Error block — Alert pattern with the upload recovery path. */}\n {phase === 'error' && errorKind ? (\n <Alert variant=\"error\" live=\"assertive\">\n <Alert.Description>\n {t(ERROR_KEY[errorKind], { maxSizeMb })}\n </Alert.Description>\n <Alert.Action>\n {/* The camera-retry button is the focus target on a\n hardware/permission error; for upload-side or\n insecure-context errors there is nothing to retry and\n the upload affordance is the recovery path. */}\n {canRetryCamera ? (\n <Button\n ref={recoveryRef}\n intent=\"secondary\"\n size=\"sm\"\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.retry')}\n </Button>\n ) : null}\n {showUploadFallback ? uploadAffordance : null}\n </Alert.Action>\n </Alert>\n ) : null}\n\n {/* Primary control bar (no hard error). */}\n {phase !== 'error' ? (\n <div className={controlBarVariants()}>\n {phase === 'streaming' ? (\n <Button\n ref={shutterBtnRef}\n intent=\"primary\"\n size=\"lg\"\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void capturePhoto();\n }}\n disabled={disabled || !streamReady}\n aria-describedby={hintId}\n aria-label={t('documentScanner.capture')}\n >\n {t('documentScanner.capture')}\n </Button>\n ) : null}\n\n {(phase === 'idle' || phase === 'requesting') &&\n !isUploadOnly ? (\n <Button\n ref={useCameraBtnRef}\n intent=\"primary\"\n size=\"md\"\n className=\"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]\"\n loading={phase === 'requesting'}\n startIcon={<Camera aria-hidden=\"true\" />}\n onClick={() => {\n void startCamera();\n }}\n disabled={disabled}\n >\n {t('documentScanner.useCamera')}\n </Button>\n ) : null}\n\n {decoding ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[var(--muted-foreground)]\">\n <Loader2\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:animate-spin ds:motion-reduce:animate-none\"\n />\n {t('documentScanner.state.uploading')}\n </span>\n ) : showUploadFallback && phase !== 'streaming' ? (\n uploadAffordance\n ) : null}\n\n {/* In streaming, upload stays reachable as a low-emphasis\n fallback below the shutter. */}\n {phase === 'streaming' && captureMode !== 'camera-only'\n ? uploadAffordance\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nDocumentScanner.displayName = 'DocumentScanner';\n\nexport {\n rootVariants as documentScannerRootVariants,\n viewportVariants as documentScannerViewportVariants,\n};\n"],"names":["documentScannerAgent","handle","rootVariants","cva","viewportVariants","mediaVariants","frameOverlayVariants","cornerVariants","controlBarVariants","hintVariants","toHex","bytes","out","i","sha256Hex","buffer","g","_a","copy","digest","classifyMediaError","err","name","mediaDevicesAvailable","HINT_KEY","ERROR_KEY","DocumentScanner","forwardRef","id","value","defaultValue","onConfirm","onRetake","onError","documentType","captureMode","accept","maxSize","facingMode","outputType","outputQuality","cropToFrame","disabled","size","ariaLabel","className","ref","t","useTranslation","hintId","useId","capture","setCapture","useControllableState","seededRef","useRef","phase","setPhase","useState","errorKind","setErrorKind","streamReady","setStreamReady","decoding","setDecoding","videoRef","viewportRef","streamRef","unmountedRef","confirmBtnRef","shutterBtnRef","useCameraBtnRef","recoveryRef","onErrorRef","onConfirmRef","onRetakeRef","useEffect","isControlled","isUploadOnly","stopStream","useCallback","held","track","video","reportError","kind","startCamera","stream","playResult","handleVideoReady","interval","stopAfter","capturePhoto","vw","vh","sx","sy","sw","sh","insetX","insetY","canvas","ctx","blob","resolve","b","dataUrl","arrayBuffer","sha256","next","handleUploadDrop","accepted","file","objectUrl","dimensions","reject","img","reader","handleUploadReject","rejections","confirm","focusUseCameraRef","retake","_b","_c","onKeyDown","event","onVisibility","agentHandle","useMemo","useImperativeHandle","useAgentRegistration","regionLabel","hintText","maxSizeMb","statusText","canRetryCamera","showUploadFallback","uploadAffordance","jsx","FileUpload","acceptedFiles","showViewport","jsxs","Button","RotateCcw","Check","Loader2","Alert","Camera"],"mappings":";;;;;;;;;;;;AAUO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW,QAAQ;AAAA,EAClC,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,WAAA;AAAA,IAAW;AAAA,IAEtC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAA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glass.mjs","../../node_modules/lucide-react/dist/esm/icons/mars.mjs","../../node_modules/lucide-react/dist/esm/icons/settings-2.mjs","../../node_modules/lucide-react/dist/esm/icons/venus.mjs","../../src/components/_shared/patient-fields.ts","../../src/components/_shared/field-visibility.ts","../../src/components/_shared/field-visibility-cog.tsx","../../src/components/_shared/field-value.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: \"M5 22h14\", key: \"ehvnwv\" }],\n [\"path\", { d: \"M5 2h14\", key: \"pdyrp9\" }],\n [\n \"path\",\n {\n d: \"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22\",\n key: \"1d314k\"\n }\n ],\n [\n \"path\",\n { d: \"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2\", key: \"1vvvr6\" }\n ]\n];\nconst Hourglass = createLucideIcon(\"hourglass\", __iconNode);\n\nexport { __iconNode, Hourglass as default };\n//# sourceMappingURL=hourglass.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: \"M16 3h5v5\", key: \"1806ms\" }],\n [\"path\", { d: \"m21 3-6.75 6.75\", key: \"pv0uzu\" }],\n [\"circle\", { cx: \"10\", cy: \"14\", r: \"6\", key: \"1qwbdc\" }]\n];\nconst Mars = createLucideIcon(\"mars\", __iconNode);\n\nexport { __iconNode, Mars as default };\n//# sourceMappingURL=mars.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: \"M14 17H5\", key: \"gfn3mx\" }],\n [\"path\", { d: \"M19 7h-9\", key: \"6i9tg\" }],\n [\"circle\", { cx: \"17\", cy: \"17\", r: \"3\", key: \"18b49y\" }],\n [\"circle\", { cx: \"7\", cy: \"7\", r: \"3\", key: \"dfmy0x\" }]\n];\nconst Settings2 = createLucideIcon(\"settings-2\", __iconNode);\n\nexport { __iconNode, Settings2 as default };\n//# sourceMappingURL=settings-2.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: \"M12 15v7\", key: \"t2xh3l\" }],\n [\"path\", { d: \"M9 19h6\", key: \"456am0\" }],\n [\"circle\", { cx: \"12\", cy: \"9\", r: \"6\", key: \"1nw4tq\" }]\n];\nconst Venus = createLucideIcon(\"venus\", __iconNode);\n\nexport { __iconNode, Venus as default };\n//# sourceMappingURL=venus.mjs.map\n","import type { ReactElement, ReactNode } from 'react';\n\n/* -------------------------------------------------------------------- */\n/* Shared patient-field model */\n/* */\n/* The single field VOCABULARY every patient surface speaks — consumed */\n/* by both `PatientDetails` (full, inline-editable) and */\n/* `PatientSummaryCard` (compact). Either can surface a \"Customize */\n/* fields\" cog (show/hide + drag-and-drop reorder). The kit owns the */\n/* SHAPE; the CONSUMER owns the registry (which DoctorPatient field maps */\n/* to which id/label/PHI flag). */\n/* */\n/* Visibility + order are PER-CONTEXT, not global: the kit never persists */\n/* them — each PLACEMENT is wired to its own `visibleFieldOrder` / */\n/* `onVisibleFieldsChange`, so the SAME vocabulary can display */\n/* differently in different parts of the app (a care-plan card vs the */\n/* patient folder). The consumer chooses the persistence scope — global */\n/* per-user, or per-surface (PRS §Security; design doc D1/D2). */\n/* -------------------------------------------------------------------- */\n\n/**\n * Canonical field TYPE. When set (and no explicit `value` is supplied), the\n * kit renders the field's canonical chip from the shared `<FieldValue>`\n * registry instead of plain text — so the SAME field type looks the same on\n * every surface. Each chip is a high-contrast neutral pill with a glyph:\n *\n * - `sex` → Venus / Mars / User glyph + localised label\n * - `age` → hourglass glyph + localised, pluralised age\n * - `dob` → calendar glyph + locale-formatted date\n * - `fiscalCode` → hash glyph + monospace code (already mono — no `mono` flag\n * needed; copy + PHI lock stay the row-level affordance via\n * `copyable` / `sensitive`)\n * - `discount` → `TransactionChip` `state=\"discount\"` (the canonical monetary\n * discount chip — magnitude + `currency`, sign owned by the chip)\n * - `email` → a `mailto:` `Link` (the address is both display + target)\n * - `phone` → a `tel:` `Link` (formatted display, target normalised to\n * `+` and digits)\n *\n * The raw datum is read from `editValue` (the same scalar that seeds the\n * editor): a number for `age` / `discount`, an ISO string or `Date` for `dob`,\n * a code string for `sex`, the code string for `fiscalCode`. For the contact\n * link kinds the DISPLAY string is read from `value` (or `editValue`) and the\n * href is derived from it — so a plain-string `value` still becomes a link.\n * For every OTHER kind an explicit `value` ALWAYS wins, so a consumer can still\n * override per placement.\n */\nexport type PatientFieldKind =\n | 'sex'\n | 'age'\n | 'dob'\n | 'fiscalCode'\n | 'discount'\n | 'email'\n | 'phone';\n\n/** Editor control rendered when a field enters inline-edit mode. */\nexport type PatientFieldEditType =\n | 'text'\n | 'textarea'\n | 'select'\n | 'boolean'\n | 'date'\n | 'number'\n // Typed text variants — each renders the kit's dedicated input (validation,\n // formatting, masking) instead of a bare TextInput. Their edited value still\n // serialises to a plain string through the shared save callback.\n | 'email'\n | 'phone'\n | 'fiscalCode'\n // Address / location variants — each renders the dedicated kit picker.\n // `province`/`country`/`city` emit a plain string (UPPER sigla / alpha-2\n // lower / city name); `postalCode` validates the IT CAP format on blur.\n | 'province'\n | 'country'\n | 'postalCode'\n | 'city';\n\n/** A choice for an `editType: 'select'` field. */\nexport interface PatientFieldOption {\n value: string;\n label: string;\n}\n\n/**\n * Raw value seeded into an editor. The kit never inspects this beyond\n * handing it to the matching control and back through a save callback.\n */\nexport type PatientFieldEditValue =\n | string\n | number\n | boolean\n | Date\n | null\n | undefined;\n\n/** One label→value patient field. */\nexport interface PatientField {\n /**\n * Stable field key — drives visibility, ordering, the `data-field-id`\n * hook, and agent addressing. MUST NOT be the value (no PHI in keys).\n */\n id: string;\n /** Display label (already localised by the consumer, or a kit label). */\n label: string;\n /**\n * Display node — formatted by the consumer (Badge / Tag / Link / text).\n * Optional: omit it and set `kind` to let the kit render the field's\n * canonical chip from `editValue`. When present, `value` ALWAYS wins.\n */\n value?: ReactNode;\n /**\n * Canonical field type — when set and `value` is omitted, the kit renders\n * the matching canonical chip from the shared registry. Presentation only;\n * NEVER emitted into any `data-*` attribute (same rule as `sensitive`).\n */\n kind?: PatientFieldKind;\n /** Leading icon (a single lucide element). */\n icon?: ReactElement | null;\n /** Render the copy-to-clipboard affordance (fiscal code, ids). */\n copyable?: boolean;\n /** Text written to the clipboard when `copyable`. */\n copyText?: string;\n /** Render the value monospaced (codes, ids). */\n mono?: boolean;\n /**\n * High-sensitivity PHI marker — renders a lock glyph next to the label.\n * Presentation only; NEVER emitted into any `data-*` attribute.\n */\n sensitive?: boolean;\n /** Whether this field can be inline-edited (consumer gates by permission). */\n editable?: boolean;\n /** Control used in edit mode. Defaults to `'text'`. */\n editType?: PatientFieldEditType;\n /** Options for `editType: 'select'`. */\n options?: PatientFieldOption[];\n /** Value seeded into the editor when editing begins. */\n editValue?: PatientFieldEditValue;\n /** Currency code for `editType: 'number'` (renders a currency input). */\n currency?: string;\n}\n\n/** A labelled, collapsible group of fields. */\nexport interface PatientFieldSection {\n /** Stable section key. */\n id: string;\n /** Section heading. */\n heading: string;\n fields: PatientField[];\n /** Wrap the section in a Collapsible (default `true`). Honoured by PatientDetails. */\n collapsible?: boolean;\n /** Initial open state when `collapsible` (default `true`). */\n defaultOpen?: boolean;\n}\n\n/** The flat declaration-order list of every field id — the \"show everything\" default. */\nexport function patientFieldCatalogue(\n sections: PatientFieldSection[],\n): string[] {\n return sections.flatMap((s) => s.fields.map((f) => f.id));\n}\n\n/** A section paired with its currently-visible fields, in the chosen order. */\nexport interface ResolvedPatientSection {\n section: PatientFieldSection;\n fields: PatientField[];\n}\n\n/**\n * Project `sections` to the visible fields per section, ordered by\n * `visibleFieldOrder`. This is the single piece of visibility logic shared\n * by every patient surface, so the card and the details panel always agree\n * on what is shown and in what order.\n *\n * `visibleFieldOrder` omitted (`undefined`) ⇒ every field visible in\n * declaration order (\"show everything by default\", design doc D3). An explicit\n * empty array `[]` ⇒ NO fields visible — a surface that starts collapsed and\n * reveals fields via the customize-fields cog. Unknown ids are ignored.\n * Sections stay in declaration order; only intra-section field order follows\n * `visibleFieldOrder`.\n */\nexport function resolveVisibleFields(\n sections: PatientFieldSection[],\n visibleFieldOrder?: string[],\n): ResolvedPatientSection[] {\n const order = visibleFieldOrder ?? patientFieldCatalogue(sections);\n const orderIndex = new Map(order.map((id, index) => [id, index]));\n return sections.map((section) => ({\n section,\n fields: section.fields\n .filter((field) => orderIndex.has(field.id))\n .sort(\n (a, b) =>\n (orderIndex.get(a.id) as number) - (orderIndex.get(b.id) as number),\n ),\n }));\n}\n","import { useCallback, useMemo } from 'react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport {\n patientFieldCatalogue,\n type PatientField,\n type PatientFieldSection,\n} from './patient-fields';\n\n/* -------------------------------------------------------------------- */\n/* usePatientFieldVisibility */\n/* */\n/* The single visibility + ordering engine behind the patient field */\n/* picker, shared by every surface that lets a user curate which patient */\n/* fields show and in what order (PatientDetails, PatientSummaryCard). */\n/* */\n/* CONTEXT-SCOPED, not global: the order is a per-INSTANCE prop the kit */\n/* never persists. Each placement (a care-plan card, the patient-folder */\n/* summary, the Control Room details panel) is wired to its OWN */\n/* `value` / `onChange`, so the SAME field vocabulary can be displayed */\n/* differently in different parts of the app. The consumer owns the */\n/* persistence scope — global per-user, or per-context. */\n/* */\n/* Every mutation filters to known field ids, so persisted / agent input */\n/* can never smuggle an unknown key into the visible set. */\n/* -------------------------------------------------------------------- */\n\nexport interface UsePatientFieldVisibilityOptions {\n /** Controlled ordered list of visible field ids. */\n value?: string[];\n /** Uncontrolled initial order. Omit both ⇒ every field, declaration order. */\n defaultValue?: string[];\n /** Fired on any show / hide / reorder, with the next ordered visible set. */\n onChange?: (orderedIds: string[]) => void;\n}\n\nexport interface PatientFieldVisibility {\n /** Current ordered list of visible field ids (filtered to known fields). */\n visible: string[];\n /** Flat declaration-order catalogue of every field id (\"show everything\"). */\n catalogueIds: string[];\n /** field id → its field + owning section id. */\n fieldById: Map<string, { field: PatientField; sectionId: string }>;\n /** Replace the visible set / order (filtered to known fields). */\n setOrder: (orderedIds: string[]) => void;\n /** Show or hide a single field. */\n toggleField: (fieldId: string) => void;\n /** Show or hide every field in a section. */\n toggleSection: (sectionId: string, show: boolean) => void;\n /**\n * Move a field to land at another field's slot, WITHIN its section's\n * visible subsequence. Cross-section moves are ignored — sections stay in\n * declaration order. Drives both pointer drops and keyboard (Alt+Arrow).\n */\n moveFieldOnto: (fromId: string, toId: string) => void;\n /** Reset to `defaultValue` (or the full catalogue when none was given). */\n reset: () => void;\n}\n\nexport function usePatientFieldVisibility(\n sections: PatientFieldSection[],\n { value, defaultValue, onChange }: UsePatientFieldVisibilityOptions = {},\n): PatientFieldVisibility {\n const catalogueIds = useMemo(\n () => patientFieldCatalogue(sections),\n [sections],\n );\n\n const [orderState, setOrderState] = useControllableState<string[]>({\n value,\n defaultValue: defaultValue ?? catalogueIds,\n onChange,\n });\n // `useControllableState` may yield `undefined` before the first write.\n const visible = orderState ?? defaultValue ?? catalogueIds;\n\n const fieldById = useMemo(() => {\n const map = new Map<string, { field: PatientField; sectionId: string }>();\n for (const section of sections) {\n for (const field of section.fields) {\n map.set(field.id, { field, sectionId: section.id });\n }\n }\n return map;\n }, [sections]);\n\n const setOrder = useCallback(\n (next: string[]) => {\n // Drop unknown ids so persisted / agent input can't smuggle keys.\n setOrderState(next.filter((fid) => fieldById.has(fid)));\n },\n [setOrderState, fieldById],\n );\n\n const toggleField = useCallback(\n (fieldId: string) => {\n setOrder(\n visible.includes(fieldId)\n ? visible.filter((fid) => fid !== fieldId)\n : [...visible, fieldId],\n );\n },\n [visible, setOrder],\n );\n\n const toggleSection = useCallback(\n (sectionId: string, show: boolean) => {\n const sectionIds =\n sections.find((s) => s.id === sectionId)?.fields.map((f) => f.id) ?? [];\n const sectionSet = new Set(sectionIds);\n if (show) {\n const missing = sectionIds.filter((fid) => !visible.includes(fid));\n setOrder([...visible, ...missing]);\n } else {\n setOrder(visible.filter((fid) => !sectionSet.has(fid)));\n }\n },\n [sections, visible, setOrder],\n );\n\n const moveFieldOnto = useCallback(\n (fromId: string, toId: string) => {\n if (fromId === toId) return;\n const fromSection = fieldById.get(fromId)?.sectionId;\n const toSection = fieldById.get(toId)?.sectionId;\n if (!fromSection || fromSection !== toSection) return;\n const sectionIds = new Set(\n sections.find((s) => s.id === fromSection)?.fields.map((f) => f.id) ??\n [],\n );\n const siblings = visible.filter((fid) => sectionIds.has(fid));\n const fromIdx = siblings.indexOf(fromId);\n const toIdx = siblings.indexOf(toId);\n if (fromIdx < 0 || toIdx < 0) return;\n const [moved] = siblings.splice(fromIdx, 1);\n siblings.splice(toIdx, 0, moved);\n // Splice the reordered siblings back into their positions in `visible`.\n let k = 0;\n const next = visible.map((fid) =>\n sectionIds.has(fid) ? siblings[k++] : fid,\n );\n setOrder(next);\n },\n [fieldById, sections, visible, setOrder],\n );\n\n const reset = useCallback(() => {\n setOrder(defaultValue ?? catalogueIds);\n }, [defaultValue, catalogueIds, setOrder]);\n\n return {\n visible,\n catalogueIds,\n fieldById,\n setOrder,\n toggleField,\n toggleSection,\n moveFieldOnto,\n reset,\n };\n}\n","import {\n useCallback,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { GripVertical, Settings2 } from 'lucide-react';\nimport { Button, IconButton } from '../button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { Popover } from '../popover/popover';\nimport { Separator } from '../separator/separator';\nimport type { PatientFieldSection } from './patient-fields';\n\n/* -------------------------------------------------------------------- */\n/* FieldVisibilityCog — the patient field picker */\n/* */\n/* The shared \"Customize fields\" cog: a Popover of per-field checkboxes */\n/* (grouped by section, with a section-level toggle-all where the section */\n/* is named), a drag handle per visible field for pointer reordering, and */\n/* the canonical Sidebar keyboard reorder gesture (Alt+Arrow / Alt+Home / */\n/* Alt+End) with an sr-only live announcement. Pure UI — the visibility */\n/* state + reducers live in `usePatientFieldVisibility`, so PatientDetails */\n/* and PatientSummaryCard share ONE picker driving each surface's own */\n/* per-context order. */\n/* */\n/* Native-HTML5 DnD (no library), mirroring data-table's ColumnToggle; */\n/* the grip adds the keyboard channel that pattern lacks. Sections with an */\n/* empty heading render their fields flat with no toggle-all (the card's */\n/* legacy single-section mode) so no empty-named checkbox is emitted. */\n/* -------------------------------------------------------------------- */\n\nexport interface FieldVisibilityCogProps {\n /** The sectioned field catalogue. */\n sections: PatientFieldSection[];\n /** Current ordered visible field ids. */\n visible: string[];\n /** Show / hide a single field. */\n onToggleField: (fieldId: string) => void;\n /** Show / hide every field in a section. */\n onToggleSection: (sectionId: string, show: boolean) => void;\n /** Move a field onto another field's slot within its section. */\n onMoveFieldOnto: (fromId: string, toId: string) => void;\n /** Reset to the default field set / order. */\n onReset: () => void;\n /** Override the cog trigger's accessible name. */\n label?: string;\n}\n\nexport function FieldVisibilityCog({\n sections,\n visible,\n onToggleField,\n onToggleSection,\n onMoveFieldOnto,\n onReset,\n label,\n}: FieldVisibilityCogProps): ReactNode {\n const { t } = useTranslation();\n const visibleSet = useMemo(() => new Set(visible), [visible]);\n\n // Drag-and-drop reorder (pointer). The keyboard channel runs through each\n // grip handle's Alt+Arrow keys; both routes share `onMoveFieldOnto`.\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const [dragOverId, setDragOverId] = useState<string | null>(null);\n const [announcement, setAnnouncement] = useState('');\n\n // Field id → section id and → label: the cross-section drop guard and the\n // move announcement both need the DRAGGED field's section/label, which isn't\n // in the drop row's render scope.\n const { sectionOfField, labelOfField } = useMemo(() => {\n const sectionMap = new Map<string, string>();\n const labelMap = new Map<string, string>();\n for (const section of sections) {\n for (const field of section.fields) {\n sectionMap.set(field.id, section.id);\n labelMap.set(field.id, field.label);\n }\n }\n return { sectionOfField: sectionMap, labelOfField: labelMap };\n }, [sections]);\n\n const draggingSectionId = draggingId\n ? sectionOfField.get(draggingId)\n : undefined;\n\n const clearDrag = useCallback(() => {\n setDraggingId(null);\n setDragOverId(null);\n }, []);\n\n // Announce the moved field's new 1-based position to assistive tech.\n const announceMoved = useCallback(\n (fieldId: string, newIndex: number, count: number) => {\n setAnnouncement(\n t('fieldPicker.moved', {\n field: labelOfField.get(fieldId) ?? '',\n position: newIndex + 1,\n count,\n defaultValue: 'Moved {{field}} to position {{position}} of {{count}}',\n }),\n );\n },\n [t, labelOfField],\n );\n\n return (\n <Popover.Root>\n <Popover.Trigger asChild>\n <IconButton\n size=\"sm\"\n intent=\"outline\"\n icon={<Settings2 aria-hidden=\"true\" />}\n aria-label={\n label ??\n t('fieldPicker.trigger', { defaultValue: 'Customize fields' })\n }\n className=\"ds:shrink-0\"\n />\n </Popover.Trigger>\n <Popover.Content align=\"end\" size=\"sm\">\n <Popover.Heading>\n {t('fieldPicker.title', { defaultValue: 'Customize fields' })}\n </Popover.Heading>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:mt-[var(--spacing-xs)]\">\n {sections.map((section) => {\n const fieldIds = section.fields.map((f) => f.id);\n const shownCount = fieldIds.filter((fid) =>\n visibleSet.has(fid),\n ).length;\n // Visible siblings in display order — the subsequence reordering\n // operates on. The keyboard arrows' no-op bounds key off the\n // field's index HERE, not the full declaration array.\n const orderedVisible = visible.filter((fid) =>\n fieldIds.includes(fid),\n );\n const sectionState: boolean | 'indeterminate' =\n shownCount === 0\n ? false\n : shownCount === fieldIds.length\n ? true\n : 'indeterminate';\n // A named section gets a toggle-all checkbox + indented field list;\n // an unnamed one (the card's single legacy section) renders flat.\n const named = !!section.heading;\n return (\n <div\n key={section.id}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\"\n >\n {named ? (\n <Checkbox\n size=\"sm\"\n label={section.heading}\n checked={sectionState}\n onCheckedChange={(checked) =>\n onToggleSection(section.id, checked === true)\n }\n />\n ) : null}\n <ul\n className={[\n 'ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)]',\n named ? 'ds:ps-[var(--spacing-md)]' : 'ds:ps-0',\n ].join(' ')}\n >\n {section.fields.map((field) => {\n const shown = visibleSet.has(field.id);\n const visIndex = orderedVisible.indexOf(field.id);\n const count = orderedVisible.length;\n const isDragging = draggingId === field.id;\n const isDragOver =\n dragOverId === field.id &&\n draggingId !== null &&\n draggingId !== field.id &&\n draggingSectionId === section.id;\n\n // Native-HTML5 DnD wiring, applied only to visible rows —\n // a hidden field is neither a drag source nor a drop slot.\n const dragProps: HTMLAttributes<HTMLLIElement> = shown\n ? {\n draggable: true,\n onDragStart: (e) => {\n setDraggingId(field.id);\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', field.id);\n },\n onDragOver: (e) => {\n // Same-section drops only; sections stay fixed.\n if (\n draggingId === null ||\n draggingSectionId !== section.id\n )\n return;\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n setDragOverId(field.id);\n },\n onDragLeave: () =>\n setDragOverId((prev) =>\n prev === field.id ? null : prev,\n ),\n onDrop: (e) => {\n e.preventDefault();\n const fromId = e.dataTransfer.getData('text/plain');\n if (\n fromId &&\n fromId !== field.id &&\n sectionOfField.get(fromId) === section.id\n ) {\n onMoveFieldOnto(fromId, field.id);\n announceMoved(fromId, visIndex, count);\n }\n clearDrag();\n },\n onDragEnd: clearDrag,\n }\n : {};\n\n return (\n <li\n key={field.id}\n {...dragProps}\n className={[\n 'ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-2xs)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-2xs)] ds:py-[var(--spacing-2xs)] ds:transition-colors ds:motion-reduce:transition-none',\n isDragging ? 'ds:opacity-50' : '',\n isDragOver\n ? 'ds:bg-[color:color-mix(in_srgb,var(--primary)_8%,transparent)]'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <Checkbox\n size=\"sm\"\n label={field.label}\n checked={shown}\n onCheckedChange={() => onToggleField(field.id)}\n />\n {shown ? (\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n icon={<GripVertical aria-hidden=\"true\" />}\n aria-label={t('fieldPicker.reorder', {\n field: field.label,\n defaultValue:\n 'Reorder {{field}}. Press Alt + Up or Alt + Down to move.',\n })}\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown Alt+Home Alt+End\"\n className=\"ds:shrink-0 ds:cursor-grab ds:active:cursor-grabbing\"\n onKeyDown={(e) => {\n // Reorder gestures mirror the canonical Sidebar\n // handle: Alt+Arrow (+ Alt+Home / Alt+End). Bare\n // arrows fall through to the browser default.\n if (!e.altKey) return;\n if (e.key === 'ArrowUp') {\n if (visIndex <= 0) return;\n e.preventDefault();\n onMoveFieldOnto(\n field.id,\n orderedVisible[visIndex - 1],\n );\n announceMoved(field.id, visIndex - 1, count);\n } else if (e.key === 'ArrowDown') {\n if (visIndex >= count - 1) return;\n e.preventDefault();\n onMoveFieldOnto(\n field.id,\n orderedVisible[visIndex + 1],\n );\n announceMoved(field.id, visIndex + 1, count);\n } else if (e.key === 'Home') {\n if (visIndex <= 0) return;\n e.preventDefault();\n onMoveFieldOnto(field.id, orderedVisible[0]);\n announceMoved(field.id, 0, count);\n } else if (e.key === 'End') {\n if (visIndex >= count - 1) return;\n e.preventDefault();\n onMoveFieldOnto(\n field.id,\n orderedVisible[count - 1],\n );\n announceMoved(field.id, count - 1, count);\n }\n }}\n />\n ) : null}\n </li>\n );\n })}\n </ul>\n </div>\n );\n })}\n <Separator orientation=\"horizontal\" />\n <Button type=\"button\" size=\"sm\" intent=\"ghost\" onClick={onReset}>\n {t('fieldPicker.reset', { defaultValue: 'Reset to defaults' })}\n </Button>\n </div>\n {/* Reorder announcements for assistive tech (drag drop + arrow keys). */}\n <span role=\"status\" className=\"ds:sr-only\">\n {announcement}\n </span>\n </Popover.Content>\n </Popover.Root>\n );\n}\n","import { cloneElement, type ReactElement, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { CalendarDays, Hash, Hourglass, Mars, User, Venus } from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Link } from '../link/link';\nimport { TransactionChip } from '../transaction-chip/transaction-chip';\nimport type { PatientField } from './patient-fields';\n\n/* -------------------------------------------------------------------- */\n/* FieldValue — the canonical field-chip registry */\n/* */\n/* Renders ONE patient field's value slot. When the consumer supplies an */\n/* explicit `value` (legacy rows, per-placement overrides) it wins */\n/* verbatim. Otherwise `kind` selects the canonical chip and the raw */\n/* datum is read from `editValue`, so a known field type looks the same */\n/* on every surface (PatientSummaryCard + PatientDetails share this). */\n/* */\n/* The per-type chips (`SexChip` / `AgeChip` / `NeutralChip`) are exported */\n/* so the PatientSummaryCard identity line renders the SAME chips under */\n/* the name. */\n/* */\n/* Pure composition over already-marked kit primitives (Badge / */\n/* TransactionChip) — it mounts no surface of its own, so it carries no */\n/* `data-component` (allowlisted in check-data-component-coverage.mjs). */\n/* -------------------------------------------------------------------- */\n\n// The neutral Badge's own text colour (`--muted-foreground`) is too low\n// contrast for primary demographic data — grey text on the grey pill reads at\n// ~5.8:1. The chip label + glyph are pinned to `--foreground` (~11:1) so the\n// data stays legible on every theme.\nconst STRONG = 'ds:text-[color:var(--foreground)]';\n\n/** Default English labels — real translations live under `patientField.*`. */\nconst SEX_LABEL_DEFAULT: Record<string, string> = {\n m: 'Male',\n f: 'Female',\n x: 'Other',\n};\n\n/** A neutral pill with high-contrast text + an optional leading glyph. */\nexport function NeutralChip({\n icon,\n mono,\n children,\n}: {\n icon?: ReactElement;\n mono?: boolean;\n children: ReactNode;\n}): ReactNode {\n return (\n <Badge\n variant=\"neutral\"\n className={mono ? 'ds:font-mono' : undefined}\n // Clone the glyph (don't wrap it) so it stays Badge's DIRECT <svg> child —\n // Badge's `[&>svg]:size-*` rule only sizes a direct child, so wrapping it\n // left the glyph at lucide's default 24px. The clone also carries `STRONG`.\n leading={\n icon\n ? cloneElement(icon as ReactElement<{ className?: string }>, {\n className: STRONG,\n })\n : undefined\n }\n >\n <span className={STRONG}>{children}</span>\n </Badge>\n );\n}\n\n/** Sex chip — Venus / Mars / User glyph + localised label. Female / male carry a\n * tonal pink / blue FILL; unspecified stays the neutral pill. */\nexport function SexChip({ code }: { code: string }): ReactNode {\n const { t } = useTranslation();\n const c = code.toLowerCase();\n const label = t(`patientField.sex.${c}`, {\n defaultValue: SEX_LABEL_DEFAULT[c] ?? code,\n });\n // The fill carries the colour; Badge sizes + tones the glyph from the variant.\n // `accentSoft` is the kit's tonal magenta (≈ pink); `info` the tonal indigo\n // (≈ blue, the closest the closed palette has to blue). Other → neutral.\n if (c === 'f') {\n return (\n <Badge variant=\"accentSoft\" leading={<Venus />}>\n {label}\n </Badge>\n );\n }\n if (c === 'm') {\n return (\n <Badge variant=\"info\" leading={<Mars />}>\n {label}\n </Badge>\n );\n }\n return <NeutralChip icon={<User />}>{label}</NeutralChip>;\n}\n\n/** Age chip — hourglass glyph + localised, pluralised age. */\nexport function AgeChip({ years }: { years: number }): ReactNode {\n const { t } = useTranslation();\n return (\n <NeutralChip icon={<Hourglass />}>\n {t('patientField.age', {\n count: years,\n defaultValue: '{{count}} years old',\n })}\n </NeutralChip>\n );\n}\n\nexport function FieldValue({ field }: { field: PatientField }): ReactNode {\n const { i18n } = useTranslation();\n\n // Contact kinds render as a mailto:/tel: Link — the display string is read\n // from `value` (or `editValue`), the href is derived from it. Checked BEFORE\n // the explicit-value short-circuit so a plain-string `value` still links.\n if (field.kind === 'email' || field.kind === 'phone') {\n const display =\n typeof field.value === 'string'\n ? field.value\n : (field.copyText ??\n (typeof field.editValue === 'string' ? field.editValue : ''));\n if (display) {\n // mailto: trims surrounding whitespace; tel: keeps only `+` and digits\n // (dialler-safe), leaving the formatted text as the visible label.\n const href =\n field.kind === 'email'\n ? `mailto:${display.trim()}`\n : `tel:${display.replace(/[^+\\d]/g, '')}`;\n return <Link href={href}>{display}</Link>;\n }\n // No string to link — fall through to any explicit node value below.\n }\n\n // An explicit value always wins — legacy rows + per-placement overrides.\n if (field.value != null) {\n return <>{field.value}</>;\n }\n if (!field.kind) {\n return null;\n }\n\n switch (field.kind) {\n case 'sex':\n return <SexChip code={String(field.editValue ?? '')} />;\n case 'age': {\n const years =\n typeof field.editValue === 'number'\n ? field.editValue\n : Number(field.editValue);\n if (!Number.isFinite(years)) {\n return null;\n }\n return <AgeChip years={years} />;\n }\n case 'dob': {\n const raw = field.editValue;\n const date = raw instanceof Date ? raw : new Date(String(raw ?? ''));\n const formatted = Number.isNaN(date.getTime())\n ? String(raw ?? '')\n : new Intl.DateTimeFormat(i18n.language, {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n }).format(date);\n if (!formatted) {\n return null;\n }\n return <NeutralChip icon={<CalendarDays />}>{formatted}</NeutralChip>;\n }\n case 'fiscalCode': {\n // Copy + PHI lock stay the consumer's row-level affordance (PatientDetails\n // renders them from `copyable` / `sensitive`); the chip is the mono pill.\n const code =\n field.copyText ??\n (typeof field.editValue === 'string' ? field.editValue : '');\n if (!code) {\n return null;\n }\n return (\n <NeutralChip icon={<Hash />} mono>\n {code}\n </NeutralChip>\n );\n }\n case 'discount': {\n // The canonical monetary discount chip — magnitude + currency, the sign\n // (\"−\") and glyph owned by TransactionChip. The row label gives context,\n // so the chip itself shows only the amount (no duplicate state label).\n const amount =\n typeof field.editValue === 'number'\n ? field.editValue\n : Number(field.editValue);\n if (!Number.isFinite(amount)) {\n return null;\n }\n return (\n <TransactionChip\n state=\"discount\"\n amount={Math.abs(amount)}\n currency={field.currency}\n size=\"sm\"\n />\n );\n }\n default:\n return null;\n }\n}\n"],"names":["__iconNode","Hourglass","createLucideIcon","Mars","Settings2","Venus","patientFieldCatalogue","sections","s","f","resolveVisibleFields","visibleFieldOrder","order","orderIndex","id","index","section","field","a","b","usePatientFieldVisibility","value","defaultValue","onChange","catalogueIds","useMemo","orderState","setOrderState","useControllableState","visible","fieldById","map","setOrder","useCallback","next","fid","toggleField","fieldId","toggleSection","sectionId","show","sectionIds","_a","sectionSet","missing","moveFieldOnto","fromId","toId","fromSection","toSection","_b","_c","siblings","fromIdx","toIdx","moved","k","reset","FieldVisibilityCog","onToggleField","onToggleSection","onMoveFieldOnto","onReset","label","t","useTranslation","visibleSet","draggingId","setDraggingId","useState","dragOverId","setDragOverId","announcement","setAnnouncement","sectionOfField","labelOfField","sectionMap","labelMap","draggingSectionId","clearDrag","announceMoved","newIndex","count","jsxs","Popover","jsx","IconButton","fieldIds","shownCount","orderedVisible","sectionState","named","Checkbox","checked","shown","visIndex","isDragging","isDragOver","e","prev","GripVertical","Separator","Button","STRONG","SEX_LABEL_DEFAULT","NeutralChip","icon","mono","children","Badge","cloneElement","SexChip","code","c","User","AgeChip","years","FieldValue","i18n","display","href","Link","Fragment","raw","date","formatted","CalendarDays","Hash","amount","TransactionChip"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE;AAAA,IACE;AAAA,IACA,EAAE,GAAG,0EAA0E,KAAK,SAAQ;AAAA,EAChG;AACA,GACMC,KAAYC,EAAiB,aAAaF,EAAU;ACxB1D;AAAA;AAAA;AAAA;AAAA;AAAA;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