@alfadocs/ui-kit-debug 0.78.0 → 0.80.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 (50) 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/{fiscal-code-input-DWA6C8x8.js → fiscal-code-input-QP9gkyDE.js} +2 -2
  10. package/dist/_chunks/fiscal-code-input-QP9gkyDE.js.map +1 -0
  11. package/dist/_chunks/{patient-details-zy76MRh7.js → patient-details-COvYWp2e.js} +2 -2
  12. package/dist/_chunks/{patient-details-zy76MRh7.js.map → patient-details-COvYWp2e.js.map} +1 -1
  13. package/dist/_chunks/signature-request-CEOrCDyk.js +341 -0
  14. package/dist/_chunks/signature-request-CEOrCDyk.js.map +1 -0
  15. package/dist/agent-catalog.json +1 -1
  16. package/dist/components/_shared/contrast-warning.d.ts +46 -0
  17. package/dist/components/_shared/contrast-warning.d.ts.map +1 -0
  18. package/dist/components/calendar/calendar.d.ts +284 -7
  19. package/dist/components/calendar/calendar.d.ts.map +1 -1
  20. package/dist/components/calendar/index.d.ts +1 -1
  21. package/dist/components/calendar/index.d.ts.map +1 -1
  22. package/dist/components/calendar/index.js +1 -1
  23. package/dist/components/calendar-event-card/calendar-event-card.d.ts +103 -0
  24. package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -0
  25. package/dist/components/calendar-event-card/index.d.ts +3 -0
  26. package/dist/components/calendar-event-card/index.d.ts.map +1 -0
  27. package/dist/components/calendar-event-card/index.js +5 -0
  28. package/dist/components/calendar-event-card/index.js.map +1 -0
  29. package/dist/components/chat-input/chat-input.d.ts.map +1 -1
  30. package/dist/components/chat-input/index.js +1 -1
  31. package/dist/components/fiscal-code-input/index.js +1 -1
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/patient-details/index.js +1 -1
  35. package/dist/index.js +252 -250
  36. package/dist/index.js.map +1 -1
  37. package/dist/patterns/alia-assistant/index.js +1 -1
  38. package/dist/patterns/signature-request/index.js +1 -1
  39. package/dist/patterns/signature-request/signature-request.d.ts +7 -0
  40. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  41. package/dist/tokens.css +8 -5
  42. package/package.json +5 -1
  43. package/dist/_chunks/calendar-DeAlFPsF.js +0 -1050
  44. package/dist/_chunks/calendar-DeAlFPsF.js.map +0 -1
  45. package/dist/_chunks/chat-input-BTCDqUDX.js.map +0 -1
  46. package/dist/_chunks/fiscal-code-input-DWA6C8x8.js.map +0 -1
  47. package/dist/_chunks/signature-request-C-mskXwi.js +0 -318
  48. package/dist/_chunks/signature-request-C-mskXwi.js.map +0 -1
  49. package/dist/components/calendar/contrast-warning.d.ts +0 -20
  50. package/dist/components/calendar/contrast-warning.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar-DeAlFPsF.js","sources":["../../node_modules/lucide-react/dist/esm/icons/ban.mjs","../../node_modules/lucide-react/dist/esm/icons/euro.mjs","../../node_modules/lucide-react/dist/esm/icons/thumbs-up.mjs","../../node_modules/lucide-react/dist/esm/icons/zap.mjs","../../src/components/calendar/calendar.agent.ts","../../src/components/calendar/calendar.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M4.929 4.929 19.07 19.071\", key: \"196cmz\" }]\n];\nconst Ban = createLucideIcon(\"ban\", __iconNode);\n\nexport { __iconNode, Ban as default };\n//# sourceMappingURL=ban.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M4 10h12\", key: \"1y6xl8\" }],\n [\"path\", { d: \"M4 14h9\", key: \"1loblj\" }],\n [\n \"path\",\n {\n d: \"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2\",\n key: \"1j6lzo\"\n }\n ]\n];\nconst Euro = createLucideIcon(\"euro\", __iconNode);\n\nexport { __iconNode, Euro as default };\n//# sourceMappingURL=euro.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\",\n key: \"emmmcr\"\n }\n ],\n [\"path\", { d: \"M7 10v12\", key: \"1qc93n\" }]\n];\nconst ThumbsUp = createLucideIcon(\"thumbs-up\", __iconNode);\n\nexport { __iconNode, ThumbsUp as default };\n//# sourceMappingURL=thumbs-up.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\",\n key: \"1xq2db\"\n }\n ]\n];\nconst Zap = createLucideIcon(\"zap\", __iconNode);\n\nexport { __iconNode, Zap as default };\n//# sourceMappingURL=zap.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — Calendar. */\n/* */\n/* Calendar's existing `CalendarHandle` is the canonical shape for an */\n/* agent-friendly third-party wrapper — see `26-agent-readiness.mdx` */\n/* §15. The handle methods translate directly into adapter actions. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { CalendarHandle, CalendarView } from './calendar';\n\nexport const calendarAgent: AgentAdapter<CalendarHandle> = {\n id: 'calendar',\n capabilities: ['view_change', 'range_navigate', 'pick'],\n state: {\n currentView: {\n type: 'CalendarView',\n descriptionKey: 'ui.agent.calendar.state.currentView',\n description: 'Active view name (e.g. dayGridMonth, timeGridWeek).',\n read: (handle) => handle.getCurrentView() ?? null,\n },\n currentDate: {\n type: 'iso-date',\n descriptionKey: 'ui.agent.calendar.state.currentDate',\n description: 'ISO date anchor of the visible range.',\n read: (handle) => handle.getCurrentDate()?.toISOString() ?? null,\n },\n currentTitle: {\n type: 'string',\n descriptionKey: 'ui.agent.calendar.state.currentTitle',\n description: 'Human title of the current range (e.g. \"April 2026\").',\n read: (handle) => handle.getTitle(),\n },\n },\n actions: {\n today: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.calendar.actions.today',\n description: 'Jump to the current day.',\n invoke: (handle) => {\n handle.today();\n },\n },\n prev: {\n // Not idempotent: each call steps one range further back.\n safety: 'read',\n descriptionKey: 'ui.agent.calendar.actions.prev',\n description: 'Move to the previous range.',\n invoke: (handle) => {\n handle.prev();\n },\n },\n next: {\n // Not idempotent: each call steps one range further forward.\n safety: 'read',\n descriptionKey: 'ui.agent.calendar.actions.next',\n description: 'Move to the next range.',\n invoke: (handle) => {\n handle.next();\n },\n },\n goto_date: {\n safety: 'read',\n argsType: '{ date: string | Date }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n type: 'string',\n format: 'date',\n description: 'Target date — ISO 8601 string (or Date at runtime).',\n },\n },\n required: ['date'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.calendar.actions.gotoDate',\n description: 'Navigate to a specific date.',\n examples: [\n { args: { date: '2026-04-15' }, note: 'Jump to 15 April 2026.' },\n ],\n invoke: (handle, args: { date: string | Date }) => {\n handle.gotoDate(args.date);\n },\n },\n change_view: {\n safety: 'read',\n argsType: '{ view: CalendarView }',\n argsSchema: {\n type: 'object',\n properties: {\n view: {\n type: 'string',\n enum: [\n 'dayGridMonth',\n 'timeGridWeek',\n 'timeGridDay',\n 'listWeek',\n 'resourceTimeGridDayChair',\n 'resourceTimeGridThreeDaysChair',\n 'resourceTimeGridWeekChair',\n 'resourceTimeGridDayOperator',\n 'resourceTimeGridThreeDaysOperator',\n 'resourceTimeGridWeekOperator',\n ],\n description: 'Target view name.',\n },\n },\n required: ['view'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.calendar.actions.changeView',\n description: 'Switch the calendar to the given view.',\n examples: [\n { args: { view: 'timeGridWeek' }, note: 'Switch to the week view.' },\n ],\n invoke: (handle, args: { view: CalendarView }) => {\n handle.changeView(args.view);\n },\n },\n focus_event: {\n // pick: transient focus + highlight of an event — no persisted selection.\n // Not idempotent: each call re-triggers the flash highlight.\n safety: 'read',\n argsType: '{ eventId: string }',\n argsSchema: {\n type: 'object',\n properties: {\n eventId: {\n type: 'string',\n description: 'Stable event id (matches a data-event-id node).',\n },\n },\n required: ['eventId'],\n },\n descriptionKey: 'ui.agent.calendar.actions.focusEvent',\n description: 'Scroll an event into view and briefly highlight it.',\n errors: ['No DOM node matches the given event id — no-op.'],\n invoke: (handle, args: { eventId: string }) => {\n handle.focusEvent(args.eventId);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'calendar',\n description: 'Marks the Calendar wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-event-id',\n description:\n 'Emitted on every rendered FullCalendar event by the kit event renderer. Used by focusEvent.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Calendar — a thin, typed wrapper over FullCalendar. */\n/* */\n/* - Plugins are registered once internally so consumers never import */\n/* `@fullcalendar/core` / plugins directly (08-third-party §Calendar).*/\n/* - Chrome is styled entirely from `fullcalendar-theme.css` via the */\n/* `.fc-theme-alfadocs` root class — no inline styles anywhere. */\n/* - Locale, week-start, date formats, and direction all flow from the */\n/* active i18next language (06-i18n.mdx). */\n/* */\n/* TODO (deferred, per implementation plan): */\n/* - Virtualised resource timeline with @tanstack/react-virtual for */\n/* > 50 resources (performance user story). */\n/* - Protanopia screenshot stories (colour-blind story acceptance). */\n/* - Playwright performance trace for 1000 events / 50 resources. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/daygrid';\nimport timeGridPlugin from '@fullcalendar/timegrid';\nimport listPlugin from '@fullcalendar/list';\nimport resourcePlugin from '@fullcalendar/resource';\nimport type { ResourceLabelContentArg } from '@fullcalendar/resource';\nimport resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';\nimport resourceTimelinePlugin from '@fullcalendar/resource-timeline';\nimport timelinePlugin from '@fullcalendar/timeline';\nimport interactionPlugin from '@fullcalendar/interaction';\nimport type { EventResizeDoneArg } from '@fullcalendar/interaction';\nimport type {\n DatesSetArg,\n EventClickArg,\n EventContentArg,\n EventDropArg,\n DateSelectArg,\n EventInput,\n} from '@fullcalendar/core';\nimport {\n ThumbsUp,\n Clock,\n Stethoscope,\n Check,\n Ban,\n Zap,\n Globe,\n AlertTriangle,\n HeartPulse,\n Euro,\n Video,\n ChevronLeft,\n ChevronRight,\n type LucideIcon,\n} from 'lucide-react';\nimport '../../tokens/themes/bridges/fullcalendar-theme.css';\n\nimport { usePrefersReducedMotion } from '../../hooks';\nimport { useAgentRegistration } from '../../agent';\nimport { warnLowContrast } from './contrast-warning';\nimport { calendarAgent } from './calendar.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type CalendarView =\n // Standard views\n | 'dayGridMonth'\n | 'timeGridWeek'\n | 'timeGridDay'\n | 'listWeek'\n // Chair resource views\n | 'resourceTimeGridDayChair'\n | 'resourceTimeGridThreeDaysChair'\n | 'resourceTimeGridWeekChair'\n // Operator resource views\n | 'resourceTimeGridDayOperator'\n | 'resourceTimeGridThreeDaysOperator'\n | 'resourceTimeGridWeekOperator';\n\n/**\n * View-name mapping table — maps the DS public view name (with the\n * Chair/Operator semantic suffix stripped) onto the internal FullCalendar\n * view name for each `resourceLayout` orientation. The table is exported\n * via `resolveFullCalendarView`; invalid combinations are caught at\n * compile time because the `CalendarView` union is exhaustive.\n */\nconst RESOURCE_VIEW_MAP = {\n vertical: {\n Day: 'resourceTimeGridDay',\n ThreeDays: 'resourceTimeGridThreeDays',\n Week: 'resourceTimeGridWeek',\n },\n horizontal: {\n Day: 'resourceTimelineDay',\n ThreeDays: 'resourceTimelineThreeDays',\n Week: 'resourceTimelineWeek',\n },\n} as const satisfies Record<\n 'vertical' | 'horizontal',\n Record<'Day' | 'ThreeDays' | 'Week', string>\n>;\n\ntype ResourceViewStem = keyof (typeof RESOURCE_VIEW_MAP)['vertical'];\n\nconst STANDARD_VIEWS = new Set<CalendarView>([\n 'dayGridMonth',\n 'timeGridWeek',\n 'timeGridDay',\n 'listWeek',\n]);\n\n/**\n * Maps a public `CalendarView` name to the internal FullCalendar view\n * name. `resourceLayout` selects between `resourceTimeGrid*` (vertical)\n * and `resourceTimeline*` (horizontal) for the 6 resource views; the\n * 4 standard views are returned as-is.\n */\nexport function resolveFullCalendarView(\n view: CalendarView,\n resourceLayout: 'vertical' | 'horizontal' = 'vertical',\n): string {\n if (STANDARD_VIEWS.has(view)) {\n return view;\n }\n // Strip the trailing Chair / Operator suffix — the DS maps both to the\n // same internal FC view name. The suffix is semantic only.\n const withoutPrefix = view.replace(/^resourceTimeGrid/, '');\n const stem = withoutPrefix.replace(\n /(Chair|Operator)$/,\n '',\n ) as ResourceViewStem;\n return RESOURCE_VIEW_MAP[resourceLayout][stem];\n}\n\n/**\n * Registered custom FC view shapes — the two 3-day views are defined as\n * durations over the base `resourceTimeGrid` / `resourceTimeline` types.\n * Kept at module scope because the object is a compile-time constant.\n * Typed loosely to match FC's `ViewConfigInputHash` ( `[viewType: string]:\n * ViewConfigInput` ).\n */\nconst CALENDAR_CUSTOM_VIEWS: Record<\n string,\n { type: string; duration: { days: number } }\n> = {\n resourceTimeGridThreeDays: {\n type: 'resourceTimeGrid',\n duration: { days: 3 },\n },\n resourceTimelineThreeDays: {\n type: 'resourceTimeline',\n duration: { days: 3 },\n },\n};\n\nexport type CalendarEventStatus =\n | 'confirmed'\n | 'waiting'\n | 'in_care'\n | 'done'\n | 'cancelled'\n | 'absent';\n\nexport type CalendarMode = 'default' | 'create' | 'move' | 'copy';\n\nexport interface CalendarEvent {\n id: string;\n title: string;\n start: string | Date;\n end?: string | Date;\n resourceId?: string;\n allDay?: boolean;\n\n /* Appointment-specific (all optional) */\n status?: CalendarEventStatus;\n /** Hex colour from a DoctorColor palette — overrides CVA bg. */\n backgroundColor?: string;\n /** Hex colour from a DoctorColor palette — overrides CVA text. */\n textColor?: string;\n /** Extra description rendered after the title in normal weight. */\n suffix?: string;\n /** Masked title shown when `privacyMode` is true. */\n privacyModeTitle?: string;\n /** Shows a Globe icon + zebra overlay. */\n isBookedOnline?: boolean;\n /** Shows an AlertTriangle icon. */\n hasUnassignedPatient?: boolean;\n /** Shows a HeartPulse icon. */\n hasHighlightedAnamnesis?: boolean;\n /** Shows a Euro icon. */\n hasBillableAmount?: boolean;\n /** Shows a Video icon. */\n isTelehealth?: boolean;\n isRecurrenceParent?: boolean;\n /** Rendered as a background event; not clickable. */\n isInternal?: boolean;\n patientId?: string | number;\n operatorId?: string | number;\n}\n\nexport interface CalendarResource {\n id: string;\n title: string;\n /** Initials for the compact \"avatar\" label (e.g. \"MR\"). */\n shortTitle?: string;\n /** Hex background colour for the dot or initials circle. */\n color?: string;\n /** Hex text colour for the initials circle. */\n shortTitleTextColor?: string;\n /** Numeric ordering — passed to FullCalendar's `resourceOrder`. */\n sequenceNumber?: number;\n}\n\nexport interface CalendarEventDropInfo {\n event: CalendarEvent;\n oldStart: Date;\n newStart: Date;\n}\n\nexport interface CalendarEventResizeInfo {\n event: CalendarEvent;\n oldEnd: Date;\n newEnd: Date;\n}\n\nexport interface CalendarDateSelectInfo {\n start: Date;\n end: Date;\n allDay: boolean;\n resourceId?: string;\n}\n\nexport interface CalendarProps {\n /**\n * Stable identifier for this calendar instance. Used for the agent-readiness\n * `data-component-id` attribute and the agent registry. Required only when\n * the consuming app expects an MCP / agent integration to address this\n * specific calendar.\n */\n id?: string;\n /** Events to render on the calendar. */\n events: CalendarEvent[];\n /** Resources for `resourceTimeline` view. */\n resources?: CalendarResource[];\n /** Active view. */\n view?: CalendarView;\n /** Initial date (string or Date). */\n initialDate?: string | Date;\n /** Locale override — defaults to the active i18next language. */\n locale?: string;\n /** Fires when an event is dragged to a new slot. */\n onEventDrop?: (info: CalendarEventDropInfo) => void;\n /** Fires when an event is resized. */\n onEventResize?: (info: CalendarEventResizeInfo) => void;\n /** Fires when an event resize gesture begins. */\n onEventResizeStart?: () => void;\n /** Fires when an event is clicked. */\n onEventClick?: (event: CalendarEvent) => void;\n /** Fires when the user click-drags a range to create a new event. */\n onDateSelect?: (range: CalendarDateSelectInfo) => void;\n /** Allow drag-drop rescheduling. */\n editable?: boolean;\n /** Allow resize gestures on events. Defaults to `editable`. */\n eventDurationEditable?: boolean;\n /** Allow click-drag to create. */\n selectable?: boolean;\n /** Height of the calendar. */\n height?: number | string;\n /** Extra class names on the wrapper. */\n className?: string;\n /** Mask patient titles — announces state changes via aria-live. */\n privacyMode?: boolean;\n /** Interaction mode — renders a sticky banner when not `'default'`. */\n mode?: CalendarMode;\n /** Override text for the mode banner. */\n modeLabel?: string;\n /** Hex background colour for the mode banner (consuming-app supplied). */\n modeBannerColor?: string;\n /** Hex text colour for the mode banner. */\n modeBannerTextColor?: string;\n /** Cancel handler wired to the mode banner button. */\n onModeCancel?: () => void;\n /** Optional alert banner rendered above the mode banner. */\n alertBanner?: ReactNode;\n /** Lower bound of the time axis (e.g. '07:00'). */\n slotMinTime?: string;\n /** Upper bound of the time axis (e.g. '23:00'). */\n slotMaxTime?: string;\n /** Slot duration (e.g. '00:15'). */\n slotDuration?: string;\n /** When false, hides the inline time pill on events. */\n showTime?: boolean;\n /** Place date headers above the resource axis. */\n datesAboveResources?: boolean;\n /** Allow overlapping events in the same slot. */\n slotEventOverlap?: boolean;\n /** Keep date headers pinned during scroll. */\n stickyHeaderDates?: boolean;\n /** Show a now-indicator line on time-grid views. */\n nowIndicator?: boolean;\n /** Collapse overflow events into \"+N more\" links. */\n dayMaxEvents?: boolean | number;\n /**\n * FullCalendar Scheduler premium license key. Required for the\n * `resourceTimeline` view. Defaults to `VITE_FULLCALENDAR_LICENSE_KEY`\n * from the environment; consumers can override per-instance.\n */\n schedulerLicenseKey?: string;\n /**\n * Show the built-in toolbar. Default true. Pass false to hide it\n * entirely (e.g. when the consuming app renders its own\n * `<Calendar.Toolbar ... />` elsewhere on the page).\n */\n toolbar?: boolean;\n /**\n * Extra controls rendered at the inline-end of the default toolbar —\n * commonly a view switcher, a privacy toggle, or an \"add appointment\"\n * button. Ignored when `toolbar` is false.\n */\n toolbarEnd?: ReactNode;\n /**\n * Orientation for resource views. `vertical` (default) uses\n * `resourceTimeGrid` — resources as columns, time as rows.\n * `horizontal` uses `resourceTimeline` — resources as rows, time as columns.\n * Ignored for non-resource views.\n */\n resourceLayout?: 'vertical' | 'horizontal';\n /**\n * When true, render a round initials avatar (using\n * `resource.shortTitle` + `resource.color` + `resource.shortTitleTextColor`)\n * in the resource label. When false (default), a small coloured dot\n * prefixes the title when `resource.color` is set.\n */\n showResourceInitials?: boolean;\n}\n\nexport interface CalendarHandle {\n /** Returns the internal FullCalendar instance for advanced use. */\n getApi: () => unknown;\n /** Jump to today. */\n today: () => void;\n /** Navigate to the previous period. */\n prev: () => void;\n /** Navigate to the next period. */\n next: () => void;\n /** Navigate to an arbitrary date. */\n gotoDate: (date: Date | string) => void;\n /** Switch the active view. */\n changeView: (view: CalendarView) => void;\n /** Current view title (e.g. \"April 2026\") — reflects the FC API getter. */\n getTitle: () => string;\n /** Currently active view name. */\n getCurrentView: () => CalendarView | undefined;\n /** Currently focused date — the anchor of the visible range. */\n getCurrentDate: () => Date | undefined;\n /** Scroll to an event by id and briefly highlight it. */\n focusEvent: (eventId: string) => void;\n}\n\n/* Narrow structural interface for the subset of the FullCalendar API\n we actually invoke. Keeps the handle methods typed without pulling\n `@fullcalendar/core` types across the public boundary. */\ninterface FcApi {\n today: () => void;\n prev: () => void;\n next: () => void;\n gotoDate: (date: Date | string) => void;\n changeView: (view: string) => void;\n render: () => void;\n getDate: () => Date;\n view: { title: string; type: string };\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA — status → event card classes */\n/* ------------------------------------------------------------------ */\n\nconst eventCardVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]',\n 'ds:w-full ds:h-full',\n 'ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:text-[length:var(--font-size-sm)]',\n 'ds:font-[var(--font-weight-medium)]',\n 'ds:overflow-hidden',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-[var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n ].join(' '),\n {\n variants: {\n status: {\n // Note: every text-[…] uses the explicit `color:` prefix so\n // Tailwind interprets it as a colour, not a length. Without the\n // prefix, `text-[var(--X)]` resolves to font-size and the text\n // colour falls through to the inherited `--foreground` — which\n // produced 2.07:1 axe failures on saturated backgrounds.\n confirmed:\n 'ds:bg-[color:var(--success)] ds:text-[color:var(--success-solid-foreground)] ds:border ds:border-[color:var(--success)]',\n waiting:\n 'ds:bg-[color:var(--info)] ds:text-[color:var(--info-solid-foreground)] ds:border ds:border-[color:var(--info)]',\n in_care:\n 'ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:border ds:border-[color:var(--primary)]',\n // `done` reads as \"completed, fading out\". Previously\n // `bg-color-mix(--success 70%, transparent) text-success-solid-foreground`,\n // composited to ~#65a586 with white text → 2.88:1 fail.\n // Now uses a low-saturation tint background with dark\n // `--foreground` text + a left accent bar carrying the status\n // hue.\n done: 'ds:bg-[color:color-mix(in_srgb,var(--success)_18%,var(--background))] ds:text-[color:var(--foreground)] ds:border-s-[3px] ds:border-s-[color:var(--success)] ds:border-y ds:border-e ds:border-y-[color:color-mix(in_srgb,var(--success)_25%,var(--border))] ds:border-e-[color:color-mix(in_srgb,var(--success)_25%,var(--border))]',\n cancelled:\n 'ds:bg-[color:var(--destructive)] ds:text-[color:var(--destructive-foreground)] ds:border ds:border-[color:var(--destructive)] ds:line-through',\n absent:\n 'ds:bg-[color:var(--warning)] ds:text-[color:var(--warning-solid-foreground)] ds:border ds:border-[color:var(--warning)]',\n default:\n 'ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:border ds:border-[color:var(--primary)]',\n },\n },\n defaultVariants: { status: 'default' },\n },\n);\n\nconst STATUS_ICON: Record<CalendarEventStatus, LucideIcon> = {\n confirmed: ThumbsUp,\n waiting: Clock,\n in_care: Stethoscope,\n done: Check,\n cancelled: Ban,\n absent: Zap,\n};\n\n/* Mode banner → i18n key lookup. Kept as a literal object (not a\n template) so static-analysis extractors can find every key. */\nconst MODE_BANNER_KEYS: Record<Exclude<CalendarMode, 'default'>, string> = {\n create: 'calendar.modeBanner.create',\n move: 'calendar.modeBanner.move',\n copy: 'calendar.modeBanner.copy',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\ninterface LocaleWeekInfo {\n firstDay?: number;\n}\n\ninterface LocaleWithWeekInfo {\n getWeekInfo?: () => LocaleWeekInfo;\n weekInfo?: LocaleWeekInfo;\n}\n\n/**\n * Resolve the first day of the week for a locale using the modern\n * `Intl.Locale.getWeekInfo()` API when available, falling back to Monday\n * for EU-leaning locales and Sunday for en-US / he-IL / ar-SA.\n */\nexport function resolveFirstDay(locale: string): number {\n try {\n const intlLocale = new Intl.Locale(locale) as unknown as LocaleWithWeekInfo;\n const info =\n typeof intlLocale.getWeekInfo === 'function'\n ? intlLocale.getWeekInfo()\n : intlLocale.weekInfo;\n if (info && typeof info.firstDay === 'number') {\n return info.firstDay % 7;\n }\n } catch {\n /* no-op — fall through to heuristic */\n }\n if (\n locale.startsWith('en-US') ||\n locale.startsWith('he') ||\n locale.startsWith('ar-SA')\n ) {\n return 0;\n }\n return 1;\n}\n\n/**\n * Small hook that mirrors the parent Calendar's document-dir observer\n * so sub-components can swap physical icons for logical direction\n * without threading a prop through. Returns true when the effective\n * document direction is RTL.\n */\nfunction useIsRtl(): boolean {\n const { i18n } = useTranslation();\n const [isRtl, setIsRtl] = useState<boolean>(() => {\n if (typeof document === 'undefined') return false;\n const docDir = document.documentElement.getAttribute('dir');\n const i18nDir = typeof i18n.dir === 'function' ? i18n.dir() : 'ltr';\n return docDir === 'rtl' || i18nDir === 'rtl';\n });\n\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n const observer = new MutationObserver(() => {\n const docDir = document.documentElement.getAttribute('dir');\n const i18nDir = typeof i18n.dir === 'function' ? i18n.dir() : 'ltr';\n setIsRtl(docDir === 'rtl' || i18nDir === 'rtl');\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir', 'lang'],\n });\n return () => observer.disconnect();\n }, [i18n]);\n\n return isRtl;\n}\n\n/* ------------------------------------------------------------------ */\n/* Event content render-prop */\n/* */\n/* Renders the event card with: */\n/* - a status icon (aria-hidden) coloured by status token */\n/* - indicator icons (online, unassigned, anamnesis, billable, tele) */\n/* - a time range pill (when !allDay && showTime) */\n/* - the event title (bold, masked in privacy mode) */\n/* - an optional suffix (regular weight) */\n/* - an aria-label built from title + range + resource + status */\n/* ------------------------------------------------------------------ */\n\ninterface RenderEventContentParams {\n arg: EventContentArg;\n locale: string;\n resources: CalendarResource[];\n statusLabels: Record<CalendarEventStatus, string>;\n privacyMode: boolean;\n showTime: boolean;\n}\n\ntype EventExtendedProps = Omit<\n CalendarEvent,\n 'id' | 'title' | 'start' | 'end' | 'allDay'\n>;\n\nfunction renderEventContent({\n arg,\n locale,\n resources,\n statusLabels,\n privacyMode,\n showTime,\n}: RenderEventContentParams): ReactElement {\n const extended = (arg.event.extendedProps ?? {}) as EventExtendedProps;\n const {\n status,\n backgroundColor,\n textColor,\n suffix,\n privacyModeTitle,\n isBookedOnline,\n hasUnassignedPatient,\n hasHighlightedAnamnesis,\n hasBillableAmount,\n isTelehealth,\n resourceId,\n } = extended;\n\n const StatusIcon = status ? STATUS_ICON[status] : null;\n\n const start = arg.event.start;\n const end = arg.event.end ?? arg.event.start;\n const allDay = arg.event.allDay;\n\n let rangeText = '';\n if (start && end) {\n try {\n const fmt = new Intl.DateTimeFormat(locale, {\n hour: '2-digit',\n minute: '2-digit',\n hour12: false,\n });\n rangeText =\n typeof fmt.formatRange === 'function'\n ? fmt.formatRange(start, end)\n : `${fmt.format(start)} – ${fmt.format(end)}`;\n } catch {\n rangeText = '';\n }\n }\n\n const resourceTitle = resourceId\n ? resources.find((r) => r.id === resourceId)?.title\n : undefined;\n const statusLabel = status ? statusLabels[status] : undefined;\n\n const displayTitle = privacyMode\n ? (privacyModeTitle ?? '•••')\n : arg.event.title;\n\n const ariaLabel = [displayTitle, rangeText, resourceTitle, statusLabel]\n .filter(Boolean)\n .join(', ');\n\n /* Per-event colour override: the consuming app passes a runtime hex\n from a DoctorColor (Material-Design style) palette. 23-constraints\n permits inline `style` only as a CSS custom property setter for\n runtime values that can't be enumerated at build time — the\n consuming `background-color` / `color` references live in the\n className as Tailwind arbitrary values. */\n const colourOverrides: CSSProperties | undefined =\n backgroundColor || textColor\n ? {\n ...(backgroundColor\n ? ({ '--calendar-event-bg': backgroundColor } as CSSProperties)\n : {}),\n ...(textColor\n ? ({ '--calendar-event-text': textColor } as CSSProperties)\n : {}),\n }\n : undefined;\n\n /* DEV-only guardrail: warn when caller-supplied bg/fg hex pair falls\n below WCAG AA. No-op when either half is missing (fg missing falls\n back to the DS foreground token, which isn't a hex we can check). */\n if (backgroundColor || textColor) {\n warnLowContrast(backgroundColor, textColor, `event ${arg.event.id}`);\n }\n\n const className = [\n eventCardVariants({ status: status ?? 'default' }),\n isBookedOnline ? 'event-booked-online' : null,\n backgroundColor ? 'ds:[background-color:var(--calendar-event-bg)]' : null,\n textColor ? 'ds:[color:var(--calendar-event-text)]' : null,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div\n className={className}\n // eslint-disable-next-line react/forbid-dom-props -- caller-supplied event bg/text hex injected via CSS variables\n style={colourOverrides}\n aria-label={ariaLabel}\n data-event-id={arg.event.id}\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:self-end\">\n {StatusIcon ? <StatusIcon size={14} aria-hidden=\"true\" /> : null}\n {isBookedOnline ? <Globe size={12} aria-hidden=\"true\" /> : null}\n {hasUnassignedPatient ? (\n <AlertTriangle size={12} aria-hidden=\"true\" />\n ) : null}\n {hasHighlightedAnamnesis ? (\n <HeartPulse size={12} aria-hidden=\"true\" />\n ) : null}\n {hasBillableAmount ? <Euro size={12} aria-hidden=\"true\" /> : null}\n {isTelehealth ? <Video size={12} aria-hidden=\"true\" /> : null}\n </div>\n {showTime && !allDay && rangeText ? (\n // No opacity here — composing 70% over saturated bgs (success /\n // destructive / primary) drops effective contrast below WCAG AA\n // (≤ 3.82:1 measured). The smaller font-size-xs vs the title's\n // font-weight-semibold provides sufficient visual hierarchy.\n <span className=\"ds:text-[length:var(--font-size-xs)]\">\n {rangeText}\n </span>\n ) : null}\n <span className=\"ds:font-[var(--font-weight-semibold)] ds:truncate ds:text-start\">\n {displayTitle}\n </span>\n {suffix ? (\n <span className=\"ds:truncate ds:text-start ds:text-[length:var(--font-size-xs)]\">\n {suffix}\n </span>\n ) : null}\n </div>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* CalendarToolbar — compound sub-component */\n/* */\n/* Renders the DS-styled prev/today/next controls + a centered <h2> */\n/* title (aria-live so navigation updates announce politely) plus an */\n/* optional inline-end slot. Logical properties only; physical icons */\n/* (ChevronLeft / ChevronRight) are swapped in RTL so the pair always */\n/* points in the expected reading direction. */\n/* ------------------------------------------------------------------ */\n\nexport interface CalendarToolbarProps {\n /** Title shown in the toolbar (e.g. \"April 2026\"). Typically\n * produced by `calendarHandle.getTitle()`. */\n title?: string;\n /** Jump to today. */\n onToday: () => void;\n /** Navigate to the previous period. */\n onPrev: () => void;\n /** Navigate to the next period. */\n onNext: () => void;\n /** Extra controls rendered at the inline-end. */\n end?: ReactNode;\n /** Additional className. */\n className?: string;\n}\n\nconst toolbarButtonBaseClass = [\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:border ds:border-[var(--border)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:font-[var(--font-weight-medium)] ds:text-[length:var(--font-size-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:hover:bg-[var(--muted)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-[var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:motion-reduce:transition-none',\n].join(' ');\n\nconst toolbarTextButtonClass = [\n toolbarButtonBaseClass,\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n].join(' ');\n\nconst toolbarIconButtonClass = [\n toolbarButtonBaseClass,\n 'ds:min-w-[var(--min-target-size)]',\n].join(' ');\n\nexport const CalendarToolbar = forwardRef<HTMLDivElement, CalendarToolbarProps>(\n ({ title, onToday, onPrev, onNext, end, className }, ref) => {\n const { t } = useTranslation();\n const isRtl = useIsRtl();\n const PrevIcon = isRtl ? ChevronRight : ChevronLeft;\n const NextIcon = isRtl ? ChevronLeft : ChevronRight;\n\n const rootClassName = [\n 'ds:calendar-toolbar',\n 'ds:sticky ds:top-0 ds:z-20',\n 'ds:flex ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:py-[var(--spacing-sm)]',\n 'ds:bg-[var(--background)]',\n 'ds:border-b ds:border-[var(--border)]',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div ref={ref} className={rootClassName}>\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <button\n type=\"button\"\n onClick={onToday}\n className={toolbarTextButtonClass}\n >\n {t('calendar.today')}\n </button>\n <button\n type=\"button\"\n onClick={onPrev}\n aria-label={t('calendar.previousPeriod')}\n className={toolbarIconButtonClass}\n >\n <PrevIcon size={16} aria-hidden=\"true\" />\n </button>\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={t('calendar.nextPeriod')}\n className={toolbarIconButtonClass}\n >\n <NextIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n {title ? (\n <h2\n aria-live=\"polite\"\n className=\"ds:flex-1 ds:text-center ds:truncate type-title-card\"\n >\n {title}\n </h2>\n ) : (\n /* Keep the centering slot stable even before the first\n `datesSet` populates the title — an empty <h2> would trip\n axe's `empty-heading` rule, so we substitute a decorative\n spacer that matches the h2's flex sizing. Once `title` is\n non-empty the h2 renders in the same slot. */\n <div aria-hidden=\"true\" className=\"ds:flex-1 ds:text-center\" />\n )}\n {end ? (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {end}\n </div>\n ) : null}\n </div>\n );\n },\n);\nCalendarToolbar.displayName = 'Calendar.Toolbar';\n\n/* ------------------------------------------------------------------ */\n/* Calendar component */\n/* ------------------------------------------------------------------ */\n\nconst CalendarInner = forwardRef<CalendarHandle, CalendarProps>(\n (\n {\n id,\n events,\n resources,\n view = 'dayGridMonth',\n initialDate,\n locale: localeProp,\n onEventDrop,\n onEventResize,\n onEventResizeStart,\n onEventClick,\n onDateSelect,\n editable = false,\n eventDurationEditable,\n selectable = false,\n height,\n className,\n privacyMode = false,\n mode = 'default',\n modeLabel,\n modeBannerColor,\n modeBannerTextColor,\n onModeCancel,\n alertBanner,\n slotMinTime,\n slotMaxTime,\n slotDuration,\n showTime = true,\n datesAboveResources = true,\n slotEventOverlap = false,\n stickyHeaderDates = true,\n nowIndicator = true,\n dayMaxEvents = true,\n schedulerLicenseKey = import.meta.env.VITE_FULLCALENDAR_LICENSE_KEY,\n toolbar = true,\n toolbarEnd,\n resourceLayout = 'vertical',\n showResourceInitials = false,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const fcRef = useRef<FullCalendar | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n const liveRegionRef = useRef<HTMLDivElement>(null);\n const focusTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const focusedElRef = useRef<HTMLElement | null>(null);\n\n const locale = localeProp ?? i18n.language ?? 'en';\n\n /* ---- direction reacts to dir attribute changes ----------------- */\n const [direction, setDirection] = useState<'ltr' | 'rtl'>(() => {\n if (typeof document === 'undefined') return 'ltr';\n const docDir = document.documentElement.getAttribute('dir');\n const i18nDir = typeof i18n.dir === 'function' ? i18n.dir() : 'ltr';\n return docDir === 'rtl' || i18nDir === 'rtl' ? 'rtl' : 'ltr';\n });\n\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n const observer = new MutationObserver(() => {\n const docDir = document.documentElement.getAttribute('dir');\n const i18nDir = typeof i18n.dir === 'function' ? i18n.dir() : 'ltr';\n setDirection(docDir === 'rtl' || i18nDir === 'rtl' ? 'rtl' : 'ltr');\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir', 'lang'],\n });\n return () => observer.disconnect();\n }, [i18n]);\n\n /* ---- theme class-change observer → forces FullCalendar repaint - */\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n const api = fcRef.current?.getApi() as unknown;\n if (\n api &&\n typeof (api as { render?: () => void }).render === 'function'\n ) {\n (api as { render: () => void }).render();\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- FullCalendar markup a11y patches --------------------------- */\n /* */\n /* FullCalendar emits a few markup patterns that axe (correctly) */\n /* flags but we cannot fix without forking FC. Patching at */\n /* render-time via MutationObserver keeps the fix scoped: */\n /* */\n /* 1. `<a aria-expanded aria-controls>` for the daygrid \"+N more\" */\n /* trigger has no `role` — `aria-expanded` is not allowed on a */\n /* bare anchor. Add `role=\"button\"`. */\n /* 2. `.fc-scroller` is a scrollable region with no keyboard */\n /* access — give it `tabindex=\"0\"` and `role=\"region\"` so */\n /* keyboard users can scroll it. */\n /* 3. `.fc-bg-event` (background events used for highlight ranges) */\n /* is rendered with `aria-hidden=\"true\"` ancestor + an inner */\n /* `<a tabindex=\"0\">` — strip the focusability when */\n /* `aria-hidden` is in effect. */\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n const root = rootRef.current;\n if (!root) return undefined;\n\n const patchMarkup = () => {\n root\n .querySelectorAll<HTMLAnchorElement>('.fc-daygrid-more-link')\n .forEach((link) => {\n if (!link.getAttribute('role')) {\n link.setAttribute('role', 'button');\n }\n });\n // `.fc-scroller` cannot be patched — adding `tabindex=\"0\"`\n // makes it a focusable direct child of FC's `<table\n // role=\"grid\">`, which axe (correctly) flags as a violation of\n // `aria-required-children` (a grid expects only `role=\"row\"`\n // children). The `scrollable-region-focusable` rule will need\n // an upstream FC fix or per-story override; for now we accept\n // it. (Tracked: deferred.)\n // Inside any aria-hidden subtree, force focusable descendants to\n // tabindex=\"-1\" so they leave the tab sequence (axe\n // aria-hidden-focus). FC marks decorative rows / mirror events\n // aria-hidden but leaves the inner anchors focusable.\n root\n .querySelectorAll<HTMLElement>('[aria-hidden=\"true\"]')\n .forEach((hidden) => {\n hidden\n .querySelectorAll<HTMLElement>(\n 'a[href], button, [tabindex]:not([tabindex=\"-1\"])',\n )\n .forEach((el) => {\n el.setAttribute('tabindex', '-1');\n });\n });\n };\n\n patchMarkup();\n const observer = new MutationObserver(patchMarkup);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['aria-hidden'],\n });\n return () => observer.disconnect();\n }, [t]);\n\n /* ---- reduced-motion gate --------------------------------------- */\n const reducedMotion = usePrefersReducedMotion();\n\n /* ---- current title (synced from FC via datesSet) --------------- */\n const [currentTitle, setCurrentTitle] = useState('');\n\n /* ---- imperative handle ----------------------------------------- */\n const handle = useMemo<CalendarHandle>(() => {\n const getRawApi = (): FcApi | undefined =>\n fcRef.current?.getApi() as FcApi | undefined;\n\n return {\n getApi: () => fcRef.current?.getApi(),\n today: () => {\n getRawApi()?.today();\n },\n prev: () => {\n getRawApi()?.prev();\n },\n next: () => {\n getRawApi()?.next();\n },\n gotoDate: (date: Date | string) => {\n getRawApi()?.gotoDate(date);\n },\n changeView: (nextView: CalendarView) => {\n getRawApi()?.changeView(\n resolveFullCalendarView(nextView, resourceLayout),\n );\n },\n getTitle: () => getRawApi()?.view.title ?? '',\n getCurrentView: () => {\n const type = getRawApi()?.view.type;\n return type as CalendarView | undefined;\n },\n getCurrentDate: () => getRawApi()?.getDate(),\n focusEvent: (eventId: string) => {\n const root = rootRef.current;\n if (!root) return;\n const selector = `[data-event-id=\"${CSS.escape(eventId)}\"]`;\n const element = root.querySelector<HTMLElement>(selector);\n if (!element) {\n if (import.meta.env.DEV) {\n console.warn(\n `[Calendar] focusEvent: no DOM node matches event id \"${eventId}\".`,\n );\n }\n return;\n }\n /* Clear any previous highlight still in-flight before\n starting a new one — prevents overlapping timers from\n removing the className mid-animation. */\n if (focusTimerRef.current) {\n clearTimeout(focusTimerRef.current);\n focusTimerRef.current = null;\n }\n if (focusedElRef.current && focusedElRef.current !== element) {\n focusedElRef.current.classList.remove('calendar-event-focused');\n }\n\n element.scrollIntoView({\n behavior: reducedMotion ? 'auto' : 'smooth',\n block: 'center',\n });\n element.classList.add('calendar-event-focused');\n focusedElRef.current = element;\n\n /* Announce via aria-live, masking the title under privacy\n mode the same way drop/resize do. */\n if (liveRegionRef.current) {\n const titleAttr = element.getAttribute('aria-label') ?? eventId;\n const announcedTitle = privacyMode ? '•••' : titleAttr;\n liveRegionRef.current.textContent = t('calendar.focusedEvent', {\n title: announcedTitle,\n });\n }\n\n focusTimerRef.current = setTimeout(() => {\n element.classList.remove('calendar-event-focused');\n if (focusedElRef.current === element) {\n focusedElRef.current = null;\n }\n focusTimerRef.current = null;\n }, 3000);\n },\n };\n }, [reducedMotion, privacyMode, t, resourceLayout]);\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(calendarAgent, handle, id);\n\n /* Clean up any pending focus timer on unmount. */\n useEffect(\n () => () => {\n if (focusTimerRef.current) {\n clearTimeout(focusTimerRef.current);\n focusTimerRef.current = null;\n }\n },\n [],\n );\n\n /* ---- translated toolbar button labels (used by FC internal when\n we opt in to its toolbar — currently always off in the default\n path; retained for noEventsText / allDayText completeness) ---- */\n const statusLabels = useMemo<Record<CalendarEventStatus, string>>(\n () => ({\n confirmed: t('calendar.status.confirmed'),\n waiting: t('calendar.status.waiting'),\n in_care: t('calendar.status.inCare'),\n done: t('calendar.status.done'),\n cancelled: t('calendar.status.cancelled'),\n absent: t('calendar.status.absent'),\n }),\n [t],\n );\n\n /* ---- privacy-mode announcer (skip initial render) --------------- */\n const privacyFirstRun = useRef(true);\n useEffect(() => {\n if (privacyFirstRun.current) {\n privacyFirstRun.current = false;\n return;\n }\n if (liveRegionRef.current) {\n liveRegionRef.current.textContent = privacyMode\n ? t('calendar.privacyModeOn')\n : t('calendar.privacyModeOff');\n }\n }, [privacyMode, t]);\n\n /* ---- adapt events for FullCalendar ----------------------------- */\n const fcEvents = useMemo<EventInput[]>(\n () =>\n events.map((event) => ({\n id: event.id,\n title: event.title,\n start: event.start,\n end: event.end,\n allDay: event.allDay,\n resourceId: event.resourceId,\n display: event.isInternal ? 'background' : undefined,\n extendedProps: {\n status: event.status,\n resourceId: event.resourceId,\n backgroundColor: event.backgroundColor,\n textColor: event.textColor,\n suffix: event.suffix,\n privacyModeTitle: event.privacyModeTitle,\n isBookedOnline: event.isBookedOnline ?? false,\n hasUnassignedPatient: event.hasUnassignedPatient ?? false,\n hasHighlightedAnamnesis: event.hasHighlightedAnamnesis ?? false,\n hasBillableAmount: event.hasBillableAmount ?? false,\n isTelehealth: event.isTelehealth ?? false,\n isRecurrenceParent: event.isRecurrenceParent ?? false,\n isInternal: event.isInternal ?? false,\n patientId: event.patientId,\n operatorId: event.operatorId,\n },\n })),\n [events],\n );\n\n /* ---- formatters (Intl, never literal format strings) ----------- */\n const titleFormat = useMemo(\n () => ({\n year: 'numeric' as const,\n month: 'long' as const,\n }),\n [],\n );\n const dayHeaderFormat = useMemo(\n () => ({\n weekday: 'short' as const,\n }),\n [],\n );\n const eventTimeFormat = useMemo(\n () => ({\n hour: 'numeric' as const,\n minute: '2-digit' as const,\n }),\n [],\n );\n const slotLabelFormat = useMemo(\n () => ({\n hour: 'numeric' as const,\n minute: '2-digit' as const,\n }),\n [],\n );\n\n /* ---- helper: adapt FC event to CalendarEvent -------------------- */\n const adaptEvent = (\n fcEvent: EventDropArg['event'] | EventClickArg['event'],\n ): CalendarEvent => {\n const ext = (fcEvent.extendedProps ?? {}) as EventExtendedProps;\n return {\n id: fcEvent.id,\n title: fcEvent.title,\n start: fcEvent.start ?? new Date(),\n end: fcEvent.end ?? undefined,\n resourceId: ext.resourceId,\n status: ext.status,\n allDay: fcEvent.allDay,\n backgroundColor: ext.backgroundColor,\n textColor: ext.textColor,\n suffix: ext.suffix,\n privacyModeTitle: ext.privacyModeTitle,\n isBookedOnline: ext.isBookedOnline,\n hasUnassignedPatient: ext.hasUnassignedPatient,\n hasHighlightedAnamnesis: ext.hasHighlightedAnamnesis,\n hasBillableAmount: ext.hasBillableAmount,\n isTelehealth: ext.isTelehealth,\n isRecurrenceParent: ext.isRecurrenceParent,\n isInternal: ext.isInternal,\n patientId: ext.patientId,\n operatorId: ext.operatorId,\n };\n };\n\n /* ---- callbacks ------------------------------------------------- */\n const handleEventDrop = useMemo(() => {\n if (!onEventDrop) return undefined;\n return (info: EventDropArg) => {\n if (!info.event.start) return;\n // `info.oldEvent.start` is the only reliable source for the pre-drag\n // time — FullCalendar guarantees it is non-null for a drop on an\n // event that had a start. The `delta` field is unsafe to subtract\n // because it reports calendrical components (years/months/days +\n // sub-day ms), not a single ms offset, and month/year reconstruction\n // is ambiguous across boundaries. If oldStart is somehow missing we\n // bail rather than produce a silently-wrong value.\n const oldStart = info.oldEvent.start;\n if (!oldStart) {\n if (import.meta.env.DEV) {\n console.warn(\n '[Calendar] handleEventDrop: oldEvent.start was null — dropping the event-drop callback rather than emitting wrong oldStart data.',\n );\n }\n return;\n }\n onEventDrop({\n event: adaptEvent(info.event),\n oldStart,\n newStart: info.event.start,\n });\n /* Announce via aria-live. The announced title must honour\n privacyMode — the event card's aria-label already masks, but\n the live-region text is a separate codepath that would leak\n the raw name on drop if not masked here too. */\n if (liveRegionRef.current) {\n const ext = (info.event.extendedProps ?? {}) as EventExtendedProps;\n const announcedTitle = privacyMode\n ? (ext.privacyModeTitle ?? '•••')\n : info.event.title;\n liveRegionRef.current.textContent = t('calendar.eventMoved', {\n title: announcedTitle,\n });\n }\n };\n }, [onEventDrop, privacyMode, t]);\n\n const handleEventResize = useMemo(() => {\n if (!onEventResize) return undefined;\n return (info: EventResizeDoneArg) => {\n if (!info.event.end) return;\n // Mirror the drop path: rely on `info.oldEvent.end` for the pre-resize\n // boundary. Bail on null rather than fabricating a value from deltas.\n const oldEnd = info.oldEvent.end;\n if (!oldEnd) {\n if (import.meta.env.DEV) {\n console.warn(\n '[Calendar] handleEventResize: oldEvent.end was null — dropping the resize callback rather than emitting wrong oldEnd data.',\n );\n }\n return;\n }\n const newEnd = info.event.end;\n // Fall back to the pre-resize start (info.oldEvent.start), not\n // oldEnd — using oldEnd collapses cancelled drags to a zero-minute\n // duration in the live-region announcement.\n const newStart = info.event.start ?? info.oldEvent.start ?? oldEnd;\n onEventResize({\n event: adaptEvent(info.event),\n oldEnd,\n newEnd,\n });\n if (liveRegionRef.current) {\n const duration = Math.round(\n (newEnd.getTime() - newStart.getTime()) / 60000,\n );\n /* Mirror the drop path: mask the title when privacyMode is on. */\n const ext = (info.event.extendedProps ?? {}) as EventExtendedProps;\n const announcedTitle = privacyMode\n ? (ext.privacyModeTitle ?? '•••')\n : info.event.title;\n liveRegionRef.current.textContent = t('calendar.eventResized', {\n title: announcedTitle,\n duration,\n });\n }\n };\n }, [onEventResize, privacyMode, t]);\n\n const handleEventClick = useMemo(() => {\n if (!onEventClick) return undefined;\n return (info: EventClickArg) => {\n if (!info.event.start) return;\n onEventClick(adaptEvent(info.event));\n };\n }, [onEventClick]);\n\n const handleDateSelect = useMemo(() => {\n if (!onDateSelect) return undefined;\n return (info: DateSelectArg) => {\n onDateSelect({\n start: info.start,\n end: info.end,\n allDay: info.allDay,\n resourceId: info.resource?.id,\n });\n };\n }, [onDateSelect]);\n\n const handleDatesSet = useCallback((info: DatesSetArg) => {\n setCurrentTitle(info.view.title);\n }, []);\n\n /* ---- firstDay from locale -------------------------------------- */\n const firstDay = useMemo(() => resolveFirstDay(locale), [locale]);\n\n /* ---- plugins --------------------------------------------------- */\n const plugins = useMemo(\n () => [\n dayGridPlugin,\n timeGridPlugin,\n listPlugin,\n interactionPlugin,\n resourcePlugin,\n resourceTimeGridPlugin,\n resourceTimelinePlugin,\n timelinePlugin,\n ],\n [],\n );\n\n /* ---- resolved internal FC view name ---------------------------- */\n const resolvedView = useMemo(\n () => resolveFullCalendarView(view, resourceLayout),\n [view, resourceLayout],\n );\n\n /* ---- resource label render prop -------------------------------- */\n /* FC's `resourceLabelContent` supplies a `ResourceApi` whose\n `extendedProps` is typed as `{ [k: string]: any }`. We narrow to\n just the fields we pushed through `fcResources` via a local\n interface reached by an `unknown` pivot — keeps the DS body free\n of `any` while accepting FC's runtime shape. */\n interface ResourceExtendedProps {\n shortTitle?: string;\n color?: string;\n shortTitleTextColor?: string;\n }\n\n const renderResourceLabel = useCallback(\n (arg: ResourceLabelContentArg): ReactElement => {\n const ext = arg.resource\n .extendedProps as unknown as ResourceExtendedProps;\n const title = arg.resource.title;\n const shortTitle = ext.shortTitle;\n const color = ext.color;\n const textColor = ext.shortTitleTextColor;\n\n /* Runtime caller-supplied hex values flow through inline CSS\n custom properties only; the consuming `background-color` /\n `color` references live in the className as Tailwind arbitrary\n values, matching the event/mode-banner pattern (see\n 23-constraints §Runtime-computed dimensions).\n\n Inline style — permitted per 23-constraints §Runtime-computed\n dimensions (CSS custom property setters for --resource-color /\n --resource-initials-text-color). */\n const swatchStyle: CSSProperties | undefined =\n color || textColor\n ? {\n ...(color\n ? ({ '--resource-color': color } as CSSProperties)\n : {}),\n ...(textColor\n ? ({\n '--resource-initials-text-color': textColor,\n } as CSSProperties)\n : {}),\n }\n : undefined;\n\n if (showResourceInitials && shortTitle && color) {\n /* DEV-only guardrail: the initials circle is the one resource\n branch that actually paints text over the caller-supplied\n colour. Warn when the pair falls below WCAG AA. */\n warnLowContrast(color, textColor, `resource ${arg.resource.id}`);\n const initialsClass = [\n 'resource-initials',\n 'ds:[background-color:var(--resource-color)]',\n textColor ? 'ds:[color:var(--resource-initials-text-color)]' : null,\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span\n className={initialsClass}\n // eslint-disable-next-line react/forbid-dom-props -- caller-supplied resource colours injected via CSS variables\n style={swatchStyle}\n aria-hidden=\"true\"\n >\n {shortTitle}\n </span>\n <span className=\"ds:truncate ds:text-start\">{title}</span>\n </span>\n );\n }\n\n if (color) {\n /* Dot branch has no text, but callers may still pass both halves\n of the pair in anticipation of flipping `showResourceInitials`.\n Only warn when both are defined — otherwise we'd noisily\n suggest a textColor that the dot renderer ignores. */\n if (color && textColor) {\n warnLowContrast(color, textColor, `resource ${arg.resource.id}`);\n }\n return (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span\n className=\"resource-dot ds:[background-color:var(--resource-color)]\"\n // eslint-disable-next-line react/forbid-dom-props -- caller-supplied resource colour injected via CSS variable\n style={swatchStyle}\n aria-hidden=\"true\"\n />\n <span className=\"ds:truncate ds:text-start\">{title}</span>\n </span>\n );\n }\n\n return (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span className=\"ds:truncate ds:text-start\">{title}</span>\n </span>\n );\n },\n [showResourceInitials],\n );\n\n /* ---- resources adapted for FC with extendedProps --------------- */\n const fcResources = useMemo(\n () =>\n resources?.map((resource) => ({\n id: resource.id,\n title: resource.title,\n sequenceNumber: resource.sequenceNumber,\n extendedProps: {\n shortTitle: resource.shortTitle,\n color: resource.color,\n shortTitleTextColor: resource.shortTitleTextColor,\n sequenceNumber: resource.sequenceNumber,\n },\n })),\n [resources],\n );\n\n /* ---- default-toolbar button handlers --------------------------- */\n const handleToolbarToday = useCallback(() => {\n (fcRef.current?.getApi() as FcApi | undefined)?.today();\n }, []);\n const handleToolbarPrev = useCallback(() => {\n (fcRef.current?.getApi() as FcApi | undefined)?.prev();\n }, []);\n const handleToolbarNext = useCallback(() => {\n (fcRef.current?.getApi() as FcApi | undefined)?.next();\n }, []);\n\n const wrapperClassName = [\n 'fc-theme-alfadocs',\n 'ds:bg-background ds:text-foreground',\n 'ds:rounded-[var(--radius-md)]',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n /* Mode banner style — runtime caller-supplied hex values flow through\n inline CSS-variable assignments only. The consuming\n `background-color` / `color` references live in the className as\n Tailwind arbitrary values, same justification as the event\n colour overrides above. */\n const modeBannerStyle: CSSProperties | undefined =\n modeBannerColor || modeBannerTextColor\n ? {\n ...(modeBannerColor\n ? ({ '--calendar-mode-bg': modeBannerColor } as CSSProperties)\n : {}),\n ...(modeBannerTextColor\n ? ({ '--calendar-mode-fg': modeBannerTextColor } as CSSProperties)\n : {}),\n }\n : undefined;\n\n /* DEV-only guardrail: warn when the caller-supplied mode-banner\n bg/fg hex pair falls below WCAG AA. No-op when either half is\n missing — the component falls back to --muted / --muted-foreground\n which are already calibrated to AA. */\n if (mode !== 'default' && (modeBannerColor || modeBannerTextColor)) {\n warnLowContrast(modeBannerColor, modeBannerTextColor, 'mode banner');\n }\n\n /* Static key map — keeps i18n-extraction tools (i18next-parser, etc.)\n happy, since they can't resolve template-literal keys. */\n const resolvedModeLabel =\n mode !== 'default' ? (modeLabel ?? t(MODE_BANNER_KEYS[mode])) : '';\n\n const modeBannerClassName = [\n 'ds:sticky ds:top-0 ds:z-10',\n 'ds:flex ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:py-[var(--spacing-sm)]',\n /* Caller-supplied colours flow through CSS custom properties set\n in `modeBannerStyle`; fallback tokens apply when the caller\n doesn't supply a hex. */\n modeBannerColor\n ? 'ds:[background-color:var(--calendar-mode-bg)]'\n : 'ds:bg-[var(--muted)]',\n modeBannerTextColor\n ? 'ds:[color:var(--calendar-mode-fg)]'\n : 'ds:text-[var(--muted-foreground)]',\n ]\n .filter(Boolean)\n .join(' ');\n\n const modeCancelClassName = [\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:border ds:border-[var(--border)]',\n 'ds:font-[var(--font-weight-medium)] ds:text-[length:var(--font-size-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:hover:bg-[var(--muted)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-[var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:motion-reduce:transition-none',\n ].join(' ');\n\n return (\n <div\n ref={rootRef}\n className={wrapperClassName}\n role=\"region\"\n aria-label={t('calendar.ariaLabel')}\n data-component=\"calendar\"\n data-component-id={id}\n data-mode={mode}\n >\n <div\n ref={liveRegionRef}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n />\n {alertBanner}\n {/* role=\"status\" already implies aria-live=\"polite\" +\n aria-atomic=\"true\"; setting the live attributes explicitly\n causes double announcements in some AT combinations. */}\n {mode !== 'default' ? (\n <div\n className={modeBannerClassName}\n // eslint-disable-next-line react/forbid-dom-props -- caller-supplied mode banner colours injected via CSS variables\n style={modeBannerStyle}\n role=\"status\"\n >\n <span className=\"ds:flex-1 ds:text-start\">{resolvedModeLabel}</span>\n {onModeCancel ? (\n <button\n type=\"button\"\n onClick={onModeCancel}\n className={modeCancelClassName}\n >\n {t('calendar.modeBanner.cancel')}\n </button>\n ) : null}\n </div>\n ) : null}\n {toolbar !== false ? (\n <CalendarToolbar\n title={currentTitle}\n onToday={handleToolbarToday}\n onPrev={handleToolbarPrev}\n onNext={handleToolbarNext}\n end={toolbarEnd}\n />\n ) : null}\n <FullCalendar\n ref={fcRef}\n plugins={plugins}\n schedulerLicenseKey={schedulerLicenseKey}\n initialView={resolvedView}\n views={CALENDAR_CUSTOM_VIEWS}\n initialDate={initialDate}\n locale={locale}\n direction={direction}\n firstDay={firstDay}\n editable={editable}\n eventDurationEditable={eventDurationEditable ?? editable}\n selectable={selectable}\n droppable={editable}\n dayMaxEvents={dayMaxEvents}\n height={height}\n events={fcEvents}\n resources={fcResources}\n resourceOrder=\"sequenceNumber\"\n resourceLabelContent={renderResourceLabel}\n headerToolbar={false}\n allDayText={t('calendar.allDay')}\n noEventsText={t('calendar.noEvents')}\n titleFormat={titleFormat}\n dayHeaderFormat={dayHeaderFormat}\n eventTimeFormat={eventTimeFormat}\n slotLabelFormat={slotLabelFormat}\n slotMinTime={slotMinTime ?? '00:00:00'}\n slotMaxTime={slotMaxTime ?? '24:00:00'}\n slotDuration={slotDuration ?? '00:30:00'}\n // Explicit `slotLabelInterval` — FullCalendar 6.1.x crashes\n // inside `wholeDivideDurations` / `addDurations` when its\n // internal default computation produces an undefined Duration\n // (`Cannot read properties of undefined (reading 'years')`).\n // Passing all three slot props as explicit strings bypasses\n // the fragile default-resolution path. 1h matches FC's\n // documented default for day/week views.\n slotLabelInterval=\"01:00:00\"\n datesAboveResources={datesAboveResources}\n slotEventOverlap={slotEventOverlap}\n stickyHeaderDates={stickyHeaderDates}\n nowIndicator={nowIndicator}\n eventLongPressDelay={reducedMotion ? 0 : 1000}\n eventDragMinDistance={reducedMotion ? 0 : 5}\n eventContent={(arg) =>\n renderEventContent({\n arg,\n locale,\n resources: resources ?? [],\n statusLabels,\n privacyMode,\n showTime,\n })\n }\n eventClick={handleEventClick}\n eventDrop={handleEventDrop}\n eventResize={handleEventResize}\n eventResizeStart={onEventResizeStart}\n select={handleDateSelect}\n datesSet={handleDatesSet}\n />\n </div>\n );\n },\n);\nCalendarInner.displayName = 'Calendar';\n\n/* Compound attachment — exposes `<Calendar.Toolbar />` so consumers can\n render a standalone toolbar bound to their own handle-driven handlers\n when they hide the built-in toolbar via `toolbar={false}`. The\n `typeof CalendarInner & { Toolbar }` widening is the single acceptable\n cast called out in the implementation plan. */\ntype CalendarComponent = typeof CalendarInner & {\n Toolbar: typeof CalendarToolbar;\n};\nexport const Calendar = CalendarInner as CalendarComponent;\nCalendar.Toolbar = CalendarToolbar;\n"],"names":["__iconNode","Ban","createLucideIcon","Euro","ThumbsUp","Zap","calendarAgent","handle","_a","args","RESOURCE_VIEW_MAP","STANDARD_VIEWS","resolveFullCalendarView","view","resourceLayout","stem","CALENDAR_CUSTOM_VIEWS","eventCardVariants","cva","STATUS_ICON","Clock","Stethoscope","Check","MODE_BANNER_KEYS","resolveFirstDay","locale","intlLocale","info","useIsRtl","i18n","useTranslation","isRtl","setIsRtl","useState","docDir","i18nDir","useEffect","observer","renderEventContent","arg","resources","statusLabels","privacyMode","showTime","extended","status","backgroundColor","textColor","suffix","privacyModeTitle","isBookedOnline","hasUnassignedPatient","hasHighlightedAnamnesis","hasBillableAmount","isTelehealth","resourceId","StatusIcon","start","end","allDay","rangeText","fmt","resourceTitle","r","statusLabel","displayTitle","ariaLabel","colourOverrides","className","jsxs","Globe","AlertTriangle","HeartPulse","Video","toolbarButtonBaseClass","toolbarTextButtonClass","toolbarIconButtonClass","CalendarToolbar","forwardRef","title","onToday","onPrev","onNext","ref","t","PrevIcon","ChevronRight","ChevronLeft","NextIcon","rootClassName","jsx","CalendarInner","id","events","initialDate","localeProp","onEventDrop","onEventResize","onEventResizeStart","onEventClick","onDateSelect","editable","eventDurationEditable","selectable","height","mode","modeLabel","modeBannerColor","modeBannerTextColor","onModeCancel","alertBanner","slotMinTime","slotMaxTime","slotDuration","datesAboveResources","slotEventOverlap","stickyHeaderDates","nowIndicator","dayMaxEvents","schedulerLicenseKey","toolbar","toolbarEnd","showResourceInitials","fcRef","useRef","rootRef","liveRegionRef","focusTimerRef","focusedElRef","direction","setDirection","timer","api","root","patchMarkup","link","hidden","el","reducedMotion","usePrefersReducedMotion","currentTitle","setCurrentTitle","useMemo","getRawApi","date","nextView","eventId","selector","element","titleAttr","announcedTitle","useImperativeHandle","useAgentRegistration","privacyFirstRun","fcEvents","event","titleFormat","dayHeaderFormat","eventTimeFormat","slotLabelFormat","adaptEvent","fcEvent","ext","handleEventDrop","oldStart","handleEventResize","oldEnd","newEnd","newStart","duration","handleEventClick","handleDateSelect","handleDatesSet","useCallback","firstDay","plugins","dayGridPlugin","timeGridPlugin","listPlugin","interactionPlugin","resourcePlugin","resourceTimeGridPlugin","resourceTimelinePlugin","timelinePlugin","resolvedView","renderResourceLabel","shortTitle","color","swatchStyle","initialsClass","fcResources","resource","handleToolbarToday","_b","handleToolbarPrev","handleToolbarNext","wrapperClassName","modeBannerStyle","resolvedModeLabel","modeBannerClassName","modeCancelClassName","FullCalendar","Calendar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,6BAA6B,KAAK,SAAQ,CAAE;AAC5D,GACMC,KAAMC,EAAiB,OAAOF,EAAU;ACb9C;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC;AAAA,IACE;AAAA,IACA;AAAA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gB,IAAI;AAAA,cAC1C,cAAc,CAACnG,MACbD,GAAmB;AAAA,gBACjB,KAAAC;AAAA,gBACA,QAAAd;AAAA,gBACA,WAAWe,KAAa,CAAA;AAAA,gBACxB,cAAAC;AAAA,gBACA,aAAAC;AAAA,gBACA,UAAAC;AAAA,cAAA,CACD;AAAA,cAEH,YAAY+H;AAAA,cACZ,WAAWP;AAAA,cACX,aAAaE;AAAA,cACb,kBAAkBnE;AAAA,cAClB,QAAQyE;AAAA,cACR,UAAUC;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAjF,GAAc,cAAc;AAUrB,MAAM+G,KAAW/G;AACxB+G,GAAS,UAAU7H;","x_google_ignoreList":[0,1,2,3]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-input-BTCDqUDX.js","sources":["../../node_modules/lucide-react/dist/esm/icons/paperclip.mjs","../../src/components/chat-input/chat-input.agent.ts","../../src/components/chat-input/chat-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 [\n \"path\",\n {\n d: \"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\",\n key: \"1miecu\"\n }\n ]\n];\nconst Paperclip = createLucideIcon(\"paperclip\", __iconNode);\n\nexport { __iconNode, Paperclip as default };\n//# sourceMappingURL=paperclip.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — ChatInput. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ChatInputHandle } from './chat-input';\n\nexport const chatInputAgent: AgentAdapter<ChatInputHandle> = {\n id: 'chat-input',\n capabilities: ['edit_inline', 'submit'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.chatInput.state.value',\n description: 'Current text in the composer.',\n read: (handle) => handle.getValue(),\n },\n isEmpty: {\n type: 'boolean',\n descriptionKey: 'ui.agent.chatInput.state.isEmpty',\n description: 'True when the composer has no text.',\n read: (handle) => handle.isEmpty(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: 'string',\n description: 'New composer text, replacing the current value.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chatInput.actions.setValue',\n description: 'Replace the composer text.',\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n clear: {\n // Discards whatever the user has typed — irreversible from this UI.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.chatInput.actions.clear',\n description: 'Clear the composer. Irreversible from the same UI.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n submit: {\n safety: 'write',\n // Hands the composer text to the host `onSubmit` callback, which sends\n // the message to a backend / model — an external side effect.\n openWorld: true,\n descriptionKey: 'ui.agent.chatInput.actions.submit',\n description: 'Submit the current composer state via onSubmit.',\n invoke: (handle) => {\n handle.submit();\n },\n },\n focus: {\n safety: 'read',\n descriptionKey: 'ui.agent.chatInput.actions.focus',\n description: 'Move keyboard focus into the textarea.',\n invoke: (handle) => {\n handle.focus();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'chat-input',\n description: 'Marks the ChatInput wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n type ChangeEvent,\n type CompositionEvent,\n type KeyboardEvent,\n type ReactNode,\n type TextareaHTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { AlertCircle, Paperclip, Send } from 'lucide-react';\nimport { IconButton } from '../button';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { chatInputAgent } from './chat-input.agent';\n\nconst rootVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:w-full',\n // Uses the kit's shared input-chrome tokens — `--input` for fill,\n // `--shadow-input` for the halo. Border stays at 1px (`--border`,\n // softened to `grey-700` in light) so the focus-within override and\n // forced-colors fallback both still paint a visible edge.\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border',\n 'ds:bg-input ds:shadow-[var(--shadow-input)]',\n 'ds:focus-within:border-[color:var(--primary)]',\n 'ds:transition-[border-color,box-shadow] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n 'ds:forced-colors:border-[CanvasText]',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:text-[length:var(--font-size-sm)]',\n md: 'ds:text-[length:var(--font-size-base)]',\n lg: 'ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\ntype NativeTextareaProps = Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'size' | 'onSubmit' | 'children'\n>;\n\n/** Curated imperative handle for agent / external automation. */\nexport interface ChatInputHandle {\n getValue: () => string;\n isEmpty: () => boolean;\n setValue: (value: string) => void;\n clear: () => void;\n submit: () => void;\n focus: () => void;\n}\n\nexport interface ChatInputProps\n extends NativeTextareaProps, VariantProps<typeof rootVariants> {\n /** Invoked when the user submits (Cmd/Ctrl+Enter, or send button). */\n onSubmit?: (text: string) => void;\n /** Maximum allowed characters (grapheme clusters via Intl.Segmenter when available). */\n maxLength?: number;\n /** When true, plain Enter submits and Shift+Enter inserts a newline.\n * Default false (Enter inserts newline; Cmd/Ctrl+Enter submits). */\n submitOnEnter?: boolean;\n /** Minimum visible rows. Default 1. */\n minRows?: number;\n /** Maximum visible rows before the field scrolls. Default 8. */\n maxRows?: number;\n /** Optional attachment handler — when provided, renders the attachment button. */\n onAttach?: (files: FileList) => void;\n /** `accept` forwarded to the hidden file input. */\n accept?: string;\n /** Controls whether the textarea is disabled and submit is blocked. */\n disabled?: boolean;\n /** Optional slot placed between the textarea and the send button. */\n toolbar?: ReactNode;\n /** Visible label above the textarea. When omitted, a visually-hidden label is used. */\n label?: string;\n}\n\nfunction graphemeCount(value: string, locale: string): number {\n if (typeof Intl !== 'undefined' && typeof Intl.Segmenter === 'function') {\n try {\n const seg = new Intl.Segmenter(locale, { granularity: 'grapheme' });\n let n = 0;\n for (const _s of seg.segment(value)) n += 1;\n return n;\n } catch {\n /* fall through to Array.from */\n }\n }\n return Array.from(value).length;\n}\n\n/** Truncate `value` to at most `max` graphemes. Returns the original\n * string when it already fits so callers can compare references. */\nfunction truncateToGraphemes(\n value: string,\n max: number,\n locale: string,\n): string {\n if (typeof Intl !== 'undefined' && typeof Intl.Segmenter === 'function') {\n try {\n const seg = new Intl.Segmenter(locale, { granularity: 'grapheme' });\n const parts: string[] = [];\n for (const s of seg.segment(value)) {\n parts.push(s.segment);\n if (parts.length >= max) break;\n }\n const joined = parts.join('');\n return joined.length === value.length ? value : joined;\n } catch {\n /* fall through to code-point split */\n }\n }\n const cps = Array.from(value);\n return cps.length <= max ? value : cps.slice(0, max).join('');\n}\n\nexport const ChatInput = forwardRef<HTMLDivElement, ChatInputProps>(\n (\n {\n size = 'md',\n value,\n defaultValue,\n maxLength,\n submitOnEnter = false,\n minRows = 1,\n maxRows = 8,\n onSubmit,\n onAttach,\n accept,\n disabled,\n toolbar,\n label,\n placeholder,\n className,\n onChange,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n id,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const textareaId = useId();\n const composingRef = useRef(false);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n\n const setRefs = useCallback((node: HTMLTextAreaElement | null) => {\n innerRef.current = node;\n }, []);\n\n const [currentValueRaw, setChatValue] = useControllableState<string>({\n value: value === undefined ? undefined : String(value),\n defaultValue: String(defaultValue ?? ''),\n });\n const currentValue = currentValueRaw ?? '';\n\n const count = graphemeCount(currentValue, i18n.language);\n const hasMaxLength = typeof maxLength === 'number' && maxLength > 0;\n const remaining = hasMaxLength ? Math.max(0, maxLength - count) : 0;\n const showCounter = hasMaxLength && count > (maxLength as number) * 0.9;\n const atLimit = hasMaxLength && count >= maxLength;\n\n /* Auto-grow — compute height from scrollHeight, clamped to [minRows, maxRows].\n Imperative `.style` write is permitted per 23-constraints\n §Runtime-computed dimensions (textarea scrollHeight measurement). */\n const resize = useCallback(() => {\n const el = innerRef.current;\n if (!el) return;\n const styles = window.getComputedStyle(el);\n const lineHeight = parseFloat(styles.lineHeight) || 24;\n const padTop = parseFloat(styles.paddingTop) || 0;\n const padBot = parseFloat(styles.paddingBottom) || 0;\n const borderTop = parseFloat(styles.borderTopWidth) || 0;\n const borderBot = parseFloat(styles.borderBottomWidth) || 0;\n const chrome = padTop + padBot + borderTop + borderBot;\n const minH = lineHeight * minRows + chrome;\n const maxH = lineHeight * maxRows + chrome;\n el.style.height = 'auto';\n const next = Math.max(minH, Math.min(el.scrollHeight, maxH));\n el.style.height = `${next}px`;\n el.style.overflowY = el.scrollHeight > maxH ? 'auto' : 'hidden';\n }, [minRows, maxRows]);\n\n useIsomorphicLayoutEffect(() => {\n resize();\n }, [resize, currentValue]);\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n let next = e.target.value;\n // Enforce a grapheme cap so emoji like 👨‍👩‍👧 (1 grapheme, 11 UTF-16\n // units) stay aligned with the visible counter. Skip during IME\n // composition so the in-progress text is preserved verbatim.\n if (hasMaxLength && !composingRef.current) {\n next = truncateToGraphemes(next, maxLength as number, i18n.language);\n }\n setChatValue(next);\n if (composingRef.current) return;\n onChange?.(e);\n };\n\n const handleCompositionStart = (\n e: CompositionEvent<HTMLTextAreaElement>,\n ) => {\n composingRef.current = true;\n onCompositionStart?.(e);\n };\n const handleCompositionEnd = (e: CompositionEvent<HTMLTextAreaElement>) => {\n composingRef.current = false;\n onCompositionEnd?.(e);\n };\n\n const isIMEKey = (e: KeyboardEvent<HTMLTextAreaElement>) =>\n e.nativeEvent.isComposing || e.keyCode === 229 || composingRef.current;\n\n const submit = () => {\n const text = currentValue.trim();\n if (!text || disabled || atLimit) return;\n onSubmit?.(currentValue);\n setChatValue('');\n };\n\n const rootRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, []);\n\n const agentHandle = useMemo<ChatInputHandle>(\n () => ({\n getValue: () => currentValue,\n isEmpty: () => !currentValue.trim(),\n setValue: (next: string) => {\n setChatValue(next);\n },\n clear: () => {\n setChatValue('');\n },\n submit: () => {\n submit();\n },\n focus: () => {\n innerRef.current?.focus();\n },\n }),\n // `submit` is a local closure that always sees the latest currentValue\n // via React's render cycle — depend on currentValue so the handle\n // picks up new values across renders.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [currentValue, setChatValue],\n );\n useAgentRegistration(chatInputAgent, agentHandle, id);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n if (isIMEKey(e)) return;\n\n if (e.key === 'Enter') {\n const explicitSubmit = e.metaKey || e.ctrlKey;\n const plainEnterSubmits = submitOnEnter && !e.shiftKey;\n if (explicitSubmit || plainEnterSubmits) {\n e.preventDefault();\n submit();\n }\n }\n };\n\n const handleAttach = () => {\n fileInputRef.current?.click();\n };\n\n const handleFilePick = (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n onAttach?.(e.target.files);\n }\n // Reset so picking the same file twice still fires change.\n e.target.value = '';\n };\n\n const effectiveId = id ?? textareaId;\n const labelId = `${effectiveId}-label`;\n const counterId = hasMaxLength ? `${effectiveId}-counter` : undefined;\n const hintId = `${effectiveId}-hint`;\n\n const resolvedPlaceholder = placeholder ?? t('chat.input.placeholder');\n const resolvedLabel = label ?? t('chat.prompt');\n\n return (\n <div\n ref={rootRef}\n data-component=\"chat-input\"\n data-component-id={id}\n className={rootVariants({ size, className })}\n >\n <label\n id={labelId}\n htmlFor={effectiveId}\n className={\n label\n ? 'type-label ds:ps-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)]'\n : 'ds:sr-only'\n }\n >\n {resolvedLabel}\n </label>\n <textarea\n ref={setRefs}\n id={effectiveId}\n value={currentValue}\n disabled={disabled}\n rows={minRows}\n placeholder={resolvedPlaceholder}\n aria-labelledby={labelId}\n aria-describedby={\n [counterId, hintId].filter(Boolean).join(' ') || undefined\n }\n aria-invalid={atLimit || undefined}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n className={[\n 'ds:w-full ds:resize-none ds:bg-transparent',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-xs)]',\n 'ds:placeholder:text-[color:var(--muted-foreground)]',\n 'ds:leading-[var(--line-height-base)]',\n 'ds:disabled:opacity-50 ds:disabled:cursor-not-allowed',\n // Tokenised focus ring on the textarea itself — the 1px border\n // shift on the wrapper alone fails the 3px accessible-theme\n // requirement. See a11y-critical-fixes.mdx.\n 'ds:outline-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' ')}\n {...rest}\n />\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]\">\n {onAttach ? (\n <>\n <input\n ref={fileInputRef}\n type=\"file\"\n className=\"ds:sr-only\"\n multiple\n accept={accept}\n onChange={handleFilePick}\n aria-label={t('chat.input.attach')}\n tabIndex={-1}\n />\n <IconButton\n icon={<Paperclip />}\n aria-label={t('chat.input.attach')}\n intent=\"ghost\"\n size=\"sm\"\n onClick={handleAttach}\n disabled={disabled}\n />\n </>\n ) : null}\n {toolbar}\n <div className=\"ds:ms-auto ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n {showCounter ? (\n <span\n id={counterId}\n aria-live=\"polite\"\n className={[\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'type-meta ds:tabular-nums',\n atLimit\n ? 'ds:text-[color:var(--destructive)]'\n : 'ds:text-[color:var(--muted-foreground)]',\n ].join(' ')}\n >\n {atLimit ? (\n // Icon pairs with --destructive colour so the at-limit\n // state is not conveyed by hue alone (WCAG 1.4.1).\n <AlertCircle aria-hidden=\"true\" className=\"ds:size-3.5\" />\n ) : null}\n {t('chat.input.remaining', { count: remaining })}\n </span>\n ) : null}\n <span id={hintId} className=\"ds:sr-only\">\n {t('chat.input.sendHint')}\n </span>\n <IconButton\n icon={<Send />}\n aria-label={t('chat.send')}\n intent=\"primary\"\n size=\"sm\"\n disabled={disabled || !currentValue.trim() || atLimit}\n onClick={submit}\n aria-keyshortcuts=\"Meta+Enter Control+Enter\"\n />\n </div>\n </div>\n </div>\n );\n },\n);\n\nChatInput.displayName = 'ChatInput';\n"],"names":["__iconNode","Paperclip","createLucideIcon","chatInputAgent","handle","args","rootVariants","cva","graphemeCount","value","locale","seg","n","_s","truncateToGraphemes","max","parts","s","joined","cps","ChatInput","forwardRef","size","defaultValue","maxLength","submitOnEnter","minRows","maxRows","onSubmit","onAttach","accept","disabled","toolbar","label","placeholder","className","onChange","onKeyDown","onCompositionStart","onCompositionEnd","id","rest","ref","t","i18n","useTranslation","textareaId","useId","composingRef","useRef","fileInputRef","innerRef","setRefs","useCallback","node","currentValueRaw","setChatValue","useControllableState","currentValue","count","hasMaxLength","remaining","showCounter","atLimit","resize","el","styles","lineHeight","padTop","padBot","borderTop","borderBot","chrome","minH","maxH","next","useIsomorphicLayoutEffect","handleChange","handleCompositionStart","handleCompositionEnd","isIMEKey","submit","rootRef","useImperativeHandle","agentHandle","useMemo","_a","useAgentRegistration","handleKeyDown","explicitSubmit","plainEnterSubmits","handleAttach","handleFilePick","effectiveId","labelId","counterId","hintId","resolvedPlaceholder","resolvedLabel","jsxs","jsx","Fragment","IconButton","AlertCircle","Send"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAYC,GAAiB,aAAaF,EAAU,GCX7CG,KAAgD;AAAA,EAC3D,IAAI;AAAA,EACJ,cAAc,CAAC,eAAe,QAAQ;AAAA,EACtC,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM;AAAA,YACN,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CA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,OAAA,EAAI,WAAU,wEACZ,UAAA;AAAA,cAAArC,IACC,gBAAAqC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,IAAIJ;AAAA,kBACJ,aAAU;AAAA,kBACV,WAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACAhC,IACI,uCACA;AAAA,kBAAA,EACJ,KAAK,GAAG;AAAA,kBAET,UAAA;AAAA,oBAAAA;AAAA;AAAA;AAAA,sBAGC,gBAAAqC,EAACG,IAAA,EAAY,eAAY,QAAO,WAAU,cAAA,CAAc;AAAA,wBACtD;AAAA,oBACH5D,EAAE,wBAAwB,EAAE,OAAOkB,GAAW;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA,IAE/C;AAAA,cACJ,gBAAAuC,EAAC,UAAK,IAAIJ,GAAQ,WAAU,cACzB,UAAArD,EAAE,qBAAqB,GAC1B;AAAA,cACA,gBAAAyD;AAAA,gBAACE;AAAA,gBAAA;AAAA,kBACC,wBAAOE,IAAA,EAAK;AAAA,kBACZ,cAAY7D,EAAE,WAAW;AAAA,kBACzB,QAAO;AAAA,kBACP,MAAK;AAAA,kBACL,UAAUZ,KAAY,CAAC2B,EAAa,UAAUK;AAAA,kBAC9C,SAASkB;AAAA,kBACT,qBAAkB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACpB,EAAA,CACF;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA7D,GAAU,cAAc;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fiscal-code-input-DWA6C8x8.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(/[̀-ͯ]/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,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAAQ,CAAE;AAAA,EAC3C,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAAQ,CAAE;AAAA,EAC3C,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAAA,EAC1C,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAAQ,CAAE;AAAA,EAC3C,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAAA,EAC1C,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAAQ,CAAE;AAAA,EAC3C,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAC5C,GACMC,KAAaC,GAAiB,cAAcF,EAAU,GCZ/CG,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,WAA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