@alfadocs/ui-kit-debug 0.77.0 → 0.79.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 (147) hide show
  1. package/dist/_chunks/{alia-sidebar-w6B0TEx7.js → alia-sidebar-DzNz1gDf.js} +2 -2
  2. package/dist/_chunks/{alia-sidebar-w6B0TEx7.js.map → alia-sidebar-DzNz1gDf.js.map} +1 -1
  3. package/dist/_chunks/calendar-4dXTvsCz.js +1136 -0
  4. package/dist/_chunks/calendar-4dXTvsCz.js.map +1 -0
  5. package/dist/_chunks/calendar-event-card-C6qGtywL.js +257 -0
  6. package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +1 -0
  7. package/dist/_chunks/{chat-input-BTCDqUDX.js → chat-input-QpHxBEnN.js} +32 -31
  8. package/dist/_chunks/chat-input-QpHxBEnN.js.map +1 -0
  9. package/dist/_chunks/document-preview-nwfulDEs.js +290 -0
  10. package/dist/_chunks/document-preview-nwfulDEs.js.map +1 -0
  11. package/dist/_chunks/{fiscal-code-input-DWA6C8x8.js → fiscal-code-input-QP9gkyDE.js} +2 -2
  12. package/dist/_chunks/fiscal-code-input-QP9gkyDE.js.map +1 -0
  13. package/dist/_chunks/{patient-details-zy76MRh7.js → patient-details-COvYWp2e.js} +2 -2
  14. package/dist/_chunks/{patient-details-zy76MRh7.js.map → patient-details-COvYWp2e.js.map} +1 -1
  15. package/dist/_chunks/signature-request-CEOrCDyk.js +341 -0
  16. package/dist/_chunks/signature-request-CEOrCDyk.js.map +1 -0
  17. package/dist/agent-catalog.json +1 -1
  18. package/dist/components/_shared/contrast-warning.d.ts +46 -0
  19. package/dist/components/_shared/contrast-warning.d.ts.map +1 -0
  20. package/dist/components/calendar/calendar.d.ts +284 -7
  21. package/dist/components/calendar/calendar.d.ts.map +1 -1
  22. package/dist/components/calendar/index.d.ts +1 -1
  23. package/dist/components/calendar/index.d.ts.map +1 -1
  24. package/dist/components/calendar/index.js +1 -1
  25. package/dist/components/calendar-event-card/calendar-event-card.d.ts +103 -0
  26. package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -0
  27. package/dist/components/calendar-event-card/index.d.ts +3 -0
  28. package/dist/components/calendar-event-card/index.d.ts.map +1 -0
  29. package/dist/components/calendar-event-card/index.js +5 -0
  30. package/dist/components/calendar-event-card/index.js.map +1 -0
  31. package/dist/components/chat-input/chat-input.d.ts.map +1 -1
  32. package/dist/components/chat-input/index.js +1 -1
  33. package/dist/components/document-preview/document-preview.d.ts +10 -0
  34. package/dist/components/document-preview/document-preview.d.ts.map +1 -1
  35. package/dist/components/document-preview/index.js +1 -1
  36. package/dist/components/fiscal-code-input/index.js +1 -1
  37. package/dist/components/index.d.ts +1 -0
  38. package/dist/components/index.d.ts.map +1 -1
  39. package/dist/components/patient-details/index.js +1 -1
  40. package/dist/i18n/locales/ar.d.ts +6 -0
  41. package/dist/i18n/locales/ar.d.ts.map +1 -1
  42. package/dist/i18n/locales/ar.js +6 -0
  43. package/dist/i18n/locales/ar.js.map +1 -1
  44. package/dist/i18n/locales/de.d.ts +6 -0
  45. package/dist/i18n/locales/de.d.ts.map +1 -1
  46. package/dist/i18n/locales/de.js +6 -0
  47. package/dist/i18n/locales/de.js.map +1 -1
  48. package/dist/i18n/locales/el.d.ts +6 -0
  49. package/dist/i18n/locales/el.d.ts.map +1 -1
  50. package/dist/i18n/locales/el.js +6 -0
  51. package/dist/i18n/locales/el.js.map +1 -1
  52. package/dist/i18n/locales/en.d.ts +6 -0
  53. package/dist/i18n/locales/en.d.ts.map +1 -1
  54. package/dist/i18n/locales/en.js +6 -0
  55. package/dist/i18n/locales/en.js.map +1 -1
  56. package/dist/i18n/locales/es.d.ts +6 -0
  57. package/dist/i18n/locales/es.d.ts.map +1 -1
  58. package/dist/i18n/locales/es.js +6 -0
  59. package/dist/i18n/locales/es.js.map +1 -1
  60. package/dist/i18n/locales/fr.d.ts +6 -0
  61. package/dist/i18n/locales/fr.d.ts.map +1 -1
  62. package/dist/i18n/locales/fr.js +6 -0
  63. package/dist/i18n/locales/fr.js.map +1 -1
  64. package/dist/i18n/locales/hi.d.ts +6 -0
  65. package/dist/i18n/locales/hi.d.ts.map +1 -1
  66. package/dist/i18n/locales/hi.js +6 -0
  67. package/dist/i18n/locales/hi.js.map +1 -1
  68. package/dist/i18n/locales/it.d.ts +6 -0
  69. package/dist/i18n/locales/it.d.ts.map +1 -1
  70. package/dist/i18n/locales/it.js +6 -0
  71. package/dist/i18n/locales/it.js.map +1 -1
  72. package/dist/i18n/locales/ja.d.ts +6 -0
  73. package/dist/i18n/locales/ja.d.ts.map +1 -1
  74. package/dist/i18n/locales/ja.js +6 -0
  75. package/dist/i18n/locales/ja.js.map +1 -1
  76. package/dist/i18n/locales/nl.d.ts +6 -0
  77. package/dist/i18n/locales/nl.d.ts.map +1 -1
  78. package/dist/i18n/locales/nl.js +6 -0
  79. package/dist/i18n/locales/nl.js.map +1 -1
  80. package/dist/i18n/locales/pl.d.ts +6 -0
  81. package/dist/i18n/locales/pl.d.ts.map +1 -1
  82. package/dist/i18n/locales/pl.js +6 -0
  83. package/dist/i18n/locales/pl.js.map +1 -1
  84. package/dist/i18n/locales/pt.d.ts +6 -0
  85. package/dist/i18n/locales/pt.d.ts.map +1 -1
  86. package/dist/i18n/locales/pt.js +6 -0
  87. package/dist/i18n/locales/pt.js.map +1 -1
  88. package/dist/i18n/locales/ro.d.ts +6 -0
  89. package/dist/i18n/locales/ro.d.ts.map +1 -1
  90. package/dist/i18n/locales/ro.js +6 -0
  91. package/dist/i18n/locales/ro.js.map +1 -1
  92. package/dist/i18n/locales/ru.d.ts +6 -0
  93. package/dist/i18n/locales/ru.d.ts.map +1 -1
  94. package/dist/i18n/locales/ru.js +6 -0
  95. package/dist/i18n/locales/ru.js.map +1 -1
  96. package/dist/i18n/locales/sq.d.ts +6 -0
  97. package/dist/i18n/locales/sq.d.ts.map +1 -1
  98. package/dist/i18n/locales/sq.js +6 -0
  99. package/dist/i18n/locales/sq.js.map +1 -1
  100. package/dist/i18n/locales/sv.d.ts +6 -0
  101. package/dist/i18n/locales/sv.d.ts.map +1 -1
  102. package/dist/i18n/locales/sv.js +6 -0
  103. package/dist/i18n/locales/sv.js.map +1 -1
  104. package/dist/i18n/locales/tr.d.ts +6 -0
  105. package/dist/i18n/locales/tr.d.ts.map +1 -1
  106. package/dist/i18n/locales/tr.js +6 -0
  107. package/dist/i18n/locales/tr.js.map +1 -1
  108. package/dist/i18n/locales/zh.d.ts +6 -0
  109. package/dist/i18n/locales/zh.d.ts.map +1 -1
  110. package/dist/i18n/locales/zh.js +6 -0
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/index.js +252 -250
  113. package/dist/index.js.map +1 -1
  114. package/dist/locales/ar.json +6 -0
  115. package/dist/locales/de.json +6 -0
  116. package/dist/locales/el.json +6 -0
  117. package/dist/locales/en.json +6 -0
  118. package/dist/locales/es.json +6 -0
  119. package/dist/locales/fr.json +6 -0
  120. package/dist/locales/hi.json +6 -0
  121. package/dist/locales/it.json +6 -0
  122. package/dist/locales/ja.json +6 -0
  123. package/dist/locales/nl.json +6 -0
  124. package/dist/locales/pl.json +6 -0
  125. package/dist/locales/pt.json +6 -0
  126. package/dist/locales/ro.json +6 -0
  127. package/dist/locales/ru.json +6 -0
  128. package/dist/locales/sq.json +6 -0
  129. package/dist/locales/sv.json +6 -0
  130. package/dist/locales/tr.json +6 -0
  131. package/dist/locales/zh.json +6 -0
  132. package/dist/patterns/alia-assistant/index.js +1 -1
  133. package/dist/patterns/signature-request/index.js +1 -1
  134. package/dist/patterns/signature-request/signature-request.d.ts +7 -0
  135. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  136. package/dist/tokens.css +9 -5
  137. package/package.json +5 -1
  138. package/dist/_chunks/calendar-DeAlFPsF.js +0 -1050
  139. package/dist/_chunks/calendar-DeAlFPsF.js.map +0 -1
  140. package/dist/_chunks/chat-input-BTCDqUDX.js.map +0 -1
  141. package/dist/_chunks/document-preview-CvHnHf6T.js +0 -243
  142. package/dist/_chunks/document-preview-CvHnHf6T.js.map +0 -1
  143. package/dist/_chunks/fiscal-code-input-DWA6C8x8.js.map +0 -1
  144. package/dist/_chunks/signature-request-C-mskXwi.js +0 -318
  145. package/dist/_chunks/signature-request-C-mskXwi.js.map +0 -1
  146. package/dist/components/calendar/contrast-warning.d.ts +0 -20
  147. package/dist/components/calendar/contrast-warning.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-preview-nwfulDEs.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.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: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation();\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAA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;AAAA,gBAACqB;AAAA,gBAAA;AAAA,kBAEC,OAAO7B,EAAI;AAAA,kBAGX,MACE,gBAAAQ;AAAA,oBAACoB;AAAA,oBAAA;AAAA,sBACC,eAAY;AAAA,sBACZ,WAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAGd,WAAU;AAAA,kBAEV,UAAA,gBAAApB,EAAC,QAAA,EAAK,WAAU,+CACb,YAAI,KAAA,CACP;AAAA,gBAAA;AAAA,gBAdKR,EAAI;AAAA,cAAA;AAAA,YAiBf,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFP,EAAK,IAAI,CAACO,MACT,gBAAAQ;AAAA,UAACsB;AAAA,UAAA;AAAA,YAEC,OAAO9B,EAAI;AAAA,YACX,WAAU;AAAA,YAET,YAAWA,CAAG;AAAA,UAAA;AAAA,UAJVA,EAAI;AAAA,QAAA,CAMZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAILwB,IAAUrB,EAAWJ,CAAS,GAI9B,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAe;AAAA,MACf,qBAAmBxB;AAAA,MAMnB,UAAU;AAAA,MACV,cAAYL,EAAE,+BAA+B,kBAAkB;AAAA,MAC/D,WAAWjB,GAAwB,EAAE,WAAAyB,GAAW;AAAA,MAE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
@@ -212,7 +212,7 @@ const pe = /* @__PURE__ */ new Set(["A", "E", "I", "O", "U"]), ft = [
212
212
  "T"
213
213
  ];
214
214
  function me(e) {
215
- return e.normalize("NFD").replace(/[̀-ͯ]/g, "").toUpperCase().replace(/[^A-Z]/g, "");
215
+ return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase().replace(/[^A-Z]/g, "");
216
216
  }
217
217
  function he(e) {
218
218
  return [...e].filter((t) => !pe.has(t)).join("");
@@ -550,4 +550,4 @@ export {
550
550
  Ut as i,
551
551
  vt as w
552
552
  };
553
- //# sourceMappingURL=fiscal-code-input-DWA6C8x8.js.map
553
+ //# sourceMappingURL=fiscal-code-input-QP9gkyDE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fiscal-code-input-QP9gkyDE.js","sources":["../../node_modules/lucide-react/dist/esm/icons/calculator.mjs","../../src/components/fiscal-code-input/fiscal-code-input.agent.ts","../../src/components/fiscal-code-input/is-valid-codice-fiscale.ts","../../src/components/fiscal-code-input/calculate-codice-fiscale.ts","../../src/components/fiscal-code-input/fiscal-code-input.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 [\"rect\", { width: \"16\", height: \"20\", x: \"4\", y: \"2\", rx: \"2\", key: \"1nb95v\" }],\n [\"line\", { x1: \"8\", x2: \"16\", y1: \"6\", y2: \"6\", key: \"x4nwl0\" }],\n [\"line\", { x1: \"16\", x2: \"16\", y1: \"14\", y2: \"18\", key: \"wjye3r\" }],\n [\"path\", { d: \"M16 10h.01\", key: \"1m94wz\" }],\n [\"path\", { d: \"M12 10h.01\", key: \"1nrarc\" }],\n [\"path\", { d: \"M8 10h.01\", key: \"19clt8\" }],\n [\"path\", { d: \"M12 14h.01\", key: \"1etili\" }],\n [\"path\", { d: \"M8 14h.01\", key: \"6423bh\" }],\n [\"path\", { d: \"M12 18h.01\", key: \"mhygvu\" }],\n [\"path\", { d: \"M8 18h.01\", key: \"lrp35t\" }]\n];\nconst Calculator = createLucideIcon(\"calculator\", __iconNode);\n\nexport { __iconNode, Calculator as default };\n//# sourceMappingURL=calculator.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — FiscalCodeInput. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { FiscalCodeInputHandle } from './fiscal-code-input';\n\nexport const fiscalCodeInputAgent: AgentAdapter<FiscalCodeInputHandle> = {\n id: 'fiscal-code-input',\n capabilities: ['set_value'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.fiscalCodeInput.state.value',\n description:\n 'Current codice fiscale, normalised (uppercased, 0–16 [A-Z0-9] characters).',\n read: (handle) => handle.getValue(),\n },\n isValid: {\n type: 'boolean',\n descriptionKey: 'ui.agent.fiscalCodeInput.state.isValid',\n description:\n 'Whether the value is 16 structurally-sound characters with a matching control character.',\n read: (handle) => handle.isValid(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: { value: { type: 'string' } },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.fiscalCodeInput.actions.setValue',\n description:\n 'Replace the codice fiscale. The value is uppercased and stripped to [A-Z0-9], capped at 16 characters.',\n examples: [\n {\n args: { value: 'RSSMRA85T10A562S' },\n note: 'A complete, structurally-sound codice fiscale.',\n },\n ],\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.fiscalCodeInput.actions.clear',\n description: 'Empty the input. Loses any typed value.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.fiscalCodeInput.actions.focus',\n description: 'Move keyboard focus to the codice fiscale input.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'fiscal-code-input',\n description: 'Marks the FiscalCodeInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Codice Fiscale (Italian fiscal code) — client-side structural + */\n/* control-character checksum validator. */\n/* */\n/* SCOPE: this is a CLIENT MIRROR of the platform's */\n/* ValidateFiscalCodeService used ONLY to give instant feedback. It */\n/* validates two things and nothing more: */\n/* 1. The structural shape — 15 alphanumerics followed by 1 control */\n/* letter, where each position obeys its letter/digit class */\n/* (/^[A-Z0-9]{15}[A-Z]$/ plus the per-position class pattern). */\n/* 2. The 16th control character, derived from the first 15 via the */\n/* official odd/even per-position weighted-sum mod-26 algorithm. */\n/* */\n/* OUT OF SCOPE (server stays source of truth): birth-date / comune */\n/* Belfiore-code cross-checks and omocodia digit-substitution. A */\n/* structurally-correct code with a valid control character can still */\n/* be rejected by the server — the client never hard-blocks submit on */\n/* its own verdict. */\n/* ------------------------------------------------------------------ */\n\n/** Outcome of a structural + checksum check on a 16-char candidate. */\nexport type FiscalCodeReason =\n | 'empty'\n | 'incomplete'\n | 'badFormat'\n | 'badChecksum'\n | 'valid';\n\n/**\n * Position classes for the 15 informative characters. Positions are\n * 0-indexed. Letter positions accept A–Z; digit positions accept 0–9.\n * The 16th (control) character is a letter and validated separately.\n *\n * Standard layout (ignoring omocodia substitution, which the SERVER\n * handles): surname (0–2 letters), name (3–5 letters), year (6–7\n * digits), month (8 letter), day (9–10 digits), comune (11 letter +\n * 12–14 digits). For client structural feedback we accept the canonical\n * non-omocodic layout; omocodic variants surface as `badFormat` here and\n * are resolved server-side — documented as an accepted client limitation.\n */\nconst LETTER_POSITIONS = new Set([0, 1, 2, 3, 4, 5, 8, 11]);\nconst DIGIT_POSITIONS = new Set([6, 7, 9, 10, 12, 13, 14]);\n\nconst ODD_MAP: Readonly<Record<string, number>> = Object.freeze({\n '0': 1,\n '1': 0,\n '2': 5,\n '3': 7,\n '4': 9,\n '5': 13,\n '6': 15,\n '7': 17,\n '8': 19,\n '9': 21,\n A: 1,\n B: 0,\n C: 5,\n D: 7,\n E: 9,\n F: 13,\n G: 15,\n H: 17,\n I: 19,\n J: 21,\n K: 2,\n L: 4,\n M: 18,\n N: 20,\n O: 11,\n P: 3,\n Q: 6,\n R: 8,\n S: 12,\n T: 14,\n U: 16,\n V: 10,\n W: 22,\n X: 25,\n Y: 24,\n Z: 23,\n});\n\nconst EVEN_MAP: Readonly<Record<string, number>> = Object.freeze({\n '0': 0,\n '1': 1,\n '2': 2,\n '3': 3,\n '4': 4,\n '5': 5,\n '6': 6,\n '7': 7,\n '8': 8,\n '9': 9,\n A: 0,\n B: 1,\n C: 2,\n D: 3,\n E: 4,\n F: 5,\n G: 6,\n H: 7,\n I: 8,\n J: 9,\n K: 10,\n L: 11,\n M: 12,\n N: 13,\n O: 14,\n P: 15,\n Q: 16,\n R: 17,\n S: 18,\n T: 19,\n U: 20,\n V: 21,\n W: 22,\n X: 23,\n Y: 24,\n Z: 25,\n});\n\nconst REMAINDER_TO_CONTROL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n/** True when every informative position matches its letter/digit class. */\nfunction hasValidStructure(code: string): boolean {\n if (!/^[A-Z0-9]{15}[A-Z]$/.test(code)) return false;\n for (let i = 0; i < 15; i += 1) {\n const ch = code[i];\n const isDigit = ch >= '0' && ch <= '9';\n if (LETTER_POSITIONS.has(i) && isDigit) return false;\n if (DIGIT_POSITIONS.has(i) && !isDigit) return false;\n }\n return true;\n}\n\n/**\n * Compute the expected 16th control character from the first 15\n * informative characters. The input MUST already be 15 uppercase\n * `[A-Z0-9]` characters (callers guard with `hasValidStructure`).\n */\nexport function computeControlChar(first15: string): string {\n let sum = 0;\n for (let i = 0; i < 15; i += 1) {\n const ch = first15[i];\n // Per the official spec, odd POSITIONS (1st, 3rd, … — i.e. 0-indexed\n // even i) use the ODD weight table; even positions use the EVEN table.\n sum += i % 2 === 0 ? ODD_MAP[ch] : EVEN_MAP[ch];\n }\n return REMAINDER_TO_CONTROL[sum % 26];\n}\n\n/**\n * Classify a normalised (uppercased, `[A-Z0-9]`-only) candidate.\n *\n * - `empty` — no characters.\n * - `incomplete` — fewer than 16 characters.\n * - `badFormat` — 16 characters but the position-class pattern fails.\n * - `badChecksum` — 16 well-formed characters but the control char is wrong.\n * - `valid` — structurally sound and the control char matches.\n */\nexport function classifyCodiceFiscale(raw: string): FiscalCodeReason {\n if (raw.length === 0) return 'empty';\n if (raw.length < 16) return 'incomplete';\n // raw is normalised to at most 16 chars by the component; guard anyway.\n const code = raw.slice(0, 16);\n if (!hasValidStructure(code)) return 'badFormat';\n if (computeControlChar(code.slice(0, 15)) !== code[15]) return 'badChecksum';\n return 'valid';\n}\n\n/** Convenience boolean: structurally sound AND control character matches. */\nexport function isValidCodiceFiscale(raw: string): boolean {\n return classifyCodiceFiscale(raw) === 'valid';\n}\n","/* ------------------------------------------------------------------ */\n/* Codice Fiscale (Italian fiscal code) — client-side DERIVATION. */\n/* */\n/* SCOPE: a pure, self-contained function that computes the 16-char */\n/* codice fiscale from a person's identity data when the caller already */\n/* holds it. This is a CONVENIENCE so a form that knows surname / name */\n/* / birth date / sex / birthplace can pre-fill the field — the server */\n/* (ValidateFiscalCodeService) remains the source of truth. */\n/* */\n/* OUT OF SCOPE: municipality-name → Belfiore (cadastral) code lookup. */\n/* That mapping requires a ~8000-row table the kit must not bundle, so */\n/* the caller supplies the 4-character `belfioreCode` directly. */\n/* Omocodia digit-substitution (used only when two people would share a */\n/* code) is also out of scope — the base, non-omocodic code is emitted. */\n/* ------------------------------------------------------------------ */\n\nimport { computeControlChar } from './is-valid-codice-fiscale';\n\n/** Identity inputs needed to derive the (non-omocodic) codice fiscale. */\nexport interface CodiceFiscaleInput {\n /** Family name (cognome). Diacritics are folded; non-letters ignored. */\n surname: string;\n /** Given name (nome). Diacritics are folded; non-letters ignored. */\n name: string;\n /** Date of birth — a `Date` or an ISO `YYYY-MM-DD` (or full ISO) string. */\n birthDate: Date | string;\n /** Biological sex as recorded for the fiscal code: 'M' or 'F'. */\n sex: 'M' | 'F';\n /** 4-character cadastral / Belfiore code of the birthplace (e.g. H501). */\n belfioreCode: string;\n}\n\nconst VOWELS = new Set(['A', 'E', 'I', 'O', 'U']);\n\n/** Month → fiscal-code letter (Jan→A … Dec→T), 0-indexed by month. */\nconst MONTH_LETTERS = [\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'H',\n 'L',\n 'M',\n 'P',\n 'R',\n 'S',\n 'T',\n] as const;\n\n/**\n * Fold a free-text name to bare uppercase A–Z: strip diacritics via NFD,\n * drop combining marks, uppercase, and keep only A–Z. Spaces / apostrophes\n * in compound names collapse away (the algorithm treats the name as one run\n * of letters).\n */\nfunction foldToLetters(input: string): string {\n return input\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toUpperCase()\n .replace(/[^A-Z]/g, '');\n}\n\nfunction consonantsOf(letters: string): string {\n return [...letters].filter((c) => !VOWELS.has(c)).join('');\n}\n\nfunction vowelsOf(letters: string): string {\n return [...letters].filter((c) => VOWELS.has(c)).join('');\n}\n\n/**\n * Surname triple: consonants first, then vowels, right-padded with 'X'.\n * (e.g. \"Rossi\" → R S S; \"Fo\" → F O X.)\n */\nfunction surnameCode(surname: string): string {\n const letters = foldToLetters(surname);\n const code = consonantsOf(letters) + vowelsOf(letters);\n return (code + 'XXX').slice(0, 3);\n}\n\n/**\n * Name triple. With 4+ consonants, take the 1st, 3rd and 4th (the standard\n * \"skip the 2nd consonant\" rule); otherwise consonants then vowels,\n * right-padded with 'X'. (e.g. \"Mario\" → M R A; \"Maria\" → M RA → MRA;\n * \"Gianfranco\" → G F R.)\n */\nfunction nameCode(name: string): string {\n const letters = foldToLetters(name);\n const cons = consonantsOf(letters);\n if (cons.length >= 4) {\n return cons[0] + cons[2] + cons[3];\n }\n const code = cons + vowelsOf(letters);\n return (code + 'XXX').slice(0, 3);\n}\n\n/** Coerce a `Date` or ISO string to a `Date`; throws on an unparseable value. */\nfunction toDate(birthDate: Date | string): Date {\n const d = birthDate instanceof Date ? birthDate : new Date(birthDate);\n if (Number.isNaN(d.getTime())) {\n throw new Error(`calculateCodiceFiscale: invalid birthDate \"${birthDate}\"`);\n }\n return d;\n}\n\n/**\n * Two-digit zero-padded value. The fiscal code uses LOCAL calendar fields\n * (a birth date is a calendar date, not an instant), so we read the UTC\n * fields of a date-only ISO string consistently — see the date handling\n * below.\n */\nfunction pad2(n: number): string {\n return String(n).padStart(2, '0');\n}\n\n/**\n * Birth-date triple: 2-digit year + month letter + 2-digit day (+40 for\n * female). Returns the 5 characters `YYMDD`.\n *\n * Date fields are read in UTC so a date-only string like \"1980-01-01\"\n * (parsed by `Date` as UTC midnight) yields day 01 regardless of the\n * runtime timezone. Callers passing a `Date` built from local components\n * should construct it at UTC midnight (e.g. `new Date('1980-01-01')`).\n */\nfunction birthCode(birthDate: Date | string, sex: 'M' | 'F'): string {\n const d = toDate(birthDate);\n const yy = pad2(d.getUTCFullYear() % 100);\n const monthLetter = MONTH_LETTERS[d.getUTCMonth()];\n const day = d.getUTCDate() + (sex === 'F' ? 40 : 0);\n return yy + monthLetter + pad2(day);\n}\n\n/**\n * Compute the full 16-character (non-omocodic) codice fiscale from a\n * person's identity data. The caller supplies the 4-char Belfiore code of\n * the birthplace (the kit does not bundle the municipality table).\n *\n * Throws if `birthDate` is unparseable or `belfioreCode` is not 4\n * `[A-Z][0-9]{3}`-shaped characters — i.e. a letter followed by 3 digits,\n * the canonical Belfiore shape.\n */\nexport function calculateCodiceFiscale(input: CodiceFiscaleInput): string {\n const { surname, name, birthDate, sex, belfioreCode } = input;\n\n const belfiore = belfioreCode.trim().toUpperCase();\n if (!/^[A-Z][0-9]{3}$/.test(belfiore)) {\n throw new Error(\n `calculateCodiceFiscale: belfioreCode must be a letter + 3 digits (e.g. \"H501\"), got \"${belfioreCode}\"`,\n );\n }\n\n const first15 =\n surnameCode(surname) +\n nameCode(name) +\n birthCode(birthDate, sex) +\n belfiore;\n\n return first15 + computeControlChar(first15);\n}\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ClipboardEvent,\n type CompositionEvent,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { AlertCircle, CheckCircle2, Calculator } from 'lucide-react';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT,\n INPUT_SURFACE_TEXT,\n INPUT_SURFACE_TONE,\n} from '../_shared/input-surface';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { useAgentRegistration } from '../../agent';\nimport { IconButton } from '../button';\nimport { fiscalCodeInputAgent } from './fiscal-code-input.agent';\nimport {\n classifyCodiceFiscale,\n type FiscalCodeReason,\n} from './is-valid-codice-fiscale';\nimport {\n calculateCodiceFiscale,\n type CodiceFiscaleInput,\n} from './calculate-codice-fiscale';\n\n/** Agent-readiness curated handle for FiscalCodeInput. */\nexport interface FiscalCodeInputHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n clear: () => void;\n focus: () => void;\n isValid: () => boolean;\n}\n\n/** Structured payload emitted on every keystroke alongside the raw value. */\nexport interface FiscalCodeChangeMeta {\n /** Structurally sound AND control character matches (always 16 chars). */\n isValid: boolean;\n /** Whether all 16 characters are present (regardless of validity). */\n isComplete: boolean;\n /** Why the value is (in)valid — drives consumer messaging. */\n reason: FiscalCodeReason;\n}\n\nexport interface FiscalCodeInputProps {\n /** Controlled value (raw, uppercased, no spaces). Pair with onChange. */\n value?: string;\n /** Uncontrolled initial value. Normalised on mount. */\n defaultValue?: string;\n /** Fires on every keystroke with the normalised raw string + meta. */\n onChange?: (raw: string, meta: FiscalCodeChangeMeta) => void;\n size?: 'sm' | 'md' | 'lg';\n tone?: 'default' | 'error';\n /** When the invalid tone + error string surface. Never marks partial input invalid. */\n validateOn?: 'change' | 'blur' | 'submit';\n /** Controlled escape hatch to force the invalid state (e.g. server rejection). */\n showError?: boolean;\n /** Overrides the kit's default i18n error string. */\n errorMessage?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n placeholder?: string;\n /** Render the \"16 characters\" caption when NOT inside a FormField. */\n showFormatHint?: boolean;\n /**\n * OPT-IN. When the consuming form already holds the person's identity\n * data, supply it here to render an inline \"calculate\" affordance: a\n * small icon button that derives the codice fiscale and fills the field.\n * The caller supplies the 4-char `belfioreCode` of the birthplace — the\n * kit does not bundle the municipality lookup table. Omit to render\n * nothing extra (no behavioural change). Ignored when readOnly/disabled.\n */\n calculateFrom?: CodiceFiscaleInput;\n id?: string;\n name?: string;\n className?: string;\n 'aria-label'?: string;\n}\n\nconst MAX_LEN = 16;\n\nconst wrapperVariants = cva(\n ['ds:relative ds:flex ds:items-center ds:w-full', INPUT_SURFACE_CHROME].join(\n ' ',\n ),\n {\n variants: {\n size: {\n sm: INPUT_SURFACE_HEIGHT.sm,\n md: INPUT_SURFACE_HEIGHT.md,\n lg: INPUT_SURFACE_HEIGHT.lg,\n },\n tone: {\n default: INPUT_SURFACE_TONE.default,\n error: `${INPUT_SURFACE_TONE.error} ds:focus-within:outline-destructive`,\n },\n },\n defaultVariants: { size: 'md', tone: 'default' },\n },\n);\n\nconst inputVariants = cva(\n [\n // dir=\"ltr\" + tabular-nums keep the alphanumeric code rendering\n // left-to-right and evenly spaced even under an RTL/CJK surrounding\n // UI — this is a value-RENDERING concern (the code is never mirrored),\n // not a layout-direction violation, so logical-prop rules don't apply\n // to the code glyphs themselves.\n 'ds:w-full ds:min-w-0 ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:border-0 ds:outline-none ds:tabular-nums ds:uppercase ds:tracking-wide',\n 'ds:disabled:cursor-not-allowed',\n 'ds:read-only:cursor-default',\n ].join(' '),\n {\n variants: {\n size: {\n sm: `ds:pe-3 ${INPUT_SURFACE_TEXT.sm}`,\n md: `ds:pe-3 ${INPUT_SURFACE_TEXT.md}`,\n lg: `ds:pe-4 ${INPUT_SURFACE_TEXT.lg}`,\n },\n // When the calculate affordance is shown, the input text starts after\n // the inline-start icon button (mirrors `hasEnd`'s pe-10 reservation).\n hasStart: {\n true: 'ds:ps-10',\n false: '',\n },\n hasEnd: {\n true: 'ds:pe-10',\n false: '',\n },\n },\n compoundVariants: [\n { size: 'sm', hasStart: false, class: 'ds:ps-3' },\n { size: 'md', hasStart: false, class: 'ds:ps-3' },\n { size: 'lg', hasStart: false, class: 'ds:ps-4' },\n ],\n defaultVariants: { size: 'md', hasStart: false, hasEnd: false },\n },\n);\n\nconst adornmentEnd =\n 'ds:absolute ds:inset-y-0 ds:end-0 ds:pe-3 ds:flex ds:items-center ds:pointer-events-none ds:[&_svg]:size-4';\n\n// Inline-start wrapper for the calculate icon button. Positioned over the\n// reserved `ps-10` gutter; the button itself remains pointer-interactive.\nconst adornmentStart =\n 'ds:absolute ds:inset-y-0 ds:start-0 ds:ps-1 ds:flex ds:items-center';\n\nconst captionBase = 'type-body-sm ds:mt-[var(--spacing-xs)]';\n\n/** Uppercase, strip non-[A-Z0-9], normalise full-width / Eastern-Arabic\n * digits, and cap at 16 characters. */\nfunction normaliseFiscalCode(input: string): string {\n return (\n input\n .normalize('NFKC')\n // Eastern-Arabic & Extended-Arabic-Indic digits → ASCII (otp-input precedent).\n .replace(/[٠-٩]/g, (c) => String(c.charCodeAt(0) - 0x0660))\n .replace(/[۰-۹]/g, (c) => String(c.charCodeAt(0) - 0x06f0))\n .toUpperCase()\n .replace(/[^A-Z0-9]/g, '')\n .slice(0, MAX_LEN)\n );\n}\n\n/** Count [A-Z0-9] characters before `position` in the RAW (pre-normalise)\n * string, so the caret can be restored after re-normalising. */\nfunction countKeptBefore(str: string, position: number): number {\n let kept = 0;\n for (let i = 0; i < position && i < str.length; i += 1) {\n const c = str[i];\n if (\n (c >= '0' && c <= '9') ||\n (c >= 'A' && c <= 'Z') ||\n (c >= 'a' && c <= 'z')\n ) {\n kept += 1;\n }\n }\n return kept;\n}\n\nexport const FiscalCodeInput = forwardRef<\n HTMLInputElement,\n FiscalCodeInputProps\n>(function FiscalCodeInput(\n {\n value,\n defaultValue,\n onChange,\n size = 'md',\n tone = 'default',\n validateOn = 'blur',\n showError,\n errorMessage,\n disabled,\n readOnly,\n required,\n placeholder,\n showFormatHint = true,\n calculateFrom,\n id,\n name,\n className,\n 'aria-label': ariaLabel,\n },\n ref,\n) {\n const { t } = useTranslation();\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(() =>\n normaliseFiscalCode(defaultValue ?? ''),\n );\n const currentValue = isControlled\n ? normaliseFiscalCode(value ?? '')\n : internalValue;\n\n const [blurred, setBlurred] = useState(false);\n const composingRef = useRef(false);\n const pendingCaretRef = useRef<number | null>(null);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const composedRef = composeRefs(ref, inputRef);\n\n const reactId = useId();\n const generatedHintId = `${reactId}-hint`;\n const generatedStatusId = `${reactId}-status`;\n const generatedErrorId = `${reactId}-error`;\n\n // DEV-time guard: a standalone field with no visible label needs an\n // aria-label, mirroring Button's icon-only guard. No-op in production.\n useEffect(() => {\n const isDev =\n typeof import.meta !== 'undefined' &&\n typeof import.meta.env !== 'undefined' &&\n import.meta.env.DEV === true;\n if (isDev && !inFormField && !ariaLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n '[FiscalCodeInput] No FormField/label and no `aria-label` — the field has no accessible name. Wrap it in a FormField or pass `aria-label`.',\n );\n }\n }, [inFormField, ariaLabel]);\n\n const reason = useMemo(\n () => classifyCodiceFiscale(currentValue),\n [currentValue],\n );\n const isComplete = currentValue.length === MAX_LEN;\n const isValid = reason === 'valid';\n\n const effectiveDisabled =\n (inFormField ? ctx.disabled : false) || Boolean(disabled);\n const effectiveRequired =\n (inFormField ? ctx.required : false) || Boolean(required);\n\n // Whether the component's OWN feedback should surface.\n //\n // `showError` is a controlled escape hatch (e.g. the server rejected the\n // code on submit): it forces the error regardless of completeness or the\n // client's own verdict. Otherwise the client only flags a COMPLETE\n // (16-char) code that fails its structural/checksum check — never a\n // partially-typed code — and `validateOn` governs the trigger.\n const ownFeedbackActive =\n !readOnly &&\n (Boolean(showError) ||\n (isComplete &&\n !isValid &&\n (validateOn === 'change' || (validateOn === 'blur' && blurred))));\n\n // When inside a FormField with its own error, FormField's role=alert wins\n // and this component stays silent (no double message / duplicate\n // aria-describedby target).\n const formFieldHasError = inFormField && ctx.invalid;\n const showOwnError = ownFeedbackActive && !formFieldHasError;\n\n const effectiveInvalid = formFieldHasError || showOwnError;\n const effectiveTone: 'default' | 'error' =\n effectiveInvalid || tone === 'error' ? 'error' : 'default';\n\n const ownErrorText = useMemo(() => {\n if (errorMessage) return errorMessage;\n if (reason === 'badChecksum') return t('inputs.fiscalCode.errorChecksum');\n if (reason === 'badFormat') return t('inputs.fiscalCode.errorFormat');\n return t('inputs.fiscalCode.errorIncomplete');\n }, [errorMessage, reason, t]);\n\n // Standalone (no FormField) describedby: format hint + the live region that\n // is currently surfacing. When the component is showing its OWN error we\n // point at the assertive error node; otherwise at the polite status node\n // (valid affordance / typing progress). Inside a FormField, the FormField\n // owns describedBy entirely.\n const wantsHint = !inFormField && showFormatHint && !readOnly;\n const standaloneDescribedBy = inFormField\n ? undefined\n : [\n wantsHint ? generatedHintId : null,\n showOwnError ? generatedErrorId : generatedStatusId,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const describedBy = inFormField\n ? ctx.describedBy || undefined\n : standaloneDescribedBy;\n\n const inputId = id ?? ctx.id;\n\n const emit = useCallback(\n (next: string) => {\n const nextReason = classifyCodiceFiscale(next);\n onChange?.(next, {\n isValid: nextReason === 'valid',\n isComplete: next.length === MAX_LEN,\n reason: nextReason,\n });\n },\n [onChange],\n );\n\n const commit = useCallback(\n (next: string) => {\n if (!isControlled) setInternalValue(next);\n emit(next);\n },\n [isControlled, emit],\n );\n\n // Restore caret after a normalising re-render that may have changed the\n // string length (mid-string edit / paste). Mirrors phone-input's caret\n // discipline.\n useIsomorphicLayoutEffect(() => {\n if (pendingCaretRef.current == null) return;\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n const node = inputRef.current;\n if (node && document.activeElement === node) {\n // Re-clamp against the value the input ACTUALLY rendered this pass, not\n // the value we committed: a controlled parent may transform or reject\n // the emitted change so the echoed value diverges. Clamping to the live\n // DOM length keeps the caret inside the rendered string.\n const safePos = Math.min(pos, node.value.length);\n node.setSelectionRange(safePos, safePos);\n }\n });\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (readOnly) return;\n // Don't re-mask mid-IME composition or the user loses input; the\n // uppercase mask is re-applied on composition end / next change.\n if (composingRef.current) return;\n const target = event.target;\n const raw = target.value;\n const caret = target.selectionStart ?? raw.length;\n const keptBefore = countKeptBefore(raw, caret);\n const next = normaliseFiscalCode(raw);\n pendingCaretRef.current = Math.min(keptBefore, next.length);\n commit(next);\n };\n\n const handleCompositionStart = () => {\n composingRef.current = true;\n };\n\n const handleCompositionEnd = (event: CompositionEvent<HTMLInputElement>) => {\n composingRef.current = false;\n if (readOnly) return;\n const next = normaliseFiscalCode(event.currentTarget.value);\n pendingCaretRef.current = next.length;\n commit(next);\n };\n\n const handlePaste = (event: ClipboardEvent<HTMLInputElement>) => {\n if (readOnly) return;\n const text = event.clipboardData.getData('text');\n event.preventDefault();\n const node = inputRef.current;\n const selStart = node?.selectionStart ?? currentValue.length;\n const selEnd = node?.selectionEnd ?? currentValue.length;\n const cleaned = normaliseFiscalCode(text);\n const before = currentValue.slice(0, selStart);\n const after = currentValue.slice(selEnd);\n const next = normaliseFiscalCode(before + cleaned + after);\n pendingCaretRef.current = Math.min((before + cleaned).length, next.length);\n commit(next);\n };\n\n const handleBlur = () => {\n if (validateOn === 'blur') setBlurred(true);\n };\n\n // Opt-in derivation. Compute the CF from the supplied identity data and\n // route it through the SAME commit path as typing/paste so the controlled\n // / uncontrolled contract, the validation verdict, and the live-region\n // announcement all behave identically to a user-entered value.\n const handleCalculate = () => {\n if (!calculateFrom || readOnly || effectiveDisabled) return;\n let computed: string;\n try {\n computed = calculateCodiceFiscale(calculateFrom);\n } catch {\n // Bad identity data (unparseable date / malformed Belfiore code) is a\n // caller error, not a user action — fail quietly rather than throwing\n // out of an event handler and leave the field untouched.\n return;\n }\n const next = normaliseFiscalCode(computed);\n // After a successful derivation the value is complete: let blur-gated\n // validation surface immediately (the derived code is valid by\n // construction, so this confirms rather than errors).\n if (validateOn === 'blur') setBlurred(true);\n commit(next);\n inputRef.current?.focus();\n };\n\n const agentHandle = useMemo<FiscalCodeInputHandle>(\n () => ({\n getValue: () => currentValue,\n setValue: (next) => {\n const normalised = normaliseFiscalCode(next);\n if (!isControlled) setInternalValue(normalised);\n emit(normalised);\n inputRef.current?.focus();\n },\n clear: () => {\n if (!isControlled) setInternalValue('');\n emit('');\n inputRef.current?.focus();\n },\n focus: () => inputRef.current?.focus(),\n isValid: () => classifyCodiceFiscale(currentValue) === 'valid',\n }),\n [currentValue, isControlled, emit],\n );\n useAgentRegistration(fiscalCodeInputAgent, agentHandle, id);\n\n const resolvedPlaceholder = placeholder ?? t('inputs.fiscalCode.placeholder');\n\n // Polite status text (role=status). Carries ONLY non-error affordances:\n // the valid confirmation and, while typing an incomplete code, the live\n // character-count progress. Errors the user must act on are announced\n // assertively via the separate role=alert node below — never here.\n // Gated on !inFormField (matching showEndIcon): inside a FormField the\n // FormField owns every helper/status/error slot, so this stays silent.\n const statusMessage =\n readOnly || inFormField\n ? ''\n : isValid\n ? t('inputs.fiscalCode.valid')\n : currentValue.length > 0 && !isComplete\n ? t('inputs.fiscalCode.charactersEntered', {\n count: currentValue.length,\n })\n : '';\n\n // Assertive error text (role=alert) — surfaces only the component's own\n // actionable validation error, mirroring FormField's error <p>.\n const errorText = showOwnError ? ownErrorText : '';\n\n const showEndIcon = !readOnly && (showOwnError || (isValid && !inFormField));\n\n // Opt-in calculate affordance: only when identity data is supplied AND the\n // field is editable. Disabled/read-only fields render nothing extra.\n const showCalculate =\n Boolean(calculateFrom) && !readOnly && !effectiveDisabled;\n\n return (\n <div\n className=\"ds:flex ds:flex-col\"\n data-component=\"fiscal-code-input\"\n data-component-id={id}\n >\n <div\n data-slot=\"fiscal-code-input\"\n className={wrapperVariants({ size, tone: effectiveTone, className })}\n >\n {showCalculate ? (\n <span className={adornmentStart}>\n <IconButton\n type=\"button\"\n size=\"sm\"\n intent=\"ghost\"\n icon={<Calculator />}\n aria-label={t('inputs.fiscalCode.calculate')}\n onClick={handleCalculate}\n />\n </span>\n ) : null}\n <input\n ref={composedRef}\n id={inputId}\n name={name}\n // dir=\"ltr\": the codice fiscale glyphs render LTR even under an\n // RTL surrounding UI — a value-rendering concern, not a layout\n // direction violation (see inputVariants comment).\n dir=\"ltr\"\n type=\"text\"\n inputMode=\"text\"\n autoCapitalize=\"characters\"\n autoCorrect=\"off\"\n autoComplete=\"off\"\n spellCheck={false}\n maxLength={MAX_LEN}\n // Loose structural mirror: 15 [A-Z0-9] + a final letter control\n // char (value is always uppercased). The real position-class /\n // checksum rule is enforced in classifyCodiceFiscale; this native\n // pattern is only a non-JS fallback.\n pattern=\"[A-Z0-9]{15}[A-Z]\"\n value={currentValue}\n placeholder={resolvedPlaceholder}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n aria-label={ariaLabel}\n aria-describedby={describedBy}\n aria-invalid={effectiveInvalid || undefined}\n aria-required={effectiveRequired || undefined}\n onChange={handleChange}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n onPaste={handlePaste}\n onBlur={handleBlur}\n className={inputVariants({\n size,\n hasStart: showCalculate,\n hasEnd: showEndIcon,\n })}\n />\n {showEndIcon ? (\n <span\n aria-hidden=\"true\"\n className={`${adornmentEnd} ${\n showOwnError ? 'ds:text-destructive' : 'ds:text-success'\n }`}\n >\n {showOwnError ? <AlertCircle /> : <CheckCircle2 />}\n </span>\n ) : null}\n </div>\n\n {wantsHint ? (\n <p\n id={generatedHintId}\n className={`${captionBase} ds:text-muted-foreground`}\n >\n {t('inputs.fiscalCode.formatHint')}\n </p>\n ) : null}\n\n {/* Polite live region (role=status): announces the valid affordance\n and the typing-progress count as TEXT, satisfying 1.4.1 (never\n colour-only). Never carries an actionable error — that goes to the\n assertive node below, mirroring the kit's input-error convention. */}\n <p\n id={generatedStatusId}\n role=\"status\"\n aria-live=\"polite\"\n className={`${captionBase} ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ${\n isValid ? 'ds:text-success' : 'ds:text-muted-foreground'\n } ${statusMessage ? '' : 'ds:sr-only'}`}\n >\n {statusMessage ? (\n <>\n {isValid ? (\n <CheckCircle2\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:shrink-0\"\n />\n ) : null}\n <span>{statusMessage}</span>\n </>\n ) : null}\n </p>\n\n {/* Assertive error region (role=alert): a validation error the user\n must correct is announced assertively, mirroring FormField's error\n <p> (form-field.tsx). Rendered only when the component owns the\n error — inside a FormField, FormField's role=alert wins. */}\n {errorText ? (\n <p\n id={generatedErrorId}\n role=\"alert\"\n className={`${captionBase} ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-destructive`}\n >\n <AlertCircle aria-hidden=\"true\" className=\"ds:size-4 ds:shrink-0\" />\n <span>{errorText}</span>\n </p>\n ) : null}\n </div>\n );\n});\n\nFiscalCodeInput.displayName = 'FiscalCodeInput';\n\nexport { wrapperVariants as fiscalCodeWrapperVariants };\n"],"names":["__iconNode","Calculator","createLucideIcon","fiscalCodeInputAgent","handle","args","LETTER_POSITIONS","DIGIT_POSITIONS","ODD_MAP","EVEN_MAP","REMAINDER_TO_CONTROL","hasValidStructure","code","i","ch","isDigit","computeControlChar","first15","sum","classifyCodiceFiscale","raw","isValidCodiceFiscale","VOWELS","MONTH_LETTERS","foldToLetters","input","consonantsOf","letters","c","vowelsOf","surnameCode","surname","nameCode","name","cons","toDate","birthDate","d","pad2","n","birthCode","sex","yy","monthLetter","day","calculateCodiceFiscale","belfioreCode","belfiore","MAX_LEN","wrapperVariants","cva","INPUT_SURFACE_CHROME","INPUT_SURFACE_HEIGHT","INPUT_SURFACE_TONE","inputVariants","INPUT_SURFACE_TEXT","adornmentEnd","adornmentStart","captionBase","normaliseFiscalCode","countKeptBefore","str","position","kept","FiscalCodeInput","forwardRef","value","defaultValue","onChange","size","tone","validateOn","showError","errorMessage","disabled","readOnly","required","placeholder","showFormatHint","calculateFrom","id","className","ariaLabel","ref","t","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","isControlled","internalValue","setInternalValue","useState","currentValue","blurred","setBlurred","composingRef","useRef","pendingCaretRef","inputRef","composedRef","composeRefs","reactId","useId","generatedHintId","generatedStatusId","generatedErrorId","useEffect","reason","useMemo","isComplete","isValid","effectiveDisabled","effectiveRequired","ownFeedbackActive","formFieldHasError","showOwnError","effectiveInvalid","effectiveTone","ownErrorText","wantsHint","standaloneDescribedBy","describedBy","inputId","emit","useCallback","next","nextReason","commit","useIsomorphicLayoutEffect","pos","node","safePos","handleChange","event","target","caret","keptBefore","handleCompositionStart","handleCompositionEnd","handlePaste","text","selStart","selEnd","cleaned","before","after","handleBlur","handleCalculate","computed","_a","agentHandle","normalised","useAgentRegistration","resolvedPlaceholder","statusMessage","errorText","showEndIcon","showCalculate","jsxs","jsx","IconButton","AlertCircle","CheckCircle2","Fragment"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,MAAM,QAAQ,MAAM,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAC9E,CAAC,QAAQ,EAAE,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAC/D,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,KAAK,SAAQ,CAAE;AAAA,EAClE,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,YACL,aAAU;AAAA,YACV,WAAW,GAAGjD,CAAW,8DACvBuD,IAAU,oBAAoB,0BAChC,IAAI4C,IAAgB,KAAK,YAAY;AAAA,YAEpC,cACC,gBAAAI,EAAAK,IAAA,EACG,UAAA;AAAA,cAAArD,IACC,gBAAAiD;AAAA,gBAACG;AAAAA,gBAAA;AAAA,kBACC,eAAY;AAAA,kBACZ,WAAU;AAAA,gBAAA;AAAA,cAAA,IAEV;AAAA,cACJ,gBAAAH,EAAC,UAAM,UAAAL,GAAc;AAAA,YAAA,EAAA,CACvB,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,QAOLC,KACC,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAIrD;AAAA,YACJ,MAAK;AAAA,YACL,WAAW,GAAGlD,CAAW;AAAA,YAEzB,UAAA;AAAA,gCAAC0G,IAAA,EAAY,eAAY,QAAO,WAAU,yBAAwB;AAAA,cAClE,gBAAAF,EAAC,UAAM,UAAAJ,IAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,IAEjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AAED9F,GAAgB,cAAc;","x_google_ignoreList":[0]}
@@ -9,7 +9,7 @@ import { C as ne, b as le, a as oe } from "./collapsible-BrnRiCC6.js";
9
9
  import { D as de } from "./date-picker-DzQS8mvt.js";
10
10
  import { D as S } from "./description-list-ClNLdRMy.js";
11
11
  import { E as ce } from "./email-input-Dpe63k0K.js";
12
- import { F as pe } from "./fiscal-code-input-DWA6C8x8.js";
12
+ import { F as pe } from "./fiscal-code-input-QP9gkyDE.js";
13
13
  import { N as ue } from "./number-input-DjWzmlEY.js";
14
14
  import { P as me } from "./panel-header-D313n_9-.js";
15
15
  import { P as fe } from "./phone-input-D00ZBAm-.js";
@@ -775,4 +775,4 @@ export {
775
775
  Ae as P,
776
776
  je as p
777
777
  };
778
- //# sourceMappingURL=patient-details-zy76MRh7.js.map
778
+ //# sourceMappingURL=patient-details-COvYWp2e.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"patient-details-zy76MRh7.js","sources":["../../node_modules/lucide-react/dist/esm/icons/clipboard-list.mjs","../../src/components/patient-details/patient-details.agent.ts","../../src/components/patient-details/patient-details.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 [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\", key: \"tgr4d6\" }],\n [\n \"path\",\n {\n d: \"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\",\n key: \"116196\"\n }\n ],\n [\"path\", { d: \"M12 11h4\", key: \"1jrz19\" }],\n [\"path\", { d: \"M12 16h4\", key: \"n85exb\" }],\n [\"path\", { d: \"M8 11h.01\", key: \"1dfujw\" }],\n [\"path\", { d: \"M8 16h.01\", key: \"18s6g9\" }]\n];\nconst ClipboardList = createLucideIcon(\"clipboard-list\", __iconNode);\n\nexport { __iconNode, ClipboardList as default };\n//# sourceMappingURL=clipboard-list.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { PatientDetailsHandle } from './patient-details';\n\n/* -------------------------------------------------------------------- */\n/* Agent adapter — PatientDetails */\n/* */\n/* Exposes the patient panel to a future MCP runtime: */\n/* - VIEW CONFIG (safety: write) — show/hide + reorder the visible */\n/* field set. These mutate the user's view, not the patient record. */\n/* - PHI WRITE (safety: phi) — `update_field` writes a patient field */\n/* value. It is the ONLY PHI mutation and routes through the same */\n/* `onFieldSave` path as a human inline edit, so the consumer's */\n/* permission + validation + audit are the single write authority. */\n/* `phi` (not `write`) forces the runtime's confirm-before-act gate. */\n/* */\n/* STATE exposes only field KEYS (`visibleFieldOrder`) and an opaque */\n/* `patientId` — never a field value or patient identity (PRS §Security, */\n/* 26-agent-readiness §6.1/§7). */\n/* -------------------------------------------------------------------- */\n\nexport const patientDetailsAgent: AgentAdapter<PatientDetailsHandle> = {\n id: 'patient-details',\n // `view_change` backs the view-config actions (show/hide + reorder are both\n // view reconfigurations); `set_value` backs the single-value `update_field`\n // (not `edit_inline`, which is for granular free-text/formatting edits).\n capabilities: ['view_change', 'set_value'],\n state: {\n visibleFieldOrder: {\n type: 'string[]',\n descriptionKey: 'ui.agent.patientDetails.state.visibleFieldOrder',\n description:\n 'Ordered list of visible field KEYS (e.g. \"fiscalCode\"). Never a field value.',\n read: (handle) => handle.getVisibleFieldOrder(),\n },\n patientId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.patientDetails.state.patientId',\n description:\n 'Opaque patient id the panel is bound to. No patient-identifiable data.',\n read: (handle) => handle.getPatientId(),\n },\n },\n actions: {\n set_visible_fields: {\n safety: 'write',\n argsType: '{ fieldIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['fieldIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setVisibleFields',\n description:\n 'Set which fields are visible (and their order). Unknown ids are ignored.',\n examples: [\n {\n args: { fieldIds: ['lastName', 'firstName', 'phone', 'email'] },\n note: 'Show only name + contact fields.',\n },\n ],\n invoke: (handle, args: { fieldIds: string[] }) => {\n handle.setVisibleFields(args.fieldIds);\n },\n },\n set_field_order: {\n safety: 'write',\n argsType: '{ orderedIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n orderedIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['orderedIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setFieldOrder',\n description:\n 'Reorder the visible fields. Order within a section is honoured; sections stay fixed.',\n invoke: (handle, args: { orderedIds: string[] }) => {\n handle.setFieldOrder(args.orderedIds);\n },\n },\n update_field: {\n // PHI: mutates a patient-identifiable value. NOT `write` — the runtime\n // must confirm + audit. Routes through `onFieldSave` (server write).\n safety: 'phi',\n openWorld: true,\n argsType: '{ fieldId: string; value: unknown }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldId: { type: 'string' },\n value: {},\n },\n required: ['fieldId', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.updateField',\n description:\n \"Write a patient field value via the consumer's audited save path. Subject to the same permissions and validation as a human edit.\",\n errors: ['no-save-handler', 'validation-failed', 'permission-denied'],\n examples: [\n {\n args: { fieldId: 'job', value: 'Architect' },\n note: 'Update the patient’s occupation.',\n },\n ],\n invoke: (handle, args: { fieldId: string; value: unknown }) =>\n handle.updateField(args.fieldId, args.value),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'patient-details',\n description: 'Marks the PatientDetails root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop. Addresses a specific panel.',\n },\n item: {\n attr: 'data-field-id',\n description:\n 'Stable field KEY on each row. Never the field value (no PHI in the DOM hook).',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useCallback,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, ClipboardList, Copy, Lock, Pencil, X } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { IconButton } from '../button';\nimport { Card } from '../card/card';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\nimport { DatePicker } from '../date-picker/date-picker';\nimport { DescriptionList } from '../description-list/description-list';\nimport { EmailInput } from '../email-input/email-input';\nimport { FiscalCodeInput } from '../fiscal-code-input/fiscal-code-input';\nimport { NumberInput } from '../number-input/number-input';\nimport { PanelHeader } from '../panel-header/panel-header';\nimport { PhoneInput } from '../phone-input/phone-input';\nimport { Select } from '../select/select';\nimport { Switch } from '../switch/switch';\nimport { TextArea } from '../text-area/text-area';\nimport { TextInput } from '../text-input/text-input';\nimport { CountrySelect } from '../country-select/country-select';\nimport { ProvinceSelect } from '../province-select/province-select';\nimport { PostalCodeInput } from '../postal-code-input/postal-code-input';\nimport { CityInput } from '../city-input/city-input';\nimport { useAgentRegistration } from '../../agent/registry';\nimport {\n resolveVisibleFields,\n type PatientField,\n type PatientFieldEditType,\n type PatientFieldEditValue,\n type PatientFieldOption,\n type PatientFieldSection,\n} from '../_shared/patient-fields';\nimport { usePatientFieldVisibility } from '../_shared/field-visibility';\nimport { FieldVisibilityCog } from '../_shared/field-visibility-cog';\nimport { FieldValue } from '../_shared/field-value';\nimport { patientDetailsAgent } from './patient-details.agent';\n\n/* -------------------------------------------------------------------- */\n/* PatientDetails */\n/* */\n/* The customizable, inline-editable patient record panel — the kit's */\n/* replacement for platform's hardcoded, per-user-identical patient */\n/* \"scheda paziente\" table. Mounts as a CONTEXTUAL tool in the Control */\n/* Room rail (a separate tool from EntitySummary, the AI brief). */\n/* */\n/* Boundaries (PRS §Security + 26-agent-readiness §PHI): */\n/* - DATA-IN for values: the consumer maps DoctorPatient → sections. */\n/* The kit owns the layout, the cog field-picker, i18n & theming. */\n/* - PERSISTENCE-OUT: the cog emits `onVisibleFieldsChange`; the */\n/* consumer persists the user's chosen ordered field set (platform: */\n/* a per-user × per-practice JSON column). */\n/* - WRITE-OUT: inline edits AND the agent's `update_field` BOTH route */\n/* through the single `onFieldSave` callback, so platform's */\n/* permission + validation + audit path is the only write channel. */\n/* - DOM hooks + agent state carry only field KEYS and an opaque */\n/* `patientId` — never a field VALUE / patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:text-[color:var(--foreground)]',\n {\n variants: {\n // `compact` (default) suits the narrow rail panel; `comfortable`\n // relaxes spacing for a wider host (a full-width profile page).\n density: {\n comfortable: '',\n compact: '',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n },\n);\n\n// The scrolling body sits BELOW the shared PanelHeader (which owns the title\n// row + divider + its own top/side padding). The header is full-bleed at the\n// top of the scroll region; the body carries the panel's content padding.\nconst bodyVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', {\n variants: {\n density: {\n comfortable: 'ds:p-[var(--spacing-md)]',\n compact: 'ds:p-[var(--spacing-sm)]',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* */\n/* The field model is the shared `_shared/patient-fields` vocabulary, so */\n/* PatientDetails and PatientSummaryCard speak ONE field language. The */\n/* visible set + order are a PER-CONTEXT preference the consumer owns and */\n/* wires per placement — never a single value synced across surfaces. The */\n/* `PatientDetails*` names below are kept as aliases for back-compat. */\n/* -------------------------------------------------------------------- */\n\nexport type {\n PatientField,\n PatientFieldSection,\n PatientFieldOption,\n PatientFieldEditType,\n PatientFieldEditValue,\n} from '../_shared/patient-fields';\n\n/** A label→value patient field. Alias of the shared {@link PatientField}. */\nexport type PatientDetailsField = PatientField;\n/** A labelled, collapsible group of fields. Alias of {@link PatientFieldSection}. */\nexport type PatientDetailsSection = PatientFieldSection;\n/** Alias of the shared {@link PatientFieldOption}. */\nexport type PatientDetailsFieldOption = PatientFieldOption;\n/** Alias of the shared {@link PatientFieldEditType}. */\nexport type PatientDetailsEditType = PatientFieldEditType;\n/** Alias of the shared {@link PatientFieldEditValue}. */\nexport type PatientDetailsEditValue = PatientFieldEditValue;\n\n/**\n * Imperative handle the agent adapter drives. Exposes only field KEYS and\n * an opaque `patientId` for reads; `updateField` routes writes through the\n * same `onFieldSave` path as a human inline edit (no second channel).\n */\nexport interface PatientDetailsHandle {\n /** The current ordered list of visible field ids. */\n getVisibleFieldOrder: () => string[];\n /** Opaque patient id (no PHI). */\n getPatientId: () => string | undefined;\n /** Replace the visible set, preserving the given order (filtered to known fields). */\n setVisibleFields: (fieldIds: string[]) => void;\n /** Replace the full ordered visible list (filtered to known fields). */\n setFieldOrder: (orderedIds: string[]) => void;\n /** Write a field value — delegates to `onFieldSave`. Rejects if no handler. */\n updateField: (fieldId: string, value: unknown) => Promise<void>;\n}\n\nexport interface PatientDetailsProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /** Patient display name — the panel heading. */\n title: ReactNode;\n /** The sectioned field catalogue (consumer-mapped from DoctorPatient). */\n sections: PatientDetailsSection[];\n /**\n * Header avatar photo / initials override. The panel always fronts the name\n * with an Avatar — initials derive from a string `title` by default; pass\n * `src` for a photo, or `name` to override the initials source.\n */\n avatar?: { src?: string; name?: string };\n /** At-a-glance chips under the name (consumer-composed Badge/Tag/Chip row). */\n headerChips?: ReactNode;\n\n /* ----- inline editing (kit-owned controls, consumer-owned write) ----- */\n\n /**\n * Frame the identity header and each section in its own elevated `Card`,\n * for a \"control-room\" rail that reads as a stack of cards rather than one\n * flat panel. Default `false` (the flat panel with a header rule + eyebrow\n * section headings). When framed, the header rule is dropped — the cards\n * provide the separation.\n */\n framed?: boolean;\n /** Master switch — show edit affordances on `editable` fields. */\n editable?: boolean;\n /**\n * Persist a field edit. Resolve ⇒ committed; reject(Error) ⇒ the message\n * is shown inline and the row stays in edit mode. Also the single channel\n * the agent's `update_field` uses.\n */\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n /** Domain validation — return an error message, or `null` when valid. */\n validate?: (fieldId: string, value: unknown) => string | null;\n\n /* ----- customization (the cog; controlled OR uncontrolled) ----- */\n\n /**\n * Controlled ordered list of visible field ids. `undefined` ⇒ every field\n * visible; an explicit `[]` ⇒ none (a panel that starts collapsed).\n */\n visibleFieldOrder?: string[];\n /** Uncontrolled initial order. Omit both ⇒ every field visible, in declaration order. */\n defaultVisibleFieldOrder?: string[];\n /** Fired whenever the user shows/hides/reorders fields via the cog. */\n onVisibleFieldsChange?: (orderedIds: string[]) => void;\n\n /* ----- states ----- */\n\n /** Render the loading skeleton. */\n loading?: boolean;\n /** Shown when there are no sections / no patient. Defaults to a localised hint. */\n emptyState?: ReactNode;\n\n /* ----- agent / a11y ----- */\n\n /** Opaque patient id — emitted as `data-patient-id` + agent stateRead. No PHI. */\n patientId?: string;\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /** BCP-47 locale override (currency / number editors). */\n locale?: string;\n /** Override the cog trigger's accessible name. */\n cogLabel?: string;\n /** Override the panel region's accessible name (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PatientDetails = forwardRef<HTMLElement, PatientDetailsProps>(\n function PatientDetails(\n {\n title,\n sections,\n avatar,\n headerChips,\n framed = false,\n editable = false,\n onFieldSave,\n validate,\n visibleFieldOrder,\n defaultVisibleFieldOrder,\n onVisibleFieldsChange,\n loading = false,\n emptyState,\n patientId,\n id,\n locale,\n cogLabel,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const headingId = useId();\n\n // Per-context field visibility + ordering. The order is a per-INSTANCE\n // preference the kit never persists — the consumer wires its own\n // value/onChange, so the same field vocabulary can render differently in\n // different parts of the app (see usePatientFieldVisibility).\n const {\n visible,\n catalogueIds,\n setOrder,\n toggleField,\n toggleSection,\n moveFieldOnto,\n reset: resetToDefaults,\n } = usePatientFieldVisibility(sections, {\n value: visibleFieldOrder,\n defaultValue: defaultVisibleFieldOrder,\n onChange: onVisibleFieldsChange,\n });\n\n /* ---- imperative handle (agent) ------------------------------- */\n\n const handle = useMemo<PatientDetailsHandle>(\n () => ({\n getVisibleFieldOrder: () => visible,\n getPatientId: () => patientId,\n setVisibleFields: (fieldIds) => setOrder(fieldIds),\n setFieldOrder: (orderedIds) => setOrder(orderedIds),\n updateField: (fieldId, value) => {\n if (!onFieldSave) {\n return Promise.reject(\n new Error('PatientDetails: no onFieldSave handler is wired.'),\n );\n }\n return onFieldSave(fieldId, value);\n },\n }),\n [visible, patientId, setOrder, onFieldSave],\n );\n useAgentRegistration(patientDetailsAgent, handle, id);\n\n /* ---- region accessible name ---------------------------------- */\n\n const panelTitle = t('patientDetails.regionLabel', {\n defaultValue: 'Patient details',\n });\n const resolvedAriaLabel = ariaLabel ?? panelTitle;\n\n /* ---- header avatar ------------------------------------------- */\n // Parity with the card: the panel fronts the name with an Avatar (photo via\n // `avatar.src`, else initials from the name). Omitted only when `title` is a\n // non-string node and no `avatar.name` is given (nothing to derive from).\n const avatarName =\n avatar?.name ?? (typeof title === 'string' ? title : undefined);\n const showAvatar = Boolean(avatar?.src || avatarName);\n\n /* ---- loading / empty ----------------------------------------- */\n\n const hasVisible = catalogueIds.some((cid) => visible.includes(cid));\n\n if (loading) {\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-label={resolvedAriaLabel}\n aria-busy=\"true\"\n className={rootVariants({ className })}\n {...rest}\n >\n <div className={bodyVariants()}>\n <PatientDetailsSkeleton />\n </div>\n </section>\n );\n }\n\n const isEmpty = sections.length === 0 || !hasVisible;\n\n // The identity card (avatar + name + chips) is now the FIRST block of the\n // scrolling body — the shared PanelHeader owns the panel title row. The\n // name demotes to <h3> (the PanelHeader title is the <h2>).\n const identityBlock = (\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {showAvatar ? (\n <Avatar\n size=\"md\"\n name={avatarName}\n src={avatar?.src}\n className=\"ds:shrink-0\"\n />\n ) : null}\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h3 className=\"ds:m-0 type-title-item ds:text-[color:var(--foreground)]\">\n {title}\n </h3>\n {/* Chips sit under the NAME (not the avatar) — same column shape\n as the card's identity line. */}\n {headerChips ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {headerChips}\n </div>\n ) : null}\n </div>\n </div>\n );\n\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel ?? undefined}\n className={rootVariants({ className })}\n {...rest}\n >\n {/* The shared rail-panel header: panel title + the field-picker cog as\n its panel-owned action; the rail injects favourite/close after it.\n Sticky + divider so the title stays as the body scrolls. */}\n <PanelHeader\n title={panelTitle}\n icon={<ClipboardList aria-hidden=\"true\" />}\n headingId={headingId}\n sticky\n divider\n actions={\n <FieldVisibilityCog\n sections={sections}\n visible={visible}\n onToggleField={toggleField}\n onToggleSection={toggleSection}\n onMoveFieldOnto={moveFieldOnto}\n onReset={resetToDefaults}\n label={cogLabel}\n />\n }\n />\n\n <div className={bodyVariants()}>\n {/* Identity card — first block of the body; framed wraps it in its\n own elevated card alongside each section. */}\n {framed ? (\n <Card variant=\"elevated\">\n <Card.Body>{identityBlock}</Card.Body>\n </Card>\n ) : (\n identityBlock\n )}\n\n {/* Body — one card per section when framed, otherwise a flat stack. */}\n {isEmpty ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {emptyState ??\n t('patientDetails.empty', {\n defaultValue: 'No patient selected.',\n })}\n </p>\n ) : (\n resolveVisibleFields(sections, visible)\n // A section whose fields are all hidden drops out entirely —\n // no empty card / \"No fields shown.\" placeholder. (The field\n // picker still lists it, so hidden fields can be re-added.)\n .filter(({ fields }) => fields.length > 0)\n .map(({ section, fields }) => {\n const block = (\n <SectionBlock\n section={section}\n fields={fields}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n );\n return framed ? (\n <Card key={section.id} variant=\"elevated\">\n <Card.Body>{block}</Card.Body>\n </Card>\n ) : (\n <Fragment key={section.id}>{block}</Fragment>\n );\n })\n )}\n </div>\n </section>\n );\n },\n);\n\nPatientDetails.displayName = 'PatientDetails';\n\n/* -------------------------------------------------------------------- */\n/* SectionBlock — one collapsible group */\n/* -------------------------------------------------------------------- */\n\nfunction SectionBlock({\n section,\n fields,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n section: PatientDetailsSection;\n fields: PatientDetailsField[];\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation();\n const headingId = useId();\n const collapsible = section.collapsible ?? true;\n\n // The empty hint must be a SIBLING of the <dl>, never a child — a <p> is\n // not a valid direct child of <dl> (axe `definition-list`).\n const rows =\n fields.length === 0 ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('patientDetails.section.empty', {\n defaultValue: 'No fields shown.',\n })}\n </p>\n ) : (\n <DescriptionList\n layout=\"inline\"\n density=\"compact\"\n divider=\"none\"\n // Label icons paint in the accent (the slot's recolour hook); no row rules.\n className=\"ds:[--description-list-icon-color:var(--accent)]\"\n >\n {fields.map((field) => (\n <FieldRow\n key={field.id}\n field={field}\n // Surface the icon on the direct child: DescriptionList reserves its\n // icon column by inspecting direct children only, so the FieldRow\n // wrapper must carry it (not just the nested Row).\n icon={field.icon ?? null}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n ))}\n </DescriptionList>\n );\n\n if (!collapsible) {\n return (\n <section\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n {rows}\n </section>\n );\n }\n\n return (\n <Collapsible\n defaultOpen={section.defaultOpen ?? true}\n variant=\"minimal\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n {/* Real <h3> so collapsible sections appear in the heading outline\n (the non-collapsible branch is an <h3> too); the WAI-ARIA accordion\n pattern is a heading wrapping the disclosure button. */}\n <h3 className=\"ds:m-0\">\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n id={headingId}\n className=\"ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:bg-transparent ds:border-0 ds:p-0 ds:text-start ds:cursor-pointer ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText] type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </button>\n </CollapsibleTrigger>\n </h3>\n <CollapsibleContent aria-labelledby={headingId}>\n {rows}\n </CollapsibleContent>\n </Collapsible>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FieldRow — display ↔ inline-edit */\n/* -------------------------------------------------------------------- */\n\nfunction FieldRow({\n field,\n icon,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n field: PatientDetailsField;\n icon?: ReactElement | null;\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation();\n const errorId = useId();\n const canEdit = editable && !!field.editable && !!onFieldSave;\n\n const [editing, setEditing] = useState(false);\n const [draft, setDraft] = useState<PatientDetailsEditValue>(field.editValue);\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n const beginEdit = useCallback(() => {\n setDraft(field.editValue);\n setError(null);\n setEditing(true);\n }, [field.editValue]);\n\n const cancelEdit = useCallback(() => {\n setEditing(false);\n setError(null);\n }, []);\n\n const commitEdit = useCallback(async () => {\n if (!onFieldSave) return;\n const validationError = validate?.(field.id, draft) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n setSaving(true);\n setError(null);\n try {\n await onFieldSave(field.id, draft);\n setEditing(false);\n } catch (err) {\n // Keep the row in edit mode + surface the failure; the value the\n // consumer holds is unchanged (no optimistic mutation of `value`).\n setError(\n err instanceof Error && err.message\n ? err.message\n : t('patientDetails.edit.saveFailed', {\n defaultValue: 'Could not save. Try again.',\n }),\n );\n } finally {\n setSaving(false);\n }\n }, [onFieldSave, validate, field.id, draft, t]);\n\n const label = (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]\">\n {field.label}\n {field.sensitive ? (\n <Lock\n aria-label={t('patientDetails.sensitive', {\n defaultValue: 'Sensitive',\n })}\n className=\"ds:size-3 ds:shrink-0 ds:text-[color:var(--muted-foreground)]\"\n />\n ) : null}\n </span>\n );\n\n // Best-effort plain text for the truncated value's hover tooltip — the full\n // value also stays reachable via inline edit and (when copyable) the copy button.\n const valueTitle =\n typeof field.value === 'string'\n ? field.value\n : (field.copyText ??\n (typeof field.editValue === 'string' ? field.editValue : undefined));\n\n const detail = editing ? (\n <span className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <span className=\"ds:flex ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <FieldEditor\n field={field}\n value={draft}\n onChange={setDraft}\n invalid={!!error}\n errorId={error ? errorId : undefined}\n locale={locale}\n disabled={saving}\n />\n <IconButton\n size=\"sm\"\n intent=\"primary\"\n icon={<Check aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.save', { defaultValue: 'Save' })}\n loading={saving}\n onClick={commitEdit}\n />\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n icon={<X aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.cancel', {\n defaultValue: 'Cancel',\n })}\n disabled={saving}\n onClick={cancelEdit}\n />\n </span>\n {error ? (\n <span\n id={errorId}\n role=\"alert\"\n className=\"type-meta ds:text-[color:var(--destructive)]\"\n >\n {error}\n </span>\n ) : null}\n </span>\n ) : (\n <span className=\"ds:flex ds:items-start ds:gap-[var(--spacing-2xs)] ds:min-w-0\">\n {/* Single-line values truncate so the read row matches the editor height\n (no shift on open); textarea fields keep wrapping. */}\n <span\n className={`ds:min-w-0 ${field.editType === 'textarea' ? '' : 'ds:truncate'}${field.mono ? ' ds:font-mono' : ''}`}\n title={valueTitle}\n >\n <FieldValue field={field} />\n </span>\n {field.copyable && field.copyText ? (\n <CopyButton text={field.copyText} label={field.label} />\n ) : null}\n {canEdit ? (\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n // Reveal on row hover / keyboard focus only — stays in the tab order\n // (opacity, not display) so keyboard + SR users always reach it.\n className=\"ds:shrink-0 ds:opacity-0 ds:transition-opacity ds:motion-reduce:transition-none ds:group-hover:opacity-100 ds:focus-visible:opacity-100\"\n icon={<Pencil aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.editField', {\n field: field.label,\n defaultValue: 'Edit {{field}}',\n })}\n onClick={beginEdit}\n />\n ) : null}\n </span>\n );\n\n return (\n <DescriptionList.Row\n icon={icon ?? null}\n data-field-id={field.id}\n className=\"ds:group\"\n >\n <DescriptionList.Term>{label}</DescriptionList.Term>\n <DescriptionList.Detail>{detail}</DescriptionList.Detail>\n </DescriptionList.Row>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FieldEditor — the right control per editType */\n/* -------------------------------------------------------------------- */\n\nfunction FieldEditor({\n field,\n value,\n onChange,\n invalid,\n errorId,\n locale,\n disabled,\n}: {\n field: PatientDetailsField;\n value: PatientDetailsEditValue;\n onChange: (next: PatientDetailsEditValue) => void;\n invalid: boolean;\n errorId?: string;\n locale?: string;\n disabled?: boolean;\n}): ReactNode {\n const { t } = useTranslation();\n const tone = invalid ? 'error' : 'default';\n const editType = field.editType ?? 'text';\n\n switch (editType) {\n case 'textarea':\n return (\n <TextArea\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'select':\n return (\n <Select\n size=\"sm\"\n options={field.options ?? []}\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n />\n );\n case 'boolean':\n return (\n <Switch\n label={field.label}\n checked={value === true}\n onCheckedChange={(checked) => onChange(checked)}\n disabled={disabled}\n />\n );\n case 'date':\n return (\n <DatePicker\n size=\"sm\"\n value={value instanceof Date ? value : undefined}\n onChange={(next) => onChange(next ?? null)}\n disabled={disabled}\n aria-label={field.label}\n />\n );\n case 'number':\n return (\n <NumberInput\n size=\"sm\"\n value={typeof value === 'number' ? value : null}\n onChange={(next) => onChange(next)}\n mode={field.currency ? 'currency' : 'decimal'}\n currency={field.currency}\n locale={locale}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n />\n );\n case 'email':\n return (\n <EmailInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n // EmailInput owns format validation — it surfaces its own border +\n // \"Invalid email\" message. PatientDetails' `validate` layers on top\n // for business rules (e.g. already-in-use), never format.\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'phone':\n return (\n <PhoneInput\n size=\"sm\"\n // E.164 string in / out — the dialling-code split is the input's own\n // internal state, never part of the saved value.\n value={typeof value === 'string' ? value : ''}\n onChange={(e164) => onChange(e164)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'fiscalCode':\n return (\n <FiscalCodeInput\n size=\"sm\"\n // The input normalises (uppercase, strip, ≤16) and hands back the\n // plain string; that normalised value is what we save.\n value={typeof value === 'string' ? value : ''}\n onChange={(raw) => onChange(raw)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n // Address / location pickers. Inline edit has no FormField, so we pass\n // aria-invalid / aria-describedby explicitly (the components fall back to\n // these props outside a FormFieldContext) so the invalid state isn't\n // conveyed by colour alone.\n case 'province':\n return (\n <ProvinceSelect\n size=\"sm\"\n country=\"it\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'country':\n return (\n <CountrySelect\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'postalCode':\n // PostalCodeInput owns its tone (derived from CAP-format blur\n // validation), so we don't pass `tone`; it accepts aria-invalid /\n // aria-describedby for the business-rule layer above.\n return (\n <PostalCodeInput\n size=\"sm\"\n country=\"it\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'city':\n return (\n <CityInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'text':\n default:\n return (\n <TextInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n clearable\n placeholder={t('patientDetails.edit.placeholder', {\n defaultValue: 'Enter a value',\n })}\n className=\"ds:flex-1\"\n />\n );\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* CopyButton — copy a field value (rendered INSIDE the <dd>) */\n/* */\n/* Rendered inside the Detail so the <dl> grouping <div> contains only */\n/* <dt>/<dd> (the axe `definition-list` rule forbids buttons as siblings */\n/* of dt/dd). Reuses the shared keyValuePair.* copy strings. */\n/* -------------------------------------------------------------------- */\n\nfunction CopyButton({\n text,\n label,\n}: {\n text: string;\n label: string;\n}): ReactNode {\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n const [announcement, setAnnouncement] = useState('');\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setAnnouncement(t('keyValuePair.copied', { defaultValue: 'Copied' }));\n setTimeout(() => {\n setCopied(false);\n setAnnouncement('');\n }, 2000);\n } catch {\n setAnnouncement(\n t('keyValuePair.notAvailable', { defaultValue: 'Copy not available' }),\n );\n setTimeout(() => setAnnouncement(''), 3000);\n }\n }, [text, t]);\n\n return (\n <>\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n icon={\n copied ? <Check aria-hidden=\"true\" /> : <Copy aria-hidden=\"true\" />\n }\n aria-label={t('keyValuePair.copy', {\n label,\n defaultValue: 'Copy {{label}}',\n })}\n onClick={handleCopy}\n />\n <span role=\"status\" className=\"ds:sr-only\">\n {announcement}\n </span>\n </>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Skeleton */\n/* -------------------------------------------------------------------- */\n\nfunction PatientDetailsSkeleton(): ReactNode {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"ds:size-10 ds:shrink-0 ds:rounded-full ds:bg-[color:var(--muted)]\" />\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\" />\n </div>\n {[0, 1, 2].map((i) => (\n <span\n key={i}\n className=\"ds:h-4 ds:w-full ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\"\n />\n ))}\n </div>\n );\n}\n\n/** Density variant union re-exported for downstream typing. */\nexport type PatientDetailsDensity = NonNullable<\n VariantProps<typeof rootVariants>['density']\n>;\n"],"names":["__iconNode","ClipboardList","createLucideIcon","patientDetailsAgent","handle","args","rootVariants","cva","bodyVariants","PatientDetails","forwardRef","title","sections","avatar","headerChips","framed","editable","onFieldSave","validate","visibleFieldOrder","defaultVisibleFieldOrder","onVisibleFieldsChange","loading","emptyState","patientId","id","locale","cogLabel","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","visible","catalogueIds","setOrder","toggleField","toggleSection","moveFieldOnto","resetToDefaults","usePatientFieldVisibility","useMemo","fieldIds","orderedIds","fieldId","value","useAgentRegistration","panelTitle","resolvedAriaLabel","avatarName","showAvatar","hasVisible","cid","jsx","PatientDetailsSkeleton","isEmpty","identityBlock","jsxs","Avatar","PanelHeader","FieldVisibilityCog","Card","resolveVisibleFields","fields","section","block","SectionBlock","Fragment","collapsible","rows","DescriptionList","field","FieldRow","Collapsible","CollapsibleTrigger","CollapsibleContent","icon","errorId","canEdit","editing","setEditing","useState","draft","setDraft","error","setError","saving","setSaving","beginEdit","useCallback","cancelEdit","commitEdit","validationError","err","label","Lock","valueTitle","detail","FieldEditor","IconButton","Check","X","FieldValue","CopyButton","Pencil","onChange","invalid","disabled","tone","TextArea","e","Select","next","Switch","checked","DatePicker","NumberInput","EmailInput","PhoneInput","e164","FiscalCodeInput","raw","ProvinceSelect","CountrySelect","PostalCodeInput","CityInput","TextInput","text","copied","setCopied","announcement","setAnnouncement","handleCopy","Copy","i"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,KAAK,QAAQ,KAAK,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,KAAK,UAAU;AAAA,EACrF;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EAC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,EAAE,cAAc,sBAAsB;AAAA,MAAA,GAEvE,WAAW,MAAMsG,EAAgB,EAAE,GAAG,GAAI;AAAA,IAC5C;AAAA,EACF,GAAG,CAACJ,GAAMlG,CAAC,CAAC;AAEZ,SACE,gBAAA4B,EAAAU,IAAA,EACE,UAAA;AAAA,IAAA,gBAAAd;AAAA,MAAC8C;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,QAAO;AAAA,QACP,MACE6B,IAAS,gBAAA3E,EAAC+C,GAAA,EAAM,eAAY,QAAO,IAAK,gBAAA/C,EAACgF,IAAA,EAAK,eAAY,OAAA,CAAO;AAAA,QAEnE,cAAYxG,EAAE,qBAAqB;AAAA,UACjC,OAAAiE;AAAA,UACA,cAAc;AAAA,QAAA,CACf;AAAA,QACD,SAASsC;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEV,QAAA,EAAK,MAAK,UAAS,WAAU,cAC3B,UAAAF,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;AAMA,SAAS5E,KAAoC;AAC3C,SACE,gBAAAG,EAAC,OAAA,EAAI,WAAU,kDACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,sDACb,UAAA;AAAA,MAAA,gBAAAJ,EAAC,QAAA,EAAK,WAAU,oEAAA,CAAoE;AAAA,MACpF,gBAAAA,EAAC,QAAA,EAAK,WAAU,2EAAA,CAA2E;AAAA,IAAA,GAC7F;AAAA,IACC,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAACiF,MACd,gBAAAjF;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,WAAU;AAAA,MAAA;AAAA,MADLiF;AAAA,IAAA,CAGR;AAAA,EAAA,GACH;AAEJ;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"patient-details-COvYWp2e.js","sources":["../../node_modules/lucide-react/dist/esm/icons/clipboard-list.mjs","../../src/components/patient-details/patient-details.agent.ts","../../src/components/patient-details/patient-details.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 [\"rect\", { width: \"8\", height: \"4\", x: \"8\", y: \"2\", rx: \"1\", ry: \"1\", key: \"tgr4d6\" }],\n [\n \"path\",\n {\n d: \"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\",\n key: \"116196\"\n }\n ],\n [\"path\", { d: \"M12 11h4\", key: \"1jrz19\" }],\n [\"path\", { d: \"M12 16h4\", key: \"n85exb\" }],\n [\"path\", { d: \"M8 11h.01\", key: \"1dfujw\" }],\n [\"path\", { d: \"M8 16h.01\", key: \"18s6g9\" }]\n];\nconst ClipboardList = createLucideIcon(\"clipboard-list\", __iconNode);\n\nexport { __iconNode, ClipboardList as default };\n//# sourceMappingURL=clipboard-list.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { PatientDetailsHandle } from './patient-details';\n\n/* -------------------------------------------------------------------- */\n/* Agent adapter — PatientDetails */\n/* */\n/* Exposes the patient panel to a future MCP runtime: */\n/* - VIEW CONFIG (safety: write) — show/hide + reorder the visible */\n/* field set. These mutate the user's view, not the patient record. */\n/* - PHI WRITE (safety: phi) — `update_field` writes a patient field */\n/* value. It is the ONLY PHI mutation and routes through the same */\n/* `onFieldSave` path as a human inline edit, so the consumer's */\n/* permission + validation + audit are the single write authority. */\n/* `phi` (not `write`) forces the runtime's confirm-before-act gate. */\n/* */\n/* STATE exposes only field KEYS (`visibleFieldOrder`) and an opaque */\n/* `patientId` — never a field value or patient identity (PRS §Security, */\n/* 26-agent-readiness §6.1/§7). */\n/* -------------------------------------------------------------------- */\n\nexport const patientDetailsAgent: AgentAdapter<PatientDetailsHandle> = {\n id: 'patient-details',\n // `view_change` backs the view-config actions (show/hide + reorder are both\n // view reconfigurations); `set_value` backs the single-value `update_field`\n // (not `edit_inline`, which is for granular free-text/formatting edits).\n capabilities: ['view_change', 'set_value'],\n state: {\n visibleFieldOrder: {\n type: 'string[]',\n descriptionKey: 'ui.agent.patientDetails.state.visibleFieldOrder',\n description:\n 'Ordered list of visible field KEYS (e.g. \"fiscalCode\"). Never a field value.',\n read: (handle) => handle.getVisibleFieldOrder(),\n },\n patientId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.patientDetails.state.patientId',\n description:\n 'Opaque patient id the panel is bound to. No patient-identifiable data.',\n read: (handle) => handle.getPatientId(),\n },\n },\n actions: {\n set_visible_fields: {\n safety: 'write',\n argsType: '{ fieldIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['fieldIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setVisibleFields',\n description:\n 'Set which fields are visible (and their order). Unknown ids are ignored.',\n examples: [\n {\n args: { fieldIds: ['lastName', 'firstName', 'phone', 'email'] },\n note: 'Show only name + contact fields.',\n },\n ],\n invoke: (handle, args: { fieldIds: string[] }) => {\n handle.setVisibleFields(args.fieldIds);\n },\n },\n set_field_order: {\n safety: 'write',\n argsType: '{ orderedIds: string[] }',\n argsSchema: {\n type: 'object',\n properties: {\n orderedIds: { type: 'array', items: { type: 'string' } },\n },\n required: ['orderedIds'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.setFieldOrder',\n description:\n 'Reorder the visible fields. Order within a section is honoured; sections stay fixed.',\n invoke: (handle, args: { orderedIds: string[] }) => {\n handle.setFieldOrder(args.orderedIds);\n },\n },\n update_field: {\n // PHI: mutates a patient-identifiable value. NOT `write` — the runtime\n // must confirm + audit. Routes through `onFieldSave` (server write).\n safety: 'phi',\n openWorld: true,\n argsType: '{ fieldId: string; value: unknown }',\n argsSchema: {\n type: 'object',\n properties: {\n fieldId: { type: 'string' },\n value: {},\n },\n required: ['fieldId', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.patientDetails.actions.updateField',\n description:\n \"Write a patient field value via the consumer's audited save path. Subject to the same permissions and validation as a human edit.\",\n errors: ['no-save-handler', 'validation-failed', 'permission-denied'],\n examples: [\n {\n args: { fieldId: 'job', value: 'Architect' },\n note: 'Update the patient’s occupation.',\n },\n ],\n invoke: (handle, args: { fieldId: string; value: unknown }) =>\n handle.updateField(args.fieldId, args.value),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'patient-details',\n description: 'Marks the PatientDetails root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop. Addresses a specific panel.',\n },\n item: {\n attr: 'data-field-id',\n description:\n 'Stable field KEY on each row. Never the field value (no PHI in the DOM hook).',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useCallback,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, ClipboardList, Copy, Lock, Pencil, X } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { IconButton } from '../button';\nimport { Card } from '../card/card';\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from '../collapsible/collapsible';\nimport { DatePicker } from '../date-picker/date-picker';\nimport { DescriptionList } from '../description-list/description-list';\nimport { EmailInput } from '../email-input/email-input';\nimport { FiscalCodeInput } from '../fiscal-code-input/fiscal-code-input';\nimport { NumberInput } from '../number-input/number-input';\nimport { PanelHeader } from '../panel-header/panel-header';\nimport { PhoneInput } from '../phone-input/phone-input';\nimport { Select } from '../select/select';\nimport { Switch } from '../switch/switch';\nimport { TextArea } from '../text-area/text-area';\nimport { TextInput } from '../text-input/text-input';\nimport { CountrySelect } from '../country-select/country-select';\nimport { ProvinceSelect } from '../province-select/province-select';\nimport { PostalCodeInput } from '../postal-code-input/postal-code-input';\nimport { CityInput } from '../city-input/city-input';\nimport { useAgentRegistration } from '../../agent/registry';\nimport {\n resolveVisibleFields,\n type PatientField,\n type PatientFieldEditType,\n type PatientFieldEditValue,\n type PatientFieldOption,\n type PatientFieldSection,\n} from '../_shared/patient-fields';\nimport { usePatientFieldVisibility } from '../_shared/field-visibility';\nimport { FieldVisibilityCog } from '../_shared/field-visibility-cog';\nimport { FieldValue } from '../_shared/field-value';\nimport { patientDetailsAgent } from './patient-details.agent';\n\n/* -------------------------------------------------------------------- */\n/* PatientDetails */\n/* */\n/* The customizable, inline-editable patient record panel — the kit's */\n/* replacement for platform's hardcoded, per-user-identical patient */\n/* \"scheda paziente\" table. Mounts as a CONTEXTUAL tool in the Control */\n/* Room rail (a separate tool from EntitySummary, the AI brief). */\n/* */\n/* Boundaries (PRS §Security + 26-agent-readiness §PHI): */\n/* - DATA-IN for values: the consumer maps DoctorPatient → sections. */\n/* The kit owns the layout, the cog field-picker, i18n & theming. */\n/* - PERSISTENCE-OUT: the cog emits `onVisibleFieldsChange`; the */\n/* consumer persists the user's chosen ordered field set (platform: */\n/* a per-user × per-practice JSON column). */\n/* - WRITE-OUT: inline edits AND the agent's `update_field` BOTH route */\n/* through the single `onFieldSave` callback, so platform's */\n/* permission + validation + audit path is the only write channel. */\n/* - DOM hooks + agent state carry only field KEYS and an opaque */\n/* `patientId` — never a field VALUE / patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:text-[color:var(--foreground)]',\n {\n variants: {\n // `compact` (default) suits the narrow rail panel; `comfortable`\n // relaxes spacing for a wider host (a full-width profile page).\n density: {\n comfortable: '',\n compact: '',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n },\n);\n\n// The scrolling body sits BELOW the shared PanelHeader (which owns the title\n// row + divider + its own top/side padding). The header is full-bleed at the\n// top of the scroll region; the body carries the panel's content padding.\nconst bodyVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', {\n variants: {\n density: {\n comfortable: 'ds:p-[var(--spacing-md)]',\n compact: 'ds:p-[var(--spacing-sm)]',\n },\n },\n defaultVariants: {\n density: 'compact',\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* */\n/* The field model is the shared `_shared/patient-fields` vocabulary, so */\n/* PatientDetails and PatientSummaryCard speak ONE field language. The */\n/* visible set + order are a PER-CONTEXT preference the consumer owns and */\n/* wires per placement — never a single value synced across surfaces. The */\n/* `PatientDetails*` names below are kept as aliases for back-compat. */\n/* -------------------------------------------------------------------- */\n\nexport type {\n PatientField,\n PatientFieldSection,\n PatientFieldOption,\n PatientFieldEditType,\n PatientFieldEditValue,\n} from '../_shared/patient-fields';\n\n/** A label→value patient field. Alias of the shared {@link PatientField}. */\nexport type PatientDetailsField = PatientField;\n/** A labelled, collapsible group of fields. Alias of {@link PatientFieldSection}. */\nexport type PatientDetailsSection = PatientFieldSection;\n/** Alias of the shared {@link PatientFieldOption}. */\nexport type PatientDetailsFieldOption = PatientFieldOption;\n/** Alias of the shared {@link PatientFieldEditType}. */\nexport type PatientDetailsEditType = PatientFieldEditType;\n/** Alias of the shared {@link PatientFieldEditValue}. */\nexport type PatientDetailsEditValue = PatientFieldEditValue;\n\n/**\n * Imperative handle the agent adapter drives. Exposes only field KEYS and\n * an opaque `patientId` for reads; `updateField` routes writes through the\n * same `onFieldSave` path as a human inline edit (no second channel).\n */\nexport interface PatientDetailsHandle {\n /** The current ordered list of visible field ids. */\n getVisibleFieldOrder: () => string[];\n /** Opaque patient id (no PHI). */\n getPatientId: () => string | undefined;\n /** Replace the visible set, preserving the given order (filtered to known fields). */\n setVisibleFields: (fieldIds: string[]) => void;\n /** Replace the full ordered visible list (filtered to known fields). */\n setFieldOrder: (orderedIds: string[]) => void;\n /** Write a field value — delegates to `onFieldSave`. Rejects if no handler. */\n updateField: (fieldId: string, value: unknown) => Promise<void>;\n}\n\nexport interface PatientDetailsProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /** Patient display name — the panel heading. */\n title: ReactNode;\n /** The sectioned field catalogue (consumer-mapped from DoctorPatient). */\n sections: PatientDetailsSection[];\n /**\n * Header avatar photo / initials override. The panel always fronts the name\n * with an Avatar — initials derive from a string `title` by default; pass\n * `src` for a photo, or `name` to override the initials source.\n */\n avatar?: { src?: string; name?: string };\n /** At-a-glance chips under the name (consumer-composed Badge/Tag/Chip row). */\n headerChips?: ReactNode;\n\n /* ----- inline editing (kit-owned controls, consumer-owned write) ----- */\n\n /**\n * Frame the identity header and each section in its own elevated `Card`,\n * for a \"control-room\" rail that reads as a stack of cards rather than one\n * flat panel. Default `false` (the flat panel with a header rule + eyebrow\n * section headings). When framed, the header rule is dropped — the cards\n * provide the separation.\n */\n framed?: boolean;\n /** Master switch — show edit affordances on `editable` fields. */\n editable?: boolean;\n /**\n * Persist a field edit. Resolve ⇒ committed; reject(Error) ⇒ the message\n * is shown inline and the row stays in edit mode. Also the single channel\n * the agent's `update_field` uses.\n */\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n /** Domain validation — return an error message, or `null` when valid. */\n validate?: (fieldId: string, value: unknown) => string | null;\n\n /* ----- customization (the cog; controlled OR uncontrolled) ----- */\n\n /**\n * Controlled ordered list of visible field ids. `undefined` ⇒ every field\n * visible; an explicit `[]` ⇒ none (a panel that starts collapsed).\n */\n visibleFieldOrder?: string[];\n /** Uncontrolled initial order. Omit both ⇒ every field visible, in declaration order. */\n defaultVisibleFieldOrder?: string[];\n /** Fired whenever the user shows/hides/reorders fields via the cog. */\n onVisibleFieldsChange?: (orderedIds: string[]) => void;\n\n /* ----- states ----- */\n\n /** Render the loading skeleton. */\n loading?: boolean;\n /** Shown when there are no sections / no patient. Defaults to a localised hint. */\n emptyState?: ReactNode;\n\n /* ----- agent / a11y ----- */\n\n /** Opaque patient id — emitted as `data-patient-id` + agent stateRead. No PHI. */\n patientId?: string;\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /** BCP-47 locale override (currency / number editors). */\n locale?: string;\n /** Override the cog trigger's accessible name. */\n cogLabel?: string;\n /** Override the panel region's accessible name (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PatientDetails = forwardRef<HTMLElement, PatientDetailsProps>(\n function PatientDetails(\n {\n title,\n sections,\n avatar,\n headerChips,\n framed = false,\n editable = false,\n onFieldSave,\n validate,\n visibleFieldOrder,\n defaultVisibleFieldOrder,\n onVisibleFieldsChange,\n loading = false,\n emptyState,\n patientId,\n id,\n locale,\n cogLabel,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const headingId = useId();\n\n // Per-context field visibility + ordering. The order is a per-INSTANCE\n // preference the kit never persists — the consumer wires its own\n // value/onChange, so the same field vocabulary can render differently in\n // different parts of the app (see usePatientFieldVisibility).\n const {\n visible,\n catalogueIds,\n setOrder,\n toggleField,\n toggleSection,\n moveFieldOnto,\n reset: resetToDefaults,\n } = usePatientFieldVisibility(sections, {\n value: visibleFieldOrder,\n defaultValue: defaultVisibleFieldOrder,\n onChange: onVisibleFieldsChange,\n });\n\n /* ---- imperative handle (agent) ------------------------------- */\n\n const handle = useMemo<PatientDetailsHandle>(\n () => ({\n getVisibleFieldOrder: () => visible,\n getPatientId: () => patientId,\n setVisibleFields: (fieldIds) => setOrder(fieldIds),\n setFieldOrder: (orderedIds) => setOrder(orderedIds),\n updateField: (fieldId, value) => {\n if (!onFieldSave) {\n return Promise.reject(\n new Error('PatientDetails: no onFieldSave handler is wired.'),\n );\n }\n return onFieldSave(fieldId, value);\n },\n }),\n [visible, patientId, setOrder, onFieldSave],\n );\n useAgentRegistration(patientDetailsAgent, handle, id);\n\n /* ---- region accessible name ---------------------------------- */\n\n const panelTitle = t('patientDetails.regionLabel', {\n defaultValue: 'Patient details',\n });\n const resolvedAriaLabel = ariaLabel ?? panelTitle;\n\n /* ---- header avatar ------------------------------------------- */\n // Parity with the card: the panel fronts the name with an Avatar (photo via\n // `avatar.src`, else initials from the name). Omitted only when `title` is a\n // non-string node and no `avatar.name` is given (nothing to derive from).\n const avatarName =\n avatar?.name ?? (typeof title === 'string' ? title : undefined);\n const showAvatar = Boolean(avatar?.src || avatarName);\n\n /* ---- loading / empty ----------------------------------------- */\n\n const hasVisible = catalogueIds.some((cid) => visible.includes(cid));\n\n if (loading) {\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-label={resolvedAriaLabel}\n aria-busy=\"true\"\n className={rootVariants({ className })}\n {...rest}\n >\n <div className={bodyVariants()}>\n <PatientDetailsSkeleton />\n </div>\n </section>\n );\n }\n\n const isEmpty = sections.length === 0 || !hasVisible;\n\n // The identity card (avatar + name + chips) is now the FIRST block of the\n // scrolling body — the shared PanelHeader owns the panel title row. The\n // name demotes to <h3> (the PanelHeader title is the <h2>).\n const identityBlock = (\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {showAvatar ? (\n <Avatar\n size=\"md\"\n name={avatarName}\n src={avatar?.src}\n className=\"ds:shrink-0\"\n />\n ) : null}\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h3 className=\"ds:m-0 type-title-item ds:text-[color:var(--foreground)]\">\n {title}\n </h3>\n {/* Chips sit under the NAME (not the avatar) — same column shape\n as the card's identity line. */}\n {headerChips ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {headerChips}\n </div>\n ) : null}\n </div>\n </div>\n );\n\n return (\n <section\n ref={ref}\n data-component=\"patient-details\"\n data-component-id={id}\n data-patient-id={patientId}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel ?? undefined}\n className={rootVariants({ className })}\n {...rest}\n >\n {/* The shared rail-panel header: panel title + the field-picker cog as\n its panel-owned action; the rail injects favourite/close after it.\n Sticky + divider so the title stays as the body scrolls. */}\n <PanelHeader\n title={panelTitle}\n icon={<ClipboardList aria-hidden=\"true\" />}\n headingId={headingId}\n sticky\n divider\n actions={\n <FieldVisibilityCog\n sections={sections}\n visible={visible}\n onToggleField={toggleField}\n onToggleSection={toggleSection}\n onMoveFieldOnto={moveFieldOnto}\n onReset={resetToDefaults}\n label={cogLabel}\n />\n }\n />\n\n <div className={bodyVariants()}>\n {/* Identity card — first block of the body; framed wraps it in its\n own elevated card alongside each section. */}\n {framed ? (\n <Card variant=\"elevated\">\n <Card.Body>{identityBlock}</Card.Body>\n </Card>\n ) : (\n identityBlock\n )}\n\n {/* Body — one card per section when framed, otherwise a flat stack. */}\n {isEmpty ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {emptyState ??\n t('patientDetails.empty', {\n defaultValue: 'No patient selected.',\n })}\n </p>\n ) : (\n resolveVisibleFields(sections, visible)\n // A section whose fields are all hidden drops out entirely —\n // no empty card / \"No fields shown.\" placeholder. (The field\n // picker still lists it, so hidden fields can be re-added.)\n .filter(({ fields }) => fields.length > 0)\n .map(({ section, fields }) => {\n const block = (\n <SectionBlock\n section={section}\n fields={fields}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n );\n return framed ? (\n <Card key={section.id} variant=\"elevated\">\n <Card.Body>{block}</Card.Body>\n </Card>\n ) : (\n <Fragment key={section.id}>{block}</Fragment>\n );\n })\n )}\n </div>\n </section>\n );\n },\n);\n\nPatientDetails.displayName = 'PatientDetails';\n\n/* -------------------------------------------------------------------- */\n/* SectionBlock — one collapsible group */\n/* -------------------------------------------------------------------- */\n\nfunction SectionBlock({\n section,\n fields,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n section: PatientDetailsSection;\n fields: PatientDetailsField[];\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation();\n const headingId = useId();\n const collapsible = section.collapsible ?? true;\n\n // The empty hint must be a SIBLING of the <dl>, never a child — a <p> is\n // not a valid direct child of <dl> (axe `definition-list`).\n const rows =\n fields.length === 0 ? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('patientDetails.section.empty', {\n defaultValue: 'No fields shown.',\n })}\n </p>\n ) : (\n <DescriptionList\n layout=\"inline\"\n density=\"compact\"\n divider=\"none\"\n // Label icons paint in the accent (the slot's recolour hook); no row rules.\n className=\"ds:[--description-list-icon-color:var(--accent)]\"\n >\n {fields.map((field) => (\n <FieldRow\n key={field.id}\n field={field}\n // Surface the icon on the direct child: DescriptionList reserves its\n // icon column by inspecting direct children only, so the FieldRow\n // wrapper must carry it (not just the nested Row).\n icon={field.icon ?? null}\n editable={editable}\n onFieldSave={onFieldSave}\n validate={validate}\n locale={locale}\n />\n ))}\n </DescriptionList>\n );\n\n if (!collapsible) {\n return (\n <section\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <h3\n id={headingId}\n className=\"ds:m-0 type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </h3>\n {rows}\n </section>\n );\n }\n\n return (\n <Collapsible\n defaultOpen={section.defaultOpen ?? true}\n variant=\"minimal\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n {/* Real <h3> so collapsible sections appear in the heading outline\n (the non-collapsible branch is an <h3> too); the WAI-ARIA accordion\n pattern is a heading wrapping the disclosure button. */}\n <h3 className=\"ds:m-0\">\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n id={headingId}\n className=\"ds:flex ds:w-full ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)] ds:bg-transparent ds:border-0 ds:p-0 ds:text-start ds:cursor-pointer ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText] type-eyebrow ds:text-[color:var(--foreground)]\"\n >\n {section.heading}\n </button>\n </CollapsibleTrigger>\n </h3>\n <CollapsibleContent aria-labelledby={headingId}>\n {rows}\n </CollapsibleContent>\n </Collapsible>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FieldRow — display ↔ inline-edit */\n/* -------------------------------------------------------------------- */\n\nfunction FieldRow({\n field,\n icon,\n editable,\n onFieldSave,\n validate,\n locale,\n}: {\n field: PatientDetailsField;\n icon?: ReactElement | null;\n editable: boolean;\n onFieldSave?: (fieldId: string, value: unknown) => Promise<void>;\n validate?: (fieldId: string, value: unknown) => string | null;\n locale?: string;\n}): ReactNode {\n const { t } = useTranslation();\n const errorId = useId();\n const canEdit = editable && !!field.editable && !!onFieldSave;\n\n const [editing, setEditing] = useState(false);\n const [draft, setDraft] = useState<PatientDetailsEditValue>(field.editValue);\n const [error, setError] = useState<string | null>(null);\n const [saving, setSaving] = useState(false);\n\n const beginEdit = useCallback(() => {\n setDraft(field.editValue);\n setError(null);\n setEditing(true);\n }, [field.editValue]);\n\n const cancelEdit = useCallback(() => {\n setEditing(false);\n setError(null);\n }, []);\n\n const commitEdit = useCallback(async () => {\n if (!onFieldSave) return;\n const validationError = validate?.(field.id, draft) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n setSaving(true);\n setError(null);\n try {\n await onFieldSave(field.id, draft);\n setEditing(false);\n } catch (err) {\n // Keep the row in edit mode + surface the failure; the value the\n // consumer holds is unchanged (no optimistic mutation of `value`).\n setError(\n err instanceof Error && err.message\n ? err.message\n : t('patientDetails.edit.saveFailed', {\n defaultValue: 'Could not save. Try again.',\n }),\n );\n } finally {\n setSaving(false);\n }\n }, [onFieldSave, validate, field.id, draft, t]);\n\n const label = (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]\">\n {field.label}\n {field.sensitive ? (\n <Lock\n aria-label={t('patientDetails.sensitive', {\n defaultValue: 'Sensitive',\n })}\n className=\"ds:size-3 ds:shrink-0 ds:text-[color:var(--muted-foreground)]\"\n />\n ) : null}\n </span>\n );\n\n // Best-effort plain text for the truncated value's hover tooltip — the full\n // value also stays reachable via inline edit and (when copyable) the copy button.\n const valueTitle =\n typeof field.value === 'string'\n ? field.value\n : (field.copyText ??\n (typeof field.editValue === 'string' ? field.editValue : undefined));\n\n const detail = editing ? (\n <span className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <span className=\"ds:flex ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <FieldEditor\n field={field}\n value={draft}\n onChange={setDraft}\n invalid={!!error}\n errorId={error ? errorId : undefined}\n locale={locale}\n disabled={saving}\n />\n <IconButton\n size=\"sm\"\n intent=\"primary\"\n icon={<Check aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.save', { defaultValue: 'Save' })}\n loading={saving}\n onClick={commitEdit}\n />\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n icon={<X aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.cancel', {\n defaultValue: 'Cancel',\n })}\n disabled={saving}\n onClick={cancelEdit}\n />\n </span>\n {error ? (\n <span\n id={errorId}\n role=\"alert\"\n className=\"type-meta ds:text-[color:var(--destructive)]\"\n >\n {error}\n </span>\n ) : null}\n </span>\n ) : (\n <span className=\"ds:flex ds:items-start ds:gap-[var(--spacing-2xs)] ds:min-w-0\">\n {/* Single-line values truncate so the read row matches the editor height\n (no shift on open); textarea fields keep wrapping. */}\n <span\n className={`ds:min-w-0 ${field.editType === 'textarea' ? '' : 'ds:truncate'}${field.mono ? ' ds:font-mono' : ''}`}\n title={valueTitle}\n >\n <FieldValue field={field} />\n </span>\n {field.copyable && field.copyText ? (\n <CopyButton text={field.copyText} label={field.label} />\n ) : null}\n {canEdit ? (\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n // Reveal on row hover / keyboard focus only — stays in the tab order\n // (opacity, not display) so keyboard + SR users always reach it.\n className=\"ds:shrink-0 ds:opacity-0 ds:transition-opacity ds:motion-reduce:transition-none ds:group-hover:opacity-100 ds:focus-visible:opacity-100\"\n icon={<Pencil aria-hidden=\"true\" />}\n aria-label={t('patientDetails.edit.editField', {\n field: field.label,\n defaultValue: 'Edit {{field}}',\n })}\n onClick={beginEdit}\n />\n ) : null}\n </span>\n );\n\n return (\n <DescriptionList.Row\n icon={icon ?? null}\n data-field-id={field.id}\n className=\"ds:group\"\n >\n <DescriptionList.Term>{label}</DescriptionList.Term>\n <DescriptionList.Detail>{detail}</DescriptionList.Detail>\n </DescriptionList.Row>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FieldEditor — the right control per editType */\n/* -------------------------------------------------------------------- */\n\nfunction FieldEditor({\n field,\n value,\n onChange,\n invalid,\n errorId,\n locale,\n disabled,\n}: {\n field: PatientDetailsField;\n value: PatientDetailsEditValue;\n onChange: (next: PatientDetailsEditValue) => void;\n invalid: boolean;\n errorId?: string;\n locale?: string;\n disabled?: boolean;\n}): ReactNode {\n const { t } = useTranslation();\n const tone = invalid ? 'error' : 'default';\n const editType = field.editType ?? 'text';\n\n switch (editType) {\n case 'textarea':\n return (\n <TextArea\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'select':\n return (\n <Select\n size=\"sm\"\n options={field.options ?? []}\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n />\n );\n case 'boolean':\n return (\n <Switch\n label={field.label}\n checked={value === true}\n onCheckedChange={(checked) => onChange(checked)}\n disabled={disabled}\n />\n );\n case 'date':\n return (\n <DatePicker\n size=\"sm\"\n value={value instanceof Date ? value : undefined}\n onChange={(next) => onChange(next ?? null)}\n disabled={disabled}\n aria-label={field.label}\n />\n );\n case 'number':\n return (\n <NumberInput\n size=\"sm\"\n value={typeof value === 'number' ? value : null}\n onChange={(next) => onChange(next)}\n mode={field.currency ? 'currency' : 'decimal'}\n currency={field.currency}\n locale={locale}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n />\n );\n case 'email':\n return (\n <EmailInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n // EmailInput owns format validation — it surfaces its own border +\n // \"Invalid email\" message. PatientDetails' `validate` layers on top\n // for business rules (e.g. already-in-use), never format.\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'phone':\n return (\n <PhoneInput\n size=\"sm\"\n // E.164 string in / out — the dialling-code split is the input's own\n // internal state, never part of the saved value.\n value={typeof value === 'string' ? value : ''}\n onChange={(e164) => onChange(e164)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'fiscalCode':\n return (\n <FiscalCodeInput\n size=\"sm\"\n // The input normalises (uppercase, strip, ≤16) and hands back the\n // plain string; that normalised value is what we save.\n value={typeof value === 'string' ? value : ''}\n onChange={(raw) => onChange(raw)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n // Address / location pickers. Inline edit has no FormField, so we pass\n // aria-invalid / aria-describedby explicitly (the components fall back to\n // these props outside a FormFieldContext) so the invalid state isn't\n // conveyed by colour alone.\n case 'province':\n return (\n <ProvinceSelect\n size=\"sm\"\n country=\"it\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'country':\n return (\n <CountrySelect\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'postalCode':\n // PostalCodeInput owns its tone (derived from CAP-format blur\n // validation), so we don't pass `tone`; it accepts aria-invalid /\n // aria-describedby for the business-rule layer above.\n return (\n <PostalCodeInput\n size=\"sm\"\n country=\"it\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n className=\"ds:flex-1\"\n />\n );\n case 'city':\n return (\n <CityInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onValueChange={(next) => onChange(next)}\n tone={tone}\n disabled={disabled}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n className=\"ds:flex-1\"\n />\n );\n case 'text':\n default:\n return (\n <TextInput\n size=\"sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(e) => onChange(e.target.value)}\n tone={tone}\n aria-label={field.label}\n aria-invalid={invalid || undefined}\n aria-describedby={errorId}\n disabled={disabled}\n clearable\n placeholder={t('patientDetails.edit.placeholder', {\n defaultValue: 'Enter a value',\n })}\n className=\"ds:flex-1\"\n />\n );\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* CopyButton — copy a field value (rendered INSIDE the <dd>) */\n/* */\n/* Rendered inside the Detail so the <dl> grouping <div> contains only */\n/* <dt>/<dd> (the axe `definition-list` rule forbids buttons as siblings */\n/* of dt/dd). Reuses the shared keyValuePair.* copy strings. */\n/* -------------------------------------------------------------------- */\n\nfunction CopyButton({\n text,\n label,\n}: {\n text: string;\n label: string;\n}): ReactNode {\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n const [announcement, setAnnouncement] = useState('');\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setAnnouncement(t('keyValuePair.copied', { defaultValue: 'Copied' }));\n setTimeout(() => {\n setCopied(false);\n setAnnouncement('');\n }, 2000);\n } catch {\n setAnnouncement(\n t('keyValuePair.notAvailable', { defaultValue: 'Copy not available' }),\n );\n setTimeout(() => setAnnouncement(''), 3000);\n }\n }, [text, t]);\n\n return (\n <>\n <IconButton\n size=\"sm\"\n intent=\"ghost\"\n icon={\n copied ? <Check aria-hidden=\"true\" /> : <Copy aria-hidden=\"true\" />\n }\n aria-label={t('keyValuePair.copy', {\n label,\n defaultValue: 'Copy {{label}}',\n })}\n onClick={handleCopy}\n />\n <span role=\"status\" className=\"ds:sr-only\">\n {announcement}\n </span>\n </>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Skeleton */\n/* -------------------------------------------------------------------- */\n\nfunction PatientDetailsSkeleton(): ReactNode {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"ds:size-10 ds:shrink-0 ds:rounded-full ds:bg-[color:var(--muted)]\" />\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\" />\n </div>\n {[0, 1, 2].map((i) => (\n <span\n key={i}\n className=\"ds:h-4 ds:w-full ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]\"\n />\n ))}\n </div>\n );\n}\n\n/** Density variant union re-exported for downstream typing. */\nexport type PatientDetailsDensity = NonNullable<\n VariantProps<typeof rootVariants>['density']\n>;\n"],"names":["__iconNode","ClipboardList","createLucideIcon","patientDetailsAgent","handle","args","rootVariants","cva","bodyVariants","PatientDetails","forwardRef","title","sections","avatar","headerChips","framed","editable","onFieldSave","validate","visibleFieldOrder","defaultVisibleFieldOrder","onVisibleFieldsChange","loading","emptyState","patientId","id","locale","cogLabel","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","visible","catalogueIds","setOrder","toggleField","toggleSection","moveFieldOnto","resetToDefaults","usePatientFieldVisibility","useMemo","fieldIds","orderedIds","fieldId","value","useAgentRegistration","panelTitle","resolvedAriaLabel","avatarName","showAvatar","hasVisible","cid","jsx","PatientDetailsSkeleton","isEmpty","identityBlock","jsxs","Avatar","PanelHeader","FieldVisibilityCog","Card","resolveVisibleFields","fields","section","block","SectionBlock","Fragment","collapsible","rows","DescriptionList","field","FieldRow","Collapsible","CollapsibleTrigger","CollapsibleContent","icon","errorId","canEdit","editing","setEditing","useState","draft","setDraft","error","setError","saving","setSaving","beginEdit","useCallback","cancelEdit","commitEdit","validationError","err","label","Lock","valueTitle","detail","FieldEditor","IconButton","Check","X","FieldValue","CopyButton","Pencil","onChange","invalid","disabled","tone","TextArea","e","Select","next","Switch","checked","DatePicker","NumberInput","EmailInput","PhoneInput","e164","FiscalCodeInput","raw","ProvinceSelect","CountrySelect","PostalCodeInput","CityInput","TextInput","text","copied","setCopied","announcement","setAnnouncement","handleCopy","Copy","i"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,KAAK,QAAQ,KAAK,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,KAAK,UAAU;AAAA,EACrF;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAA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