@platned/ui 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +30 -7
  2. package/dist/blocks-charts.cjs +1 -0
  3. package/dist/blocks-charts.cjs.map +1 -1
  4. package/dist/blocks-charts.js +2 -0
  5. package/dist/blocks-charts.js.map +1 -1
  6. package/dist/blocks.cjs +282 -186
  7. package/dist/blocks.cjs.map +1 -1
  8. package/dist/blocks.d.cts +85 -5
  9. package/dist/blocks.d.ts +85 -5
  10. package/dist/blocks.js +280 -169
  11. package/dist/blocks.js.map +1 -1
  12. package/dist/chart.cjs +1 -0
  13. package/dist/chart.cjs.map +1 -1
  14. package/dist/chart.d.ts +1 -1
  15. package/dist/chart.js +2 -1
  16. package/dist/chart.js.map +1 -1
  17. package/dist/{chunk-327NSKZW.js → chunk-6BJ3OMUZ.js} +4 -3
  18. package/dist/{chunk-327NSKZW.js.map → chunk-6BJ3OMUZ.js.map} +1 -1
  19. package/dist/{chunk-GJJWRZ4B.js → chunk-7RXFHQL5.js} +4 -3
  20. package/dist/{chunk-GJJWRZ4B.js.map → chunk-7RXFHQL5.js.map} +1 -1
  21. package/dist/{chunk-2L5XAYNK.js → chunk-MJC4A7I4.js} +3 -1
  22. package/dist/{chunk-2L5XAYNK.js.map → chunk-MJC4A7I4.js.map} +1 -1
  23. package/dist/{chunk-WGCAQEZ4.js → chunk-QYFD7KIK.js} +3 -2
  24. package/dist/{chunk-WGCAQEZ4.js.map → chunk-QYFD7KIK.js.map} +1 -1
  25. package/dist/code-block-highlight.cjs +1 -0
  26. package/dist/code-block-highlight.cjs.map +1 -1
  27. package/dist/code-block-highlight.js +4 -3
  28. package/dist/code-block-highlight.js.map +1 -1
  29. package/dist/{data-table-Dec6t8NO.d.ts → data-table-CcIINjPg.d.ts} +30 -3
  30. package/dist/data-table.cjs +200 -124
  31. package/dist/data-table.cjs.map +1 -1
  32. package/dist/data-table.d.ts +1 -1
  33. package/dist/data-table.js +156 -79
  34. package/dist/data-table.js.map +1 -1
  35. package/dist/index.cjs +10632 -7124
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.ts +204 -8
  38. package/dist/index.js +5933 -2507
  39. package/dist/index.js.map +1 -1
  40. package/dist/map.cjs +1 -0
  41. package/dist/map.cjs.map +1 -1
  42. package/dist/map.d.cts +2 -0
  43. package/dist/map.d.ts +2 -0
  44. package/dist/map.js +6 -0
  45. package/dist/map.js.map +1 -1
  46. package/package.json +2 -7
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/forms/button-group.tsx","../src/components/forms/native-select.tsx","../src/components/forms/date-picker.tsx","../src/components/forms/calendar.tsx","../src/components/forms/questionnaire.tsx","../src/components/forms/switch.tsx","../src/components/forms/input-otp.tsx","../src/components/forms/combobox.tsx","../src/components/forms/radio-group.tsx","../src/components/forms/slider.tsx","../src/components/overlays/tooltip.tsx","../src/components/overlays/hover-card.tsx","../src/components/overlays/context-menu.tsx","../src/components/overlays/menubar.tsx","../src/components/overlays/drawer.tsx","../src/components/cards/scroll-area.tsx","../src/components/overlays/sheet.tsx","../src/components/overlays/alert-dialog.tsx","../src/lib/direction.tsx","../src/components/cards/card.tsx","../src/components/cards/dashboard-edit-context.ts","../src/components/cards/accordion.tsx","../src/components/cards/collapsible.tsx","../src/components/cards/aspect-ratio.tsx","../src/components/cards/carousel.tsx","../src/components/cards/resizable.tsx","../src/components/chrome/sidebar.tsx","../src/lib/use-media-query.ts","../src/components/chrome/kbd.tsx","../src/components/chrome/breadcrumb.tsx","../src/components/chrome/pagination.tsx","../src/components/chrome/navigation-menu.tsx","../src/components/chrome/typography.tsx","../src/components/lists/item.tsx","../src/components/lists/attachment.tsx","../src/index.tsx","../src/components/feedback/alert.tsx","../src/components/feedback/sonner.tsx","../src/components/ai/message.tsx","../src/components/ai/message-scroller.tsx","../src/components/ai/marker.tsx","../src/components/ai/trace.tsx","../src/components/ai/bubble.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './button';\n\n/**\n * ButtonGroup: a container that groups related buttons together with consistent styling.\n *\n * It joins its children (`Button`, `Input`, `Select`, `InputGroup`, `ButtonGroupText`) into\n * one control: inner corners square off and shared borders collapse. Nest groups to put\n * spacing between clusters. It is for actions; for a set of buttons that toggle a state,\n * use `ToggleGroup`.\n *\n * Corners and borders use logical sides (`rounded-s`, `border-s`), so the joins follow\n * `dir=\"rtl\"`; in LTR they are the same as left/right.\n *\n * Shorthand: `items` renders one `Button` per entry, with the group's `variant` and `size`\n * unless an item sets its own. Composition: any children, plus `ButtonGroupSeparator` and\n * `ButtonGroupText`.\n */\n\nexport type ButtonGroupOrientation = 'horizontal' | 'vertical';\n\n/** One button in the `items` shorthand: any `Button` props. */\nexport type ButtonGroupItem = ButtonProps;\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `horizontal`. */\n orientation?: ButtonGroupOrientation;\n /** Shorthand: one `Button` per entry. Children render after them. */\n items?: readonly ButtonGroupItem[];\n /** The `variant` of each `items` button that doesn't set one. */\n variant?: ButtonVariant;\n /** The `size` of each `items` button that doesn't set one. */\n size?: ButtonSize;\n}\n\nconst BASE =\n \"group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-e-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\";\n\nconst ORIENTATION: Record<ButtonGroupOrientation, string> = {\n horizontal:\n '[&>*:not(:first-child)]:rounded-s-none [&>*:not(:first-child)]:border-s-0 [&>*:not(:last-child)]:rounded-e-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-e-lg!',\n vertical:\n 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!',\n};\n\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(function ButtonGroup(\n { orientation = 'horizontal', items, variant, size, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(BASE, ORIENTATION[orientation], className)}\n {...props}\n >\n {items?.map((item, index) => (\n <Button key={index} variant={variant} size={size} {...item} />\n ))}\n {children}\n </div>\n );\n});\n\nexport interface ButtonGroupTextProps extends HTMLAttributes<HTMLDivElement> {\n /** Render the child element instead, e.g. a `Label`. */\n asChild?: boolean;\n}\n\n/** Text inside a group, such as a label or a unit. */\nexport const ButtonGroupText = forwardRef<HTMLDivElement, ButtonGroupTextProps>(function ButtonGroupText(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n className={cn(\n \"flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface ButtonGroupSeparatorProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `vertical`. */\n orientation?: ButtonGroupOrientation;\n}\n\n/** Divides buttons within a group. Outline buttons don't need one; their borders already do. */\nexport const ButtonGroupSeparator = forwardRef<HTMLDivElement, ButtonGroupSeparatorProps>(\n function ButtonGroupSeparator({ orientation = 'vertical', className, ...props }, ref) {\n return (\n <div\n ref={ref}\n role=\"none\"\n data-slot=\"button-group-separator\"\n data-orientation={orientation}\n className={cn(\n 'relative shrink-0 self-stretch bg-input data-horizontal:mx-px data-horizontal:h-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto data-vertical:w-px',\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type SelectHTMLAttributes } from 'react';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useFieldContext, useFieldControl } from './field';\nimport type { SelectOption, SelectOptionGroup } from './select';\n\n/**\n * NativeSelect: a styled native `<select>`. Use it for form fields and anywhere on a phone: the\n * OS draws the picker, it is fast with long lists, and it submits and validates as any form\n * control does. Use `Select` where the open list must look like the other popup panels.\n *\n * Two ways to write one:\n * - Shorthand: `<NativeSelect options={[{ value, label }]} />` (groups become `<optgroup>`s);\n * the same option types as `Select`.\n * - Composition: `NativeSelect` > `NativeSelectOption`s, optionally in `NativeSelectOptGroup`s.\n *\n * `className` goes on the wrapper that holds the select and its chevron, so width and margin\n * apply to both. `onChange` is the native event. Inside a `Field` it takes the control id,\n * description, invalid, required and disabled state; otherwise name it with `aria-label`.\n */\n\nexport type NativeSelectSize = 'default' | 'sm';\n\nexport interface NativeSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {\n /** Default `default` (32px); `sm` is 28px. */\n size?: NativeSelectSize;\n /** Shorthand: flat options, or groups which render as `<optgroup>`. Use it or `children`. */\n options?: (SelectOption | SelectOptionGroup)[];\n}\n\nfunction isGroup(entry: SelectOption | SelectOptionGroup): entry is SelectOptionGroup {\n return 'options' in entry;\n}\n\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(function NativeSelect(\n { className, size = 'default', options, children, ...props },\n ref,\n) {\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n\n if (!fieldContext && !props['aria-label'] && !props['aria-labelledby'] && !props.id) {\n devWarn('NativeSelect outside a Field needs aria-label, aria-labelledby, or an id a <label> points at.');\n }\n\n return (\n <div\n data-slot=\"native-select-wrapper\"\n data-size={size}\n className={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}\n >\n <select\n ref={ref}\n data-slot=\"native-select\"\n data-size={size}\n {...field}\n required={field['aria-required']}\n className=\"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 ps-2.5 pe-8 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\"\n {...props}\n >\n {options\n ? options.map((entry, index) =>\n isGroup(entry) ? (\n <NativeSelectOptGroup key={`group-${index}`} label={entry.label}>\n {entry.options.map((option) => (\n <NativeSelectOption key={option.value} value={option.value} disabled={option.disabled}>\n {option.label}\n </NativeSelectOption>\n ))}\n </NativeSelectOptGroup>\n ) : (\n <NativeSelectOption key={entry.value} value={entry.value} disabled={entry.disabled}>\n {entry.label}\n </NativeSelectOption>\n ),\n )\n : children}\n </select>\n <ChevronDownIcon\n aria-hidden=\"true\"\n data-slot=\"native-select-icon\"\n className=\"pointer-events-none absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground select-none\"\n />\n </div>\n );\n});\n\n/** One option. Uses the system colours, so the native list reads in dark mode too. */\nexport const NativeSelectOption = forwardRef<HTMLOptionElement, ComponentPropsWithoutRef<'option'>>(\n function NativeSelectOption({ className, ...props }, ref) {\n return (\n <option\n ref={ref}\n data-slot=\"native-select-option\"\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n );\n },\n);\n\n/** A labelled group of options. */\nexport const NativeSelectOptGroup = forwardRef<HTMLOptGroupElement, ComponentPropsWithoutRef<'optgroup'>>(\n function NativeSelectOptGroup({ className, ...props }, ref) {\n return (\n <optgroup\n ref={ref}\n data-slot=\"native-select-optgroup\"\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n );\n },\n);\n","import {\n forwardRef,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type FocusEventHandler,\n type InputHTMLAttributes,\n} from 'react';\nimport { CalendarIcon, ChevronDownIcon } from 'lucide-react';\nimport type { DateRange } from 'react-day-picker';\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlays/popover';\nimport { Button } from './button';\nimport { Calendar } from './calendar';\nimport { useFieldContext, useFieldControl } from './field';\n\n/** A range as ISO `YYYY-MM-DD` strings; `''` for an end that is not picked yet. */\nexport interface DatePickerRange {\n from: string;\n to: string;\n}\n\ninterface DatePickerCommonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange'> {\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /** Shown when there is no date. Default \"Pick a date\". */\n placeholder?: string;\n /** BCP 47 tag for the shown date and the calendar. Default: the browser's. */\n locale?: string;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** `dropdown` puts month and year selects in the calendar header. Default `label`. */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n /** Months shown side by side. Default 1, or 2 with `mode=\"range\"`. */\n numberOfMonths?: number;\n}\n\nexport interface DatePickerSingleProps extends DatePickerCommonProps {\n /** `single` (default) picks one date. */\n mode?: 'single';\n /** The selected date as an ISO `YYYY-MM-DD` string, `''` for none. Controlled. */\n value?: string;\n /** Initial ISO date when uncontrolled. */\n defaultValue?: string;\n /**\n * Called with a real change event from the underlying date input, so\n * `onChange={(e) => set(e.target.value)}` keeps working; `e.target.value` is the ISO date.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** The new ISO date. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface DatePickerRangeProps extends DatePickerCommonProps {\n /** `range` picks a start and an end date. */\n mode: 'range';\n /** The selected range. Controlled. */\n value?: DatePickerRange;\n /** Initial range when uncontrolled. */\n defaultValue?: DatePickerRange;\n /** The new range, on every pick (`to` is `''` until the second pick). */\n onValueChange?: (value: DatePickerRange) => void;\n onChange?: never;\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst EMPTY_RANGE: DatePickerRange = { from: '', to: '' };\n\nfunction parseIso(value: string | undefined): Date | undefined {\n const match = value ? ISO.exec(value) : null;\n if (!match) return undefined;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\nfunction toIso(date: Date | undefined): string {\n if (!date) return '';\n const pad = (n: number) => String(n).padStart(2, '0');\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/** Sets an input's value the way the browser would, so React reports a real change event. */\nfunction setNativeValue(input: HTMLInputElement | null, value: string) {\n if (!input) return;\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, value);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n}\n\n/**\n * A date picker: an outline Button that opens the `Calendar` in a `Popover`. The same parts\n * compose by hand (`Popover` > `PopoverTrigger` > `Button`, `PopoverContent` > `Calendar`); this\n * is the shorthand for the common case.\n *\n * - The trigger is a `role=\"combobox\"` button with `aria-haspopup=\"dialog\"`, named by the label\n * and then the date (\"Start date June 1, 2026\"); that role carries the `aria-required` and\n * `aria-invalid` that `Field` supplies.\n * - Opening moves focus into the calendar grid, on the selected date or today. In `single` mode\n * picking a date closes the popover and returns focus to the trigger; Escape closes it without\n * a change. In `range` mode it stays open until dismissed.\n * - Bare: no label, hint or error of its own. Put it in a `Field` with a `FieldLabel`, or give it\n * an `aria-label`. The calendar dialog takes its name from either.\n * - A real, invisible input keeps the form contract: `name`, `value`, `required` (and `min` /\n * `max` in `single` mode) for forms and native validation; the forwarded ref points at it.\n * `single` mode uses a date input whose genuine change event reaches `onChange`. `range` mode\n * posts an ISO 8601 interval (`2026-01-20/2026-02-09`). When validation focuses it, focus is\n * handed to the trigger.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(props, ref) {\n const {\n mode = 'single',\n invalid = false,\n className,\n disabled,\n required,\n value: valueProp,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder = 'Pick a date',\n locale,\n weekStartsOn,\n captionLayout = 'label',\n startYear,\n endYear,\n numberOfMonths,\n min: minProp,\n max: maxProp,\n 'aria-label': ariaLabel,\n name,\n ...inputProps\n } = props;\n const range = mode === 'range';\n\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n const valueId = useId();\n const dialogId = useId();\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState<string | DatePickerRange>(\n (defaultValue as string | DatePickerRange | undefined) ?? (range ? EMPTY_RANGE : ''),\n );\n const current = (valueProp as string | DatePickerRange | undefined) ?? internal;\n const iso = range ? '' : (current as string);\n const isoRange = range ? ((current as DatePickerRange) ?? EMPTY_RANGE) : EMPTY_RANGE;\n const date = parseIso(iso);\n const from = parseIso(isoRange.from);\n const to = parseIso(isoRange.to);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = disabled ?? field.disabled;\n const isRequired = required || !!field['aria-required'];\n // The calendar dialog is named after the field: the FieldLabel's text, else the aria-label.\n // Read when it opens, since the label is a sibling this control can't see as a prop.\n const [label, setLabel] = useState<string | undefined>(ariaLabel);\n const handleOpenChange = (next: boolean) => {\n if (next) {\n const labelText = fieldContext && typeof document !== 'undefined' ? document.getElementById(fieldContext.labelId)?.textContent : null;\n setLabel(labelText?.trim() || ariaLabel);\n }\n setOpen(next);\n };\n\n const longFormat = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'long' }), [locale]);\n const shortFormat = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'short', day: '2-digit', year: 'numeric' }),\n [locale],\n );\n const min = typeof minProp === 'number' ? String(minProp) : minProp;\n const max = typeof maxProp === 'number' ? String(maxProp) : maxProp;\n const minDate = parseIso(min);\n const maxDate = parseIso(max);\n const disabledDays = [...(minDate ? [{ before: minDate }] : []), ...(maxDate ? [{ after: maxDate }] : [])];\n\n const shown = range\n ? from\n ? to\n ? `${shortFormat.format(from)} - ${shortFormat.format(to)}`\n : shortFormat.format(from)\n : undefined\n : date\n ? longFormat.format(date)\n : undefined;\n const interval = isoRange.from && isoRange.to ? `${isoRange.from}/${isoRange.to}` : '';\n\n const commitSingle = (next: Date) => {\n const nextIso = toIso(next);\n if (valueProp === undefined) setInternal(nextIso);\n (onValueChange as ((value: string) => void) | undefined)?.(nextIso);\n // Let the real input report the change, so `onChange` gets a genuine ChangeEvent.\n setNativeValue(inputRef.current, nextIso);\n setOpen(false);\n };\n\n const commitRange = (next: DateRange | undefined) => {\n const nextRange = { from: toIso(next?.from), to: toIso(next?.to) };\n if (valueProp === undefined) setInternal(nextRange);\n (onValueChange as ((value: DatePickerRange) => void) | undefined)?.(nextRange);\n };\n\n const calendarCommon = {\n disabled: disabledDays,\n weekStartsOn: weekStartsOn ?? 1,\n captionLayout,\n startMonth: new Date(startYear ?? minDate?.getFullYear() ?? new Date().getFullYear() - 100, 0),\n endMonth: new Date(endYear ?? maxDate?.getFullYear() ?? new Date().getFullYear() + 10, 11),\n 'aria-label': label ?? 'Calendar',\n } as const;\n\n return (\n <div className={cn('relative flex items-center', className)}>\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={triggerRef}\n variant=\"outline\"\n // `role=\"combobox\"` with a dialog popup (APG date-picker combobox). A plain button\n // may not carry aria-required / aria-invalid, which Field supplies.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n // Only while open, so it never points at an element that does not exist.\n aria-controls={open ? dialogId : undefined}\n // Named by the label, then the value: \"Start date June 1, 2026\".\n aria-labelledby={fieldContext ? `${fieldContext.labelId} ${valueId}` : undefined}\n aria-label={fieldContext ? undefined : ariaLabel}\n data-empty={!shown}\n {...field}\n aria-invalid={isInvalid || undefined}\n aria-required={isRequired || undefined}\n disabled={isDisabled}\n onBlur={onBlur as unknown as FocusEventHandler<HTMLButtonElement>}\n className={cn(\n 'w-full font-normal data-[empty=true]:text-muted-foreground',\n range ? 'justify-start px-2.5' : 'justify-between text-start',\n )}\n >\n {range ? <CalendarIcon aria-hidden /> : null}\n <span id={valueId} className=\"truncate\">\n {shown ?? placeholder}\n </span>\n {range ? null : <ChevronDownIcon aria-hidden />}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n ref={contentRef}\n id={dialogId}\n aria-label={label ? `Choose ${label.toLowerCase()}` : range ? 'Choose dates' : 'Choose date'}\n align=\"start\"\n className=\"w-auto max-w-none overflow-hidden p-0\"\n onOpenAutoFocus={(event) => {\n // Land on the grid's roving cell (the selected date, else today), not on the first\n // focusable element, which would be the previous-month button or the month select.\n event.preventDefault();\n contentRef.current?.querySelector<HTMLElement>('[role=\"grid\"] [tabindex=\"0\"]')?.focus();\n }}\n >\n {range ? (\n <Calendar\n mode=\"range\"\n selected={from ? { from, to } : undefined}\n onSelect={commitRange}\n defaultMonth={from}\n numberOfMonths={numberOfMonths ?? 2}\n {...calendarCommon}\n />\n ) : (\n <Calendar\n mode=\"single\"\n required\n selected={date}\n onSelect={commitSingle}\n defaultMonth={date}\n numberOfMonths={numberOfMonths}\n {...calendarCommon}\n />\n )}\n </PopoverContent>\n </Popover>\n\n {/* The form contract: a real input for `name`, native `required` (and `min` / `max`)\n validation and the forwarded ref. Invisible, out of the tab order and hidden from\n assistive tech, which hears the trigger instead. */}\n <input\n ref={composeRefs(ref, inputRef)}\n type={range ? 'text' : 'date'}\n aria-hidden\n tabIndex={-1}\n {...inputProps}\n name={name}\n value={range ? interval : iso}\n min={range ? undefined : min}\n max={range ? undefined : max}\n required={isRequired}\n disabled={isDisabled}\n onChange={(event) => {\n if (range) return;\n if (valueProp === undefined) setInternal(event.target.value);\n (onChange as ChangeEventHandler<HTMLInputElement> | undefined)?.(event);\n }}\n onFocus={() => triggerRef.current?.focus()}\n className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0\"\n />\n </div>\n );\n});\n","import { useEffect, useRef, type ComponentProps } from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\nimport { DayPicker as PersianDayPicker } from 'react-day-picker/persian';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button, buttonVariants, type ButtonVariant } from './button';\n\n/**\n * Calendar: a date field component that allows users to enter and edit a date.\n *\n * Built on React DayPicker: every DayPicker prop works (`mode` `single` / `multiple` / `range`,\n * `selected`, `onSelect`, `disabled` matchers, `numberOfMonths`, `captionLayout=\"dropdown\"`,\n * `showWeekNumber`, `locale` from `react-day-picker/locale`, `timeZone`, `modifiers`,\n * `components`, `formatters`). The cell size is the `--cell-size` CSS variable\n * (`className=\"[--cell-size:--spacing(10)]\"`).\n *\n * Range corners and the nav chevrons use logical sides, so `dir=\"rtl\"` works without changes.\n */\n\nexport type CalendarProps = ComponentProps<typeof DayPicker> & {\n /** The variant of the previous / next month buttons. Default `ghost`. */\n buttonVariant?: ButtonVariant;\n};\n\nexport function Calendar(props: CalendarProps) {\n return <CalendarRoot picker={DayPicker} {...props} />;\n}\n\n/**\n * PersianCalendar: the same Calendar on the Persian (Solar Hijri / Jalali) calendar. Defaults to\n * the `faIR` locale, `dir=\"rtl\"` and Eastern Arabic numerals; pass `locale={enUS}` from\n * `react-day-picker/persian` for English labels.\n */\nexport function PersianCalendar(props: PersianCalendarProps) {\n // Same props apart from the narrower Jalali `locale` type, which PersianCalendarProps keeps.\n return <CalendarRoot picker={PersianDayPicker as unknown as typeof DayPicker} {...(props as CalendarProps)} />;\n}\n\nexport type PersianCalendarProps = ComponentProps<typeof PersianDayPicker> & {\n /** The variant of the previous / next month buttons. Default `ghost`. */\n buttonVariant?: ButtonVariant;\n};\n\nfunction CalendarRoot({\n picker: Picker,\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: CalendarProps & { picker: typeof DayPicker }) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <Picker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn(\n 'relative rounded-(--cell-radius) border border-input has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50',\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : 'flex h-6 items-center gap-1 rounded-(--cell-radius) ps-1.5 pe-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-[0.8rem] text-muted-foreground select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'relative isolate z-0 rounded-s-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:end-0 after:w-4 after:bg-muted',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'relative isolate z-0 rounded-e-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:start-0 after:w-4 after:bg-muted',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className: rootClassName, rootRef, ...rootProps }) => (\n <div data-slot=\"calendar\" ref={rootRef} className={cn(rootClassName)} {...rootProps} />\n ),\n Chevron: ({ className: iconClassName, orientation, ...iconProps }) => {\n if (orientation === 'left') return <ChevronLeftIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n if (orientation === 'right') return <ChevronRightIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n return <ChevronDownIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n },\n DayButton: (dayProps) => <CalendarDayButton locale={locale} {...dayProps} />,\n WeekNumber: ({ children, ...weekProps }) => (\n <td {...weekProps}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n ),\n ...components,\n }}\n {...props}\n />\n );\n}\n\nexport type CalendarDayButtonProps = ComponentProps<typeof DayButton> & { locale?: Partial<Locale> };\n\n/** The day cell's button. Use it in `components.DayButton` to add content under the date. */\nexport function CalendarDayButton({ className, day, modifiers, locale, ...props }: CalendarDayButtonProps) {\n const defaultClassNames = getDefaultClassNames();\n const ref = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle}\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n","import { Children, type ComponentProps, type ReactNode } from 'react';\nimport {\n Questionnaire as QuestionnairePrimitive,\n type QuestionnaireChoiceDefinition,\n type QuestionnaireInputType,\n type QuestionnaireItemDefinition,\n type QuestionnaireItemStatus,\n type QuestionnaireShortcutMode,\n} from '@shadcn/react/questionnaire';\nimport { CheckIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { buttonVariants, type ButtonSize, type ButtonVariant } from './button';\n\nexport type {\n QuestionnaireChoiceDefinition,\n QuestionnaireInputType,\n QuestionnaireItemDefinition,\n QuestionnaireItemStatus,\n QuestionnaireShortcutMode,\n};\n\n/**\n * Questionnaire: a multi-step form that asks one question at a time, with single-choice,\n * multiple-choice, freeform and skippable questions.\n *\n * Two ways to write one:\n * - Shorthand: `<Questionnaire items={items} onSubmit={…} />`. When it has no children and the\n * items carry `prompt` (and optionally `description`, `choices` with a `label`, `input`), it\n * renders the progress, every item, its choices, its error and the actions.\n * - Composition: `QuestionnaireProgress`, `QuestionnaireItem`s (title, description, choices,\n * input, error) and `QuestionnaireActions` (previous, skip, next, submit).\n *\n * It is a `<form>`: each item is a `fieldset` whose title is its `legend`, fixed choices are native\n * radios (checkboxes with `multiple`), and the answers arrive as `FormData` on submit. It owns the\n * active item, answers, validation, progress and navigation; the page, card or dialog around it\n * owns cancelling, persistence and branching. The behaviour comes from a headless engine (a\n * regular dependency); these parts add the look.\n */\n\nexport interface QuestionnaireShorthandChoice extends QuestionnaireChoiceDefinition {\n label?: ReactNode;\n description?: ReactNode;\n}\n\nexport interface QuestionnaireShorthandItem extends QuestionnaireItemDefinition {\n /** The question, rendered as the item's title. */\n prompt?: ReactNode;\n description?: ReactNode;\n multiple?: boolean;\n choices?: readonly QuestionnaireShorthandChoice[];\n /** A freeform answer field after the choices. `label` is its accessible name. */\n input?: { label: string; placeholder?: string; type?: QuestionnaireInputType };\n}\n\nexport type QuestionnaireProps = Omit<ComponentProps<typeof QuestionnairePrimitive.Root>, 'items'> & {\n items?: readonly QuestionnaireShorthandItem[];\n};\n\nexport function Questionnaire({ className, children, items, ...props }: QuestionnaireProps) {\n const shorthand = Children.count(children) === 0 && items?.some((item) => item.prompt != null);\n return (\n <QuestionnairePrimitive.Root\n data-slot=\"questionnaire\"\n items={items}\n className={cn('flex w-full min-w-0 flex-col gap-4', className)}\n {...props}\n >\n {shorthand && items ? <QuestionnaireShorthand items={items} /> : children}\n </QuestionnairePrimitive.Root>\n );\n}\n\nfunction QuestionnaireShorthand({ items }: { items: readonly QuestionnaireShorthandItem[] }) {\n const skippable = items.some((item) => !item.required);\n return (\n <>\n <QuestionnaireProgress />\n {items.map((item) => (\n <QuestionnaireItem\n key={item.name}\n name={item.name}\n required={item.required}\n multiple={item.multiple}\n disabled={item.disabled}\n >\n <QuestionnaireTitle>{item.prompt}</QuestionnaireTitle>\n {item.description != null && <QuestionnaireDescription>{item.description}</QuestionnaireDescription>}\n {(item.choices?.length || item.input) && (\n <QuestionnaireChoices>\n {item.choices?.map((choice) => (\n <QuestionnaireChoice key={choice.value} value={choice.value} disabled={choice.disabled}>\n <span className=\"font-medium\">{choice.label ?? choice.value}</span>\n {choice.description != null && (\n <QuestionnaireChoiceDescription>{choice.description}</QuestionnaireChoiceDescription>\n )}\n </QuestionnaireChoice>\n ))}\n {item.input && (\n <QuestionnaireInput\n aria-label={item.input.label}\n placeholder={item.input.placeholder}\n type={item.input.type}\n />\n )}\n </QuestionnaireChoices>\n )}\n <QuestionnaireError />\n </QuestionnaireItem>\n ))}\n <QuestionnaireActions>\n <QuestionnairePrevious />\n {skippable && <QuestionnaireSkip />}\n <QuestionnaireNext />\n <QuestionnaireSubmit />\n </QuestionnaireActions>\n </>\n );\n}\n\nexport type QuestionnaireProgressProps = ComponentProps<typeof QuestionnairePrimitive.Progress>;\n\nexport function QuestionnaireProgress({ className, ...props }: QuestionnaireProgressProps) {\n return (\n <QuestionnairePrimitive.Progress\n data-slot=\"questionnaire-progress\"\n className={cn('min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireItemProps = ComponentProps<typeof QuestionnairePrimitive.Item>;\n\nexport function QuestionnaireItem({ className, ...props }: QuestionnaireItemProps) {\n return (\n <QuestionnairePrimitive.Item\n data-slot=\"questionnaire-item\"\n className={cn('flex min-w-0 flex-col gap-4 border-0 p-0 outline-none', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireTitleProps = ComponentProps<typeof QuestionnairePrimitive.Title>;\n\nexport function QuestionnaireTitle({ className, ...props }: QuestionnaireTitleProps) {\n return (\n <QuestionnairePrimitive.Title\n data-slot=\"questionnaire-title\"\n className={cn(\n 'text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireDescriptionProps = ComponentProps<typeof QuestionnairePrimitive.Description>;\n\nexport function QuestionnaireDescription({ className, ...props }: QuestionnaireDescriptionProps) {\n return (\n <QuestionnairePrimitive.Description\n data-slot=\"questionnaire-description\"\n className={cn('text-sm text-pretty text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireChoicesProps = ComponentProps<typeof QuestionnairePrimitive.Choices>;\n\nexport function QuestionnaireChoices({ className, ...props }: QuestionnaireChoicesProps) {\n return (\n <QuestionnairePrimitive.Choices\n data-slot=\"questionnaire-choices\"\n className={cn('group/questionnaire-choices grid min-w-0 gap-2', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireChoiceProps = ComponentProps<typeof QuestionnairePrimitive.Choice>;\n\nexport function QuestionnaireChoice({ children, className, ...props }: QuestionnaireChoiceProps) {\n return (\n <QuestionnairePrimitive.Choice\n data-slot=\"questionnaire-choice\"\n className={cn(\n 'group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none',\n 'hover:bg-muted/50 data-checked:border-primary/40 data-checked:bg-muted data-invalid:border-destructive dark:bg-input/20 dark:data-checked:bg-muted',\n 'has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50',\n 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <QuestionnairePrimitive.ChoiceInput\n data-slot=\"questionnaire-choice-input\"\n className=\"absolute inset-0 z-10 size-full cursor-pointer opacity-0\"\n />\n <span\n aria-hidden=\"true\"\n data-slot=\"questionnaire-choice-indicator\"\n className={cn(\n 'pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-data-[type=radio]/questionnaire-choice:rounded-full dark:bg-input/30',\n 'group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:group-data-checked/questionnaire-choice:bg-primary',\n 'group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5',\n )}\n >\n <span\n data-slot=\"questionnaire-choice-indicator-dot\"\n className=\"hidden size-2 rounded-full bg-primary-foreground group-data-checked/questionnaire-choice:block group-data-[type=checkbox]/questionnaire-choice:hidden\"\n />\n <CheckIcon\n data-slot=\"questionnaire-choice-indicator-check\"\n className=\"hidden size-3.5 group-data-checked/questionnaire-choice:block group-data-[type=radio]/questionnaire-choice:hidden\"\n />\n </span>\n <QuestionnairePrimitive.ChoiceLabel\n data-slot=\"questionnaire-choice-label\"\n className=\"flex min-w-0 flex-1 flex-col gap-0.5 leading-snug\"\n >\n {children}\n </QuestionnairePrimitive.ChoiceLabel>\n <QuestionnairePrimitive.ChoiceShortcut\n data-slot=\"questionnaire-choice-shortcut\"\n className={cn(\n 'pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-data-[shortcut]/questionnaire-choice:inline-flex',\n 'group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5',\n )}\n />\n </QuestionnairePrimitive.Choice>\n );\n}\n\nexport type QuestionnaireChoiceDescriptionProps = ComponentProps<'span'>;\n\nexport function QuestionnaireChoiceDescription({ className, ...props }: QuestionnaireChoiceDescriptionProps) {\n return (\n <span data-slot=\"questionnaire-choice-description\" className={cn('text-muted-foreground', className)} {...props} />\n );\n}\n\nexport type QuestionnaireInputProps = ComponentProps<typeof QuestionnairePrimitive.Input>;\n\nexport function QuestionnaireInput({ className, ...props }: QuestionnaireInputProps) {\n return (\n <div data-slot=\"questionnaire-input-wrapper\" className=\"group/questionnaire-input relative w-full min-w-0\">\n <QuestionnairePrimitive.Input\n data-slot=\"questionnaire-input\"\n className={cn(\n 'h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none sm:min-h-0 md:text-sm dark:bg-input/30',\n 'selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80',\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nexport type QuestionnaireErrorProps = ComponentProps<typeof QuestionnairePrimitive.Error>;\n\nexport function QuestionnaireError({ className, ...props }: QuestionnaireErrorProps) {\n return (\n <QuestionnairePrimitive.Error\n data-slot=\"questionnaire-error\"\n className={cn('mt-2 text-sm text-destructive', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireActionsProps = ComponentProps<'div'>;\n\n/** Lays out Previous at the start and Skip / Next / Submit at the end. */\nexport function QuestionnaireActions({ className, ...props }: QuestionnaireActionsProps) {\n return (\n <div\n data-slot=\"questionnaire-actions\"\n className={cn(\n 'grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8',\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface NavigationButtonProps {\n size?: ButtonSize;\n variant?: ButtonVariant;\n}\n\nexport type QuestionnairePreviousProps = ComponentProps<typeof QuestionnairePrimitive.Previous> & NavigationButtonProps;\n\nexport function QuestionnairePrevious({\n children,\n className,\n size = 'default',\n variant = 'outline',\n ...props\n}: QuestionnairePreviousProps) {\n return (\n <QuestionnairePrimitive.Previous\n data-slot=\"questionnaire-previous\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Previous'}\n </QuestionnairePrimitive.Previous>\n );\n}\n\nexport type QuestionnaireSkipProps = ComponentProps<typeof QuestionnairePrimitive.Skip> & NavigationButtonProps;\n\nexport function QuestionnaireSkip({\n children,\n className,\n size = 'default',\n variant = 'outline',\n ...props\n}: QuestionnaireSkipProps) {\n return (\n <QuestionnairePrimitive.Skip\n data-slot=\"questionnaire-skip\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Skip'}\n </QuestionnairePrimitive.Skip>\n );\n}\n\nexport type QuestionnaireNextProps = ComponentProps<typeof QuestionnairePrimitive.Next> & NavigationButtonProps;\n\nexport function QuestionnaireNext({\n children,\n className,\n size = 'default',\n variant = 'default',\n ...props\n}: QuestionnaireNextProps) {\n return (\n <QuestionnairePrimitive.Next\n data-slot=\"questionnaire-next\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Next'}\n </QuestionnairePrimitive.Next>\n );\n}\n\nexport type QuestionnaireSubmitProps = ComponentProps<typeof QuestionnairePrimitive.Submit> & NavigationButtonProps;\n\nexport function QuestionnaireSubmit({\n children,\n className,\n size = 'default',\n variant = 'default',\n ...props\n}: QuestionnaireSubmitProps) {\n return (\n <QuestionnairePrimitive.Submit\n data-slot=\"questionnaire-submit\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Submit'}\n </QuestionnairePrimitive.Submit>\n );\n}\n","import { forwardRef, useId, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Switch as SwitchPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\n\nexport type SwitchSize = 'default' | 'sm';\n\nexport interface SwitchProps extends ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {\n size?: SwitchSize;\n /** Shorthand: the label at the start of the row; the switch sits at the end. */\n label?: ReactNode;\n /** Shorthand: a second line under the label. */\n description?: ReactNode;\n}\n\n/**\n * Switch: a control that allows the user to toggle between checked and not checked. A setting\n * that takes effect at once; for a pressed-state button, use `Toggle`.\n *\n * Built on Radix Switch: `role=\"switch\"`, `checked` / `defaultChecked` / `onCheckedChange`, and\n * `name` / `value` / `required` to submit and validate with a form. Mark an error with\n * `aria-invalid`.\n *\n * Shorthand: `label` (and `description`) render the horizontal field, the label first and the\n * switch at the end. Without them, compose with `Field` / `FieldLabel` and give the switch an\n * `id`, or an `aria-label`.\n *\n * Inside a `<form>`, Radix measures the switch with `ResizeObserver`, which a bare jsdom lacks:\n * tests that render a Switch in a form need a stub (`src/components/cards/resize-observer.test-stub.ts`).\n */\nexport const Switch = forwardRef<ElementRef<typeof SwitchPrimitive.Root>, SwitchProps>(function Switch(\n { className, size = 'default', label, description, id, ...props },\n ref,\n) {\n const generatedId = useId();\n const controlId = id ?? (label != null ? generatedId : undefined);\n const descriptionId = `${controlId ?? generatedId}-description`;\n\n const control = (\n <SwitchPrimitive.Root\n ref={ref}\n id={controlId}\n data-slot=\"switch\"\n data-size={size}\n aria-describedby={description != null ? descriptionId : undefined}\n className={cn(\n 'peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none motion-reduce:transition-none after:absolute after:-inset-x-3 after:-inset-y-2',\n 'data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n 'data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]',\n label == null && className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n 'pointer-events-none block rounded-full bg-background ring-0 transition-transform motion-reduce:transition-none dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground',\n 'group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3',\n 'data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0 rtl:data-checked:-translate-x-[calc(100%-2px)]',\n )}\n />\n </SwitchPrimitive.Root>\n );\n\n if (label == null) return control;\n\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation=\"horizontal\"\n data-disabled={props.disabled || undefined}\n className={cn(\n 'group/field flex w-full flex-row items-center gap-2 has-[>[data-slot=field-content]]:items-start',\n className,\n )}\n >\n <div data-slot=\"field-content\" className=\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\">\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className=\"flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </label>\n {description != null && (\n <p id={descriptionId} data-slot=\"field-description\" className=\"text-sm leading-normal text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {control}\n </div>\n );\n});\n","import { createContext, forwardRef, useContext, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { OTPInput, OTPInputContext, type OTPInputProps } from 'input-otp';\nimport { MinusIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useFieldControl } from './field';\n\nexport { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';\n\n/**\n * InputOTP: a one-time-code field, the boxed characters of a 2FA or email-verification step.\n *\n * Two ways to write one:\n * - Shorthand: `<InputOTP maxLength={6} groupSize={3} />` renders the groups, slots and\n * separators itself.\n * - Composition: `InputOTP` > `InputOTPGroup` > `InputOTPSlot index`, with `InputOTPSeparator`\n * between groups.\n *\n * Built on `input-otp`: one real input holds the whole value (so paste, SMS autofill via\n * `autocomplete=\"one-time-code\"`, undo and screen readers get the real value) and the slots are\n * drawn from its state. Its password-manager check calls `document.elementFromPoint`, which\n * jsdom lacks, so tests that render it stub it (`src/components/forms/input-otp.test-stub.ts`).\n *\n * Inside a `Field` it takes the control id, description, invalid, required and disabled state.\n * `aria-invalid` on the root (or the Field's error) marks every slot invalid; a slot's own\n * `aria-invalid` wins.\n */\n\nconst InvalidContext = createContext<boolean | undefined>(undefined);\n\ntype InputOTPBaseProps = Omit<OTPInputProps, 'render' | 'children'>;\n\nexport type InputOTPProps = InputOTPBaseProps & {\n /** The parts. Leave out for the shorthand, which renders `maxLength` slots. */\n children?: ReactNode;\n /** Shorthand: slots per group, with a separator between groups. Default: one group. */\n groupSize?: number;\n};\n\nexport const InputOTP = forwardRef<HTMLInputElement, InputOTPProps>(function InputOTP(\n { className, containerClassName, children, groupSize, maxLength, value: valueProp, defaultValue, onChange, ...props },\n ref,\n) {\n const field = useFieldControl();\n // Held here so the input is always controlled: input-otp reads `defaultValue` but also passes it\n // on to the input next to its own `value`, which React warns about.\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: typeof defaultValue === 'string' ? defaultValue : '',\n onChange: onChange as ((value: string) => void) | undefined,\n });\n const invalid = props['aria-invalid'] ?? field['aria-invalid'];\n const content = children ?? <InputOTPSlots maxLength={maxLength} groupSize={groupSize} />;\n\n return (\n <InvalidContext.Provider value={invalid === true || invalid === 'true' || undefined}>\n <OTPInput\n ref={ref}\n data-slot=\"input-otp\"\n maxLength={maxLength}\n value={value}\n onChange={setValue}\n {...field}\n required={field['aria-required']}\n containerClassName={cn('relative flex items-center gap-2 has-disabled:opacity-50', containerClassName)}\n spellCheck={false}\n className={cn('disabled:cursor-not-allowed', className)}\n {...props}\n >\n {content}\n </OTPInput>\n </InvalidContext.Provider>\n );\n});\n\nfunction InputOTPSlots({ maxLength, groupSize }: { maxLength: number; groupSize?: number }) {\n const size = groupSize && groupSize > 0 ? groupSize : maxLength;\n const groups = Array.from({ length: Math.ceil(maxLength / size) }, (_, g) =>\n Array.from({ length: Math.min(size, maxLength - g * size) }, (_, i) => g * size + i),\n );\n return (\n <>\n {groups.map((indexes, g) => (\n <InputOTPSlotGroup key={indexes[0]} indexes={indexes} separator={g > 0} />\n ))}\n </>\n );\n}\n\nfunction InputOTPSlotGroup({ indexes, separator }: { indexes: number[]; separator: boolean }) {\n return (\n <>\n {separator && <InputOTPSeparator />}\n <InputOTPGroup>\n {indexes.map((index) => (\n <InputOTPSlot key={index} index={index} />\n ))}\n </InputOTPGroup>\n </>\n );\n}\n\nexport const InputOTPGroup = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function InputOTPGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-group\"\n className={cn(\n 'flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /** Which character of the value this slot shows. */\n index: number;\n}\n\nexport const InputOTPSlot = forwardRef<HTMLDivElement, InputOTPSlotProps>(function InputOTPSlot(\n { index, className, ...props },\n ref,\n) {\n const otp = useContext(OTPInputContext);\n const invalid = useContext(InvalidContext);\n const { char, hasFakeCaret, isActive } = otp?.slots[index] ?? {};\n\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-slot\"\n data-active={isActive}\n aria-invalid={invalid}\n className={cn(\n 'relative flex size-8 items-center justify-center border-y border-e border-input text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg dark:bg-input/30',\n 'data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50',\n 'aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\n </div>\n )}\n </div>\n );\n});\n\nexport const InputOTPSeparator = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function InputOTPSeparator(\n { className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-separator\"\n role=\"separator\"\n className={cn(\"flex items-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children ?? <MinusIcon aria-hidden />}\n </div>\n );\n});\n","import { forwardRef, useRef, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';\nimport { CheckIcon, ChevronDownIcon, XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { usePortalContainer } from '../overlays/portal';\nimport { Button } from './button';\nimport { useFieldControl } from './field';\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group';\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport function ComboboxValue(props: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\nexport const ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxPrimitive.Trigger.Props>(function ComboboxTrigger(\n { className, children, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Trigger\n ref={ref}\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </ComboboxPrimitive.Trigger>\n );\n});\n\nconst ComboboxClear = forwardRef<HTMLButtonElement, ComboboxPrimitive.Clear.Props>(function ComboboxClear(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Clear\n ref={ref}\n data-slot=\"combobox-clear\"\n aria-label=\"Clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={className}\n {...props}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n});\n\nexport interface ComboboxInputProps extends ComboboxPrimitive.Input.Props {\n /** The chevron button that opens the list. Default `true`. */\n showTrigger?: boolean;\n /** A button that clears the value. Default `false`. */\n showClear?: boolean;\n}\n\n/** The text field: an `InputGroup` with the typed query, and the trigger and clear buttons. */\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(function ComboboxInput(\n {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n},\n ref,\n) {\n // Base UI gives the input an id of its own; inside a Field, the Field's id keeps its label working.\n const field = useFieldControl();\n return (\n <InputGroup className={cn('w-auto', className)}>\n <ComboboxPrimitive.Input\n ref={ref}\n render={<InputGroupInput disabled={disabled} />}\n {...props}\n id={props.id ?? field.id}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n {/* The chevron alone has no name. */}\n <ComboboxTrigger aria-label=\"Show suggestions\" />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n});\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>;\n\n/** The popup, portalled and positioned under the input (or the chips `anchor`). */\nexport const ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>(function ComboboxContent(\n {\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n},\n ref,\n) {\n // Inside a Dialog or Drawer, portal into it: a modal dialog treats anything outside as inert.\n const container = usePortalContainer();\n return (\n <ComboboxPrimitive.Portal container={container ?? undefined}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-popover\"\n >\n <ComboboxPrimitive.Popup\n ref={ref}\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n 'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 max-h-72 min-w-36 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)',\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n});\n\nexport const ComboboxList = forwardRef<HTMLDivElement, ComboboxPrimitive.List.Props>(function ComboboxList(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.List\n ref={ref}\n data-slot=\"combobox-list\"\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overscroll-contain',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ComboboxItem = forwardRef<HTMLDivElement, ComboboxPrimitive.Item.Props>(function ComboboxItem(\n { className, children, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Item\n ref={ref}\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n});\n\nexport const ComboboxGroup = forwardRef<HTMLDivElement, ComboboxPrimitive.Group.Props>(function ComboboxGroup(\n { className, ...props },\n ref,\n) {\n return <ComboboxPrimitive.Group ref={ref} data-slot=\"combobox-group\" className={className} {...props} />;\n});\n\nexport const ComboboxLabel = forwardRef<HTMLDivElement, ComboboxPrimitive.GroupLabel.Props>(function ComboboxLabel(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.GroupLabel\n ref={ref}\n data-slot=\"combobox-label\"\n className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}\n {...props}\n />\n );\n});\n\nexport function ComboboxCollection(props: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />;\n}\n\nexport const ComboboxEmpty = forwardRef<HTMLDivElement, ComboboxPrimitive.Empty.Props>(function ComboboxEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Empty\n ref={ref}\n data-slot=\"combobox-empty\"\n className={cn(\n 'text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ComboboxSeparator = forwardRef<HTMLDivElement, ComboboxPrimitive.Separator.Props>(function ComboboxSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Separator\n ref={ref}\n data-slot=\"combobox-separator\"\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\n\nexport const ComboboxChips = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props>(function ComboboxChips({\n className,\n ...props\n}: ComponentPropsWithoutRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props, ref) {\n return (\n <ComboboxPrimitive.Chips\n ref={ref}\n data-slot=\"combobox-chips\"\n className={cn(\n 'dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface ComboboxChipProps extends ComboboxPrimitive.Chip.Props {\n /** The remove button. Default `true`. */\n showRemove?: boolean;\n}\n\nexport const ComboboxChip = forwardRef<HTMLDivElement, ComboboxChipProps>(function ComboboxChip(\n { className, children, showRemove = true, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Chip\n ref={ref}\n data-slot=\"combobox-chip\"\n className={cn(\n 'bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-data-[slot=combobox-chip-remove]:pr-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n});\n\nexport const ComboboxChipsInput = forwardRef<HTMLInputElement, ComboboxPrimitive.Input.Props>(function ComboboxChipsInput(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Input\n ref={ref}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n );\n});\n\n/** A ref for `ComboboxChips`, passed to `ComboboxContent anchor` so the popup lines up with the chips. */\nexport function useComboboxAnchor() {\n return useRef<HTMLDivElement | null>(null);\n}\n\n// ── Root + shorthand ───────────────────────────────────────────────────────────\n\n/** The `{ value, label }` item shape: the input shows `label`, a form submits `value`, no `itemToStringLabel` needed. */\nexport interface ComboboxOption {\n value: string;\n label: string;\n description?: string;\n disabled?: boolean;\n}\n\ninterface ComboboxGroupItems<Item> {\n value: string;\n items: readonly Item[];\n}\n\nfunction isGroups<Item>(items: readonly unknown[] | undefined): items is readonly ComboboxGroupItems<Item>[] {\n return !!items?.length && typeof items[0] === 'object' && items[0] !== null && Array.isArray((items[0] as { items?: unknown }).items);\n}\n\nfunction labelOf(item: unknown, toLabel?: (item: never) => string): string {\n if (toLabel) return toLabel(item as never);\n if (item && typeof item === 'object' && 'label' in item) return String((item as { label: unknown }).label);\n return String(item);\n}\n\nexport type ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<\n Value,\n Multiple\n> & {\n /** Shorthand: the input's placeholder. Used when `children` is left out. */\n placeholder?: string;\n /** Shorthand: a button that clears the value. Default `false`. */\n showClear?: boolean;\n /** Shorthand: the chevron that opens the list. Default `true`. */\n showTrigger?: boolean;\n /** Shorthand: shown when nothing matches. Default `No items found.` */\n empty?: ReactNode;\n /** Shorthand: the content of each item. Default: its label (`itemToStringLabel`, `item.label`, or the string). */\n renderItem?: (item: Value) => ReactNode;\n /** Shorthand: the input's id, accessible name and invalid state. Inside a `Field`, the Field sets them. */\n id?: string;\n 'aria-label'?: string;\n 'aria-invalid'?: boolean;\n /** Shorthand: layout of the input (or the chips with `multiple`). */\n className?: string;\n};\n\n/**\n * Autocomplete input with a list of suggestions, on Base UI's Combobox.\n *\n * Compose the parts, or leave out `children` and pass `items` for the shorthand: an input\n * (chips with `multiple`), the list, and \"No items found.\" Items are strings, `{ value, label }`\n * objects, anything with `itemToStringLabel`, or groups `{ value, items }`. The value is the item.\n */\nexport function Combobox<Value, Multiple extends boolean | undefined = false>({\n children,\n placeholder,\n showClear = false,\n showTrigger = true,\n empty = 'No items found.',\n renderItem,\n id,\n 'aria-label': ariaLabel,\n 'aria-invalid': ariaInvalid,\n className,\n ...props\n}: ComboboxProps<Value, Multiple>) {\n const anchor = useComboboxAnchor();\n if (children !== undefined) {\n return <ComboboxPrimitive.Root {...props}>{children}</ComboboxPrimitive.Root>;\n }\n const toLabel = props.itemToStringLabel as ((item: never) => string) | undefined;\n const renderOne = (item: Value) => {\n const disabled = !!item && typeof item === 'object' && 'disabled' in item && !!(item as { disabled?: boolean }).disabled;\n return (\n <ComboboxItem key={labelOf(item, toLabel)} value={item} disabled={disabled}>\n {renderItem ? renderItem(item) : labelOf(item, toLabel)}\n </ComboboxItem>\n );\n };\n const inputProps = { id, placeholder, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid || undefined };\n const grouped = isGroups<Value>(props.items as readonly unknown[] | undefined);\n return (\n <ComboboxPrimitive.Root {...props}>\n {props.multiple ? (\n <ComboboxChips ref={anchor} className={className}>\n <ComboboxValue>\n {(values: Value[]) => (\n <>\n {values.map((item) => (\n <ComboboxChip key={labelOf(item, toLabel)}>{labelOf(item, toLabel)}</ComboboxChip>\n ))}\n <ComboboxChipsInput {...inputProps} />\n </>\n )}\n </ComboboxValue>\n </ComboboxChips>\n ) : (\n <ComboboxInput\n {...inputProps}\n disabled={props.disabled}\n showClear={showClear}\n showTrigger={showTrigger}\n className={className}\n />\n )}\n <ComboboxContent anchor={props.multiple ? anchor : undefined}>\n <ComboboxEmpty>{empty}</ComboboxEmpty>\n <ComboboxList>\n {grouped\n ? (group: ComboboxGroupItems<Value>, index: number) => (\n <ComboboxGroup key={group.value} items={group.items as Value[]}>\n {index > 0 && <ComboboxSeparator />}\n <ComboboxLabel>{group.value}</ComboboxLabel>\n <ComboboxCollection>{(item: Value) => renderOne(item)}</ComboboxCollection>\n </ComboboxGroup>\n )\n : (item: Value) => renderOne(item)}\n </ComboboxList>\n </ComboboxContent>\n </ComboboxPrimitive.Root>\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cn } from '../../lib/cn';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { CHOICE_CARD } from './field';\n\n/**\n * RadioGroup: a set of checkable buttons, known as radio buttons, where no more than one can be\n * checked at a time.\n *\n * Built on real `<input type=\"radio\">` elements sharing a `name`, which gives the whole keyboard\n * contract for free (arrow keys move and select, only the checked radio is a tab stop, the group\n * is announced as \"2 of 4\") and submits with a form. Nothing in it needs browser APIs a test\n * environment lacks.\n *\n * Three ways to write one:\n * - `options`: `<RadioGroup options={[{ value, label, description?, card?, disabled? }]} />`.\n * - Item shorthand: `<RadioGroupItem value label description card />` renders the field around it.\n * - Composition: `RadioGroupItem` with an `id`, labelled by `Field` / `FieldLabel`.\n *\n * Name the group with `aria-label` or a `FieldSet` + `FieldLegend`. `aria-invalid` on the group\n * marks every item; on an item it marks that item.\n */\n\ninterface RadioGroupContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n disabled: boolean;\n required: boolean;\n invalid: boolean;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\n/** One radio as data: the `RadioGroupItem` shorthand it renders with. */\nexport interface RadioGroupOption {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n /** Render this option as a choice card. */\n card?: boolean;\n disabled?: boolean;\n}\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'dir'> {\n /** The parts: `RadioGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /** Shorthand: the radios as data, each rendered as a `RadioGroupItem`. */\n options?: readonly RadioGroupOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` of the inputs, which submit with a form. Generated when omitted. */\n name?: string;\n /** Announced to assistive tech. Lay the items out with `className` (`flex gap-6`). */\n orientation?: RadioGroupOrientation;\n disabled?: boolean;\n required?: boolean;\n dir?: 'ltr' | 'rtl';\n}\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function RadioGroup(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n orientation,\n disabled = false,\n required = false,\n className,\n ...props\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n const invalid = props['aria-invalid'] === true || props['aria-invalid'] === 'true';\n\n return (\n <RadioGroupContext.Provider\n value={{ name: name ?? generatedName, value, setValue: (next) => setValue(next), disabled, required, invalid }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-required={required || undefined}\n aria-orientation={orientation}\n data-slot=\"radio-group\"\n data-disabled={disabled || undefined}\n className={cn('grid w-full gap-2', className)}\n {...props}\n >\n {options\n ? options.map((option) => (\n <RadioGroupItem\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n card={option.card}\n disabled={option.disabled}\n />\n ))\n : children}\n </div>\n </RadioGroupContext.Provider>\n );\n});\n\nexport interface RadioGroupItemProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'onChange' | 'checked' | 'defaultChecked' | 'size' | 'name'\n> {\n value: string;\n /** Shorthand: the label beside the radio. */\n label?: ReactNode;\n /** Shorthand: a second line under the label. */\n description?: ReactNode;\n /** Shorthand: render the labelled field as a choice card. Needs `label`. */\n card?: boolean;\n}\n\nconst RADIO =\n 'peer relative flex size-4 shrink-0 cursor-pointer appearance-none rounded-full border border-input bg-transparent outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary aria-invalid:data-checked:border-primary group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input group-has-[:focus-visible]/field-label:data-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-checked:bg-primary';\n\nexport const RadioGroupItem = forwardRef<HTMLInputElement, RadioGroupItemProps>(function RadioGroupItem(\n { value, label, description, card = false, id, className, disabled, ...props },\n ref,\n) {\n const group = useContext(RadioGroupContext);\n if (!group) devWarn('<RadioGroupItem> must be rendered inside a <RadioGroup>.');\n const generatedId = useId();\n const controlId = id ?? (label != null ? generatedId : undefined);\n const descriptionId = `${controlId ?? generatedId}-description`;\n const checked = group?.value === value;\n const isDisabled = disabled ?? group?.disabled ?? false;\n\n const radio = (\n <span className={cn('relative inline-flex size-4 shrink-0', label == null && className)}>\n <input\n ref={ref}\n id={controlId}\n type=\"radio\"\n name={group?.name}\n value={value}\n checked={checked}\n disabled={isDisabled}\n required={group?.required || undefined}\n data-slot=\"radio-group-item\"\n data-state={checked ? 'checked' : 'unchecked'}\n aria-describedby={description != null && !card ? descriptionId : undefined}\n onChange={() => group?.setValue(value)}\n className={RADIO}\n // The group's aria-invalid marks each item, as an item's own aria-invalid does: it drives\n // the invalid look, and assistive tech reads it on the radio.\n {...(group?.invalid ? { 'aria-invalid': true as const } : {})}\n {...props}\n />\n <span\n aria-hidden\n data-slot=\"radio-group-indicator\"\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n >\n {checked && <span className=\"size-2 rounded-full bg-primary-foreground\" />}\n </span>\n </span>\n );\n\n if (label == null) return radio;\n\n // In a card the title is a div (FieldTitle): the card is the label, and labels do not nest.\n const labelElement = card ? (\n <div\n data-slot=\"field-label\"\n className=\"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </div>\n ) : (\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className=\"group/field-label peer/field-label flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </label>\n );\n\n const content =\n description != null ? (\n <div data-slot=\"field-content\" className=\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\">\n {labelElement}\n <p\n id={descriptionId}\n data-slot=\"field-description\"\n className=\"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance\"\n >\n {description}\n </p>\n </div>\n ) : (\n labelElement\n );\n\n const field = (\n <div\n // Not a group inside a card: the card is the label, and a group between a label and its\n // input hides the label text from accessible-name checks.\n role={card ? undefined : 'group'}\n data-slot=\"field\"\n data-orientation=\"horizontal\"\n data-disabled={isDisabled || undefined}\n className={cn(\n 'group/field flex w-full flex-row items-center gap-2 has-[>[data-slot=field-content]]:items-start data-[invalid=true]:text-destructive has-[>[data-slot=field-content]]:[&>span:first-child]:mt-px *:data-[slot=field-label]:flex-auto',\n !card && className,\n )}\n >\n {/* A card puts the radio at the end, after its title and description. */}\n {card ? (\n <>\n {content}\n {radio}\n </>\n ) : (\n <>\n {radio}\n {content}\n </>\n )}\n </div>\n );\n\n if (!card) return field;\n return (\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className={cn('group/field-label peer/field-label text-sm', CHOICE_CARD, className)}\n >\n {field}\n </label>\n );\n});\n","import { forwardRef, useId, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Slider as SliderPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\n/**\n * Slider: an input where the user selects a value from within a given range.\n *\n * Built on Radix Slider. `value` / `defaultValue` are arrays: one value is one thumb, two make a\n * range, more give more thumbs. `orientation=\"vertical\"` stands it up. Each thumb is a\n * `role=\"slider\"` with arrow keys, Page Up/Down and Home/End.\n *\n * Shorthand: `label` (and `description`) render the label row and the line under the slider,\n * `showValue` shows the current value at the end of the label row, and `formatValue` formats\n * it, both on screen and as each thumb's `aria-valuetext` (\"£70\", not \"70\").\n *\n * Radix measures each thumb with `ResizeObserver`, which a bare jsdom lacks: tests that render a\n * Slider need a stub (`src/components/cards/resize-observer.test-stub.ts`).\n */\n\nexport interface SliderProps extends ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {\n /** Shorthand: the label above the slider; names every thumb. */\n label?: ReactNode;\n /** Shorthand: a line under the slider. */\n description?: ReactNode;\n /** Shorthand: show the current value (or values) at the end of the label row. */\n showValue?: boolean;\n /** Formats a value for display and for each thumb's `aria-valuetext`. */\n formatValue?: (value: number) => string;\n}\n\nexport const Slider = forwardRef<ElementRef<typeof SliderPrimitive.Root>, SliderProps>(function Slider(\n {\n className,\n defaultValue,\n value: valueProp,\n onValueChange,\n min = 0,\n max = 100,\n label,\n description,\n showValue = false,\n formatValue,\n ...props\n },\n ref,\n) {\n const [values, setValues] = useControllableState<number[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [min, max],\n onChange: onValueChange,\n });\n const labelId = useId();\n const descriptionId = useId();\n const format = (value: number) => (formatValue ? formatValue(value) : String(value));\n\n const slider = (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n value={values}\n onValueChange={setValues}\n min={min}\n max={max}\n className={cn(\n 'relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col',\n label == null && description == null && className,\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className=\"relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1\"\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full\"\n />\n </SliderPrimitive.Track>\n {values.map((value, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={index}\n aria-labelledby={label != null ? labelId : undefined}\n aria-describedby={description != null ? descriptionId : undefined}\n aria-valuetext={formatValue ? format(value) : undefined}\n className=\"relative block size-3 shrink-0 rounded-full border border-ring bg-(--prim-white-1000) ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50\"\n />\n ))}\n </SliderPrimitive.Root>\n );\n\n if (label == null && description == null) return slider;\n\n return (\n <div data-slot=\"slider-field\" className={cn('flex w-full flex-col gap-3', className)}>\n {(label != null || showValue) && (\n <div className=\"flex items-center justify-between gap-2 text-sm\">\n {label != null && (\n <span id={labelId} className=\"font-medium\">\n {label}\n </span>\n )}\n {showValue && <span className=\"text-muted-foreground tabular-nums\">{values.map(format).join(' – ')}</span>}\n </div>\n )}\n {slider}\n {description != null && (\n <p id={descriptionId} className=\"text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n );\n});\n","import { forwardRef, type ComponentProps, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Tooltip as TooltipPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { usePortalContainer } from './portal';\n\n/**\n * Tooltip: a popup that displays information related to an element when the element receives\n * keyboard focus or the mouse hovers over it.\n *\n * Built on Radix Tooltip: it opens on focus as well as hover, closes on Escape (only the\n * tooltip, not a dialog around it), stays open while the pointer moves onto it (WCAG 1.4.13),\n * and describes its trigger with `aria-describedby`. It is never focused, so it holds a short\n * label and nothing interactive; use `Popover` for that. An icon-only trigger still needs its\n * own `aria-label`.\n *\n * Mount one `TooltipProvider` at the app root (`SidebarProvider` includes one). A Tooltip\n * outside a provider throws.\n *\n * Two ways to write one:\n * - Shorthand: `<Tooltip content=\"Add to library\" side=\"right\"><Button /></Tooltip>` makes the\n * child the trigger and renders the content.\n * - Composition: `Tooltip` > `TooltipTrigger asChild` + `TooltipContent`.\n */\n\nexport function TooltipProvider({ delayDuration = 0, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>) {\n return <TooltipPrimitive.Provider data-slot=\"tooltip-provider\" delayDuration={delayDuration} {...props} />;\n}\n\nexport interface TooltipProps extends ComponentProps<typeof TooltipPrimitive.Root> {\n /** Shorthand: the tooltip text. The child becomes the trigger. */\n content?: ReactNode;\n /** Shorthand: the content's side. Default `top`. */\n side?: ComponentProps<typeof TooltipPrimitive.Content>['side'];\n /** Shorthand: the content's alignment. Default `center`. */\n align?: ComponentProps<typeof TooltipPrimitive.Content>['align'];\n}\n\nexport function Tooltip({ content, side, align, children, ...props }: TooltipProps) {\n return (\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props}>\n {content != null ? (\n <>\n <TooltipTrigger asChild>{children}</TooltipTrigger>\n <TooltipContent side={side} align={align}>\n {content}\n </TooltipContent>\n </>\n ) : (\n children\n )}\n </TooltipPrimitive.Root>\n );\n}\n\nexport const TooltipTrigger = forwardRef<\n ElementRef<typeof TooltipPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(function TooltipTrigger(props, ref) {\n return <TooltipPrimitive.Trigger ref={ref} data-slot=\"tooltip-trigger\" {...props} />;\n});\n\nexport const TooltipContent = forwardRef<\n ElementRef<typeof TooltipPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(function TooltipContent({ className, sideOffset = 0, children, ...props }, ref) {\n const container = usePortalContainer();\n return (\n <TooltipPrimitive.Portal container={container ?? undefined}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n 'z-tooltip inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"z-tooltip size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\n/**\n * HoverCard: a preview panel that appears on hover or focus — a user card on an @mention, a\n * page preview on a link.\n *\n * Two ways to write one:\n * - Shorthand: `<HoverCard content={…}>{trigger}</HoverCard>`.\n * - Composition: `HoverCard` > `HoverCardTrigger` + `HoverCardContent`.\n *\n * It sits between `Tooltip` and `Popover`, and the difference is intent: a Tooltip is a short\n * label that cannot be entered; a HoverCard is supplementary content that *can* be entered\n * (the panel stays open while the pointer is inside it); a Popover is opened deliberately by\n * click. Hover has no touch equivalent, so nothing may be reachable only here.\n *\n * Built on Radix HoverCard: the delays, the pointer grace area and Escape through the shared\n * layer stack come from Radix. Ours on top: the panel is a `group` named by the trigger, and the\n * trigger is described by the panel while it is open (Radix gives the panel no role).\n */\n\ninterface HoverCardIds {\n triggerId: string;\n contentId: string;\n open: boolean;\n}\n\nconst HoverCardContext = createContext<HoverCardIds | null>(null);\n\nexport const HoverCardTrigger = forwardRef<\n HTMLAnchorElement,\n ComponentPropsWithoutRef<typeof HoverCardPrimitive.Trigger>\n>(function HoverCardTrigger(props, ref) {\n const ids = useContext(HoverCardContext);\n return (\n <HoverCardPrimitive.Trigger\n ref={ref}\n data-slot=\"hover-card-trigger\"\n id={ids?.triggerId}\n // Not `aria-haspopup`: nothing here is triggered by activation, and claiming a popup on a\n // plain link makes a screen reader promise an interaction that does not exist.\n aria-describedby={ids?.open ? ids.contentId : undefined}\n {...props}\n />\n );\n});\n\nexport interface HoverCardContentProps extends ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content> {\n /** Where to portal the panel. Default: the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const HoverCardContent = forwardRef<HTMLDivElement, HoverCardContentProps>(function HoverCardContent(\n { className, align = 'center', sideOffset = 4, container, ...props },\n ref,\n) {\n const ids = useContext(HoverCardContext);\n const inherited = usePortalContainer();\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\" container={container ?? inherited ?? undefined}>\n <HoverCardPrimitive.Content\n ref={ref}\n data-slot=\"hover-card-content\"\n id={ids?.contentId}\n // `group`, not `dialog`: it was not opened deliberately and traps nothing.\n role=\"group\"\n aria-labelledby={ids?.triggerId}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={8}\n className={cn(\n 'z-popover w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2',\n className,\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n );\n});\n\nexport interface HoverCardProps extends ComponentPropsWithoutRef<typeof HoverCardPrimitive.Root> {\n /**\n * The parts (`HoverCardTrigger`, `HoverCardContent`); with `content`, the trigger element\n * itself (a single focusable element, normally a link).\n */\n children?: ReactNode;\n /** Shorthand: the panel content. The children become the trigger. */\n content?: ReactNode;\n /** Shorthand: where the panel opens. */\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Shorthand: classes for the panel. */\n className?: string;\n}\n\nexport function HoverCard({\n children,\n content,\n side,\n align,\n className,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n ...props\n}: HoverCardProps) {\n const baseId = useId();\n // Tracked here as well as in Radix, because the trigger is described by the panel only while it exists.\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const ids = { triggerId: `${baseId}-trigger`, contentId: `${baseId}-content`, open };\n\n return (\n <HoverCardContext.Provider value={ids}>\n <HoverCardPrimitive.Root data-slot=\"hover-card\" open={open} onOpenChange={setOpen} {...props}>\n {content !== undefined ? (\n <>\n <HoverCardTrigger asChild>{children as ReactElement}</HoverCardTrigger>\n <HoverCardContent side={side} align={align} className={className}>\n {content}\n </HoverCardContent>\n </>\n ) : (\n children\n )}\n </HoverCardPrimitive.Root>\n </HoverCardContext.Provider>\n );\n}\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { ContextMenu as ContextMenuPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport {\n createMenuParts,\n type MenuClasses,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\nconst CONTEXT_MENU_CLASSES: MenuClasses = {\n item:\n \"group/context-menu-item focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n checkboxItem:\n \"focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n radioItem:\n \"focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n indicator:\n 'absolute end-2',\n label:\n 'text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:ps-7',\n separator:\n 'bg-border -mx-1 my-1 h-px',\n shortcut:\n 'text-muted-foreground group-focus/context-menu-item:text-accent-foreground ms-auto text-xs tracking-widest',\n subTrigger:\n \"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n subContent:\n 'z-popover origin-(--radix-context-menu-content-transform-origin) overflow-hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-32 rounded-lg border p-1 shadow-lg duration-100',\n};\n\nconst CONTENT_CLASSES =\n 'z-popover max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto scrollbar-thin data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 ring-foreground/10 bg-popover text-popover-foreground min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100';\n\nexport interface ContextMenuProps {\n /**\n * The parts (`ContextMenuTrigger`, `ContextMenuContent`), or, with `items`, the area that\n * responds to right-click.\n */\n children: ReactNode;\n /**\n * The menu as data. New in 0.8.0. `children` then becomes the right-click area, wrapped in a\n * `ContextMenuTrigger` for you. The same `MenuItemDef` shape as `DropdownMenu` and `Menubar`.\n */\n items?: readonly MenuItemDef[];\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Locks page scroll and outside pointer events while open. Default `true`. */\n modal?: boolean;\n dir?: 'ltr' | 'rtl';\n}\n\n/**\n * Right-click menu, built on Radix ContextMenu from 0.7.0.\n *\n * Shares every item and the whole keyboard contract with `DropdownMenu` (see `menu-core`);\n * the only difference is how it opens — at the pointer, with no trigger element to anchor\n * to.\n *\n * **A context menu must never be the only way to reach an action.** `contextmenu` fires on\n * right-click and on the Windows Menu / Shift+F10 keys, but not on touch, and plenty of\n * users never right-click at all. `ContextMenuTrigger` therefore also opens on Shift+F10 and\n * the ContextMenu key even where the browser would not, and anything in here should have a\n * visible equivalent elsewhere — usually a `DropdownMenu` on the same row.\n *\n * Radix ContextMenu has no `open` prop (it is opened by the pointer only), so a controlled\n * `open={false}` closes it, but `open={true}` cannot open it without a position.\n */\nexport function ContextMenu({ children, items, open: openProp, defaultOpen = false, onOpenChange, modal, dir }: ContextMenuProps) {\n const [, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <ContextMenuPrimitive.Root data-slot=\"context-menu\" onOpenChange={setOpen} modal={modal} dir={dir}>\n {items ? (\n <>\n <ContextMenuTrigger>{children}</ContextMenuTrigger>\n <ContextMenuContent>\n <ContextMenuItems items={items} />\n </ContextMenuContent>\n </>\n ) : (\n children\n )}\n </ContextMenuPrimitive.Root>\n );\n}\n\nexport interface ContextMenuTriggerProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n disabled?: boolean;\n}\n\n/**\n * The area that responds to right-click. A wrapper with no tab stop of its own: the keyboard\n * path is Shift+F10 or the ContextMenu key from whatever inside it has focus.\n */\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ children, disabled = false, className, onKeyDown, ...rest }, ref) {\n const openFromKeyboard = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (disabled || event.defaultPrevented) return;\n if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {\n // Cancelling the key also stops the browser's own `contextmenu`, so the menu opens\n // exactly once, at the focused element rather than wherever the pointer happens to be.\n event.preventDefault();\n const source = event.target instanceof HTMLElement ? event.target : event.currentTarget;\n const rect = source.getBoundingClientRect();\n source.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n clientX: rect.left + rect.width / 2,\n clientY: rect.top + rect.height / 2,\n }),\n );\n }\n };\n\n return (\n <ContextMenuPrimitive.Trigger asChild disabled={disabled}>\n {/* The key handler only catches Shift+F10 / ContextMenu bubbling up from focusable\n content inside. The wrapper is deliberately not focusable and takes no role: its\n actions have a visible equivalent elsewhere, and a tab stop here would add an\n unexplained one in the middle of, say, a table row. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={ref}\n data-slot=\"context-menu-trigger\"\n className={cn('select-none', className)}\n onKeyDown={openFromKeyboard}\n {...rest}\n >\n {children}\n </div>\n </ContextMenuPrimitive.Trigger>\n );\n },\n);\n\nexport interface ContextMenuContentProps\n extends Omit<ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>, 'children'> {\n children: ReactNode;\n /** Which side of the pointer the menu prefers. Default `right`. */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const ContextMenuContent = forwardRef<HTMLDivElement, ContextMenuContentProps>(\n function ContextMenuContent(\n { children, collisionPadding, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <ContextMenuPrimitive.Portal container={container ?? inherited ?? undefined}>\n <ContextMenuPrimitive.Content\n ref={ref}\n collisionPadding={collisionPadding}\n loop\n className={cn(CONTENT_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n if (event.key === 'Tab') {\n // Tab leaves the menu, as in DropdownMenu. Radix has no imperative close for a\n // context menu, so Escape is replayed on the panel to dismiss it.\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n );\n }\n }}\n {...rest}\n >\n {children}\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(ContextMenuPrimitive, 'context-menu', CONTEXT_MENU_CLASSES);\n\n/** Renders `MenuItemDef[]` inside your own `ContextMenuContent`. New in 0.8.0. */\nexport const ContextMenuItems = parts.Items;\nexport const ContextMenuItem = parts.Item;\nexport const ContextMenuCheckboxItem = parts.CheckboxItem;\nexport const ContextMenuRadioGroup = parts.RadioGroup;\nexport const ContextMenuRadioItem = parts.RadioItem;\nexport const ContextMenuGroup = parts.Group;\nexport const ContextMenuLabel = parts.Label;\nexport const ContextMenuSeparator = parts.Separator;\nexport const ContextMenuShortcut = parts.Shortcut;\nexport const ContextMenuSub = parts.Sub;\nexport const ContextMenuSubTrigger = parts.SubTrigger;\nexport const ContextMenuSubContent = parts.SubContent;\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Menubar as MenubarPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { createMenuParts, type MenuClasses, focusMenuEdge, stopToAncestors, type MenuItemDef } from './menu-core';\nimport { usePortalContainer } from './portal';\n\nconst MENUBAR_CLASSES: MenuClasses = {\n item: \"group/menubar-item focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive! not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-disabled:opacity-50 data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n checkboxItem:\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-1.5 ps-7 text-sm data-inset:ps-7',\n radioItem:\n \"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-1.5 ps-7 text-sm data-disabled:opacity-50 data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n indicator: \"absolute flex items-center justify-center start-1.5 size-4 [&_svg:not([class*='size-'])]:size-4\",\n label: 'px-1.5 py-1 text-sm font-medium data-inset:ps-7',\n separator: 'bg-border -mx-1 my-1 h-px',\n shortcut: 'text-muted-foreground group-focus/menubar-item:text-accent-foreground text-xs tracking-widest ms-auto',\n subTrigger:\n \"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n subContent:\n 'z-popover origin-(--radix-menubar-content-transform-origin) overflow-hidden bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg p-1 shadow-lg ring-1 duration-100',\n};\n\nconst CONTENT_CLASSES =\n 'z-popover origin-(--radix-menubar-content-transform-origin) overflow-hidden bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 ring-foreground/10 min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100';\n\n/** One menu of a data-driven `Menubar`. New in 0.8.0. */\nexport interface MenubarMenuDef {\n /** Identifies the menu within the bar; what `value` / `onValueChange` report. */\n value: string;\n label: ReactNode;\n items: readonly MenuItemDef[];\n hidden?: boolean;\n}\n\nexport interface MenubarProps extends ComponentPropsWithoutRef<typeof MenubarPrimitive.Root> {\n /** The parts: `MenubarMenu`s. Omit when passing `menus`. */\n children?: ReactNode;\n /**\n * The bar as data: a trigger and its items per menu, rendered through the parts. New in 0.8.0.\n * Use it or `children`, not both.\n */\n menus?: readonly MenubarMenuDef[];\n}\n\n/**\n * A persistent horizontal bar of menus, as in a desktop application's File / Edit / View.\n *\n * Two ways to write one:\n * - Shorthand: `<Menubar menus={[{ value, label, items }]} />`.\n * - Composition: `Menubar` > `MenubarMenu` > `MenubarTrigger` + `MenubarContent` > items.\n *\n * Built on Radix Menubar, which supplies the contract: one tab stop for the whole bar,\n * Left/Right along it, Down/Up into a menu, Left/Right from inside an open menu to its sibling,\n * and moving the pointer across the bar switching menus once one is open. Items are the same\n * parts as `DropdownMenu` (see `menu-core`). Name the bar with `aria-label` when the page has\n * more than one.\n */\nexport const Menubar = forwardRef<ElementRef<typeof MenubarPrimitive.Root>, MenubarProps>(function Menubar(\n { children, menus, className, ...props },\n ref,\n) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n loop\n data-slot=\"menubar\"\n className={cn('flex h-8 items-center gap-0.5 rounded-lg border p-[3px]', className)}\n {...props}\n >\n {menus\n ? menus\n .filter((menu) => !menu.hidden)\n .map((menu) => (\n <MenubarMenu key={menu.value} value={menu.value}>\n <MenubarTrigger>{menu.label}</MenubarTrigger>\n <MenubarContent>\n <MenubarItems items={menu.items} />\n </MenubarContent>\n </MenubarMenu>\n ))\n : children}\n </MenubarPrimitive.Root>\n );\n});\n\nexport type MenubarMenuProps = ComponentPropsWithoutRef<typeof MenubarPrimitive.Menu>;\n\nexport function MenubarMenu(props: MenubarMenuProps) {\n return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />;\n}\n\nexport function MenubarPortal(props: ComponentPropsWithoutRef<typeof MenubarPrimitive.Portal>) {\n return <MenubarPrimitive.Portal data-slot=\"menubar-portal\" {...props} />;\n}\n\nexport type MenubarTriggerProps = ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>;\n\nexport const MenubarTrigger = forwardRef<ElementRef<typeof MenubarPrimitive.Trigger>, MenubarTriggerProps>(\n function MenubarTrigger({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n data-slot=\"menubar-trigger\"\n className={cn(\n 'flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface MenubarContentProps extends ComponentPropsWithoutRef<typeof MenubarPrimitive.Content> {\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const MenubarContent = forwardRef<ElementRef<typeof MenubarPrimitive.Content>, MenubarContentProps>(\n function MenubarContent(\n { container, className, align = 'start', alignOffset = -4, sideOffset = 8, onClick, onKeyDown, onFocus, ...props },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <MenubarPrimitive.Portal container={container ?? inherited ?? undefined}>\n <MenubarPrimitive.Content\n ref={ref}\n data-slot=\"menubar-content\"\n align={align}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n collisionPadding={8}\n loop\n className={cn(CONTENT_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n // Tab leaves the menu, as in DropdownMenu and ContextMenu. Radix keeps Tab inside an\n // open menu and has no imperative close here, so Escape is replayed on the panel.\n if (event.key === 'Tab') {\n event.currentTarget.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));\n }\n }}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(MenubarPrimitive, 'menubar', MENUBAR_CLASSES);\n\n/** Renders `MenuItemDef[]` inside your own `MenubarContent`. New in 0.8.0. */\nexport const MenubarItems = parts.Items;\nexport const MenubarItem = parts.Item;\nexport const MenubarCheckboxItem = parts.CheckboxItem;\nexport const MenubarRadioGroup = parts.RadioGroup;\nexport const MenubarRadioItem = parts.RadioItem;\nexport const MenubarGroup = parts.Group;\nexport const MenubarLabel = parts.Label;\nexport const MenubarSeparator = parts.Separator;\nexport const MenubarShortcut = parts.Shortcut;\nexport const MenubarSub = parts.Sub;\nexport const MenubarSubTrigger = parts.SubTrigger;\nexport const MenubarSubContent = parts.SubContent;\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { Drawer as DrawerPrimitive } from 'vaul';\nimport { cn } from '../../lib/cn';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { composeRefs } from '../../lib/slot';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider, usePortalContainer } from './portal';\nimport { isInsideToaster } from './toaster-guard';\n\n/**\n * Drawer: a panel that slides in from an edge of the screen and can be dragged away. Built on\n * Vaul, which adds the drag to Radix Dialog's modal behaviour (focus trap, scroll lock, Escape,\n * the page behind hidden from assistive tech).\n *\n * Two ways to write one:\n * - Shorthand: `<Drawer trigger title description footer>{body}</Drawer>` renders the content,\n * header, scrolling body and footer for you.\n * - Composition: `Drawer` > `DrawerTrigger` + `DrawerContent` > `DrawerHeader` (`DrawerTitle`,\n * `DrawerDescription`) + body + `DrawerFooter`.\n *\n * `direction` sets the edge: `bottom` (default), `top`, `left` or `right`. On top of Vaul:\n * - Focus moves into the drawer on open, and returns to whatever held it on close, so a\n * controlled drawer opened by an ordinary button still hands focus back.\n * - Escape closes an open popup inside the drawer (a Select, a Combobox list) before the drawer.\n * - Pressing a toast is not an outside press.\n * - Popups inside the drawer that are not Radix parts portal into it.\n *\n * Vaul calls `window.matchMedia` when a drawer opens and `setPointerCapture` when one is pressed;\n * jsdom has neither, so a test environment needs both stubbed.\n */\n\nexport type DrawerDirection = 'top' | 'right' | 'bottom' | 'left';\n\n// ── Naming ──────────────────────────────────────────────────────────────────────\n\n/**\n * Lets the content know which naming parts are rendered: without a `DrawerTitle`, `label`\n * becomes a visually hidden title; without a `DrawerDescription`, `aria-describedby` is left\n * off instead of pointing at an id that is not in the document.\n */\ninterface DrawerNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst DrawerNaming = createContext<DrawerNamingContext | null>(null);\n\n// ── Parts ───────────────────────────────────────────────────────────────────────\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>>(\n function DrawerTrigger(props, ref) {\n return <DrawerPrimitive.Trigger ref={ref} data-slot=\"drawer-trigger\" {...props} />;\n },\n);\n\nexport function DrawerPortal({ container, ...props }: ComponentProps<typeof DrawerPrimitive.Portal>) {\n const provided = usePortalContainer();\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" container={container ?? provided ?? undefined} {...props} />;\n}\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Close>>(\n function DrawerClose(props, ref) {\n return <DrawerPrimitive.Close ref={ref} data-slot=\"drawer-close\" {...props} />;\n },\n);\n\nexport const DrawerOverlay = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>>(\n function DrawerOverlay({ className, ...props }, ref) {\n return (\n <DrawerPrimitive.Overlay\n ref={ref}\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface DrawerContentProps extends ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> {\n /** Accessible name when the drawer renders no `DrawerTitle` (a visually hidden title). */\n label?: string;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Where to portal the drawer. Default: the enclosing dialog or drawer, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { container, ...props },\n ref,\n) {\n return (\n <DrawerPortal container={container ?? undefined}>\n <DrawerOverlay />\n <DrawerPanel ref={ref} {...props} />\n </DrawerPortal>\n );\n});\n\n/**\n * The panel itself. A separate component inside the portal, so it mounts only while the drawer\n * is open: the element to return focus to is read on open.\n */\nconst DrawerPanel = forwardRef<HTMLDivElement, Omit<DrawerContentProps, 'container'>>(function DrawerPanel(\n {\n className,\n children,\n label,\n initialFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n ...props\n },\n ref,\n) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n // Read during the first render, before focus moves into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DrawerPrimitive.Content\n ref={composeRefs(ref, setContentNode)}\n data-slot=\"drawer-content\"\n // Only point at a description that exists.\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t',\n 'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b',\n className,\n )}\n onOpenAutoFocus={(event) => {\n onOpenAutoFocus?.(event);\n const target = initialFocus?.current;\n if (target && !event.defaultPrevented) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n // Radix returns focus only to its own trigger; a controlled drawer opened by an\n // ordinary button would drop focus to <body>.\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n onPointerDownOutside?.(event);\n }}\n {...props}\n >\n <div\n data-slot=\"drawer-handle\"\n aria-hidden\n className=\"mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block\"\n />\n {!hasTitle && label && <DrawerPrimitive.Title className=\"sr-only\">{label}</DrawerPrimitive.Title>}\n <DrawerNaming.Provider value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}>\n <PortalContainerProvider container={contentNode}>{children}</PortalContainerProvider>\n </DrawerNaming.Provider>\n </DrawerPrimitive.Content>\n );\n});\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"drawer-header\"\n className={cn(\n 'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-start',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"drawer-footer\" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />\n );\n});\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>>(\n function DrawerTitle({ className, ...props }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n return (\n <DrawerPrimitive.Title\n ref={ref}\n data-slot=\"drawer-title\"\n className={cn('text-base font-medium text-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nexport const DrawerDescription = forwardRef<\n HTMLParagraphElement,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(function DrawerDescription({ className, ...props }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n return (\n <DrawerPrimitive.Description\n ref={ref}\n data-slot=\"drawer-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\n// ── Root (with the shorthand) ───────────────────────────────────────────────────\n\nexport interface DrawerShorthandProps {\n /** Shorthand: an element that opens the drawer (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: the title. With it, the drawer renders its own content, header, body and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: the footer's content, usually the buttons. */\n footer?: ReactNode;\n /** Shorthand: classes for the content panel. */\n className?: string;\n /** Shorthand: props for the content panel (`label`, `initialFocus`, `onEscapeKeyDown`, …). */\n contentProps?: Omit<DrawerContentProps, 'children' | 'className'>;\n}\n\nexport type DrawerProps = ComponentProps<typeof DrawerPrimitive.Root> & DrawerShorthandProps;\n\nexport function Drawer({\n trigger,\n title,\n description,\n footer,\n className,\n contentProps,\n children,\n autoFocus = true,\n ...props\n}: DrawerProps) {\n // Vaul's `autoFocus` moves focus into the drawer on open (Radix's default), not onto a field\n // on page load, which is what the lint rule is about.\n const root = { ...props, autoFocus };\n\n if (title === undefined) {\n return (\n <DrawerPrimitive.Root {...root}>\n {trigger && <DrawerTrigger asChild>{trigger}</DrawerTrigger>}\n {children}\n </DrawerPrimitive.Root>\n );\n }\n\n return (\n <DrawerPrimitive.Root {...root}>\n {trigger && <DrawerTrigger asChild>{trigger}</DrawerTrigger>}\n <DrawerContent className={className} {...contentProps}>\n <DrawerHeader>\n <DrawerTitle>{title}</DrawerTitle>\n {description !== undefined && <DrawerDescription>{description}</DrawerDescription>}\n </DrawerHeader>\n {children !== undefined && (\n <ScrollArea data-slot=\"drawer-body\" className=\"min-h-0 flex-1\" viewportProps={{ className: 'px-4' }}>\n {children}\n </ScrollArea>\n )}\n {footer !== undefined && <DrawerFooter>{footer}</DrawerFooter>}\n </DrawerContent>\n </DrawerPrimitive.Root>\n );\n}\n","import { forwardRef, useCallback, useEffect, useRef, useState, type ComponentPropsWithoutRef, type ElementRef, type Ref } from 'react';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\n\nexport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\n/**\n * ScrollArea: augments native scroll functionality for custom, cross-browser styling.\n *\n * Built on Radix ScrollArea: the content scrolls natively in a viewport, and the scrollbars are\n * drawn (a 10px track with a rounded thumb) so they look the same in every browser.\n *\n * Two ways to write one:\n * - Shorthand: `<ScrollArea axis=\"horizontal\">` renders the scrollbars for the axis\n * (`vertical`, the default, `horizontal` or `both`).\n * - Composition: a `<ScrollBar orientation=\"horizontal\" />` child adds a horizontal scrollbar\n * next to the default vertical one.\n *\n * A scroll container is not keyboard focusable in Chrome or Safari, so the viewport becomes a\n * tab stop, and a region named by `aria-label`, only while it actually overflows.\n *\n * Radix measures the viewport with `ResizeObserver`, which a bare jsdom lacks: tests that render\n * a ScrollArea (the `Sidebar` has one) need a stub.\n */\n\nexport type ScrollAreaAxis = 'vertical' | 'horizontal' | 'both';\n\nexport interface ScrollAreaProps extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /** Shorthand: which scrollbars to render. Default `vertical`. */\n axis?: ScrollAreaAxis;\n /** Names the viewport, which becomes a focusable region while it overflows. */\n 'aria-label'?: string;\n /** Props for the viewport, the element that scrolls. */\n viewportProps?: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Viewport>;\n /** A ref to the viewport, the element that scrolls (to read or set its scroll position). */\n viewportRef?: Ref<HTMLDivElement>;\n}\n\nexport const ScrollArea = forwardRef<ElementRef<typeof ScrollAreaPrimitive.Root>, ScrollAreaProps>(function ScrollArea(\n { className, children, axis = 'vertical', 'aria-label': ariaLabel, viewportProps, viewportRef: outerRef, ...props },\n ref,\n) {\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const setViewport = useCallback(\n (node: HTMLDivElement | null) => {\n viewportRef.current = node;\n if (typeof outerRef === 'function') outerRef(node);\n else if (outerRef) (outerRef as { current: HTMLDivElement | null }).current = node;\n },\n [outerRef],\n );\n const [overflows, setOverflows] = useState(false);\n\n useEffect(() => {\n const node = viewportRef.current;\n if (!node) return;\n const measure = () =>\n setOverflows(node.scrollHeight > node.clientHeight + 1 || node.scrollWidth > node.clientWidth + 1);\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n if (node.firstElementChild) observer.observe(node.firstElementChild);\n return () => observer.disconnect();\n }, [children]);\n\n return (\n <ScrollAreaPrimitive.Root ref={ref} data-slot=\"scroll-area\" className={cn('relative', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n {...viewportProps}\n ref={setViewport}\n data-slot=\"scroll-area-viewport\"\n // Only a focusable, named region while it overflows: otherwise no tab stop, no landmark.\n role={overflows && ariaLabel ? 'region' : undefined}\n aria-label={overflows ? ariaLabel : undefined}\n tabIndex={overflows ? 0 : undefined}\n className={cn(\n 'size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1',\n viewportProps?.className,\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n {axis !== 'horizontal' && <ScrollBar />}\n {axis !== 'vertical' && <ScrollBar orientation=\"horizontal\" />}\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n});\n\nexport type ScrollBarProps = ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>;\n\nexport const ScrollBar = forwardRef<ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>, ScrollBarProps>(\n function ScrollBar({ className, orientation = 'vertical', ...props }, ref) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n data-orientation={orientation}\n orientation={orientation}\n className={cn(\n 'flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"relative flex-1 rounded-full bg-border\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Dialog as SheetPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { Button } from '../forms/button';\n\n/**\n * Sheet: extends the Dialog component to display content that complements the main content of\n * the screen.\n *\n * Built on Radix Dialog: a modal panel that slides in from an edge (`side`: top, right — the\n * default — bottom or left). Use it for a side panel of filters, settings or navigation; for a\n * draggable panel from the bottom, use `Drawer`.\n *\n * Two ways to write one:\n * - Shorthand: `<Sheet trigger={…} title=\"Edit profile\" description=\"…\" footer={…}>{body}</Sheet>`\n * renders the content, header and footer; `side`, `showCloseButton` and `className` go to the\n * panel, `contentProps` to `SheetContent`.\n * - Composition: `SheetTrigger` and `SheetContent` > `SheetHeader` (`SheetTitle`,\n * `SheetDescription`), the body, `SheetFooter`.\n */\n\nexport type SheetSide = 'top' | 'right' | 'bottom' | 'left';\n\nexport const SheetTrigger = forwardRef<\n ElementRef<typeof SheetPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger>\n>(function SheetTrigger(props, ref) {\n return <SheetPrimitive.Trigger ref={ref} data-slot=\"sheet-trigger\" {...props} />;\n});\n\nexport const SheetClose = forwardRef<\n ElementRef<typeof SheetPrimitive.Close>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Close>\n>(function SheetClose(props, ref) {\n return <SheetPrimitive.Close ref={ref} data-slot=\"sheet-close\" {...props} />;\n});\n\nexport function SheetPortal(props: ComponentPropsWithoutRef<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nexport const SheetOverlay = forwardRef<\n ElementRef<typeof SheetPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(function SheetOverlay({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Overlay\n ref={ref}\n data-slot=\"sheet-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface SheetContentProps extends ComponentPropsWithoutRef<typeof SheetPrimitive.Content> {\n /** The edge the sheet slides in from. Default `right`. */\n side?: SheetSide;\n /** The × button in the top corner. Default `true`. */\n showCloseButton?: boolean;\n}\n\nexport const SheetContent = forwardRef<ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(\n function SheetContent({ className, children, side = 'right', showCloseButton = true, ...props }, ref) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n ref={ref}\n data-slot=\"sheet-content\"\n data-side={side}\n className={cn(\n 'fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out',\n 'data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t',\n 'data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:sm:max-w-sm',\n 'data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:sm:max-w-sm',\n 'data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b',\n 'data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10',\n 'data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <SheetPrimitive.Close data-slot=\"sheet-close\" asChild>\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"absolute top-3 right-3\">\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </Button>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n );\n },\n);\n\nexport const SheetHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function SheetHeader(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"sheet-header\" className={cn('flex flex-col gap-0.5 p-4', className)} {...props} />;\n});\n\nexport const SheetFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function SheetFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"sheet-footer\" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />\n );\n});\n\nexport const SheetTitle = forwardRef<\n ElementRef<typeof SheetPrimitive.Title>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(function SheetTitle({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Title\n ref={ref}\n data-slot=\"sheet-title\"\n className={cn('text-base font-medium text-foreground', className)}\n {...props}\n />\n );\n});\n\nexport const SheetDescription = forwardRef<\n ElementRef<typeof SheetPrimitive.Description>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(function SheetDescription({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Description\n ref={ref}\n data-slot=\"sheet-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\nexport interface SheetProps extends ComponentPropsWithoutRef<typeof SheetPrimitive.Root> {\n /** Shorthand: an element that opens the sheet (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: the title. With it, the sheet renders its own content, header and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: the footer's content, usually the buttons. */\n footer?: ReactNode;\n /** Shorthand: the edge the sheet slides in from. Default `right`. */\n side?: SheetSide;\n /** Shorthand: the × button. Default `true`. */\n showCloseButton?: boolean;\n /** Shorthand: classes for the panel, e.g. a width (`sm:max-w-md`). */\n className?: string;\n /** Shorthand: props for `SheetContent` (`onEscapeKeyDown`, `onOpenAutoFocus`, …). */\n contentProps?: Omit<SheetContentProps, 'children' | 'className' | 'side' | 'showCloseButton'>;\n}\n\nexport function Sheet({\n trigger,\n title,\n description,\n footer,\n side,\n showCloseButton,\n className,\n contentProps,\n children,\n ...props\n}: SheetProps) {\n if (title === undefined) {\n return (\n <SheetPrimitive.Root data-slot=\"sheet\" {...props}>\n {trigger && <SheetTrigger asChild>{trigger}</SheetTrigger>}\n {children}\n </SheetPrimitive.Root>\n );\n }\n\n return (\n <SheetPrimitive.Root data-slot=\"sheet\" {...props}>\n {trigger && <SheetTrigger asChild>{trigger}</SheetTrigger>}\n <SheetContent side={side} showCloseButton={showCloseButton} className={className} {...contentProps}>\n <SheetHeader>\n <SheetTitle>{title}</SheetTitle>\n {description !== undefined && <SheetDescription>{description}</SheetDescription>}\n </SheetHeader>\n {children !== undefined && (\n <ScrollArea data-slot=\"sheet-body\" className=\"min-h-0 flex-1\" viewportProps={{ className: 'px-4' }}>\n {children}\n </ScrollArea>\n )}\n {footer !== undefined && <SheetFooter>{footer}</SheetFooter>}\n </SheetContent>\n </SheetPrimitive.Root>\n );\n}\n","import {\n forwardRef,\n useState,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react';\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonProps } from '../forms/button';\nimport { usePortalContainer } from './portal';\n\n/**\n * AlertDialog: a modal dialog that interrupts the user with important content and expects a\n * response. Use it to confirm or cancel; for anything with a form inside, use a Dialog.\n *\n * Two ways to write one:\n * - Shorthand: `<AlertDialog open title description confirmLabel onConfirm onOpenChange />`,\n * the confirm preset (it replaces `ConfirmDialog`). If `onConfirm` returns a promise the\n * confirm button spins and the dialog closes when it settles; pass `isConfirming` to drive\n * that yourself.\n * - Composition: the standard parts, from `AlertDialogTrigger` to `AlertDialogAction`.\n *\n * Built on Radix AlertDialog: `role=\"alertdialog\"`, focus starts on Cancel, an outside press\n * does not dismiss, Escape does (except while confirming). Every part carries `data-slot`.\n */\n\nexport type AlertDialogSize = 'default' | 'sm';\nexport type AlertDialogTone = 'default' | 'destructive' | 'success' | 'warning' | 'info';\n\nconst TONE_MEDIA: Record<AlertDialogTone, string> = {\n default: 'bg-muted text-foreground',\n destructive: 'bg-destructive/10 text-destructive',\n success: 'bg-success/10 text-success',\n warning: 'bg-warning/10 text-warning',\n info: 'bg-primary/10 text-primary',\n};\n\nconst TONE_ICON: Record<Exclude<AlertDialogTone, 'default'>, ReactNode> = {\n destructive: <CircleAlertIcon />,\n success: <CircleCheckIcon />,\n warning: <TriangleAlertIcon />,\n info: <InfoIcon />,\n};\n\n// ── Parts ───────────────────────────────────────────────────────────────────────\n\nexport const AlertDialogTrigger = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Trigger>>(\n function AlertDialogTrigger(props, ref) {\n return <AlertDialogPrimitive.Trigger ref={ref} data-slot=\"alert-dialog-trigger\" {...props} />;\n },\n);\n\nexport function AlertDialogPortal({ container, ...props }: ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Portal>) {\n const provided = usePortalContainer();\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" container={container ?? provided ?? undefined} {...props} />;\n}\n\nexport const AlertDialogOverlay = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>>(\n function AlertDialogOverlay({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface AlertDialogContentProps extends ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n size?: AlertDialogSize;\n}\n\nexport const AlertDialogContent = forwardRef<HTMLDivElement, AlertDialogContentProps>(function AlertDialogContent(\n { className, size = 'default', ...props },\n ref,\n) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none',\n 'data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n );\n});\n\nexport function AlertDialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center',\n 'has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4',\n 'sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left',\n 'sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function AlertDialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n '-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4',\n 'group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport const AlertDialogTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>>(\n function AlertDialogTitle({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-base font-medium',\n 'sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const AlertDialogDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>>(\n function AlertDialogDescription({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n className={cn(\n 'text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface AlertDialogMediaProps extends HTMLAttributes<HTMLDivElement> {\n /** Platned addition: tints the media box with a theme role. Default `default` (muted). */\n tone?: AlertDialogTone;\n}\n\nexport function AlertDialogMedia({ className, tone = 'default', ...props }: AlertDialogMediaProps) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n data-tone={tone}\n className={cn(\n \"mb-2 inline-flex size-10 items-center justify-center rounded-md *:[svg:not([class*='size-'])]:size-6\",\n 'sm:group-data-[size=default]/alert-dialog-content:row-span-2',\n TONE_MEDIA[tone],\n className,\n )}\n {...props}\n />\n );\n}\n\ntype ButtonLook = Pick<ButtonProps, 'variant' | 'size'>;\n\nexport const AlertDialogAction = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> & ButtonLook & Pick<ButtonProps, 'loading' | 'loadingLabel'>>(\n function AlertDialogAction({ className, variant = 'default', size = 'default', loading, loadingLabel, children, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Action asChild {...props}>\n <Button ref={ref} data-slot=\"alert-dialog-action\" variant={variant} size={size} loading={loading} loadingLabel={loadingLabel} className={className}>\n {children}\n </Button>\n </AlertDialogPrimitive.Action>\n );\n },\n);\n\nexport const AlertDialogCancel = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> & ButtonLook>(\n function AlertDialogCancel({ className, variant = 'outline', size = 'default', children, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Cancel asChild {...props}>\n <Button ref={ref} data-slot=\"alert-dialog-cancel\" variant={variant} size={size} className={className}>\n {children}\n </Button>\n </AlertDialogPrimitive.Cancel>\n );\n },\n);\n\n// ── Root (with the confirm shorthand) ───────────────────────────────────────────────\n\nexport interface AlertDialogProps extends ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root> {\n /** Shorthand: the title. With it, the dialog renders its own content, header and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: an icon or image in the media box. Default: the tone's icon (none for `default`). */\n media?: ReactNode;\n /** Shorthand: tints the media box. Default `default`. */\n tone?: AlertDialogTone;\n /** Shorthand: an element that opens the dialog (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: content size. Default `default`. */\n size?: AlertDialogSize;\n confirmLabel?: ReactNode;\n cancelLabel?: ReactNode;\n /** Shorthand: the confirm button's look. Default `primary`. */\n confirmVariant?: ButtonProps['variant'];\n /** Shorthand: disables only the confirm button; Cancel and Escape still dismiss. */\n confirmDisabled?: boolean;\n /**\n * Shorthand: a request is in flight. The confirm button spins, Cancel is disabled and the\n * dialog cannot be dismissed. While this prop is set, confirming does not close the dialog;\n * you close it.\n */\n isConfirming?: boolean;\n /** Announced on the confirm button while confirming. Default \"Working…\". */\n confirmingLabel?: string;\n /** Shorthand: called on confirm. Return a promise to keep the dialog open until it settles. */\n onConfirm?: () => void | Promise<unknown>;\n}\n\nexport function AlertDialog({\n title,\n description,\n media,\n tone = 'default',\n trigger,\n size,\n confirmLabel = 'Continue',\n cancelLabel = 'Cancel',\n confirmVariant = 'default',\n confirmDisabled = false,\n isConfirming,\n confirmingLabel = 'Working…',\n onConfirm,\n open: openProp,\n defaultOpen,\n onOpenChange,\n children,\n ...rest\n}: AlertDialogProps) {\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const [pending, setPending] = useState(false);\n const controlled = openProp !== undefined;\n const open = controlled ? openProp : innerOpen;\n const busy = Boolean(isConfirming) || pending;\n\n const setOpen = (next: boolean) => {\n if (!next && busy) return;\n if (!controlled) setInnerOpen(next);\n onOpenChange?.(next);\n };\n\n if (title === undefined) {\n return (\n <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" open={openProp} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...rest}>\n {children}\n </AlertDialogPrimitive.Root>\n );\n }\n\n const handleConfirm = (event: MouseEvent<HTMLButtonElement>) => {\n const result = onConfirm?.();\n if (isConfirming !== undefined) {\n event.preventDefault();\n return;\n }\n if (result && typeof (result as Promise<unknown>).then === 'function') {\n event.preventDefault();\n setPending(true);\n (result as Promise<unknown>).then(\n () => {\n setPending(false);\n if (!controlled) setInnerOpen(false);\n onOpenChange?.(false);\n },\n () => setPending(false),\n );\n }\n };\n\n const glyph = media ?? (tone === 'default' ? null : TONE_ICON[tone]);\n\n return (\n <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" open={open} onOpenChange={setOpen} {...rest}>\n {trigger && <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger>}\n <AlertDialogContent size={size} onEscapeKeyDown={(e) => busy && e.preventDefault()}>\n <AlertDialogHeader>\n {glyph && <AlertDialogMedia tone={tone}>{glyph}</AlertDialogMedia>}\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {description !== undefined ? (\n <AlertDialogDescription>{description}</AlertDialogDescription>\n ) : (\n // Radix warns without a description; an empty, hidden one keeps it quiet.\n <AlertDialogDescription className=\"sr-only\" />\n )}\n </AlertDialogHeader>\n {children}\n <AlertDialogFooter>\n <AlertDialogCancel disabled={busy}>{cancelLabel}</AlertDialogCancel>\n <AlertDialogAction\n variant={confirmVariant}\n disabled={confirmDisabled}\n loading={busy}\n loadingLabel={confirmingLabel}\n onClick={handleConfirm}\n >\n {busy ? confirmingLabel : confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialogPrimitive.Root>\n );\n}\n","import type { ReactNode } from 'react';\nimport { Direction } from 'radix-ui';\nimport { DirectionProvider as BaseDirectionProvider } from '@base-ui/react/direction-provider';\n\nexport type TextDirection = 'ltr' | 'rtl';\n\nexport interface DirectionProviderProps {\n /** The reading direction for everything inside. */\n direction?: TextDirection;\n /** Same as `direction`; `direction` wins when both are set. */\n dir?: TextDirection;\n children?: ReactNode;\n}\n\n/**\n * Sets the text direction (`ltr` or `rtl`) for the components inside it: menus, popovers,\n * selects, sliders, tabs and comboboxes read it for keyboard arrows, side and alignment.\n *\n * It does not set the `dir` attribute: put `dir=\"rtl\"` on `<html>` (or a wrapper) as well, so\n * the browser lays text out right to left and the logical classes (`ms-*`, `start-*`) flip.\n *\n * Feeds both the Radix and the Base UI direction contexts, since the library uses both.\n */\nexport function DirectionProvider({ direction, dir, children }: DirectionProviderProps) {\n const value = direction ?? dir ?? 'ltr';\n return (\n <Direction.DirectionProvider dir={value}>\n <BaseDirectionProvider direction={value}>{children}</BaseDirectionProvider>\n </Direction.DirectionProvider>\n );\n}\n\n/** The direction set by the nearest `DirectionProvider`, else `ltr`. */\nexport function useDirection(): TextDirection {\n return Direction.useDirection() ?? 'ltr';\n}\n","import { Children, isValidElement, type ElementType, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Card: displays a card with header, content, and footer.\n *\n * `size` (`default` / `sm`) sets the `--card-spacing` variable (16px / 12px) that every part uses\n * for its inset and the gap between sections; override the variable for other spacings.\n *\n * Shorthand: `title`, `description`, `action`, `image` and `footer` render the matching parts,\n * and plain children go in `CardContent`. Composition: `CardHeader` (`CardTitle`,\n * `CardDescription`, `CardAction`), `CardContent`, `CardFooter`; an `<img>` placed first goes edge\n * to edge.\n */\n\nexport type CardSize = 'default' | 'sm';\n\nexport interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Default `default`. */\n size?: CardSize;\n /** Shorthand: the `CardTitle`. */\n title?: ReactNode;\n /** Shorthand: the `CardDescription`. */\n description?: ReactNode;\n /** Shorthand: the `CardAction`, top right of the header. */\n action?: ReactNode;\n /** Shorthand: an `<img>` before the header, edge to edge. */\n image?: ReactNode;\n /** Shorthand: the `CardFooter` content. */\n footer?: ReactNode;\n}\n\nconst PARTS = new Set<unknown>();\n/** Composition when any child is a Card part; otherwise the children are the content. */\nconst isComposed = (children: ReactNode) =>\n Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n\nexport function Card({ size = 'default', title, description, action, image, footer, className, children, ...props }: CardProps) {\n const hasHeader = title != null || description != null || action != null;\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n >\n {image}\n {hasHeader && (\n <CardHeader>\n {title != null && <CardTitle>{title}</CardTitle>}\n {description != null && <CardDescription>{description}</CardDescription>}\n {action != null && <CardAction>{action}</CardAction>}\n </CardHeader>\n )}\n {children == null || isComposed(children) ? children : <CardContent>{children}</CardContent>}\n {footer != null && <CardFooter>{footer}</CardFooter>}\n </div>\n );\n}\n\nexport function CardHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLElement> {\n /** The element, e.g. `h2` to make the title a heading. Default `div`. */\n as?: ElementType;\n}\n\nexport function CardTitle({ as: Tag = 'div', className, ...props }: CardTitleProps) {\n return (\n <Tag\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nexport function CardDescription({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"card-description\" className={cn('text-sm text-muted-foreground', className)} {...props} />;\n}\n\n/** Content at the top end of the header, e.g. a button or a badge. */\nexport function CardAction({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nexport function CardContent({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nPARTS.add(CardHeader);\nPARTS.add(CardContent);\nPARTS.add(CardFooter);\n","import { createContext, useContext, useLayoutEffect, type ReactNode } from 'react';\n\nimport type { MenuItemDef } from '../overlays/menu-core';\n\n/**\n * How a dashboard (`@platned/ui/blocks`) tells its cards they are being arranged. In Customize mode\n * each slot provides this; a card that reads it (the blocks' card frame, StatCard) draws the\n * controls in its own header: the drag handle before its title, and Size and Remove in its `⋯`\n * menu. A card that does not read it (an app's own widget) gets the controls on its corner.\n *\n * It lives in the main entry so the blocks and map entries, which import this one, share it.\n * Internal to the library's blocks: apps don't provide or read it.\n */\nexport interface DashboardEditControls {\n /** The widget's name, for the controls' labels. */\n name: string;\n /** Locked widgets can't be moved, resized or removed: no handle, a lock in place of the menu. */\n locked: boolean;\n /** The drag handle, drawn before the card's title. */\n handle?: ReactNode;\n /** The arranging entries for the card's `⋯` menu (Size, Remove), replacing its own actions. */\n menu: MenuItemDef[];\n /** Called by a card that draws the controls itself, so the slot adds none on its corner. */\n claim: () => void;\n}\n\nexport const DashboardEditContext = createContext<DashboardEditControls | null>(null);\n\n/** The arranging controls when the card sits in a dashboard being customized, else `null`. */\nexport function useDashboardEdit(): DashboardEditControls | null {\n const edit = useContext(DashboardEditContext);\n useLayoutEffect(() => edit?.claim(), [edit]);\n return edit;\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n type ComponentPropsWithoutRef,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { Accordion as AccordionPrimitive } from 'radix-ui';\nimport { ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Accordion: a vertically stacked set of headings that each reveal a section of content.\n *\n * Three ways to write one, all rendering the same parts:\n * 1. Data: `items={[{ title, content }]}`, or any objects plus `renderTitle` / `renderContent`.\n * 2. Shorthand: `<AccordionItem value=\"a\" title=\"…\">content</AccordionItem>`.\n * 3. Composition: `AccordionItem` > `AccordionTrigger` + `AccordionContent`, the standard parts.\n *\n * Built on Radix Accordion. Every part takes the Radix part's props (`asChild`, `dir`,\n * `orientation`, `forceMount`, …) and carries `data-slot` and `data-state`. Closed content is\n * unmounted (kept only while the close animation runs), so a closed section is never tabbable.\n * `headingLevel` sets the heading that wraps each trigger (h3 by default).\n */\n\nexport type AccordionType = 'single' | 'multiple';\n\nconst HeadingLevel = createContext<2 | 3 | 4 | 5 | 6>(3);\n\n/** One section as data, for `items`. `value` defaults to the item's index. */\nexport interface AccordionItemDef {\n value?: string;\n title: ReactNode;\n /** A muted second line under the title. */\n description?: ReactNode;\n /** An icon before the title. */\n icon?: ReactNode;\n /** Something after the title, before the chevron: a badge, a count. */\n badge?: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n hidden?: boolean;\n}\n\ntype RootPrimitiveProps = Omit<\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>,\n 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'collapsible' | 'children'\n>;\n\nexport interface AccordionProps<T = AccordionItemDef> extends RootPrimitiveProps {\n /** The parts. Omit when passing `items`. */\n children?: ReactNode;\n /** The sections as data. Use it or `children`, not both. */\n items?: readonly T[];\n /** The value of a data item. Default: `item.value`, else its index. */\n getValue?: (item: T, index: number) => string;\n /** The trigger content of a data item. Default: `item.title` (with `icon`, `description`, `badge`). */\n renderTitle?: (item: T, index: number) => ReactNode;\n /** The content of a data item. Default: `item.content`. */\n renderContent?: (item: T, index: number) => ReactNode;\n /** Whether a data item is disabled. Default: `item.disabled`. */\n getDisabled?: (item: T, index: number) => boolean;\n /** `single` opens one item at a time; `multiple` lets any number be open. Default `single`. */\n type?: AccordionType;\n /** Open item value(s): a string for `single`, an array for `multiple`. */\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** In `single` mode, allow closing the open item by clicking it. Default `false`. */\n collapsible?: boolean;\n /** Heading level wrapping each trigger. Default `3`. Match the surrounding page outline. */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n}\n\nconst field = <K extends keyof AccordionItemDef>(item: unknown, key: K) =>\n (item as Partial<AccordionItemDef> | null)?.[key];\n\nfunction AccordionRoot<T>(\n {\n children: childrenProp,\n items,\n getValue,\n renderTitle,\n renderContent,\n getDisabled,\n type = 'single',\n value,\n defaultValue,\n onValueChange,\n collapsible = false,\n headingLevel = 3,\n className,\n ...rest\n }: AccordionProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const children = items\n ? items.map((item, index) => {\n if (field(item, 'hidden')) return null;\n const itemValue = getValue ? getValue(item, index) : (field(item, 'value') ?? String(index));\n return (\n <AccordionItem\n key={itemValue}\n value={itemValue}\n disabled={getDisabled ? getDisabled(item, index) : Boolean(field(item, 'disabled'))}\n title={renderTitle ? renderTitle(item, index) : field(item, 'title')}\n description={renderTitle ? undefined : field(item, 'description')}\n icon={renderTitle ? undefined : field(item, 'icon')}\n badge={renderTitle ? undefined : field(item, 'badge')}\n >\n {renderContent ? renderContent(item, index) : field(item, 'content')}\n </AccordionItem>\n );\n })\n : childrenProp;\n\n const shared = { ref, 'data-slot': 'accordion', className: cn('flex w-full flex-col', className), ...rest };\n\n const root =\n type === 'multiple' ? (\n <AccordionPrimitive.Root\n type=\"multiple\"\n value={value === undefined ? undefined : toArray(value)}\n defaultValue={defaultValue === undefined ? undefined : toArray(defaultValue)}\n onValueChange={onValueChange as ((value: string[]) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n ) : (\n <AccordionPrimitive.Root\n type=\"single\"\n collapsible={collapsible}\n value={value === undefined ? undefined : toSingle(value)}\n defaultValue={defaultValue === undefined ? undefined : toSingle(defaultValue)}\n onValueChange={onValueChange as ((value: string) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n );\n\n return <HeadingLevel.Provider value={headingLevel}>{root}</HeadingLevel.Provider>;\n}\n\n/** Generic over the item type, so `renderTitle(item)` is typed by what you pass to `items`. */\nexport const Accordion = forwardRef(AccordionRoot) as <T = AccordionItemDef>(\n props: AccordionProps<T> & RefAttributes<HTMLDivElement>,\n) => ReactElement | null;\n\nconst toArray = (value: string | string[]) => (Array.isArray(value) ? value : value ? [value] : []);\nconst toSingle = (value: string | string[]) => (Array.isArray(value) ? (value[0] ?? '') : value);\n\nexport interface AccordionItemProps extends Omit<ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>, 'title'> {\n /**\n * Shorthand: with `title`, the item renders its own trigger, and its children become the\n * content. Without it, compose `AccordionTrigger` and `AccordionContent` yourself.\n */\n title?: ReactNode;\n /** Shorthand: a muted second line under the title. */\n description?: ReactNode;\n /** Shorthand: an icon before the title. */\n icon?: ReactNode;\n /** Shorthand: something after the title, before the chevron. */\n badge?: ReactNode;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem(\n { className, title, description, icon, badge, children, ...rest },\n ref,\n) {\n const shorthand = title !== undefined && title !== null;\n return (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn('not-last:border-b', className)}\n {...rest}\n >\n {shorthand ? (\n <>\n <AccordionTrigger className={hasSlots({ description, icon, badge }) ? 'hover:no-underline' : undefined}>\n <AccordionTitle title={title} description={description} icon={icon} badge={badge} />\n </AccordionTrigger>\n <AccordionContent>{children}</AccordionContent>\n </>\n ) : (\n children\n )}\n </AccordionPrimitive.Item>\n );\n});\n\nconst hasSlots = ({ description, icon, badge }: Pick<AccordionItemProps, 'description' | 'icon' | 'badge'>) =>\n Boolean(description || icon || badge);\n\n/**\n * The shorthand trigger layout. First line: icon, title, badge. Second line: the description,\n * starting at the trigger's start edge (under the icon), not indented under the title.\n *\n * Only the title underlines on hover. A text decoration on the trigger would run through the\n * badge and the description too (CSS gives descendants no way to opt out), so with slots the\n * trigger drops its own underline and the title takes it from the trigger's hover group.\n */\nfunction AccordionTitle({ title, description, icon, badge }: Pick<AccordionItemProps, 'title' | 'description' | 'icon' | 'badge'>) {\n if (!hasSlots({ description, icon, badge })) return <>{title}</>;\n return (\n <span data-slot=\"accordion-title\" className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"flex min-w-0 items-start gap-3\">\n {icon && (\n <span aria-hidden className=\"flex h-5 shrink-0 items-center text-muted-foreground [&_svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 underline-offset-4 group-hover/accordion-trigger:underline\">{title}</span>\n {badge && <span className=\"flex shrink-0 items-center\">{badge}</span>}\n </span>\n {description && <span className=\"font-normal text-muted-foreground\">{description}</span>}\n </span>\n );\n}\n\nexport interface AccordionTriggerProps extends ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {\n /** Hide the chevron, for a trigger that supplies its own affordance. */\n hideIndicator?: boolean;\n}\n\nexport const AccordionTrigger = forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n function AccordionTrigger({ children, hideIndicator = false, className, ...rest }, ref) {\n const level = useContext(HeadingLevel);\n const Heading = `h${level}` as 'h3';\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"m-0 flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n 'group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none',\n 'hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring',\n 'disabled:pointer-events-none disabled:opacity-50',\n '**:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground',\n className,\n )}\n {...rest}\n >\n {children}\n {!hideIndicator && (\n <>\n <ChevronDownIcon\n aria-hidden\n data-slot=\"accordion-trigger-icon\"\n className=\"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden\"\n />\n <ChevronUpIcon\n aria-hidden\n data-slot=\"accordion-trigger-icon\"\n className=\"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline\"\n />\n </>\n )}\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n },\n);\n\nexport type AccordionContentProps = ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>;\n\n/** `className` styles the inner box (the padding), so the height animation stays on the outer one. */\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n function AccordionContent({ className, children, ...rest }, ref) {\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className=\"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up\"\n {...rest}\n >\n <div\n className={cn(\n 'h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',\n className,\n )}\n >\n {children}\n </div>\n </AccordionPrimitive.Content>\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\n\nexport interface CollapsibleProps extends ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root> {\n /**\n * Shorthand: the trigger's label. Renders a full-width ghost button with a chevron that turns\n * when open, and wraps `children` in `CollapsibleContent`. Leave it out to compose the parts.\n */\n trigger?: ReactNode;\n}\n\n/**\n * A show/hide region with a trigger, on Radix Collapsible. The trigger carries `aria-expanded`\n * and `aria-controls`, the content is removed while closed, and every part has\n * `data-state=\"open\" | \"closed\"`. The open content exposes `--radix-collapsible-content-height`\n * for a height animation.\n */\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { trigger, className, children, ...props },\n ref,\n) {\n if (trigger === undefined) {\n return (\n <CollapsiblePrimitive.Root ref={ref} data-slot=\"collapsible\" className={className} {...props}>\n {children}\n </CollapsiblePrimitive.Root>\n );\n }\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n data-slot=\"collapsible\"\n className={cn('rounded-md data-[state=open]:bg-muted', className)}\n {...props}\n >\n <CollapsibleTrigger asChild>\n <Button variant=\"ghost\" className=\"group w-full\">\n {trigger}\n <ChevronDownIcon className=\"ml-auto group-data-[state=open]:rotate-180\" />\n </Button>\n </CollapsibleTrigger>\n <CollapsibleContent className=\"flex flex-col items-start gap-2 p-2.5 pt-0 text-sm\">{children}</CollapsibleContent>\n </CollapsiblePrimitive.Root>\n );\n});\n\nexport type CollapsibleTriggerProps = ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleTrigger>;\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(\n function CollapsibleTrigger(props, ref) {\n return <CollapsiblePrimitive.CollapsibleTrigger ref={ref} data-slot=\"collapsible-trigger\" {...props} />;\n },\n);\n\nexport type CollapsibleContentProps = ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>;\n\nexport const CollapsibleContent = forwardRef<HTMLDivElement, CollapsibleContentProps>(\n function CollapsibleContent(props, ref) {\n return <CollapsiblePrimitive.CollapsibleContent ref={ref} data-slot=\"collapsible-content\" {...props} />;\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport { AspectRatio as AspectRatioPrimitive } from 'radix-ui';\n\nexport type AspectRatioProps = ComponentPropsWithoutRef<typeof AspectRatioPrimitive.Root>;\n\n/**\n * AspectRatio: displays content within a desired ratio.\n *\n * Built on Radix AspectRatio: an outer box padded to the ratio and an absolutely positioned\n * inner box (this element, with `data-slot=\"aspect-ratio\"`). `ratio` is width ÷ height\n * (`16 / 9`, `1`, `9 / 16`), default `1`. The content is not resized for you: give an image\n * `className=\"size-full object-cover\"` (and the same rounding as the box) so it fills and crops.\n */\nexport const AspectRatio = forwardRef<HTMLDivElement, AspectRatioProps>(function AspectRatio(props, ref) {\n return <AspectRatioPrimitive.Root ref={ref} data-slot=\"aspect-ratio\" {...props} />;\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\n\n/**\n * Carousel: a carousel with motion and swipe built using Embla.\n *\n * `opts` are Embla options (`align`, `loop`, `direction`…), `plugins` Embla plugins (e.g.\n * `Autoplay` from `embla-carousel-autoplay`), `setApi` hands back the Embla API for counters,\n * dots or events. Item size is a `basis-*` class on `CarouselItem`; spacing is `ps-*` on the items\n * with a matching negative `-ms-*` on `CarouselContent`.\n *\n * Shorthand: `items` renders `CarouselContent`, one `CarouselItem` per entry (with\n * `itemClassName`), and the previous / next buttons.\n *\n * Accessibility on top of the engine: each slide is named by its position (\"2 of 5\") unless it has\n * its own `aria-label`, and slides out of view are `inert`, so Tab never lands in a hidden slide.\n *\n * Where the browser APIs Embla needs are missing (ResizeObserver, IntersectionObserver, matchMedia,\n * as in a bare jsdom test), the engine is never started and the slides render as a static row.\n */\n\nexport type CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\nexport type CarouselProps = ComponentProps<'div'> & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n /** Default `horizontal`. */\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n /** Shorthand: one `CarouselItem` per entry, plus the previous / next buttons. */\n items?: readonly ReactNode[];\n /** Shorthand: classes for every item, e.g. `basis-1/3`. */\n itemClassName?: string;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & Pick<CarouselProps, 'opts' | 'plugins' | 'orientation' | 'setApi'>;\n\nconst CarouselContext = createContext<CarouselContextProps | null>(null);\n\nexport function useCarousel() {\n const context = useContext(CarouselContext);\n if (!context) throw new Error('useCarousel must be used within a <Carousel />');\n return context;\n}\n\n/** Embla observes size, visibility and media queries; without those APIs it throws on mount. */\nconst canRunEngine = () =>\n typeof window !== 'undefined' &&\n 'ResizeObserver' in window &&\n 'IntersectionObserver' in window &&\n typeof window.matchMedia === 'function';\n\nexport function Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n items,\n itemClassName,\n className,\n children,\n ...props\n}: CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n // A slide counts as in view (and stays out of `inert`) once half of it shows; Embla's\n // default of any pixel would keep the neighbour's padding edge reachable.\n inViewThreshold: 0.5,\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = useState(false);\n const [canScrollNext, setCanScrollNext] = useState(false);\n\n const onSelect = useCallback((emblaApi: CarouselApi) => {\n if (!emblaApi) return;\n setCanScrollPrev(emblaApi.canScrollPrev());\n setCanScrollNext(emblaApi.canScrollNext());\n }, []);\n\n const scrollPrev = useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n useEffect(() => {\n if (!api || !setApi) return;\n setApi(api);\n }, [api, setApi]);\n\n useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n // Slides out of view are inert, so their links and buttons leave the tab order and the\n // accessibility tree; a scrolled-away slide otherwise stays reachable by Tab.\n useEffect(() => {\n if (!api) return;\n const syncInert = () => {\n const inView = new Set(api.slidesInView());\n api.slideNodes().forEach((node, index) => node.toggleAttribute('inert', !inView.has(index)));\n };\n syncInert();\n api.on('slidesInView', syncInert);\n api.on('reInit', syncInert);\n return () => {\n api.off('slidesInView', syncInert);\n api.off('reInit', syncInert);\n };\n }, [api]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {items ? (\n <>\n <CarouselContent>\n {items.map((item, index) => (\n <CarouselItem key={index} className={itemClassName}>\n {item}\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </>\n ) : null}\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\nexport function CarouselContent({ className, ...props }: ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n const trackRef = useRef<HTMLDivElement>(null);\n\n // Name each slide by its position (\"2 of 5\") unless the caller named it.\n useLayoutEffect(() => {\n const slides = trackRef.current?.querySelectorAll<HTMLElement>(':scope > [data-slot=\"carousel-item\"]') ?? [];\n slides.forEach((slide, index) => {\n if (slide.hasAttribute('aria-label') && !slide.hasAttribute('data-auto-label')) return;\n slide.setAttribute('aria-label', `${index + 1} of ${slides.length}`);\n slide.setAttribute('data-auto-label', '');\n });\n });\n\n // Without the engine's browser APIs, leave the viewport unattached so Embla never starts.\n return (\n <div ref={canRunEngine() ? carouselRef : undefined} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div\n ref={trackRef}\n className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n}\n\nexport function CarouselItem({ className, ...props }: ComponentProps<'div'>) {\n const { orientation } = useCarousel();\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nexport function CarouselPrevious({ className, variant = 'outline', size = 'icon-sm', ...props }: ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal' ? 'inset-y-0 -start-12 my-auto' : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nexport function CarouselNext({ className, variant = 'outline', size = 'icon-sm', ...props }: ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal' ? 'inset-y-0 -end-12 my-auto' : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n","import { Fragment, type ReactNode } from 'react';\nimport { Group, Panel, Separator, type GroupProps, type PanelProps, type SeparatorProps } from 'react-resizable-panels';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Resizable: accessible resizable panel groups and layouts with keyboard support.\n *\n * Built on `react-resizable-panels` (a regular dependency). Any number of panels, nested groups,\n * min / max / collapsible panels, and layout persistence through `onLayoutChange`. Sizes are\n * strings (`\"50%\"`, `\"240px\"`) or numbers (percentages). Each handle is a focusable separator:\n * the arrow keys resize, Home / End go to the bounds, Enter collapses a collapsible panel.\n *\n * Two ways to write one:\n * - Shorthand: `<ResizablePanelGroup panels={[{ content, defaultSize }]} withHandle />` renders\n * the panels with a handle between each pair.\n * - Composition: `ResizablePanelGroup` > `ResizablePanel`, `ResizableHandle`, `ResizablePanel`.\n *\n * A group measures itself with `ResizeObserver`, which a bare jsdom lacks: tests that render one\n * need a stub (see `resizable.test.tsx`).\n */\n\n/** One panel as data, for the `panels` shorthand: the content plus the `ResizablePanel` props. */\nexport interface ResizablePanelDefinition extends Omit<PanelProps, 'children' | 'content'> {\n content: ReactNode;\n}\n\nexport type ResizablePanelGroupProps = GroupProps & {\n /** Shorthand: the panels as data, rendered with a `ResizableHandle` between each pair. */\n panels?: readonly ResizablePanelDefinition[];\n /** Shorthand: show the grip on the handles the `panels` shorthand renders. */\n withHandle?: boolean;\n};\n\nexport function ResizablePanelGroup({ className, panels, withHandle, children, ...props }: ResizablePanelGroupProps) {\n return (\n <Group\n data-slot=\"resizable-panel-group\"\n className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}\n {...props}\n >\n {panels\n ? panels.map(({ content, ...panel }, index) => (\n <Fragment key={panel.id ?? index}>\n {index > 0 && <ResizableHandle withHandle={withHandle} />}\n <ResizablePanel {...panel}>{content}</ResizablePanel>\n </Fragment>\n ))\n : children}\n </Group>\n );\n}\n\nexport type ResizablePanelProps = PanelProps;\n\nexport function ResizablePanel(props: ResizablePanelProps) {\n return <Panel data-slot=\"resizable-panel\" {...props} />;\n}\n\nexport type ResizableHandleProps = SeparatorProps & {\n /** Show a visible grip on the handle. */\n withHandle?: boolean;\n};\n\nexport function ResizableHandle({ withHandle, className, ...props }: ResizableHandleProps) {\n return (\n <Separator\n data-slot=\"resizable-handle\"\n className={cn(\n 'relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',\n className,\n )}\n {...props}\n >\n {withHandle && <div className=\"z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border\" />}\n </Separator>\n );\n}\n\nexport type {\n GroupImperativeHandle as ResizablePanelGroupHandle,\n PanelImperativeHandle as ResizablePanelHandle,\n Layout as ResizableLayout,\n} from 'react-resizable-panels';\n","import {\n createContext,\n forwardRef,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ComponentProps,\n type ComponentType,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { Slot } from 'radix-ui';\nimport { ChevronRightIcon, PanelLeftIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { useMediaQuery } from '../../lib/use-media-query';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../cards/collapsible';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../overlays/dropdown-menu';\nimport { Skeleton } from '../feedback/skeleton';\nimport { Button, type ButtonProps } from '../forms/button';\nimport { Input, type InputProps } from '../forms/input';\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '../overlays/sheet';\nimport { Tooltip, TooltipProvider } from '../overlays/tooltip';\nimport { Separator, type SeparatorProps } from './separator';\n\n/**\n * Sidebar: a composable, themeable and customizable sidebar component.\n *\n * `SidebarProvider` holds the state (`open` / `defaultOpen` / `onOpenChange`, saved in the\n * `sidebar_state` cookie; Cmd/Ctrl+B toggles it) and the widths (`--sidebar-width` 16rem,\n * `--sidebar-width-icon` 3rem). Below `md` the sidebar is a Sheet opened by `SidebarTrigger`.\n *\n * Two ways to write one:\n * - Shorthand: `<Sidebar groups={nav} footerNav brand footer linkComponent currentPath />`\n * renders the header, the grouped menu (nested rows, foldable groups, badges, group actions)\n * and the footer from data, with the current row worked out from `currentPath`.\n * - Composition: `Sidebar` > `SidebarHeader`, `SidebarContent` (`SidebarGroup` >\n * `SidebarGroupLabel`, `SidebarGroupContent` > `SidebarMenu` > `SidebarMenuItem` >\n * `SidebarMenuButton`), `SidebarFooter`, beside a `SidebarInset` for the page.\n */\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state';\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n/** Below `md` the sidebar leaves the page and becomes a sheet. */\nconst MOBILE_QUERY = '(max-width: 767.98px)';\n\n// ── Provider ───────────────────────────────────────────────────────────────────\n\nexport interface SidebarContextValue {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\nexport function useSidebar(): SidebarContextValue {\n const context = useContext(SidebarContext);\n if (!context) throw new Error('useSidebar must be used within a SidebarProvider.');\n return context;\n}\n\nexport interface SidebarProviderProps extends ComponentProps<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: SidebarProviderProps) {\n const isMobile = useMediaQuery(MOBILE_QUERY);\n const [openMobile, setOpenMobile] = useState(false);\n\n // The internal state, unless `open` / `onOpenChange` control it from outside.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) setOpenProp(openState);\n else _setOpen(openState);\n // Kept in a cookie, so a server render can open the sidebar the way the user left it.\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n },\n [setOpenProp, open],\n );\n\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Cmd/Ctrl+B toggles the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextValue>(\n () => ({ state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n { '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON, ...style } as CSSProperties\n }\n className={cn('group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar', className)}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\n// ── Sidebar ────────────────────────────────────────────────────────────────────\n\nexport type SidebarSide = 'left' | 'right';\nexport type SidebarVariant = 'sidebar' | 'floating' | 'inset';\nexport type SidebarCollapsible = 'offcanvas' | 'icon' | 'none';\n\nexport interface SidebarFrameProps extends ComponentProps<'div'> {\n side?: SidebarSide;\n variant?: SidebarVariant;\n collapsible?: SidebarCollapsible;\n}\n\nfunction SidebarFrame({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n dir,\n ...props\n}: SidebarFrameProps) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn('flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground', className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n dir={dir}\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as CSSProperties}\n side={side}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-sidebar-foreground md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* Holds the sidebar's room in the page layout on desktop. */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n 'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating' || variant === 'inset'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n data-side={side}\n className={cn(\n 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex',\n variant === 'floating' || variant === 'inset'\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nexport interface SidebarTriggerProps extends ButtonProps {}\n\nexport const SidebarTrigger = forwardRef<HTMLButtonElement, SidebarTriggerProps>(function SidebarTrigger(\n { className, onClick, ...props },\n ref,\n) {\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n ref={ref}\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon-sm\"\n className={className}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n});\n\nexport function SidebarRail({ className, ...props }: ComponentProps<'button'>) {\n const { toggleSidebar } = useSidebar();\n return (\n <button\n type=\"button\"\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n 'absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2',\n 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',\n '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',\n '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarInset({ className, ...props }: ComponentProps<'main'>) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n 'relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarInput({ className, ...props }: InputProps) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn('h-8 w-full bg-background shadow-none', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarHeader({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarFooter({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n}\n\nexport type SidebarSeparatorProps = SeparatorProps;\n\nexport function SidebarSeparator({ className, ...props }: SidebarSeparatorProps) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n 'no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroup({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupLabel({\n className,\n asChild = false,\n ...props\n}: ComponentProps<'div'> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'div';\n return (\n <Comp\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupAction({\n className,\n asChild = false,\n ...props\n}: ComponentProps<'button'> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'button';\n return (\n <Comp\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n 'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn('w-full text-sm', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarMenu({ className, ...props }: ComponentProps<'ul'>) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn('flex w-full min-w-0 flex-col gap-0', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuItem({ className, ...props }: ComponentProps<'li'>) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn('group/menu-item relative', className)}\n {...props}\n />\n );\n}\n\nexport type SidebarMenuButtonVariant = 'default' | 'outline';\nexport type SidebarMenuButtonSize = 'default' | 'sm' | 'lg';\n\nconst MENU_BUTTON_VARIANT: Record<SidebarMenuButtonVariant, string> = {\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n outline:\n 'bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',\n};\n\nconst MENU_BUTTON_SIZE: Record<SidebarMenuButtonSize, string> = {\n default: 'h-8 text-sm',\n sm: 'h-7 text-xs',\n lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',\n};\n\nexport interface SidebarMenuButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n isActive?: boolean;\n variant?: SidebarMenuButtonVariant;\n size?: SidebarMenuButtonSize;\n /** Shown beside the button while the sidebar is collapsed to icons. */\n tooltip?: ReactNode;\n}\n\nexport const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(function SidebarMenuButton(\n { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot.Root : 'button';\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding]',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground',\n 'data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n 'group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2!',\n '[&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate',\n MENU_BUTTON_VARIANT[variant],\n MENU_BUTTON_SIZE[size],\n className,\n )}\n {...props}\n />\n );\n\n // The label is on screen unless the sidebar is collapsed to icons.\n if (!tooltip || state !== 'collapsed' || isMobile) return button;\n return (\n <Tooltip content={tooltip} side=\"right\" align=\"center\">\n {button}\n </Tooltip>\n );\n});\n\nexport function SidebarMenuAction({\n className,\n asChild = false,\n showOnHover = false,\n ...props\n}: ComponentProps<'button'> & { asChild?: boolean; showOnHover?: boolean }) {\n const Comp = asChild ? Slot.Root : 'button';\n return (\n <Comp\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n 'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',\n showOnHover &&\n 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuBadge({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n 'pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: ComponentProps<'div'> & { showIcon?: boolean }) {\n // A width between 50 and 90%, so a list of skeletons does not look like a ruled block.\n const [width] = useState(() => `${Math.floor(Math.random() * 40) + 50}%`);\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={{ '--skeleton-width': width } as CSSProperties}\n />\n </div>\n );\n}\n\nexport function SidebarMenuSub({ className, ...props }: ComponentProps<'ul'>) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuSubItem({ className, ...props }: ComponentProps<'li'>) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn('group/menu-sub-item relative', className)}\n {...props}\n />\n );\n}\n\nexport interface SidebarMenuSubButtonProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n asChild?: boolean;\n size?: 'sm' | 'md';\n isActive?: boolean;\n}\n\nexport const SidebarMenuSubButton = forwardRef<HTMLAnchorElement, SidebarMenuSubButtonProps>(\n function SidebarMenuSubButton({ asChild = false, size = 'md', isActive = false, className, ...props }, ref) {\n const Comp = asChild ? Slot.Root : 'a';\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n 'data-[size=md]:text-sm data-[size=sm]:text-xs [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\n// ── Shorthand: the nav as data ─────────────────────────────────────────────────\n\nexport interface SidebarNavItem {\n /** Stable key. Falls back to `to`, then `href`, then `label`. */\n id?: string;\n /**\n * An in-app destination, rendered through `linkComponent`. May carry a hash\n * (`/docs/floating#tooltip`): that row is current only when the hash matches too, and the\n * page's own plain row steps aside while it is.\n */\n to?: string;\n /** An external destination, opened in a new tab as a plain `<a>`. */\n href?: string;\n label: string;\n icon?: ReactNode;\n /** A count or short status at the end of the row (`SidebarMenuBadge`). */\n badge?: ReactNode;\n /** Match the path exactly rather than as a prefix. Needed for an index route. */\n end?: boolean;\n /** A destination that exists but cannot be opened right now. */\n disabled?: boolean;\n /** Overrides route matching. */\n isActive?: boolean;\n /** Child rows, one level deep, in a foldable sub-menu. */\n children?: SidebarNavItem[];\n /** Whether the children start open. Default: open when one of them is the current route. */\n defaultOpen?: boolean;\n /** A button at the end of the row, such as a menu of row actions (`SidebarMenuAction`). Shows on hover. */\n action?: ReactNode;\n}\n\nexport interface SidebarNavGroup {\n /** Stable key. Falls back to `title`. */\n id?: string;\n /** The group's label. Omit for an ungrouped run of rows. */\n title?: string;\n items: SidebarNavItem[];\n /** Make the label a toggle that folds the group away. Needs a `title`. */\n collapsible?: boolean;\n /** With `collapsible`: whether the group starts open. Default `true`. */\n defaultOpen?: boolean;\n /** A button at the end of the label — an \"add\" action, say (`SidebarGroupAction`). */\n action?: ReactNode;\n /** Anything below the rows, or in place of them with `items: []`: a tree, a calendar, a card. */\n content?: ReactNode;\n /** Classes for the group, e.g. `mt-auto` to pin it to the bottom of the nav. */\n className?: string;\n}\n\nexport interface SidebarLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n}\n\n/** Renders an in-app row's link; it must forward its ref to the anchor (`next/link` and react-router's `Link` do). */\nexport type SidebarLinkComponent = ComponentType<SidebarLinkProps & RefAttributes<HTMLAnchorElement>>;\n\nexport interface SidebarRenderState {\n /** Collapsed to icons. */\n collapsed: boolean;\n}\n\nexport interface SidebarProps extends SidebarFrameProps {\n /** Shorthand: the grouped nav. One untitled group is a flat list. */\n groups?: SidebarNavGroup[];\n /** Shorthand: rows pinned below the nav — settings, help. */\n footerNav?: SidebarNavItem[];\n /** Shorthand: the header's content. A function gets the render state. */\n brand?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Shorthand: the footer's content, below `footerNav`. A function gets the render state. */\n footer?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Shorthand: the current pathname, which decides the current row. */\n currentPath?: string;\n /** Shorthand: the current hash, for rows that link to a section. */\n currentHash?: string;\n /** Shorthand: renders in-app links. Default a plain `<a>`. */\n linkComponent?: SidebarLinkComponent;\n /** Shorthand: called when a row is pressed, after the mobile sheet has closed. */\n onNavigate?: () => void;\n /** Shorthand: names the nav landmark. Default \"Primary\". */\n label?: string;\n /** Shorthand: add a `SidebarRail` to toggle the sidebar from its edge. */\n rail?: boolean;\n /**\n * Shorthand: how rows with children open. `collapsible` (default) folds them open below the\n * row; `dropdown` opens them in a menu beside it, which also works when collapsed to icons.\n */\n submenus?: 'collapsible' | 'dropdown';\n}\n\nexport function Sidebar({\n groups,\n footerNav,\n brand,\n footer,\n currentPath,\n currentHash,\n linkComponent,\n onNavigate,\n label = 'Primary',\n rail = false,\n submenus = 'collapsible',\n children,\n ...props\n}: SidebarProps) {\n if (!groups) return <SidebarFrame {...props}>{children}</SidebarFrame>;\n return (\n <SidebarFrame {...props}>\n <SidebarFromData\n groups={groups}\n footerNav={footerNav}\n brand={brand}\n footer={footer}\n currentPath={currentPath}\n currentHash={currentHash}\n linkComponent={linkComponent ?? DefaultLink}\n onNavigate={onNavigate}\n label={label}\n submenus={submenus}\n collapsible={props.collapsible ?? 'offcanvas'}\n />\n {rail && <SidebarRail />}\n </SidebarFrame>\n );\n}\n\nconst DefaultLink = forwardRef<HTMLAnchorElement, SidebarLinkProps>(function DefaultLink({ children, ...rest }, ref) {\n return (\n <a ref={ref} {...rest}>\n {children}\n </a>\n );\n});\n\ninterface RowContext {\n path?: string;\n hash?: string;\n hashTargets: Set<string>;\n Link: SidebarLinkComponent;\n onNavigate: () => void;\n submenus: 'collapsible' | 'dropdown';\n isMobile: boolean;\n}\n\nconst Row = createContext<RowContext | null>(null);\n\nfunction useRow(): RowContext {\n const value = useContext(Row);\n if (!value) throw new Error('Sidebar rows must be rendered by <Sidebar groups>');\n return value;\n}\n\nfunction SidebarFromData({\n groups,\n footerNav,\n brand,\n footer,\n currentPath,\n currentHash,\n linkComponent,\n onNavigate,\n label,\n submenus,\n collapsible,\n}: Required<Pick<SidebarProps, 'groups' | 'linkComponent' | 'label' | 'submenus'>> &\n Pick<SidebarProps, 'footerNav' | 'brand' | 'footer' | 'currentPath' | 'currentHash' | 'onNavigate'> & {\n collapsible: SidebarCollapsible;\n }) {\n const { state, isMobile, setOpenMobile } = useSidebar();\n const renderState: SidebarRenderState = { collapsed: !isMobile && state === 'collapsed' && collapsible === 'icon' };\n\n const hashTargets = useMemo(\n () =>\n new Set(\n [...groups.flatMap((group) => group.items), ...(footerNav ?? [])]\n .flatMap((item) => [item, ...(item.children ?? [])])\n .map((item) => item.to)\n .filter((to): to is string => to?.includes('#') ?? false),\n ),\n [groups, footerNav],\n );\n\n const row = useMemo<RowContext>(\n () => ({\n path: currentPath,\n hash: currentHash,\n hashTargets,\n Link: linkComponent,\n onNavigate: () => {\n setOpenMobile(false);\n onNavigate?.();\n },\n submenus,\n isMobile,\n }),\n [currentPath, currentHash, hashTargets, linkComponent, setOpenMobile, onNavigate, submenus, isMobile],\n );\n\n const brandNode = typeof brand === 'function' ? brand(renderState) : brand;\n const footerNode = typeof footer === 'function' ? footer(renderState) : footer;\n\n return (\n <Row.Provider value={row}>\n {brandNode != null && <SidebarHeader>{brandNode}</SidebarHeader>}\n <SidebarContent>\n <nav aria-label={label} className=\"flex flex-1 flex-col\">\n {groups.map((group, index) => (\n <NavGroup key={group.id ?? group.title ?? index} group={group} />\n ))}\n </nav>\n </SidebarContent>\n {(footerNav?.length || footerNode != null) && (\n <SidebarFooter>\n {footerNav?.length ? (\n <SidebarMenu>\n {footerNav.map((item) => (\n <NavRow key={itemKey(item)} item={item} />\n ))}\n </SidebarMenu>\n ) : null}\n {footerNode}\n </SidebarFooter>\n )}\n </Row.Provider>\n );\n}\n\nfunction itemKey(item: SidebarNavItem): string {\n return item.id ?? item.to ?? item.href ?? item.label;\n}\n\nfunction NavGroup({ group }: { group: SidebarNavGroup }) {\n const menu = (\n <>\n {group.items.length > 0 && (\n <SidebarGroupContent>\n <SidebarMenu>\n {group.items.map((item) => (\n <NavRow key={itemKey(item)} item={item} />\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n )}\n {group.content}\n </>\n );\n const action =\n group.action == null ? null : isValidElement(group.action) ? (\n <SidebarGroupAction asChild>{group.action}</SidebarGroupAction>\n ) : (\n <SidebarGroupAction>{group.action}</SidebarGroupAction>\n );\n\n if (group.collapsible && group.title) {\n return (\n <Collapsible defaultOpen={group.defaultOpen ?? true} className=\"group/collapsible\">\n <SidebarGroup className={group.className}>\n <SidebarGroupLabel asChild>\n <CollapsibleTrigger>\n {group.title}\n <ChevronRightIcon className=\"ms-auto transition-transform group-data-[state=open]/collapsible:rotate-90 rtl:rotate-180\" />\n </CollapsibleTrigger>\n </SidebarGroupLabel>\n {action}\n <CollapsibleContent>{menu}</CollapsibleContent>\n </SidebarGroup>\n </Collapsible>\n );\n }\n\n return (\n <SidebarGroup className={group.className}>\n {group.title && <SidebarGroupLabel>{group.title}</SidebarGroupLabel>}\n {action}\n {menu}\n </SidebarGroup>\n );\n}\n\n/**\n * Whether a row is the current one. Hash-aware: with rows linking to sections of one page,\n * only the row naming the shown section is current, and the page's plain row steps aside.\n */\nfunction isRowActive(item: SidebarNavItem, row: RowContext): boolean {\n if (item.isActive !== undefined) return item.isActive;\n if (!item.to || row.path === undefined) return false;\n const [path, hash] = item.to.split('#');\n const pathMatches = item.end\n ? row.path === path\n : row.path === path || row.path.startsWith(`${path.replace(/\\/$/, '')}/`);\n if (!pathMatches) return false;\n if (hash !== undefined) return row.hash === `#${hash}`;\n return !row.hashTargets.has(`${row.path}${row.hash ?? ''}`);\n}\n\n/** Runs the row's own handler, then the sidebar's — unless the row refused the press. */\nfunction navigateHandler(row: RowContext, disabled?: boolean) {\n return (event: ReactMouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n if (!event.defaultPrevented) row.onNavigate();\n };\n}\n\n/** The row's anchor. `asChild` parts merge their classes and state onto it, so it forwards everything. */\nconst RowLink = forwardRef<\n HTMLAnchorElement,\n AnchorHTMLAttributes<HTMLAnchorElement> & { item: SidebarNavItem; row: RowContext }\n>(function RowLink({ item, row, children, onClick, ...rest }, ref) {\n const disabledProps = item.disabled ? { 'aria-disabled': true, tabIndex: -1 } : {};\n const handleClick = (event: ReactMouseEvent<HTMLAnchorElement>) => {\n onClick?.(event);\n navigateHandler(row, item.disabled)(event);\n };\n if (item.href) {\n return (\n <a ref={ref} {...rest} href={item.href} target=\"_blank\" rel=\"noreferrer\" onClick={handleClick} {...disabledProps}>\n {children}\n </a>\n );\n }\n const { Link } = row;\n return (\n <Link ref={ref} {...rest} href={item.to!} onClick={handleClick} {...disabledProps}>\n {children}\n </Link>\n );\n});\n\nfunction RowLabel({ item }: { item: SidebarNavItem }) {\n return (\n <>\n {item.icon}\n <span>{item.label}</span>\n </>\n );\n}\n\nfunction NavRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n if (item.children?.length) return <NavParentRow item={item} />;\n const active = isRowActive(item, row);\n const current = active ? { 'aria-current': 'page' as const } : {};\n\n return (\n <SidebarMenuItem>\n {item.to || item.href ? (\n <SidebarMenuButton asChild isActive={active} tooltip={item.label} {...current}>\n <RowLink item={item} row={row}>\n <RowLabel item={item} />\n </RowLink>\n </SidebarMenuButton>\n ) : (\n <SidebarMenuButton isActive={active} tooltip={item.label} disabled={item.disabled}>\n <RowLabel item={item} />\n </SidebarMenuButton>\n )}\n {item.badge != null && <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>}\n {rowAction(item)}\n </SidebarMenuItem>\n );\n}\n\n/** The row's own action: an element becomes the `SidebarMenuAction` (asChild), anything else goes inside one. */\nfunction rowAction(item: SidebarNavItem) {\n if (item.action == null) return null;\n return isValidElement(item.action) ? (\n <SidebarMenuAction asChild showOnHover>\n {item.action}\n </SidebarMenuAction>\n ) : (\n <SidebarMenuAction showOnHover>{item.action}</SidebarMenuAction>\n );\n}\n\nfunction NavParentRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n\n if (row.submenus === 'dropdown') {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n tooltip={item.label}\n isActive={childActive}\n disabled={item.disabled}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n <RowLabel item={item} />\n <ChevronRightIcon className=\"ms-auto rtl:rotate-180\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent side={row.isMobile ? 'bottom' : 'right'} align=\"start\" className=\"min-w-48\">\n {children.map((child) => {\n const active = isRowActive(child, row);\n return (\n <DropdownMenuItem key={itemKey(child)} asChild disabled={child.disabled}>\n <RowLink item={child} row={row} {...(active ? { 'aria-current': 'page' } : {})}>\n <RowLabel item={child} />\n </RowLink>\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n {rowAction(item)}\n </SidebarMenuItem>\n );\n }\n\n return (\n <Collapsible asChild defaultOpen={item.defaultOpen ?? childActive} className=\"group/collapsible\">\n <SidebarMenuItem>\n <CollapsibleTrigger asChild>\n <SidebarMenuButton\n tooltip={item.label}\n isActive={childActive}\n disabled={item.disabled}\n // From its own state, not the nearest open collapsible: the row may sit in a foldable group.\n className=\"data-[state=open]:[&>svg:last-child]:rotate-90\"\n >\n <RowLabel item={item} />\n <ChevronRightIcon className=\"ms-auto transition-transform duration-200 rtl:rotate-180\" />\n </SidebarMenuButton>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <SidebarMenuSub>\n {children.map((child) => {\n const active = isRowActive(child, row);\n return (\n <SidebarMenuSubItem key={itemKey(child)}>\n <SidebarMenuSubButton asChild isActive={active} {...(active ? { 'aria-current': 'page' } : {})}>\n <RowLink item={child} row={row}>\n <RowLabel item={child} />\n </RowLink>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n );\n })}\n </SidebarMenuSub>\n </CollapsibleContent>\n </SidebarMenuItem>\n </Collapsible>\n );\n}\n\n// ── filterNav ──────────────────────────────────────────────────────────────────\n\ninterface NavTreeItem {\n to?: string;\n href?: string;\n children?: NavTreeItem[];\n}\n\n/**\n * The nav a user may see: drops every item `isVisible` refuses, then every parent left with\n * no children and nowhere of its own to go, then every group left empty.\n *\n * The sidebar does not know about permissions and should not; this is where an app's rule\n * meets its nav data. Hiding a row is not access control — the route and the API still have\n * to refuse.\n *\n * const visible = filterNav(navConfig, (item) => !item.requires || item.requires.some(can));\n */\nexport function filterNav<G extends { items: NavTreeItem[] }>(\n groups: readonly G[],\n isVisible: (item: G['items'][number]) => boolean,\n): G[] {\n return groups\n .map((group) => ({ ...group, items: filterNavItems(group.items, isVisible) }))\n .filter((group) => group.items.length > 0);\n}\n\n/** `filterNav` for a single list of items, e.g. `footerNav`. */\nexport function filterNavItems<I extends NavTreeItem>(items: readonly I[], isVisible: (item: I) => boolean): I[] {\n return items.flatMap((item) => {\n if (!isVisible(item)) return [];\n if (!item.children) return [item];\n const children = filterNavItems(item.children as I[], isVisible);\n if (children.length === 0 && !item.to && !item.href) return [];\n return [{ ...item, children }];\n });\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * Whether a CSS media query matches, kept in sync as the viewport changes.\n *\n * `false` on the server and wherever `matchMedia` is missing — jsdom has none, and a\n * consumer's test setup should not have to polyfill it for a component to render — so the\n * first client render agrees with the server's and hydration does not warn.\n */\nexport function useMediaQuery(query: string): boolean {\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const list = window.matchMedia(query);\n list.addEventListener('change', onChange);\n return () => list.removeEventListener('change', onChange);\n },\n [query],\n );\n const getSnapshot = () =>\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(query).matches\n : false;\n return useSyncExternalStore(subscribe, getSnapshot, () => false);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Kbd: a keyboard key. Renders a real `<kbd>`, so assistive tech announces it as key input\n * rather than as a stray glyph (`⌘K` read as plain text is \"place of interest sign K\").\n *\n * Two ways to write a shortcut:\n * - Shorthand: `<KbdGroup keys={['Ctrl', 'B']} />`.\n * - Composition: `<KbdGroup><Kbd>Ctrl</Kbd><Kbd>B</Kbd></KbdGroup>`.\n *\n * One key per `Kbd`, so a shortcut reads as separate keys. Inside a tooltip the keys take the\n * tooltip's inverted colours.\n */\nexport type KbdProps = HTMLAttributes<HTMLElement>;\n\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd({ className, ...props }, ref) {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(\n \"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface KbdGroupProps extends HTMLAttributes<HTMLElement> {\n /** Shorthand: one `Kbd` per key, in order. */\n keys?: ReactNode[];\n}\n\nexport const KbdGroup = forwardRef<HTMLElement, KbdGroupProps>(function KbdGroup(\n { className, keys, children, ...props },\n ref,\n) {\n return (\n <kbd ref={ref} data-slot=\"kbd-group\" className={cn('inline-flex items-center gap-1', className)} {...props}>\n {keys ? keys.map((key, i) => <Kbd key={i}>{key}</Kbd>) : children}\n </kbd>\n );\n});\n","import { Fragment, forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';\nimport { ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Breadcrumb: displays the path to the current resource using a hierarchy of links.\n *\n * Two ways to write one:\n * - Data: `<Breadcrumb items={[{ label: 'Home', href: '/' }, { label: 'Settings' }]} />`. The last\n * item is the current page, separators are added for you, `renderLink` renders router links and\n * `maxItems` collapses the middle of a long trail into an ellipsis.\n * - Composition: `BreadcrumbList`, `BreadcrumbItem`, `BreadcrumbLink`, `BreadcrumbPage`,\n * `BreadcrumbSeparator`, `BreadcrumbEllipsis`.\n *\n * A `<nav>` around an ordered list: the order is the hierarchy, and the landmark lets a screen\n * reader user jump to the trail. Separators and the ellipsis are hidden from assistive tech.\n */\n\n/** One crumb as data. */\nexport interface BreadcrumbItemDef {\n label: ReactNode;\n /** Omit on the current page. */\n href?: string;\n /** Stable key. Default the position, which suits a static trail. */\n id?: string;\n /** Default: the last item is the current page. */\n current?: boolean;\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n /** The trail as data, root first. Use it or children (the parts), not both. */\n items?: readonly BreadcrumbItemDef[];\n /** With `items`: render each link yourself, e.g. a router `Link`. It gets the link styling. */\n renderLink?: (item: BreadcrumbItemDef) => ReactElement;\n /** With `items`: keep the root and the last `maxItems - 1` items, and collapse the rest. */\n maxItems?: number;\n}\n\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n { className, items, renderLink, maxItems, children, ...props },\n ref,\n) {\n return (\n <nav ref={ref} aria-label=\"breadcrumb\" data-slot=\"breadcrumb\" className={className} {...props}>\n {items ? <BreadcrumbList>{renderItems(items, renderLink, maxItems)}</BreadcrumbList> : children}\n </nav>\n );\n});\n\nfunction renderItems(\n items: readonly BreadcrumbItemDef[],\n renderLink: BreadcrumbProps['renderLink'],\n maxItems: number | undefined,\n) {\n const last = items.length - 1;\n const collapse = maxItems !== undefined && maxItems >= 2 && items.length > maxItems;\n const shown = collapse\n ? [0, ...items.map((_, i) => i).slice(items.length - (maxItems - 1))]\n : items.map((_, i) => i);\n\n return shown.map((index, position) => {\n const item = items[index];\n const current = item.current ?? index === last;\n return (\n <Fragment key={item.id ?? index}>\n {position > 0 && <BreadcrumbSeparator />}\n <BreadcrumbItem>\n {current ? (\n <BreadcrumbPage>{item.label}</BreadcrumbPage>\n ) : renderLink ? (\n <BreadcrumbLink asChild>{renderLink(item)}</BreadcrumbLink>\n ) : (\n <BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>\n )}\n </BreadcrumbItem>\n {collapse && position === 0 && (\n <>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbEllipsis />\n </BreadcrumbItem>\n </>\n )}\n </Fragment>\n );\n });\n}\n\nexport const BreadcrumbList = forwardRef<HTMLOListElement, HTMLAttributes<HTMLOListElement>>(function BreadcrumbList(\n { className, ...props },\n ref,\n) {\n return (\n <ol\n ref={ref}\n data-slot=\"breadcrumb-list\"\n className={cn('flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, HTMLAttributes<HTMLLIElement>>(function BreadcrumbItem(\n { className, ...props },\n ref,\n) {\n return <li ref={ref} data-slot=\"breadcrumb-item\" className={cn('inline-flex items-center gap-1', className)} {...props} />;\n});\n\nexport interface BreadcrumbLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Render the child element, e.g. a router `Link`. */\n asChild?: boolean;\n}\n\nexport const BreadcrumbLink = forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(function BreadcrumbLink(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'a';\n return (\n <Comp ref={ref} data-slot=\"breadcrumb-link\" className={cn('transition-colors hover:text-foreground', className)} {...props} />\n );\n});\n\n/** The current page: text, not a link. */\nexport const BreadcrumbPage = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function BreadcrumbPage(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"breadcrumb-page\"\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn('font-normal text-foreground', className)}\n {...props}\n />\n );\n});\n\nexport interface BreadcrumbSeparatorProps extends HTMLAttributes<HTMLLIElement> {\n /** A custom separator. Default a chevron. */\n children?: ReactNode;\n}\n\nexport const BreadcrumbSeparator = forwardRef<HTMLLIElement, BreadcrumbSeparatorProps>(function BreadcrumbSeparator(\n { children, className, ...props },\n ref,\n) {\n return (\n <li\n ref={ref}\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('[&>svg]:size-3.5', className)}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"rtl:rotate-180\" />}\n </li>\n );\n});\n\n/** Stands in for collapsed items. Wrap it in a `DropdownMenuTrigger` to make them reachable. */\nexport const BreadcrumbEllipsis = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function BreadcrumbEllipsis(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('flex size-5 items-center justify-center [&>svg]:size-4', className)}\n {...props}\n >\n <MoreHorizontalIcon />\n <span className=\"sr-only\">More</span>\n </span>\n );\n});\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type Ref,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonSize } from '../forms/button';\nimport { Select } from '../forms/select';\n\n/**\n * Pagination: page navigation with previous and next.\n *\n * Two ways to write one:\n * - Shorthand: `<Pagination page={3} pageCount={10} onPageChange={setPage} />` works out the\n * page window (first, last, the current page and `siblingCount` either side, with ellipses)\n * and renders the parts. Pages are buttons, or links when you pass `getHref`.\n * - Composition: `Pagination` > `PaginationContent` > `PaginationItem`s holding a\n * `PaginationPrevious`, `PaginationLink`s, a `PaginationEllipsis` and a `PaginationNext`.\n *\n * A `<nav>` landmark named \"pagination\" (override with `aria-label`). The current page carries\n * `aria-current=\"page\"`; the ellipsis is hidden from assistive tech.\n */\n\nconst GAP = '…';\n\n/**\n * Builds the visible page list with ellipses.\n *\n * Always returns first and last, the current page, and `siblingCount` either side. The\n * window is widened rather than allowed to shrink near the ends, so the control does not\n * change width as the user pages through — a row of buttons that reflows under the cursor\n * is how you mis-click.\n */\nexport function paginationRange(page: number, pageCount: number, siblingCount = 1): (number | typeof GAP)[] {\n // first + last + current + 2 siblings + 2 possible gaps\n const totalSlots = siblingCount * 2 + 5;\n if (pageCount <= totalSlots) {\n return Array.from({ length: pageCount }, (_, i) => i + 1);\n }\n\n const left = Math.max(page - siblingCount, 1);\n const right = Math.min(page + siblingCount, pageCount);\n\n const showLeftGap = left > 3;\n const showRightGap = right < pageCount - 2;\n\n if (!showLeftGap && showRightGap) {\n const count = siblingCount * 2 + 3;\n return [...Array.from({ length: count }, (_, i) => i + 1), GAP, pageCount];\n }\n\n if (showLeftGap && !showRightGap) {\n const count = siblingCount * 2 + 3;\n return [1, GAP, ...Array.from({ length: count }, (_, i) => pageCount - count + 1 + i)];\n }\n\n return [1, GAP, ...Array.from({ length: right - left + 1 }, (_, i) => left + i), GAP, pageCount];\n}\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport interface PaginationProps extends HTMLAttributes<HTMLElement> {\n /** Shorthand: the current page, 1-based. With `pageCount` and `onPageChange` it renders the parts. */\n page?: number;\n /** Shorthand: the total number of pages. Below 1 renders nothing. */\n pageCount?: number;\n /** Shorthand: called with the page to go to. */\n onPageChange?: (page: number) => void;\n /** Shorthand: numbered pages either side of the current one. Default `1`. */\n siblingCount?: number;\n /** Shorthand: render pages as links to these URLs instead of buttons. */\n getHref?: (page: number) => string;\n}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { className, children, page, pageCount, onPageChange, siblingCount = 1, getHref, ...props },\n ref,\n) {\n const shorthand = page !== undefined && pageCount !== undefined;\n if (shorthand && pageCount < 1) return null;\n\n return (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n className={cn('mx-auto flex w-full justify-center', className)}\n {...props}\n >\n {shorthand ? (\n <PaginationPages\n page={page}\n pageCount={pageCount}\n onPageChange={onPageChange}\n siblingCount={siblingCount}\n getHref={getHref}\n />\n ) : (\n children\n )}\n </nav>\n );\n});\n\nfunction PaginationPages({\n page,\n pageCount,\n onPageChange,\n siblingCount,\n getHref,\n}: {\n page: number;\n pageCount: number;\n onPageChange?: (page: number) => void;\n siblingCount: number;\n getHref?: (page: number) => string;\n}) {\n const go = (next: number) => (event: MouseEvent) => {\n const clamped = Math.min(Math.max(next, 1), pageCount);\n if (clamped === page) return;\n if (onPageChange) {\n if (getHref) event.preventDefault();\n onPageChange(clamped);\n }\n };\n const target = (n: number) => (getHref ? { href: getHref(n) } : {});\n\n return (\n <PaginationContent>\n <PaginationItem>\n <PaginationPrevious {...target(page - 1)} disabled={page <= 1} onClick={go(page - 1)} />\n </PaginationItem>\n {paginationRange(page, pageCount, siblingCount).map((entry, index) =>\n entry === GAP ? (\n <PaginationItem key={`gap-${index}`}>\n <PaginationEllipsis />\n </PaginationItem>\n ) : (\n <PaginationItem key={entry}>\n {/* \"3\" alone does not say what activating it does. */}\n <PaginationLink\n {...target(entry)}\n aria-label={`Page ${entry}`}\n isActive={entry === page}\n onClick={go(entry)}\n >\n {entry}\n </PaginationLink>\n </PaginationItem>\n ),\n )}\n <PaginationItem>\n <PaginationNext {...target(page + 1)} disabled={page >= pageCount} onClick={go(page + 1)} />\n </PaginationItem>\n </PaginationContent>\n );\n}\n\nexport const PaginationContent = forwardRef<HTMLUListElement, ComponentPropsWithoutRef<'ul'>>(\n function PaginationContent({ className, ...props }, ref) {\n return (\n <ul ref={ref} data-slot=\"pagination-content\" className={cn('flex items-center gap-0.5', className)} {...props} />\n );\n },\n);\n\nexport const PaginationItem = forwardRef<HTMLLIElement, ComponentPropsWithoutRef<'li'>>(\n function PaginationItem(props, ref) {\n return <li ref={ref} data-slot=\"pagination-item\" {...props} />;\n },\n);\n\nexport interface PaginationLinkProps extends Omit<ComponentPropsWithoutRef<'a'>, 'onClick'> {\n /** The current page: outlined, with `aria-current=\"page\"`. */\n isActive?: boolean;\n size?: ButtonSize;\n /** Blocks the link (`aria-disabled`, out of the tab order) or disables the button. */\n disabled?: boolean;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n}\n\n/**\n * A page: an `<a>` with `href`, or a `<button>` without one (for pages driven by state). Styled\n * as a ghost icon Button, outlined when `isActive`.\n */\nexport const PaginationLink = forwardRef<HTMLElement, PaginationLinkProps>(function PaginationLink(\n { className, isActive, size = 'icon', disabled, href, children, ...props },\n ref,\n) {\n const common = {\n 'aria-current': isActive ? ('page' as const) : undefined,\n 'data-slot': 'pagination-link',\n 'data-active': isActive || undefined,\n };\n if (href === undefined) {\n return (\n <Button\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n variant={isActive ? 'outline' : 'ghost'}\n size={size}\n disabled={disabled}\n className={className}\n {...common}\n {...(props as ComponentPropsWithoutRef<'button'>)}\n >\n {children}\n </Button>\n );\n }\n return (\n <Button asChild variant={isActive ? 'outline' : 'ghost'} size={size} className={className}>\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n // Still a link to assistive tech, announced as unavailable, out of the tab order and inert.\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n {...common}\n {...props}\n onClick={(event) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n props.onClick?.(event);\n }}\n className={cn(disabled && 'pointer-events-none opacity-50')}\n >\n {children}\n </a>\n </Button>\n );\n});\n\nexport interface PaginationArrowProps extends PaginationLinkProps {\n /** The visible text (shown from `sm`). Default \"Previous\" / \"Next\". */\n text?: ReactNode;\n}\n\nexport const PaginationPrevious = forwardRef<HTMLElement, PaginationArrowProps>(function PaginationPrevious(\n { className, text = 'Previous', ...props },\n ref,\n) {\n return (\n <PaginationLink\n ref={ref}\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn('ps-1.5!', className)}\n {...props}\n >\n <ChevronLeftIcon data-icon=\"inline-start\" className=\"rtl:rotate-180\" />\n <span className=\"hidden sm:block\">{text}</span>\n </PaginationLink>\n );\n});\n\nexport const PaginationNext = forwardRef<HTMLElement, PaginationArrowProps>(function PaginationNext(\n { className, text = 'Next', ...props },\n ref,\n) {\n return (\n <PaginationLink\n ref={ref}\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn('pe-1.5!', className)}\n {...props}\n >\n <span className=\"hidden sm:block\">{text}</span>\n <ChevronRightIcon data-icon=\"inline-end\" className=\"rtl:rotate-180\" />\n </PaginationLink>\n );\n});\n\nexport const PaginationEllipsis = forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<'span'>>(\n function PaginationEllipsis({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n <MoreHorizontalIcon />\n <span className=\"sr-only\">More pages</span>\n </span>\n );\n },\n);\n\n// ── PaginationBar ──────────────────────────────────────────────────────────────\n\nexport interface PaginationBarProps {\n /** 1-based. */\n page: number;\n /** Rows per page. */\n pageSize: number;\n /** Total rows across every page. */\n total: number;\n onPageChange: (page: number) => void;\n /** Offer a page-size selector. Omit it, or pass `[]` as `pageSizeOptions`, to hide one. */\n onPageSizeChange?: (pageSize: number) => void;\n /** Page sizes on offer. Default `[10, 20, 50]`. */\n pageSizeOptions?: number[];\n /** Replaces the \"Showing 1–10 of 57\" summary. */\n summary?: ReactNode;\n /** Names the page-button landmark. Default \"Pages\". */\n label?: string;\n className?: string;\n}\n\n/**\n * A full pager row for a list that is not a DataTable: a range summary, an optional page-size\n * selector, and the page buttons. A DataTable uses `DataTablePagination` instead. Slated to\n * become a block.\n *\n * Only the page buttons are the `<nav>` landmark. The summary and the size selector sit beside\n * it, because a landmark should hold navigation and nothing else.\n */\nexport function PaginationBar({\n page,\n pageSize,\n total,\n onPageChange,\n onPageSizeChange,\n pageSizeOptions = [10, 20, 50],\n summary,\n label = 'Pages',\n className,\n}: PaginationBarProps) {\n const pageCount = Math.max(1, Math.ceil(total / pageSize));\n const from = total === 0 ? 0 : (page - 1) * pageSize + 1;\n const to = Math.min(total, page * pageSize);\n const showSize = Boolean(onPageSizeChange) && pageSizeOptions.length > 0;\n const options = pageSizeOptions.includes(pageSize)\n ? pageSizeOptions\n : [...pageSizeOptions, pageSize].sort((a, b) => a - b);\n\n return (\n <div\n data-slot=\"pagination-bar\"\n className={clsx('flex flex-wrap items-center justify-between gap-x-4 gap-y-3', className)}\n >\n <p className=\"text-sm text-muted-foreground\">\n {summary ?? (\n <>\n Showing {from}–{to} of {total}\n </>\n )}\n </p>\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-3\">\n {showSize && (\n <div className=\"flex items-center gap-2\">\n <span aria-hidden className=\"text-sm font-medium\">\n Rows per page\n </span>\n <Select\n aria-label=\"Rows per page\"\n size=\"sm\"\n className=\"w-20\"\n value={String(pageSize)}\n options={options.map((size) => ({ value: String(size), label: String(size) }))}\n onValueChange={(value) => onPageSizeChange?.(Number(value))}\n />\n </div>\n )}\n <Pagination\n className=\"mx-0 w-auto\"\n aria-label={label}\n page={page}\n pageCount={pageCount}\n onPageChange={onPageChange}\n />\n </div>\n </div>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * NavigationMenu: a site's header navigation — top-level links, and triggers that open panels of\n * links (the \"mega-menu\" pattern). For in-app navigation use the Sidebar.\n *\n * Two ways to write one:\n * - Shorthand: `<NavigationMenu items={[{ label, href }, { label, children: [{ label, href,\n * description }] }]} />`.\n * - Composition: `NavigationMenu` > `NavigationMenuList` > `NavigationMenuItem` >\n * `NavigationMenuTrigger` + `NavigationMenuContent` (of `NavigationMenuLink`s), or a single\n * `NavigationMenuLink` styled with `navigationMenuTriggerStyle`.\n *\n * Built on Radix NavigationMenu: the keyboard model, hover intent and the panel that slides\n * between triggers come from it. It measures the open panel with `ResizeObserver`, which jsdom\n * lacks, so tests that open a panel need a stub.\n */\n\n/** Classes for a top-level link that sits beside the triggers. */\nexport const navigationMenuTriggerStyle = () =>\n 'group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted data-active:bg-muted/50';\n\n/** One entry of the `items` shorthand: a link, or a trigger with a panel of links. */\nexport interface NavigationMenuItemDef {\n label: ReactNode;\n /** A top-level link. Leave out when the entry has `children`. */\n href?: string;\n /** The current page: sets `aria-current=\"page\"` and the active look. */\n active?: boolean;\n /** The panel's links. */\n children?: Array<{ label: ReactNode; href: string; description?: ReactNode; active?: boolean }>;\n}\n\nexport interface NavigationMenuProps extends ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> {\n /** Render the shared viewport the panels open into. Default `true`; `false` opens each under its trigger. */\n viewport?: boolean;\n /** Shorthand: the menu as data. Use it or `children`. */\n items?: NavigationMenuItemDef[];\n}\n\nexport const NavigationMenu = forwardRef<ElementRef<typeof NavigationMenuPrimitive.Root>, NavigationMenuProps>(\n function NavigationMenu({ className, children, viewport = true, items, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Root\n ref={ref}\n data-slot=\"navigation-menu\"\n data-viewport={viewport}\n className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}\n {...props}\n >\n {items ? <NavigationMenuItems items={items} /> : children}\n {viewport && <NavigationMenuViewport />}\n </NavigationMenuPrimitive.Root>\n );\n },\n);\n\nfunction NavigationMenuItems({ items }: { items: NavigationMenuItemDef[] }) {\n return (\n <NavigationMenuList>\n {items.map((item, index) => (\n <NavigationMenuItem key={index}>\n {item.children ? (\n <>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <ul className=\"grid w-96 gap-1\">\n {item.children.map((child, childIndex) => (\n <li key={childIndex}>\n <NavigationMenuLink href={child.href} active={child.active}>\n <div className=\"flex flex-col gap-1\">\n <div className=\"leading-none font-medium\">{child.label}</div>\n {child.description != null && (\n <div className=\"line-clamp-2 text-muted-foreground\">{child.description}</div>\n )}\n </div>\n </NavigationMenuLink>\n </li>\n ))}\n </ul>\n </NavigationMenuContent>\n </>\n ) : (\n <NavigationMenuLink href={item.href} active={item.active} className={navigationMenuTriggerStyle()}>\n {item.label}\n </NavigationMenuLink>\n )}\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n );\n}\n\nexport const NavigationMenuList = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.List>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>\n>(function NavigationMenuList({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.List\n ref={ref}\n data-slot=\"navigation-menu-list\"\n className={cn('group flex flex-1 list-none items-center justify-center gap-0', className)}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuItem = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Item>\n>(function NavigationMenuItem({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Item\n ref={ref}\n data-slot=\"navigation-menu-item\"\n className={cn('relative', className)}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuTrigger = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>\n>(function NavigationMenuTrigger({ className, children, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n data-slot=\"navigation-menu-trigger\"\n className={cn(navigationMenuTriggerStyle(), 'group', className)}\n {...props}\n >\n {children}{' '}\n <ChevronDownIcon\n aria-hidden=\"true\"\n className=\"relative top-px ms-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180\"\n />\n </NavigationMenuPrimitive.Trigger>\n );\n});\n\nexport const NavigationMenuContent = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>\n>(function NavigationMenuContent({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Content\n ref={ref}\n data-slot=\"navigation-menu-content\"\n className={cn(\n 'start-0 top-0 w-full p-1 ease-[cubic-bezier(0.22,1,0.36,1)] **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto',\n 'data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52',\n 'group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuViewport = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>\n>(function NavigationMenuViewport({ className, ...props }, ref) {\n return (\n <div className=\"absolute start-0 top-full isolate z-popover flex justify-center\">\n <NavigationMenuPrimitive.Viewport\n ref={ref}\n data-slot=\"navigation-menu-viewport\"\n className={cn(\n 'relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full origin-top overflow-hidden rounded-lg bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100 data-open:animate-in data-open:zoom-in-90 data-closed:animate-out data-closed:zoom-out-90 md:w-(--radix-navigation-menu-viewport-width)',\n className,\n )}\n {...props}\n />\n </div>\n );\n});\n\nexport const NavigationMenuLink = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Link>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Link>\n>(function NavigationMenuLink({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Link\n ref={ref}\n data-slot=\"navigation-menu-link\"\n className={cn(\n \"flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted in-data-[slot=navigation-menu-content]:rounded-md [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuIndicator = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>\n>(function NavigationMenuIndicator({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Indicator\n ref={ref}\n data-slot=\"navigation-menu-indicator\"\n className={cn(\n 'top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in',\n className,\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n );\n});\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Typography: styles for headings, paragraphs, lists, etc., one component per style.\n *\n * Each pins the classes of one style and nothing else. All take `asChild`, because the right\n * element depends on the outline: an `h2` style on an `h3` is\n * `<TypographyH2 asChild><h3>…</h3></TypographyH2>`. `className` is merged last, so a caller\n * can override any class (`cn`).\n *\n * Sides are logical (`ms-6`, `border-s-2`, `text-start`), so the styles follow `dir=\"rtl\"`.\n *\n * Two lists of data have a shorthand: `TypographyList items={[…]}` and\n * `TypographyTable headers={[…]} rows={[[…]]}`.\n */\n\ntype TypographyProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n /** Render onto the single child instead of the default element. */\n asChild?: boolean;\n};\n\n/** Factory for the styles that differ only by element and classes. */\nfunction typography(\n displayName: string,\n slot: string,\n element: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'blockquote' | 'code' | 'div' | 'small',\n classes: string,\n) {\n const Component = forwardRef<HTMLElement, TypographyProps>(function Typography(\n { asChild = false, className, ...props },\n ref,\n ) {\n const Root = (asChild ? Slot : element) as 'p';\n return <Root ref={ref as never} data-slot={slot} className={cn(classes, className)} {...props} />;\n });\n Component.displayName = displayName;\n return Component;\n}\n\nexport type TypographyH1Props = TypographyProps;\nexport type TypographyH2Props = TypographyProps;\nexport type TypographyH3Props = TypographyProps;\nexport type TypographyH4Props = TypographyProps;\nexport type TypographyPProps = TypographyProps;\nexport type TypographyBlockquoteProps = TypographyProps;\nexport type TypographyInlineCodeProps = TypographyProps;\nexport type TypographyLeadProps = TypographyProps;\nexport type TypographyLargeProps = TypographyProps;\nexport type TypographySmallProps = TypographyProps;\nexport type TypographyMutedProps = TypographyProps;\n\nexport const TypographyH1 = typography(\n 'TypographyH1',\n 'typography-h1',\n 'h1',\n 'scroll-m-20 text-4xl font-extrabold tracking-tight text-balance',\n);\n\nexport const TypographyH2 = typography(\n 'TypographyH2',\n 'typography-h2',\n 'h2',\n 'scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0',\n);\n\nexport const TypographyH3 = typography(\n 'TypographyH3',\n 'typography-h3',\n 'h3',\n 'scroll-m-20 text-2xl font-semibold tracking-tight',\n);\n\nexport const TypographyH4 = typography(\n 'TypographyH4',\n 'typography-h4',\n 'h4',\n 'scroll-m-20 text-xl font-semibold tracking-tight',\n);\n\nexport const TypographyP = typography('TypographyP', 'typography-p', 'p', 'leading-7 [&:not(:first-child)]:mt-6');\n\nexport const TypographyBlockquote = typography(\n 'TypographyBlockquote',\n 'typography-blockquote',\n 'blockquote',\n 'mt-6 border-s-2 ps-6 italic',\n);\n\nexport const TypographyInlineCode = typography(\n 'TypographyInlineCode',\n 'typography-inline-code',\n 'code',\n 'relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold',\n);\n\nexport const TypographyLead = typography('TypographyLead', 'typography-lead', 'p', 'text-xl text-muted-foreground');\n\nexport const TypographyLarge = typography('TypographyLarge', 'typography-large', 'div', 'text-lg font-semibold');\n\nexport const TypographySmall = typography(\n 'TypographySmall',\n 'typography-small',\n 'small',\n 'text-sm leading-none font-medium',\n);\n\nexport const TypographyMuted = typography('TypographyMuted', 'typography-muted', 'p', 'text-sm text-muted-foreground');\n\n// ── List ───────────────────────────────────────────────────────────────────────\n\nexport interface TypographyListProps extends HTMLAttributes<HTMLUListElement> {\n /** Shorthand: one `<li>` per entry. Leave it out to pass `<li>` children. */\n items?: ReactNode[];\n /** Render onto the single child, such as an `<ol>`. */\n asChild?: boolean;\n}\n\nexport const TypographyList = forwardRef<HTMLUListElement, TypographyListProps>(function TypographyList(\n { items, asChild = false, className, children, ...props },\n ref,\n) {\n const Root = (asChild ? Slot : 'ul') as 'ul';\n return (\n <Root ref={ref} data-slot=\"typography-list\" className={cn('my-6 ms-6 list-disc [&>li]:mt-2', className)} {...props}>\n {items ? items.map((item, index) => <li key={index}>{item}</li>) : children}\n </Root>\n );\n});\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n\nexport interface TypographyTableProps extends HTMLAttributes<HTMLDivElement> {\n /** Shorthand: the header cells. */\n headers?: ReactNode[];\n /** Shorthand: the body rows, one array of cells per row. */\n rows?: ReactNode[][];\n}\n\n/**\n * A table for running text: a scrolling wrapper around a `<table>`. Its `thead`, `tbody`, `tr`,\n * `th` and `td` are styled from here, so composition is plain table markup inside it.\n */\nexport const TypographyTable = forwardRef<HTMLDivElement, TypographyTableProps>(function TypographyTable(\n { headers, rows, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"typography-table\"\n className={cn(\n 'my-6 w-full scrollbar-thin overflow-y-auto',\n '[&_table]:w-full [&_tr]:m-0 [&_tr]:border-t [&_tr]:p-0 [&_tr]:even:bg-muted',\n '[&_th]:border [&_th]:px-4 [&_th]:py-2 [&_th]:text-start [&_th]:font-bold [&_th[align=center]]:text-center [&_th[align=right]]:text-right',\n '[&_td]:border [&_td]:px-4 [&_td]:py-2 [&_td]:text-start [&_td[align=center]]:text-center [&_td[align=right]]:text-right',\n className,\n )}\n {...props}\n >\n {headers || rows ? (\n <table>\n {headers && (\n <thead>\n <tr>\n {headers.map((header, index) => (\n <th key={index}>{header}</th>\n ))}\n </tr>\n </thead>\n )}\n {rows && (\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <td key={cellIndex}>{cell}</td>\n ))}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n ) : (\n children\n )}\n </div>\n );\n});\n\n// ── Link ───────────────────────────────────────────────────────────────────────\n\n/**\n * `brand` (default) is the underlined link for running text. `neutral` is a default-coloured\n * link that underlines on hover, for links that stand alone in a list or tree, where a column of\n * brand underlines would be noise. Don't use `neutral` inside a sentence: there, colour and\n * underline are what mark it as a link.\n */\nexport type TextLinkTone = 'brand' | 'neutral';\n\nexport interface TextLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children?: ReactNode;\n asChild?: boolean;\n tone?: TextLinkTone;\n}\n\nconst TEXT_LINK_TONE: Record<TextLinkTone, string> = {\n brand: 'text-primary underline decoration-1 hover:text-primary/80',\n neutral: 'text-foreground no-underline decoration-1 hover:underline',\n};\n\n/**\n * A link in text. Underlined rather than colour-only: colour alone is not a sufficient\n * distinction for a link inside a run of text (WCAG 1.4.1).\n */\nexport const TextLink = forwardRef<HTMLAnchorElement, TextLinkProps>(function TextLink(\n { children, asChild = false, tone = 'brand', className, ...rest },\n ref,\n) {\n const Root = (asChild ? Slot : 'a') as 'a';\n return (\n <Root\n ref={ref}\n data-tone={tone}\n className={clsx(\n 'rounded underline-offset-2 transition-colors',\n TEXT_LINK_TONE[tone],\n 'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n","import {\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Separator, type SeparatorProps } from '../chrome/separator';\n\n/**\n * Item: a flex row for content — media, a title, a description and actions. Group items in an\n * `ItemGroup` to make a list. For a form control with a label, use `Field` instead.\n *\n * Two ways to write one:\n * - Shorthand: `<Item media={<Icon />} mediaVariant=\"icon\" title=\"…\" description=\"…\" actions={…} />`.\n * - Composition: `Item` > `ItemMedia` + `ItemContent` (`ItemTitle`, `ItemDescription`) +\n * `ItemActions`, with `ItemHeader` / `ItemFooter` spanning the full width.\n *\n * An item is not interactive by itself: render it onto a link or button with `asChild` and the\n * hover and focus styles apply to that element.\n */\n\n/** Set by ItemGroup, so its items are list items. */\nconst InGroupContext = createContext(false);\n\nexport const ItemGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemGroup(\n { className, ...props },\n ref,\n) {\n return (\n <InGroupContext.Provider value>\n <div\n ref={ref}\n role=\"list\"\n data-slot=\"item-group\"\n className={cn(\n 'group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2',\n className,\n )}\n {...props}\n />\n </InGroupContext.Provider>\n );\n});\n\nexport const ItemSeparator = forwardRef<HTMLDivElement, SeparatorProps>(function ItemSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <Separator\n ref={ref}\n data-slot=\"item-separator\"\n orientation=\"horizontal\"\n className={cn('my-2', className)}\n {...props}\n />\n );\n});\n\nexport type ItemVariant = 'default' | 'outline' | 'muted';\nexport type ItemSize = 'default' | 'sm' | 'xs';\nexport type ItemMediaVariant = 'default' | 'icon' | 'image';\n\nconst VARIANT: Record<ItemVariant, string> = {\n default: 'border-transparent',\n outline: 'border-border',\n muted: 'border-transparent bg-muted/50',\n};\n\nconst SIZE: Record<ItemSize, string> = {\n default: 'gap-2.5 px-3 py-2.5',\n sm: 'gap-2.5 px-3 py-2.5',\n xs: 'gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0',\n};\n\nexport interface ItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n variant?: ItemVariant;\n size?: ItemSize;\n /** Render onto the single child (a link or button), which takes the item's look. */\n asChild?: boolean;\n /** Shorthand: the `ItemMedia` content. */\n media?: ReactNode;\n /** Shorthand: the `ItemMedia` variant. Default `default`. */\n mediaVariant?: ItemMediaVariant;\n /** Shorthand: the `ItemTitle`. */\n title?: ReactNode;\n /** Shorthand: the `ItemDescription`. */\n description?: ReactNode;\n /** Shorthand: the `ItemActions` content. */\n actions?: ReactNode;\n /** Shorthand: an `ItemHeader` above the row. */\n header?: ReactNode;\n /** Shorthand: an `ItemFooter` below the row. */\n footer?: ReactNode;\n}\n\nexport const Item = forwardRef<HTMLDivElement, ItemProps>(function Item(\n {\n className,\n variant = 'default',\n size = 'default',\n asChild = false,\n media,\n mediaVariant = 'default',\n title,\n description,\n actions,\n header,\n footer,\n children,\n ...props\n },\n ref,\n) {\n const inGroup = useContext(InGroupContext);\n const shorthand = [media, title, description, actions, header, footer].some((part) => part != null);\n\n const parts = (extra: ReactNode) => (\n <>\n {header != null && <ItemHeader>{header}</ItemHeader>}\n {media != null && <ItemMedia variant={mediaVariant}>{media}</ItemMedia>}\n {(title != null || description != null || extra != null) && (\n <ItemContent>\n {title != null && <ItemTitle>{title}</ItemTitle>}\n {description != null && <ItemDescription>{description}</ItemDescription>}\n {extra}\n </ItemContent>\n )}\n {actions != null && <ItemActions>{actions}</ItemActions>}\n {footer != null && <ItemFooter>{footer}</ItemFooter>}\n </>\n );\n\n const rootProps = {\n 'data-slot': 'item',\n 'data-variant': variant,\n 'data-size': size,\n className: cn(\n 'group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted',\n VARIANT[variant],\n SIZE[size],\n className,\n ),\n ...props,\n };\n\n if (asChild) {\n const child = children as ReactElement<{ children?: ReactNode }>;\n return (\n <Slot ref={ref} {...rootProps} wrapChildren={shorthand ? (own) => parts(own) : undefined}>\n {isValidElement(child) ? child : null}\n </Slot>\n );\n }\n\n return (\n // A list item inside an ItemGroup. An asChild item keeps its link or button role.\n <div ref={ref} role={inGroup ? 'listitem' : undefined} {...rootProps}>\n {shorthand ? parts(children) : children}\n </div>\n );\n});\n\nexport interface ItemMediaProps extends HTMLAttributes<HTMLDivElement> {\n variant?: ItemMediaVariant;\n}\n\nconst MEDIA_VARIANT: Record<ItemMediaVariant, string> = {\n default: 'bg-transparent',\n icon: \"[&_svg:not([class*='size-'])]:size-4\",\n image:\n 'size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover',\n};\n\nexport const ItemMedia = forwardRef<HTMLDivElement, ItemMediaProps>(function ItemMedia(\n { className, variant = 'default', ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-media\"\n data-variant={variant}\n className={cn(\n 'flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none',\n MEDIA_VARIANT[variant],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-content\"\n className={cn(\n 'flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemTitle = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-title\"\n className={cn(\n 'line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(\n function ItemDescription({ className, ...props }, ref) {\n return (\n <p\n ref={ref}\n data-slot=\"item-description\"\n className={cn(\n 'line-clamp-2 text-start text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const ItemActions = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemActions(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"item-actions\" className={cn('flex items-center gap-2', className)} {...props} />;\n});\n\nexport const ItemHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-header\"\n className={cn('flex basis-full items-center justify-between gap-2', className)}\n {...props}\n />\n );\n});\n\nexport const ItemFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-footer\"\n className={cn('flex basis-full items-center justify-between gap-2', className)}\n {...props}\n />\n );\n});\n","import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Button, type ButtonProps } from '../forms/button';\n\n/**\n * Attachment: displays a file or image attachment with media, metadata, upload state, and\n * actions.\n *\n * Two ways to write one:\n * - Shorthand: `<Attachment title=\"report.pdf\" description=\"PDF · 2.4 MB\" media={<FileTextIcon />}\n * actions={<AttachmentAction aria-label=\"Remove report.pdf\"><XIcon /></AttachmentAction>} />`.\n * - Composition: `AttachmentMedia`, `AttachmentContent` (`AttachmentTitle`,\n * `AttachmentDescription`), `AttachmentActions` (`AttachmentAction`) and an optional\n * `AttachmentTrigger` that makes the whole card a button or link.\n *\n * `state` follows the upload lifecycle: `idle` (dashed), `uploading` / `processing` (the title\n * shimmers), `error` (destructive) and `done`. Every part carries `data-slot`.\n */\n\nexport type AttachmentState = 'idle' | 'uploading' | 'processing' | 'error' | 'done';\nexport type AttachmentSize = 'default' | 'sm' | 'xs';\nexport type AttachmentOrientation = 'horizontal' | 'vertical';\nexport type AttachmentMediaVariant = 'icon' | 'image';\n\nconst ROOT =\n 'group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/30 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed';\n\nconst SIZE: Record<AttachmentSize, string> = {\n default:\n 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',\n sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',\n xs: 'gap-1.5 rounded-xl text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1',\n};\n\nconst ORIENTATION: Record<AttachmentOrientation, string> = {\n horizontal: 'min-w-40 items-center',\n vertical: 'w-24 flex-col has-data-[slot=attachment-content]:w-30',\n};\n\nexport interface AttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The upload state. Drives styling and the shimmer. Default `done`. */\n state?: AttachmentState;\n /** Default `default`. */\n size?: AttachmentSize;\n /** Lay the media beside (`horizontal`) or above (`vertical`) the content. */\n orientation?: AttachmentOrientation;\n /** Shorthand: the file name. With it, the attachment renders its own parts. */\n title?: ReactNode;\n /** Shorthand: secondary metadata, e.g. type and size, or the failure reason. */\n description?: ReactNode;\n /** Shorthand: an icon, or an `<img>` (with `mediaVariant=\"image\"`). */\n media?: ReactNode;\n /** Shorthand: what `media` holds. Default `icon`. */\n mediaVariant?: AttachmentMediaVariant;\n /** Shorthand: one or more `AttachmentAction`s. */\n actions?: ReactNode;\n}\n\nexport const Attachment = forwardRef<HTMLDivElement, AttachmentProps>(function Attachment(\n {\n className,\n state = 'done',\n size = 'default',\n orientation = 'horizontal',\n title,\n description,\n media,\n mediaVariant = 'icon',\n actions,\n children,\n ...props\n },\n ref,\n) {\n const shorthand = title !== undefined || description !== undefined || media !== undefined || actions !== undefined;\n return (\n <div\n ref={ref}\n data-slot=\"attachment\"\n data-state={state}\n data-size={size}\n data-orientation={orientation}\n className={cn(ROOT, SIZE[size], ORIENTATION[orientation], className)}\n {...props}\n >\n {shorthand ? (\n <>\n {media !== undefined && <AttachmentMedia variant={mediaVariant}>{media}</AttachmentMedia>}\n {(title !== undefined || description !== undefined) && (\n <AttachmentContent>\n {title !== undefined && <AttachmentTitle>{title}</AttachmentTitle>}\n {description !== undefined && <AttachmentDescription>{description}</AttachmentDescription>}\n </AttachmentContent>\n )}\n {actions !== undefined && <AttachmentActions>{actions}</AttachmentActions>}\n {children}\n </>\n ) : (\n children\n )}\n </div>\n );\n});\n\nconst MEDIA_VARIANT: Record<AttachmentMediaVariant, string> = {\n icon: '',\n image:\n 'opacity-60 group-data-[state=idle]/attachment:opacity-100 group-data-[state=done]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover',\n};\n\nexport interface AttachmentMediaProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the media holds an icon or an `<img>`. Default `icon`. */\n variant?: AttachmentMediaVariant;\n}\n\nexport const AttachmentMedia = forwardRef<HTMLDivElement, AttachmentMediaProps>(function AttachmentMedia(\n { className, variant = 'icon', ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-media\"\n data-variant={variant}\n className={cn(\n 'relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground',\n 'group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[orientation=vertical]/attachment:w-full',\n 'group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive',\n \"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5\",\n \"group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6!\",\n MEDIA_VARIANT[variant],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const AttachmentContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-content\"\n className={cn('max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1', className)}\n {...props}\n />\n );\n});\n\nexport const AttachmentTitle = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function AttachmentTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"attachment-title\"\n className={cn(\n 'block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const AttachmentDescription = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(\n function AttachmentDescription({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n data-slot=\"attachment-description\"\n className={cn(\n 'mt-0.5 block max-w-full min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const AttachmentActions = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentActions(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-actions\"\n className={cn(\n 'relative z-20 flex shrink-0 items-center',\n 'group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type AttachmentActionProps = ButtonProps;\n\n/**\n * An icon action: a `Button`, ghost and `icon-xs` unless you pass `variant` / `size`. Name it with\n * `aria-label` (\"Remove report.pdf\"); `asChild` renders a link instead.\n */\nexport const AttachmentAction = forwardRef<HTMLButtonElement, AttachmentActionProps>(function AttachmentAction(\n { variant = 'ghost', size = 'icon-xs', ...props },\n ref,\n) {\n return <Button ref={ref} data-slot=\"attachment-action\" variant={variant} size={size} {...props} />;\n});\n\nexport interface AttachmentTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child element instead, such as a link. */\n asChild?: boolean;\n}\n\n/**\n * A full-card overlay that opens the attachment. It sits behind the actions, so both stay\n * clickable. It has no text of its own: give it an `aria-label`.\n */\nexport const AttachmentTrigger = forwardRef<HTMLButtonElement, AttachmentTriggerProps>(function AttachmentTrigger(\n { className, asChild = false, type, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-slot=\"attachment-trigger\"\n type={asChild ? undefined : (type ?? 'button')}\n className={cn('absolute inset-0 z-10 outline-none', className)}\n {...props}\n />\n );\n});\n\n/** Lays out attachments in a horizontally scrollable, snapping row with an edge fade. */\nexport const AttachmentGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-group\"\n className={cn(\n 'flex min-w-0 snap-x snap-mandatory scroll-px-1 gap-3 overflow-x-auto overscroll-x-contain py-1 scroll-fade-x scrollbar-none',\n '*:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start',\n className,\n )}\n {...props}\n />\n );\n});\n\n","export { Button } from './components/forms/button';\nexport type { ButtonProps, ButtonVariant, ButtonSize } from './components/forms/button';\n\nexport { ButtonGroup, ButtonGroupText, ButtonGroupSeparator } from './components/forms/button-group';\nexport type {\n ButtonGroupProps,\n ButtonGroupItem,\n ButtonGroupOrientation,\n ButtonGroupTextProps,\n ButtonGroupSeparatorProps,\n} from './components/forms/button-group';\n\nexport {\n Avatar,\n AvatarImage,\n AvatarFallback,\n AvatarBadge,\n AvatarGroup,\n AvatarGroupCount,\n} from './components/avatar/avatar';\nexport type {\n AvatarProps,\n AvatarImageProps,\n AvatarFallbackProps,\n AvatarBadgeProps,\n AvatarGroupProps,\n AvatarGroupCountProps,\n AvatarSize,\n AvatarShape,\n} from './components/avatar/avatar';\n\n// ── Field ──────────────────────────────────────────────────────────────────────\n// The label / description / error / control wiring. From 0.10.0 the only place a field's text\n// lives: the controls are bare, and a form (or `Form`) composes them inside a Field.\n\nexport {\n Field,\n FieldLabel,\n FieldContent,\n FieldTitle,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldSet,\n FieldLegend,\n FieldSeparator,\n useFieldContext,\n useFieldControl,\n} from './components/forms/field';\nexport type {\n FieldProps,\n FieldLabelProps,\n FieldTextProps,\n FieldErrorProps,\n FieldGroupProps,\n FieldSetProps,\n FieldLegendProps,\n FieldSeparatorProps,\n FieldOrientation,\n FieldContextValue,\n FieldPart,\n} from './components/forms/field';\n\nexport { Input } from './components/forms/input';\nexport type { InputProps } from './components/forms/input';\n\nexport { Textarea } from './components/forms/textarea';\nexport type { TextareaProps } from './components/forms/textarea';\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from './components/forms/select';\nexport type {\n SelectProps,\n SelectTriggerProps,\n SelectSize,\n SelectOption,\n SelectOptionGroup,\n} from './components/forms/select';\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from './components/forms/native-select';\nexport type { NativeSelectProps, NativeSelectSize } from './components/forms/native-select';\n\nexport { DatePicker } from './components/forms/date-picker';\nexport type {\n DatePickerProps,\n DatePickerSingleProps,\n DatePickerRangeProps,\n DatePickerRange,\n} from './components/forms/date-picker';\n\nexport {\n Questionnaire,\n QuestionnaireActions,\n QuestionnaireChoice,\n QuestionnaireChoiceDescription,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireError,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireNext,\n QuestionnairePrevious,\n QuestionnaireProgress,\n QuestionnaireSkip,\n QuestionnaireSubmit,\n QuestionnaireTitle,\n} from './components/forms/questionnaire';\nexport type {\n QuestionnaireActionsProps,\n QuestionnaireChoiceDefinition,\n QuestionnaireChoiceDescriptionProps,\n QuestionnaireChoiceProps,\n QuestionnaireChoicesProps,\n QuestionnaireDescriptionProps,\n QuestionnaireErrorProps,\n QuestionnaireInputProps,\n QuestionnaireInputType,\n QuestionnaireItemDefinition,\n QuestionnaireItemProps,\n QuestionnaireItemStatus,\n QuestionnaireNextProps,\n QuestionnairePreviousProps,\n QuestionnaireProgressProps,\n QuestionnaireProps,\n QuestionnaireShortcutMode,\n QuestionnaireShorthandChoice,\n QuestionnaireShorthandItem,\n QuestionnaireSkipProps,\n QuestionnaireSubmitProps,\n QuestionnaireTitleProps,\n} from './components/forms/questionnaire';\n\n/**\n * On/off setting. Was named `Toggle` through 0.3.0 — see the CHANGELOG rename table. The\n * name `Toggle` now belongs to the pressed-state button, as it does in Radix.\n */\nexport { Switch } from './components/forms/switch';\nexport type { SwitchProps, SwitchSize } from './components/forms/switch';\n\n/** Pressed-state button, and a group of them. New in 0.4.0. */\nexport { Toggle, ToggleGroup, ToggleGroupItem, toggleVariants } from './components/forms/toggle';\nexport type {\n ToggleProps,\n ToggleSize,\n ToggleVariant,\n ToggleGroupProps,\n ToggleGroupOption,\n ToggleGroupItemProps,\n} from './components/forms/toggle';\n\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n REGEXP_ONLY_CHARS,\n REGEXP_ONLY_DIGITS,\n REGEXP_ONLY_DIGITS_AND_CHARS,\n} from './components/forms/input-otp';\nexport type { InputOTPProps, InputOTPSlotProps } from './components/forms/input-otp';\n\nexport { Badge, BADGE_COLORS } from './components/status/badge';\nexport type { BadgeProps, BadgeColor, BadgeVariant } from './components/status/badge';\n\n/** Single-select autocomplete. ARIA 1.2 combobox pattern. */\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n} from './components/forms/combobox';\nexport type {\n ComboboxProps,\n ComboboxOption,\n ComboboxInputProps,\n ComboboxContentProps,\n ComboboxChipProps,\n} from './components/forms/combobox';\n\n/** ⌘K command palette body; `CommandDialog` puts it in a `Dialog`. */\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from './components/forms/command';\nexport type {\n CommandProps,\n CommandItemDef,\n CommandDialogProps,\n CommandInputProps,\n CommandGroupProps,\n CommandSeparatorProps,\n CommandItemProps,\n} from './components/forms/command';\n\n// ── Selection ──────────────────────────────────────────────────────────────────\n\nexport { Checkbox } from './components/forms/checkbox';\nexport type { CheckboxProps, CheckedState } from './components/forms/checkbox';\n\nexport { RadioGroup, RadioGroupItem } from './components/forms/radio-group';\n\nexport type {\n RadioGroupProps,\n RadioGroupOption,\n RadioGroupItemProps,\n RadioGroupOrientation,\n} from './components/forms/radio-group';\n\n\nexport { Slider } from './components/forms/slider';\nexport type { SliderProps } from './components/forms/slider';\n\nexport { Label } from './components/forms/label';\nexport type { LabelProps } from './components/forms/label';\n\nexport { Calendar, PersianCalendar, CalendarDayButton } from './components/forms/calendar';\nexport type { CalendarProps, PersianCalendarProps, CalendarDayButtonProps } from './components/forms/calendar';\n/** The `range` selection type, from the calendar engine, so apps needn't import it themselves. */\nexport type { DateRange } from 'react-day-picker';\n\nexport {\n InputGroup,\n InputGroupInput,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupTextarea,\n} from './components/forms/input-group';\nexport type {\n InputGroupProps,\n InputGroupInputProps,\n InputGroupAddonProps,\n InputGroupTextProps,\n InputGroupButtonProps,\n InputGroupButtonSize,\n InputGroupTextareaProps,\n InputGroupAlign,\n} from './components/forms/input-group';\n\n// ── Overlays ───────────────────────────────────────────────────────────────────\n\nexport {\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogClose,\n DialogOverlay,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/overlays/dialog';\nexport type { DialogProps, DialogContentProps, DialogFooterProps } from './components/overlays/dialog';\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './components/overlays/tooltip';\nexport type { TooltipProps } from './components/overlays/tooltip';\n\n/** Anchored panel for **interactive** content — unlike `Tooltip`, which cannot be entered. */\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverAnchor,\n} from './components/overlays/popover';\nexport type { PopoverProps, PopoverTriggerProps, PopoverContentProps } from './components/overlays/popover';\n\n/** Hover preview that can be entered. Supplementary by contract — hover has no touch equivalent. */\nexport { HoverCard, HoverCardTrigger, HoverCardContent } from './components/overlays/hover-card';\nexport type { HoverCardProps, HoverCardContentProps } from './components/overlays/hover-card';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItems,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n} from './components/overlays/context-menu';\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n} from './components/overlays/context-menu';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarPortal,\n MenubarTrigger,\n MenubarContent,\n MenubarItems,\n MenubarItem,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarGroup,\n MenubarLabel,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubTrigger,\n MenubarSubContent,\n} from './components/overlays/menubar';\nexport type {\n MenubarProps,\n MenubarMenuDef,\n MenubarMenuProps,\n MenubarTriggerProps,\n MenubarContentProps,\n} from './components/overlays/menubar';\n\nexport {\n Drawer,\n DrawerTrigger,\n DrawerPortal,\n DrawerOverlay,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './components/overlays/drawer';\nexport type {\n DrawerProps,\n DrawerShorthandProps,\n DrawerContentProps,\n DrawerDirection,\n} from './components/overlays/drawer';\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetPortal,\n SheetOverlay,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from './components/overlays/sheet';\nexport type { SheetProps, SheetContentProps, SheetSide } from './components/overlays/sheet';\n\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogMedia,\n AlertDialogAction,\n AlertDialogCancel,\n} from './components/overlays/alert-dialog';\nexport type {\n AlertDialogProps,\n AlertDialogContentProps,\n AlertDialogMediaProps,\n AlertDialogSize,\n AlertDialogTone,\n} from './components/overlays/alert-dialog';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuItems,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n} from './components/overlays/dropdown-menu';\nexport type {\n /** One menu entry as data, shared by DropdownMenu, ContextMenu and Menubar. New in 0.8.0. */\n MenuItemDef,\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuContentProps,\n DropdownMenuItemProps,\n DropdownMenuItemVariant,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuSeparatorProps,\n DropdownMenuShortcutProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './components/overlays/dropdown-menu';\n\nexport { Portal, PortalContainerProvider, usePortalContainer } from './components/overlays/portal';\nexport type { PortalProps } from './components/overlays/portal';\n\n// ── Utilities ──────────────────────────────────────────────────────────────────\n\n/** `clsx` + `tailwind-merge` — for compositions where your className must win. */\nexport { cn } from './lib/cn';\n\n/**\n * What makes `asChild` work: renders its props onto its single child. Exported from 0.7.0\n * so a composition of your own can offer the same `asChild` contract.\n */\nexport { composeRefs } from './lib/slot';\n\n/** The text direction (ltr / rtl) for the components inside. */\nexport { DirectionProvider, useDirection } from './lib/direction';\nexport type { DirectionProviderProps, TextDirection } from './lib/direction';\n\n/** The library's keyboard focus ring, for controls you build yourself. New in 0.7.0. */\nexport { FOCUS_RING, FOCUS_RING_INSET } from './lib/focus-ring';\n\n// ── Cards & containers ─────────────────────────────────────────────────────────\n\nexport {\n Card,\n CardHeader,\n CardTitle,\n CardDescription,\n CardAction,\n CardContent,\n CardFooter,\n} from './components/cards/card';\nexport type { CardProps, CardSize, CardTitleProps } from './components/cards/card';\n/** Internal: how the blocks' Dashboard reaches its cards while arranging. */\nexport { DashboardEditContext, useDashboardEdit } from './components/cards/dashboard-edit-context';\nexport type { DashboardEditControls } from './components/cards/dashboard-edit-context';\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/cards/accordion';\nexport type {\n AccordionProps,\n AccordionItemDef,\n AccordionItemProps,\n AccordionTriggerProps,\n AccordionContentProps,\n AccordionType,\n} from './components/cards/accordion';\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent } from './components/cards/collapsible';\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsibleContentProps,\n} from './components/cards/collapsible';\n\nexport { AspectRatio } from './components/cards/aspect-ratio';\nexport type { AspectRatioProps } from './components/cards/aspect-ratio';\n\nexport { ScrollArea, ScrollBar } from './components/cards/scroll-area';\nexport type { ScrollAreaProps, ScrollAreaAxis, ScrollBarProps } from './components/cards/scroll-area';\n\n// The scrollbar styling on its own, for a component that must own its own overflow — a\n// table wrapper, a tab strip, a floating panel. Use `ScrollArea` for a region of content.\nexport { SCROLLBAR_CLASSES } from './lib/scrollbar';\n\nexport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n useCarousel,\n} from './components/cards/carousel';\nexport type { CarouselProps, CarouselApi } from './components/cards/carousel';\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle } from './components/cards/resizable';\nexport type {\n ResizablePanelGroupProps,\n ResizablePanelDefinition,\n ResizablePanelProps,\n ResizableHandleProps,\n ResizablePanelGroupHandle,\n ResizablePanelHandle,\n ResizableLayout,\n} from './components/cards/resizable';\n\n// ── Page chrome ────────────────────────────────────────────────────────────────\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/chrome/tabs';\nexport type {\n TabsProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabItem,\n TabsVariant,\n} from './components/chrome/tabs';\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n filterNav,\n filterNavItems,\n} from './components/chrome/sidebar';\nexport type {\n SidebarProps,\n SidebarFrameProps,\n SidebarSide,\n SidebarVariant,\n SidebarCollapsible,\n SidebarProviderProps,\n SidebarContextValue,\n SidebarTriggerProps,\n SidebarSeparatorProps,\n SidebarMenuButtonProps,\n SidebarMenuButtonVariant,\n SidebarMenuButtonSize,\n SidebarMenuSubButtonProps,\n SidebarNavItem,\n SidebarNavGroup,\n SidebarLinkProps,\n SidebarLinkComponent,\n SidebarRenderState,\n} from './components/chrome/sidebar';\n\nexport { Separator } from './components/chrome/separator';\nexport type { SeparatorProps, SeparatorOrientation } from './components/chrome/separator';\n\nexport { Kbd, KbdGroup } from './components/chrome/kbd';\nexport type { KbdProps, KbdGroupProps } from './components/chrome/kbd';\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n} from './components/chrome/breadcrumb';\nexport type {\n BreadcrumbProps,\n BreadcrumbItemDef,\n BreadcrumbLinkProps,\n BreadcrumbSeparatorProps,\n} from './components/chrome/breadcrumb';\n\nexport {\n Pagination,\n PaginationBar,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n paginationRange,\n} from './components/chrome/pagination';\nexport type {\n PaginationArrowProps,\n PaginationBarProps,\n PaginationLinkProps,\n PaginationProps,\n} from './components/chrome/pagination';\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuIndicator,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n NavigationMenuViewport,\n navigationMenuTriggerStyle,\n} from './components/chrome/navigation-menu';\nexport type { NavigationMenuItemDef, NavigationMenuProps } from './components/chrome/navigation-menu';\n\n// ── Typography ─────────────────────────────────────────────────────────────────\n// The type ramp as components, mirroring Figma's `Text*` primitives. Every one takes\n// `asChild`, because the right element depends on the surrounding document outline.\n\nexport {\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyP,\n TypographyBlockquote,\n TypographyTable,\n TypographyList,\n TypographyInlineCode,\n TypographyLead,\n TypographyLarge,\n TypographySmall,\n TypographyMuted,\n TextLink,\n} from './components/chrome/typography';\nexport type {\n TypographyH1Props,\n TypographyH2Props,\n TypographyH3Props,\n TypographyH4Props,\n TypographyPProps,\n TypographyBlockquoteProps,\n TypographyTableProps,\n TypographyListProps,\n TypographyInlineCodeProps,\n TypographyLeadProps,\n TypographyLargeProps,\n TypographySmallProps,\n TypographyMutedProps,\n TextLinkProps,\n TextLinkTone,\n} from './components/chrome/typography';\n\n// ── Data visualisation ─────────────────────────────────────────────────────────\n// Charts are `@platned/ui/chart` (Recharts is an optional peer), not part of this entry.\n\n// ── Lists & rows ───────────────────────────────────────────────────────────────\n\nexport {\n Item,\n ItemActions,\n ItemContent,\n ItemDescription,\n ItemFooter,\n ItemGroup,\n ItemHeader,\n ItemMedia,\n ItemSeparator,\n ItemTitle,\n} from './components/lists/item';\nexport type { ItemMediaProps, ItemMediaVariant, ItemProps, ItemSize, ItemVariant } from './components/lists/item';\n\nexport {\n Attachment,\n AttachmentMedia,\n AttachmentContent,\n AttachmentTitle,\n AttachmentDescription,\n AttachmentActions,\n AttachmentAction,\n AttachmentTrigger,\n AttachmentGroup,\n} from './components/lists/attachment';\nexport type {\n AttachmentProps,\n AttachmentMediaProps,\n AttachmentActionProps,\n AttachmentTriggerProps,\n AttachmentState,\n AttachmentSize,\n AttachmentOrientation,\n AttachmentMediaVariant,\n} from './components/lists/attachment';\n\n// ── Values ─────────────────────────────────────────────────────────────────────\n// Value types: a value shown by what it is, from a JSON descriptor. Shared by DataTable, Form and\n// the blocks (`@platned/ui/blocks`), with locale and currency from one FormatProvider.\n\nexport { Value, renderValue } from './components/lists/value';\nexport type { ValueProps } from './components/lists/value';\nexport {\n FormatProvider,\n useFormat,\n formatValue,\n formatDate,\n formatRelative,\n getValueAt,\n isEmptyValue,\n isNumericType,\n humanize,\n toDate,\n} from './lib/format';\nexport type { FormatOptions, FormatProviderProps, FieldPath, ValueType, ValueFormat, ValueField } from './lib/format';\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n// The composable primitive, for the tables `DataTable`'s column config cannot express —\n// grouped headers, footers, colspans. `DataTable` remains the right default.\n\nexport {\n Table,\n TableCaption,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableHead,\n TableCell,\n} from './components/lists/table';\nexport type {\n TableProps,\n TableColumn,\n TableCaptionProps,\n TableHeaderProps,\n TableBodyProps,\n TableFooterProps,\n TableRowProps,\n TableHeadProps,\n TableCellProps,\n} from './components/lists/table';\n\n// ── Data table ─────────────────────────────────────────────────────────────────\n// DataTable, its parts and the TanStack Table types live in the `@platned/ui/data-table` entry\n// from 0.9.4 (src/data-table.tsx); the build keeps them in that file, so the main entry pulls in\n// TanStack only when a DataTable is actually used.\n\nexport * from './data-table';\n\n// The cells need no TanStack, so they are also exported straight from their module: a page that\n// renders a cell outside a DataTable does not load the table.\nexport {\n TableCellLeadText,\n TableCellText,\n TableCellBadge,\n TableCellProgress,\n} from './components/lists/data-table-cells';\n\n/** Measures an element's width, for layouts that switch structure by available space. New in 0.7.0. */\nexport { useElementWidth } from './lib/use-element-width';\n\n// ── Feedback ───────────────────────────────────────────────────────────────────\n\nexport { Alert, AlertTitle, AlertDescription, AlertAction } from './components/feedback/alert';\nexport type { AlertProps, AlertVariant } from './components/feedback/alert';\n\nexport {\n Empty,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n EmptyDescription,\n EmptyContent,\n} from './components/feedback/empty';\nexport type {\n EmptyProps,\n EmptyHeaderProps,\n EmptyMediaProps,\n EmptyMediaVariant,\n EmptyTitleProps,\n EmptyDescriptionProps,\n EmptyContentProps,\n} from './components/feedback/empty';\n\nexport { Progress } from './components/feedback/progress';\nexport type { ProgressProps, ProgressTone } from './components/feedback/progress';\n\nexport { Spinner } from './components/feedback/spinner';\nexport type { SpinnerProps } from './components/feedback/spinner';\n\nexport { Skeleton } from './components/feedback/skeleton';\nexport type { SkeletonProps } from './components/feedback/skeleton';\n\n/** Transient notifications. Mount `<Toaster />` once at the app root, then call `toast()` anywhere. */\nexport { Toaster, toast } from './components/feedback/sonner';\nexport type { ToasterProps, ToastOptions } from './components/feedback/sonner';\n\n// ── AI surfaces ────────────────────────────────────────────────────────────────\n\n/** Chat transcript pieces. New in 0.7.0, from SCIC. */\nexport {\n Message,\n MessageAvatar,\n MessageContent,\n MessageFooter,\n MessageGroup,\n MessageHeader,\n} from './components/ai/message';\nexport type { MessageAlign, MessageProps } from './components/ai/message';\nexport {\n MessageScroller,\n MessageScrollerButton,\n MessageScrollerContent,\n MessageScrollerItem,\n MessageScrollerProvider,\n MessageScrollerViewport,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n} from './components/ai/message-scroller';\nexport type {\n MessageScrollerButtonProps,\n MessageScrollerContentProps,\n MessageScrollerDefaultScrollPosition,\n MessageScrollerItemProps,\n MessageScrollerProps,\n MessageScrollerProviderProps,\n MessageScrollerScrollOptions,\n MessageScrollerViewportProps,\n} from './components/ai/message-scroller';\nexport { Marker, MarkerContent, MarkerIcon } from './components/ai/marker';\nexport type { MarkerProps, MarkerVariant } from './components/ai/marker';\nexport {\n Trace,\n TraceLine,\n TraceIcon,\n TraceTitle,\n TraceDescription,\n TraceCollapsible,\n TraceCollapsibleTrigger,\n TraceCollapsibleContent,\n} from './components/ai/trace';\nexport type {\n TraceLineProps,\n TraceStatus,\n TraceCollapsibleProps,\n TraceCollapsibleTriggerProps,\n TraceCollapsibleContentProps,\n} from './components/ai/trace';\n\nexport { Bubble, BubbleContent, BubbleReactions, BubbleGroup } from './components/ai/bubble';\nexport type { BubbleProps, BubbleVariant, BubbleContentProps, BubbleReactionsProps } from './components/ai/bubble';\n\nexport {\n CodeBlock,\n CodeBlockHeader,\n CodeBlockTitle,\n CodeBlockActions,\n CodeBlockCopyButton,\n CodeBlockContent,\n CodeBlockLine,\n CodeBlockFooter,\n} from './components/ai/code-block';\nexport type {\n CodeBlockProps,\n CodeBlockVariant,\n CodeBlockSize,\n CodeBlockLineVariant,\n CodeBlockCopyButtonProps,\n CodeBlockContentProps,\n CodeBlockLineProps,\n} from './components/ai/code-block';\n\n// Icons are not re-exported. Import them straight from `lucide-react` — the nine filled\n// 20×20 `Solid*` marks that used to live here were used by no component in this library,\n// only by its own documentation, and they were the one place the library shipped a second\n// icon set. Charts remain the sole exception to Lucide, because their SVG is geometry.\n","import { Children, isValidElement, type HTMLAttributes, type ReactNode } from 'react';\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Alert: displays a callout for user attention.\n *\n * Two ways to write one:\n * - Shorthand: `<Alert variant=\"success\" title=\"…\" description=\"…\" action={…} />`, or plain\n * children, which become the description. A default icon per variant is added.\n * - Composition: an icon (`<svg>`), `AlertTitle`, `AlertDescription`, `AlertAction` as children,\n * the standard anatomy. Bring your own icon, or pass `icon` to add the default one.\n *\n * Variants: `default` and `destructive`, plus the Platned `success`, `warning` and `info`. The\n * coloured variants are tinted (the role at 10% behind, 30% border). `destructive` is announced\n * immediately (`role=\"alert\"`); the others are polite (`role=\"status\"`) so they don't interrupt\n * a screen reader mid-sentence. Override with `role`.\n */\n\nexport type AlertVariant = 'default' | 'destructive' | 'success' | 'warning' | 'info';\n\nconst VARIANT: Record<AlertVariant, string> = {\n default: 'bg-card text-card-foreground',\n destructive:\n 'border-destructive/30 bg-destructive/10 text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current',\n success: 'border-success/30 bg-success/10 text-success *:data-[slot=alert-description]:text-success/90',\n warning: 'border-warning/30 bg-warning/10 text-warning *:data-[slot=alert-description]:text-warning/90',\n info: 'border-primary/30 bg-primary/10 text-primary *:data-[slot=alert-description]:text-primary/90',\n};\n\nconst ICON: Record<AlertVariant, ReactNode> = {\n default: <InfoIcon />,\n destructive: <CircleAlertIcon />,\n success: <CircleCheckIcon />,\n warning: <TriangleAlertIcon />,\n info: <InfoIcon />,\n};\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n variant?: AlertVariant;\n /** Shorthand: the title line. */\n title?: ReactNode;\n /** Shorthand: the description. Plain children are used when this is not set. */\n description?: ReactNode;\n /** Shorthand: an action in the top-right corner, e.g. a small button. */\n action?: ReactNode;\n /**\n * The icon. Default: the variant's icon in shorthand, none in composition (bring your own\n * `<svg>` as the first child). `null` hides it; any node replaces it.\n */\n icon?: ReactNode | null;\n /** Live-region role. Default `alert` for `destructive`, `status` for the rest. */\n role?: 'alert' | 'status';\n}\n\nconst PARTS = new Set<unknown>();\n\n/** Composition when any child is an Alert part; otherwise the children are the description. */\nfunction isComposed(children: ReactNode) {\n return Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n}\n\nexport function Alert({\n variant = 'default',\n title,\n description,\n action,\n icon,\n role,\n className,\n children,\n ...rest\n}: AlertProps) {\n const composed = title === undefined && description === undefined && action === undefined && isComposed(children);\n const glyph = icon === undefined ? (composed ? null : ICON[variant]) : icon;\n\n return (\n <div\n data-slot=\"alert\"\n data-variant={variant}\n role={role ?? (variant === 'destructive' ? 'alert' : 'status')}\n className={cn(\n 'group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm',\n 'has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18',\n \"has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4\",\n VARIANT[variant],\n className,\n )}\n {...rest}\n >\n {glyph}\n {composed ? (\n children\n ) : (\n <>\n {title !== undefined && <AlertTitle>{title}</AlertTitle>}\n {(description ?? children) !== undefined && <AlertDescription>{description ?? children}</AlertDescription>}\n {action !== undefined && <AlertAction>{action}</AlertAction>}\n </>\n )}\n </div>\n );\n}\n\nexport function AlertTitle({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn(\n 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',\n className,\n )}\n {...rest}\n />\n );\n}\n\nexport function AlertDescription({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-sm text-balance text-muted-foreground md:text-pretty [&_p:not(:last-child)]:mb-4',\n '[&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',\n className,\n )}\n {...rest}\n />\n );\n}\n\n/** An action in the top-right corner. The alert reserves room for it on the right. */\nexport function AlertAction({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"alert-action\" className={cn('absolute top-2 right-2', className)} {...rest} />;\n}\n\nPARTS.add(AlertTitle);\nPARTS.add(AlertDescription);\nPARTS.add(AlertAction);\n","import { useEffect, useState, type CSSProperties } from 'react';\nimport { Toaster as Sonner, toast, type ExternalToast, type ToasterProps } from 'sonner';\nimport { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from 'lucide-react';\n\nexport { toast };\nexport type { ExternalToast as ToastOptions, ToasterProps };\n\n/**\n * Toaster: an opinionated toast component, built on Sonner (a regular dependency).\n *\n * Mount one `<Toaster />` near the root of the app, then fire toasts from anywhere with\n * `toast('Event has been created.')`, `toast.success` / `info` / `warning` / `error` /\n * `loading` / `promise`, with a `description` and an `action`.\n *\n * The theme follows the `.dark` class on `<html>` rather than the system setting, so a toast\n * matches the page around it (and nothing calls `matchMedia`, which a test environment lacks).\n */\nexport function Toaster({ theme, style, toastOptions, ...props }: ToasterProps) {\n const pageTheme = usePageTheme();\n return (\n <Sonner\n theme={theme ?? pageTheme}\n className=\"toaster group\"\n icons={{\n success: <CircleCheckIcon className=\"size-4\" />,\n info: <InfoIcon className=\"size-4\" />,\n warning: <TriangleAlertIcon className=\"size-4\" />,\n error: <OctagonXIcon className=\"size-4\" />,\n loading: <Loader2Icon className=\"size-4 animate-spin\" />,\n }}\n style={\n {\n '--normal-bg': 'var(--popover)',\n '--normal-text': 'var(--popover-foreground)',\n '--normal-border': 'var(--border)',\n '--border-radius': 'var(--radius)',\n ...style,\n } as CSSProperties\n }\n toastOptions={{ ...toastOptions, classNames: { toast: 'rounded-2xl', ...toastOptions?.classNames } }}\n {...props}\n />\n );\n}\n\n/** `dark` while `<html>` has the `.dark` class, kept in sync as the theme changes. */\nfunction usePageTheme(): 'light' | 'dark' {\n const read = () =>\n typeof document !== 'undefined' && document.documentElement.classList.contains('dark') ? 'dark' : 'light';\n const [theme, setTheme] = useState<'light' | 'dark'>(read);\n useEffect(() => {\n if (typeof MutationObserver === 'undefined') return;\n const observer = new MutationObserver(() => setTheme(read()));\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n return theme;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Message: one row of a conversation — the avatar, the alignment, a header and a footer around\n * the message surface (a `Bubble`). For the scroll container around a conversation, see\n * `MessageScroller`; for an in-progress line (\"Checking the logs...\"), a status `Marker`.\n *\n * Two ways to write one:\n * - Shorthand: `<Message align=\"end\" avatar={<Avatar … />} header=\"Ana\" footer=\"Delivered\">\n * <Bubble>…</Bubble></Message>` — the children are the surface.\n * - Composition: `Message` > `MessageAvatar` + `MessageContent` (`MessageHeader`, the surface,\n * `MessageFooter`). `MessageGroup` stacks consecutive messages from one sender.\n *\n * Presentational: the content inside carries the semantics. Give icon-only footer actions an\n * `aria-label`.\n */\n\nexport const MessageGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"message-group\" className={cn('flex min-w-0 flex-col gap-2', className)} {...props} />\n );\n});\n\nexport type MessageAlign = 'start' | 'end';\n\nexport interface MessageProps extends HTMLAttributes<HTMLDivElement> {\n /** Which side of the conversation the row sits on. Default `start`. */\n align?: MessageAlign;\n /** Shorthand: the `MessageAvatar` content, e.g. an `Avatar`. */\n avatar?: ReactNode;\n /** Shorthand: a `MessageHeader`, e.g. the sender's name. */\n header?: ReactNode;\n /** Shorthand: a `MessageFooter`, e.g. a status or actions. */\n footer?: ReactNode;\n}\n\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n { className, align = 'start', avatar, header, footer, children, ...props },\n ref,\n) {\n const shorthand = avatar != null || header != null || footer != null;\n return (\n <div\n ref={ref}\n data-slot=\"message\"\n data-align={align}\n className={cn(\n 'group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse',\n className,\n )}\n {...props}\n >\n {shorthand ? (\n <>\n {avatar != null && <MessageAvatar>{avatar}</MessageAvatar>}\n <MessageContent>\n {header != null && <MessageHeader>{header}</MessageHeader>}\n {children}\n {footer != null && <MessageFooter>{footer}</MessageFooter>}\n </MessageContent>\n </>\n ) : (\n children\n )}\n </div>\n );\n});\n\nexport const MessageAvatar = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageAvatar(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-avatar\"\n className={cn(\n // Anchored to the bottom of the message; with a footer it moves up to the surface.\n 'flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const MessageContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-content\"\n className={cn(\n 'flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end',\n className,\n )}\n {...props}\n />\n );\n});\n\nconst META = 'text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0';\n\nexport const MessageHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-header\"\n className={cn('flex max-w-full min-w-0 items-center', META, className)}\n {...props}\n />\n );\n});\n\nexport const MessageFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-footer\"\n className={cn('flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end', META, className)}\n {...props}\n />\n );\n});\n","import { Children, isValidElement, type ComponentProps, type ReactNode } from 'react';\nimport {\n MessageScroller as MessageScrollerPrimitive,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n type MessageScrollerDefaultScrollPosition,\n type MessageScrollerScrollOptions,\n} from '@shadcn/react/message-scroller';\nimport { ArrowDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonSize, type ButtonVariant } from '../forms/button';\n\nexport { useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility };\nexport type { MessageScrollerDefaultScrollPosition, MessageScrollerScrollOptions };\n\n/**\n * MessageScroller: the scroll container of a chat transcript. It places each new turn near the\n * top with a strip of the previous one still showing, follows a streamed reply only while the\n * reader is at the live edge, reopens a saved thread at its last turn, keeps the reader's place\n * when older messages load above, and offers a \"jump to latest\" button.\n *\n * Two ways to write one:\n * - Shorthand: `<MessageScroller autoScroll>{items}</MessageScroller>` renders the provider,\n * viewport, content and button around the `MessageScrollerItem`s you pass; the provider's\n * props go on `MessageScroller`.\n * - Composition: `MessageScrollerProvider` > `MessageScroller` > `MessageScrollerViewport` >\n * `MessageScrollerContent` > `MessageScrollerItem`s, plus `MessageScrollerButton`.\n *\n * It fills its parent, so put it in a height-constrained container. The behaviour comes from a\n * headless engine (a regular dependency); these parts add the look. It owns scrolling only: the\n * messages, streaming and persistence stay in the app.\n */\n\nexport type MessageScrollerProviderProps = ComponentProps<typeof MessageScrollerPrimitive.Provider>;\n\nexport function MessageScrollerProvider(props: MessageScrollerProviderProps) {\n return <MessageScrollerPrimitive.Provider {...props} />;\n}\n\nexport type MessageScrollerProps = ComponentProps<typeof MessageScrollerPrimitive.Root> &\n Omit<MessageScrollerProviderProps, 'children'>;\n\nexport function MessageScroller({\n className,\n children,\n autoScroll,\n defaultScrollPosition,\n scrollEdgeThreshold,\n scrollPreviousItemPeek,\n scrollMargin,\n ...props\n}: MessageScrollerProps) {\n // Composition when the viewport is passed in; otherwise the children are the rows.\n const composed = Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === MessageScrollerViewport,\n );\n\n const root = (\n <MessageScrollerPrimitive.Root\n data-slot=\"message-scroller\"\n className={cn('group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden', className)}\n {...props}\n >\n {composed ? (\n children\n ) : (\n <>\n <MessageScrollerViewport>\n <MessageScrollerContent>{children}</MessageScrollerContent>\n </MessageScrollerViewport>\n <MessageScrollerButton />\n </>\n )}\n </MessageScrollerPrimitive.Root>\n );\n\n if (composed) return root;\n return (\n <MessageScrollerProvider\n autoScroll={autoScroll}\n defaultScrollPosition={defaultScrollPosition}\n scrollEdgeThreshold={scrollEdgeThreshold}\n scrollPreviousItemPeek={scrollPreviousItemPeek}\n scrollMargin={scrollMargin}\n >\n {root}\n </MessageScrollerProvider>\n );\n}\n\nexport type MessageScrollerViewportProps = ComponentProps<typeof MessageScrollerPrimitive.Viewport>;\n\n/** The scrollable element: a focusable region named \"Messages\" by default. */\nexport function MessageScrollerViewport({ className, ...props }: MessageScrollerViewportProps) {\n return (\n <MessageScrollerPrimitive.Viewport\n data-slot=\"message-scroller-viewport\"\n className={cn(\n 'size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerContentProps = ComponentProps<typeof MessageScrollerPrimitive.Content>;\n\n/** The transcript: `role=\"log\"` with `aria-relevant=\"additions\"`. Pass `aria-busy` while a turn streams. */\nexport function MessageScrollerContent({ className, ...props }: MessageScrollerContentProps) {\n return (\n <MessageScrollerPrimitive.Content\n data-slot=\"message-scroller-content\"\n className={cn('flex h-max min-h-full flex-col gap-6', className)}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerItemProps = ComponentProps<typeof MessageScrollerPrimitive.Item>;\n\n/**\n * One transcript row: a message, marker, typing line or \"load earlier\" row. `messageId` makes it\n * addressable; `scrollAnchor` marks the row that starts a turn.\n */\nexport function MessageScrollerItem({ className, scrollAnchor = false, ...props }: MessageScrollerItemProps) {\n return (\n <MessageScrollerPrimitive.Item\n data-slot=\"message-scroller-item\"\n scrollAnchor={scrollAnchor}\n className={cn('min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]', className)}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerButtonProps = ComponentProps<typeof MessageScrollerPrimitive.Button> & {\n variant?: ButtonVariant;\n size?: ButtonSize;\n children?: ReactNode;\n};\n\n/** Scrolls to the end (or start) of the transcript; hidden and inert until there is somewhere to go. */\nexport function MessageScrollerButton({\n direction = 'end',\n className,\n children,\n render,\n variant = 'secondary',\n size = 'icon-sm',\n ...props\n}: MessageScrollerButtonProps) {\n return (\n <MessageScrollerPrimitive.Button\n data-slot=\"message-scroller-button\"\n data-direction={direction}\n direction={direction}\n className={cn(\n 'absolute start-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground rtl:translate-x-1/2',\n 'data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)]',\n 'data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)]',\n 'data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full data-[direction=start]:[&_svg]:rotate-180',\n className,\n )}\n render={render ?? <Button variant={variant} size={size} />}\n {...props}\n >\n {children ?? (\n <>\n <ArrowDownIcon />\n <span className=\"sr-only\">{direction === 'end' ? 'Scroll to end' : 'Scroll to start'}</span>\n </>\n )}\n </MessageScrollerPrimitive.Button>\n );\n}\n","import { Children, forwardRef, isValidElement, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Marker: an inline line in a conversation — a status (\"Explored 4 files\"), a system note, a\n * bordered row, or a labelled separator (\"Today\").\n *\n * Two ways to write one:\n * - Shorthand: `<Marker icon={<SearchIcon />}>Explored 4 files</Marker>`.\n * - Composition: `Marker` > `MarkerIcon` + `MarkerContent`.\n *\n * Presentational by default; pick the semantics from the intent:\n * - progress (\"Thinking...\", a running tool): `role=\"status\"`, a `Spinner` in the icon, and\n * `shimmer` on the content;\n * - a labelled separator needs no role (its lines are decorative and its text is read);\n * - a link or action: `asChild` onto a real `<a>` or `<button>`.\n */\n\nexport type MarkerVariant = 'default' | 'border' | 'separator';\n\nconst VARIANT: Record<MarkerVariant, string> = {\n default: '',\n border: 'border-b border-border pb-2',\n separator:\n 'before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border',\n};\n\nexport interface MarkerProps extends HTMLAttributes<HTMLDivElement> {\n variant?: MarkerVariant;\n /** Render onto the single child (a link or button). */\n asChild?: boolean;\n /** Shorthand: a `MarkerIcon`. The children become the `MarkerContent`. */\n icon?: ReactNode;\n}\n\n/** True when the children are already Marker parts, so the shorthand leaves them alone. */\nfunction isParts(children: ReactNode) {\n return Children.toArray(children).some(\n (child) => isValidElement(child) && (child.type === MarkerIcon || child.type === MarkerContent),\n );\n}\n\nexport const Marker = forwardRef<HTMLDivElement, MarkerProps>(function Marker(\n { className, variant = 'default', asChild = false, icon, children, ...props },\n ref,\n) {\n // Text children become the MarkerContent; children that are already parts stay as they are.\n const parts = (content: ReactNode) => (\n <>\n {icon != null && <MarkerIcon>{icon}</MarkerIcon>}\n {isParts(content) || content == null || content === false ? content : <MarkerContent>{content}</MarkerContent>}\n </>\n );\n\n const rootProps = {\n 'data-slot': 'marker',\n 'data-variant': variant,\n className: cn(\n \"group/marker relative flex min-h-4 w-full items-center gap-2 text-start text-sm text-muted-foreground [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground [&_svg:not([class*='size-'])]:size-4\",\n VARIANT[variant],\n className,\n ),\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot ref={ref} {...rootProps} wrapChildren={parts}>\n {isValidElement(children) ? (children as ReactElement) : null}\n </Slot>\n );\n }\n\n return (\n <div ref={ref} {...rootProps}>\n {parts(children)}\n </div>\n );\n});\n\nexport const MarkerIcon = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function MarkerIcon(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"marker-icon\"\n aria-hidden=\"true\"\n className={cn(\"size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n />\n );\n});\n\nexport const MarkerContent = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function MarkerContent(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"marker-content\"\n className={cn(\n 'min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className,\n )}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { ChevronRightIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Trace: the building block for reasoning, tool calls, sources and more. A list of lines, each\n * with an icon, a title, and an optional description and status. A line can expand to show more\n * detail, link to a page, or open a dialog or sheet.\n *\n * Trace adds no roles of its own; each line takes its semantics from the element that wraps it.\n * A `TraceLine` on its own is a `span` (read as text, not a tab stop). Wrapped in a\n * `TraceCollapsibleTrigger` it is a button with `aria-expanded`; wrapped in a link or a dialog\n * trigger it takes that element's behaviour. `TraceIcon` is hidden from assistive tech, so the\n * title is the accessible name: write it as a sentence (\"Edited trace.tsx\"), and put the status\n * in it too (\"Running pnpm build\"), because status is otherwise shown only by colour and motion.\n *\n * Two ways to write a line:\n * - Shorthand: `<TraceLine icon={<SearchIcon />} title=\"Searched the docs\" description=\"3 results\" />`.\n * - Composition: `TraceLine` > `TraceIcon` + `TraceTitle` + `TraceDescription` (+ a trailing `TraceIcon`).\n */\n\nexport const Trace = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function Trace(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"trace\"\n className={cn(\n 'flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type TraceStatus = 'running' | 'error' | 'pending';\n\nexport interface TraceLineProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'title'> {\n /** The state of the work the line reports. Leave it out for work that is done. */\n status?: TraceStatus;\n /** Shorthand: a leading `TraceIcon`. */\n icon?: ReactNode;\n /** Shorthand: the `TraceTitle`. One sentence that says what happened. */\n title?: ReactNode;\n /** Shorthand: a `TraceDescription` after the title, such as a count or a duration. */\n description?: ReactNode;\n}\n\nexport const TraceLine = forwardRef<HTMLSpanElement, TraceLineProps>(function TraceLine(\n { className, status, icon, title, description, children, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-line\"\n data-status={status}\n className={cn(\n 'flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer',\n className,\n )}\n {...props}\n >\n {icon != null && <TraceIcon>{icon}</TraceIcon>}\n {title != null && <TraceTitle>{title}</TraceTitle>}\n {description != null && <TraceDescription>{description}</TraceDescription>}\n {children}\n </span>\n );\n});\n\nexport const TraceIcon = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceIcon(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-icon\"\n aria-hidden=\"true\"\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const TraceTitle = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-title\"\n className={cn('min-w-0 truncate motion-reduce:shimmer-none', className)}\n {...props}\n />\n );\n});\n\nexport const TraceDescription = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceDescription(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-description\"\n className={cn('shrink-0 text-muted-foreground/70 tabular-nums', className)}\n {...props}\n />\n );\n});\n\ntype CollapsibleRootProps = Omit<ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>, 'asChild' | 'open'>;\n\n/** `open` is controlled only together with `onOpenChange`. */\nexport type TraceCollapsibleProps = CollapsibleRootProps &\n ({ open?: undefined } | { open: boolean; onOpenChange: NonNullable<CollapsibleRootProps['onOpenChange']> });\n\nexport const TraceCollapsible = forwardRef<ElementRef<typeof CollapsiblePrimitive.Root>, TraceCollapsibleProps>(\n function TraceCollapsible({ className, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n data-slot=\"trace-collapsible\"\n className={cn('flex w-full min-w-0 flex-col', className)}\n {...props}\n />\n );\n },\n);\n\nexport type TraceCollapsibleTriggerProps = Omit<\n ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>,\n 'asChild'\n>;\n\nexport const TraceCollapsibleTrigger = forwardRef<\n ElementRef<typeof CollapsiblePrimitive.Trigger>,\n TraceCollapsibleTriggerProps\n>(function TraceCollapsibleTrigger({ className, children, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Trigger\n ref={ref}\n data-slot=\"trace-collapsible-trigger\"\n className={cn(\n 'group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive',\n className,\n )}\n {...props}\n >\n {children}\n <TraceIcon className=\"transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90\">\n <ChevronRightIcon />\n </TraceIcon>\n </CollapsiblePrimitive.Trigger>\n );\n});\n\nexport type TraceCollapsibleContentProps = Omit<\n ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>,\n 'asChild'\n>;\n\nexport const TraceCollapsibleContent = forwardRef<\n ElementRef<typeof CollapsiblePrimitive.Content>,\n TraceCollapsibleContentProps\n>(function TraceCollapsibleContent({ className, children, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Content\n ref={ref}\n data-slot=\"trace-collapsible-content\"\n className=\"min-w-0 overflow-hidden duration-200 [--radix-accordion-content-height:var(--radix-collapsible-content-height)] data-open:animate-accordion-down data-closed:animate-accordion-up\"\n {...props}\n >\n <div\n data-slot=\"trace-collapsible-content-inner\"\n className={cn(\n 'mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground',\n className,\n )}\n >\n {children}\n </div>\n </CollapsiblePrimitive.Content>\n );\n});\n","import { Children, forwardRef, isValidElement, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Bubble: a chat message bubble.\n *\n * `variant` sets the treatment (`default` primary, `secondary`, `muted`, `tinted`, `outline`,\n * `ghost` unframed, `destructive`), `align` puts it at the start or end of the conversation.\n * A bubble sizes to its content up to 80% of the row (`ghost` spans the full row).\n *\n * Shorthand: plain children are wrapped in `BubbleContent`. Composition: `BubbleContent`\n * (`asChild` for a link or button bubble) and `BubbleReactions`; `BubbleGroup` stacks\n * consecutive bubbles from one sender.\n */\n\nexport type BubbleVariant = 'default' | 'secondary' | 'muted' | 'tinted' | 'outline' | 'ghost' | 'destructive';\n\nconst VARIANT: Record<BubbleVariant, string> = {\n default:\n '*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80',\n secondary:\n '*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]',\n muted:\n '*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]',\n tinted:\n '*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]',\n outline:\n '*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30',\n ghost:\n 'border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50',\n destructive:\n '*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30',\n};\n\nexport const BubbleGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function BubbleGroup(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"bubble-group\" className={cn('flex min-w-0 flex-col gap-2', className)} {...props} />;\n});\n\nexport interface BubbleProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `default`. */\n variant?: BubbleVariant;\n /** Default `start`. */\n align?: 'start' | 'end';\n}\n\nconst PARTS = new Set<unknown>();\n/** Composition when any child is a Bubble part; otherwise the children are the content. */\nconst isComposed = (children: ReactNode) =>\n Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n\nexport const Bubble = forwardRef<HTMLDivElement, BubbleProps>(function Bubble(\n { variant = 'default', align = 'start', className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"bubble\"\n data-variant={variant}\n data-align={align}\n className={cn(\n 'group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 data-[align=end]:self-end data-[variant=ghost]:max-w-full group-data-[align=end]/message:self-end',\n VARIANT[variant],\n className,\n )}\n {...props}\n >\n {isComposed(children) ? children : <BubbleContent>{children}</BubbleContent>}\n </div>\n );\n});\n\nexport interface BubbleContentProps extends HTMLAttributes<HTMLDivElement> {\n /** Render the content as the child element, e.g. a `<button>` or `<a>`. */\n asChild?: boolean;\n}\n\nexport const BubbleContent = forwardRef<HTMLDivElement, BubbleContentProps>(function BubbleContent(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n data-slot=\"bubble-content\"\n className={cn(\n 'w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end',\n '[button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface BubbleReactionsProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `bottom`. */\n side?: 'top' | 'bottom';\n /** Default `end`. */\n align?: 'start' | 'end';\n}\n\nconst SIDE = { top: 'top-0 -translate-y-3/4', bottom: 'bottom-0 translate-y-3/4' } as const;\nconst ALIGN = { start: 'left-3', end: 'right-3' } as const;\n\n/** Reactions overlapping the bubble edge. Group emoji as one image with `role=\"img\"` and an `aria-label`. */\nexport const BubbleReactions = forwardRef<HTMLDivElement, BubbleReactionsProps>(function BubbleReactions(\n { side = 'bottom', align = 'end', className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"bubble-reactions\"\n data-align={align}\n data-side={side}\n className={cn(\n 'absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0',\n SIDE[side],\n ALIGN[align],\n className,\n )}\n {...props}\n />\n );\n});\n\nPARTS.add(BubbleContent);\nPARTS.add(BubbleReactions);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAC,SAAS,kBAAuC;AAoD7C,SASI,KATJ;AAfJ,IAAM,OACJ;AAEF,IAAM,cAAsD;AAAA,EAC1D,YACE;AAAA,EACF,UACE;AACJ;AAEO,IAAM,cAAc,WAA6C,SAASA,aAC/E,EAAE,cAAc,cAAc,OAAO,SAAS,MAAM,WAAW,UAAU,GAAG,MAAM,GAClF,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC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QAAQ,SAAS,WAAW,UAAU,GAAG,MAAM,GACtE,KACA;AACA,SACE,gBAAAR;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,gBAAc;AAAA,MACd,cAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACAC,SAAQ,OAAO;AAAA,QACf;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH,UAAAI,YAAW,QAAQ,IAAI,WAAW,gBAAAL,MAAC,iBAAe,UAAS;AAAA;AAAA,EAC9D;AAEJ,CAAC;AAOM,IAAM,gBAAgBE,aAA+C,SAASO,eACnF,EAAE,UAAU,OAAO,WAAW,GAAG,MAAM,GACvC,KACA;AACA,QAAM,OAAO,UAAU,OAAO;AAC9B,SACE,gBAAAT;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AASD,IAAM,OAAO,EAAE,KAAK,0BAA0B,QAAQ,2BAA2B;AACjF,IAAM,QAAQ,EAAE,OAAO,UAAU,KAAK,UAAU;AAGzC,IAAM,kBAAkBE,aAAiD,SAASQ,iBACvF,EAAE,OAAO,UAAU,QAAQ,OAAO,WAAW,GAAG,MAAM,GACtD,KACA;AACA,SACE,gBAAAV;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW;AAAA,MACX,WAAW;AAAA,QACT;AAAA,QACA,KAAK,IAAI;AAAA,QACT,MAAM,KAAK;AAAA,QACX;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAEDI,OAAM,IAAI,aAAa;AACvBA,OAAM,IAAI,eAAe;","names":["ButtonGroup","ButtonGroupText","ButtonGroupSeparator","forwardRef","jsx","jsxs","forwardRef","NativeSelect","field","NativeSelectOption","NativeSelectOptGroup","forwardRef","useRef","ChevronDownIcon","ChevronDownIcon","jsx","ChevronDownIcon","jsx","jsxs","forwardRef","DatePicker","field","useRef","ChevronDownIcon","jsx","jsxs","forwardRef","useId","jsx","jsxs","forwardRef","Switch","useId","forwardRef","Fragment","jsx","jsxs","forwardRef","InputOTP","field","_","InputOTPGroup","InputOTPSlot","InputOTPSeparator","forwardRef","useRef","CheckIcon","ChevronDownIcon","Fragment","jsx","jsxs","forwardRef","ComboboxTrigger","ChevronDownIcon","ComboboxClear","ComboboxInput","field","ComboboxContent","ComboboxList","ComboboxItem","CheckIcon","ComboboxGroup","ComboboxLabel","ComboboxEmpty","ComboboxSeparator","ComboboxChips","ComboboxChip","ComboboxChipsInput","useRef","createContext","forwardRef","useContext","useId","Fragment","jsx","jsxs","createContext","forwardRef","RadioGroup","useId","RadioGroupItem","useContext","field","forwardRef","useId","jsx","jsxs","forwardRef","Slider","formatValue","useId","forwardRef","Fragment","jsx","jsxs","forwardRef","TooltipTrigger","TooltipContent","createContext","forwardRef","useContext","useId","Fragment","jsx","jsxs","createContext","forwardRef","HoverCardTrigger","useContext","HoverCardContent","useId","forwardRef","Fragment","jsx","jsxs","forwardRef","ContextMenuTrigger","ContextMenuContent","forwardRef","jsx","jsxs","CONTENT_CLASSES","forwardRef","Menubar","MenubarTrigger","MenubarContent","parts","createContext","forwardRef","useContext","useEffect","useState","forwardRef","useEffect","useRef","useState","jsx","jsxs","forwardRef","ScrollArea","useRef","useState","useEffect","ScrollBar","jsx","jsxs","createContext","forwardRef","DrawerTrigger","DrawerClose","DrawerOverlay","DrawerContent","DrawerPanel","useState","DrawerHeader","DrawerFooter","DrawerTitle","useContext","useEffect","DrawerDescription","forwardRef","XIcon","jsx","jsxs","forwardRef","SheetTrigger","SheetClose","SheetOverlay","SheetContent","XIcon","SheetHeader","SheetFooter","SheetTitle","SheetDescription","forwardRef","useState","jsx","jsxs","forwardRef","AlertDialogTrigger","AlertDialogOverlay","AlertDialogContent","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","useState","jsx","Children","jsx","jsxs","Children","createContext","useContext","createContext","forwardRef","useContext","ChevronDownIcon","Fragment","jsx","jsxs","createContext","forwardRef","AccordionItem","AccordionTrigger","useContext","ChevronDownIcon","AccordionContent","forwardRef","ChevronDownIcon","jsx","jsxs","forwardRef","Collapsible","ChevronDownIcon","CollapsibleTrigger","CollapsibleContent","forwardRef","jsx","AspectRatio","createContext","useCallback","useContext","useEffect","useLayoutEffect","useRef","useState","ChevronLeftIcon","ChevronRightIcon","Fragment","jsx","jsxs","createContext","useContext","useState","useCallback","useEffect","useRef","useLayoutEffect","ChevronLeftIcon","ChevronRightIcon","Fragment","Separator","jsx","jsxs","Fragment","Separator","createContext","forwardRef","isValidElement","useCallback","useContext","useEffect","useMemo","useState","Slot","ChevronRightIcon","useCallback","Fragment","jsx","jsxs","createContext","useContext","useState","useCallback","useEffect","useMemo","forwardRef","SidebarTrigger","Slot","SidebarMenuButton","SidebarMenuSubButton","DefaultLink","isValidElement","ChevronRightIcon","RowLink","forwardRef","jsx","forwardRef","Kbd","KbdGroup","Fragment","forwardRef","ChevronRightIcon","Fragment","jsx","jsxs","forwardRef","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","BreadcrumbPage","BreadcrumbSeparator","ChevronRightIcon","BreadcrumbEllipsis","forwardRef","ChevronLeftIcon","ChevronRightIcon","MoreHorizontalIcon","Fragment","jsx","jsxs","forwardRef","Pagination","PaginationContent","PaginationItem","PaginationLink","PaginationPrevious","ChevronLeftIcon","PaginationNext","ChevronRightIcon","PaginationEllipsis","MoreHorizontalIcon","forwardRef","ChevronDownIcon","Fragment","jsx","jsxs","forwardRef","NavigationMenu","NavigationMenuList","NavigationMenuItem","NavigationMenuTrigger","ChevronDownIcon","NavigationMenuContent","NavigationMenuViewport","NavigationMenuLink","NavigationMenuIndicator","forwardRef","clsx","jsx","jsxs","forwardRef","TypographyList","TypographyTable","TextLink","clsx","createContext","forwardRef","isValidElement","useContext","Fragment","jsx","jsxs","createContext","forwardRef","ItemGroup","ItemSeparator","Item","useContext","parts","isValidElement","ItemMedia","ItemContent","ItemTitle","ItemDescription","ItemActions","ItemHeader","ItemFooter","forwardRef","Fragment","jsx","jsxs","SIZE","ORIENTATION","forwardRef","Attachment","MEDIA_VARIANT","AttachmentMedia","AttachmentContent","AttachmentTitle","AttachmentDescription","AttachmentActions","AttachmentAction","AttachmentTrigger","AttachmentGroup","Children","isValidElement","CircleAlertIcon","CircleCheckIcon","InfoIcon","TriangleAlertIcon","Fragment","jsx","jsxs","VARIANT","InfoIcon","CircleAlertIcon","CircleCheckIcon","TriangleAlertIcon","PARTS","isComposed","Children","isValidElement","useEffect","useState","CircleCheckIcon","InfoIcon","TriangleAlertIcon","jsx","jsx","CircleCheckIcon","InfoIcon","TriangleAlertIcon","useState","useEffect","forwardRef","Fragment","jsx","jsxs","forwardRef","MessageGroup","Message","MessageAvatar","MessageContent","MessageHeader","MessageFooter","Children","isValidElement","Fragment","jsx","jsxs","jsx","Children","isValidElement","jsxs","Fragment","Children","forwardRef","isValidElement","Fragment","jsx","jsxs","VARIANT","Children","isValidElement","forwardRef","Marker","parts","MarkerIcon","MarkerContent","forwardRef","CollapsiblePrimitive","ChevronRightIcon","jsx","jsxs","forwardRef","Trace","TraceLine","TraceIcon","TraceTitle","TraceDescription","TraceCollapsible","CollapsiblePrimitive","TraceCollapsibleTrigger","ChevronRightIcon","TraceCollapsibleContent","Children","forwardRef","isValidElement","jsx","VARIANT","forwardRef","BubbleGroup","PARTS","isComposed","Children","isValidElement","Bubble","BubbleContent","BubbleReactions"]}
1
+ {"version":3,"sources":["../src/components/forms/button-group.tsx","../src/components/forms/native-select.tsx","../src/components/forms/date-picker.tsx","../src/components/forms/calendar.tsx","../src/components/forms/questionnaire.tsx","../src/vendor/headless/questionnaire/components.tsx","../src/vendor/headless/use-render/index.ts","../src/vendor/headless/questionnaire/context.ts","../src/vendor/headless/questionnaire/use-questionnaire-choice.ts","../src/vendor/headless/questionnaire/utils.ts","../src/vendor/headless/questionnaire/use-questionnaire-input.ts","../src/vendor/headless/questionnaire/use-questionnaire-item.ts","../src/vendor/headless/questionnaire/collection.ts","../src/vendor/headless/questionnaire/use-questionnaire-root.ts","../src/vendor/headless/questionnaire/index.ts","../src/components/forms/switch.tsx","../src/components/forms/input-otp.tsx","../src/components/forms/combobox.tsx","../src/components/forms/radio-group.tsx","../src/components/forms/slider.tsx","../src/components/overlays/tooltip.tsx","../src/components/overlays/hover-card.tsx","../src/components/overlays/context-menu.tsx","../src/components/overlays/menubar.tsx","../src/components/overlays/drawer.tsx","../src/components/cards/scroll-area.tsx","../src/components/overlays/sheet.tsx","../src/components/overlays/alert-dialog.tsx","../src/lib/direction.tsx","../src/components/cards/card.tsx","../src/components/cards/dashboard-edit-context.ts","../src/components/cards/accordion.tsx","../src/components/cards/collapsible.tsx","../src/components/cards/aspect-ratio.tsx","../src/components/cards/carousel.tsx","../src/components/cards/resizable.tsx","../src/components/chrome/sidebar.tsx","../src/lib/use-media-query.ts","../src/components/chrome/kbd.tsx","../src/components/chrome/breadcrumb.tsx","../src/components/chrome/pagination.tsx","../src/components/chrome/navigation-menu.tsx","../src/components/chrome/typography.tsx","../src/components/lists/item.tsx","../src/components/lists/attachment.tsx","../src/index.tsx","../src/components/feedback/alert.tsx","../src/components/feedback/sonner.tsx","../src/components/ai/message.tsx","../src/components/ai/message-scroller.tsx","../src/vendor/headless/message-scroller/components.tsx","../src/vendor/headless/message-scroller/types.ts","../src/vendor/headless/message-scroller/use-message-scroller-controller.ts","../src/vendor/headless/message-scroller/geometry.ts","../src/vendor/headless/message-scroller/use-message-scroller-commands.ts","../src/vendor/headless/message-scroller/use-message-scroller-refs.ts","../src/vendor/headless/message-scroller/stores.ts","../src/vendor/headless/message-scroller/utils.ts","../src/vendor/headless/message-scroller/index.ts","../src/components/ai/marker.tsx","../src/components/ai/trace.tsx","../src/components/ai/bubble.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './button';\n\n/**\n * ButtonGroup: a container that groups related buttons together with consistent styling.\n *\n * It joins its children (`Button`, `Input`, `Select`, `InputGroup`, `ButtonGroupText`) into\n * one control: inner corners square off and shared borders collapse. Nest groups to put\n * spacing between clusters. It is for actions; for a set of buttons that toggle a state,\n * use `ToggleGroup`.\n *\n * Corners and borders use logical sides (`rounded-s`, `border-s`), so the joins follow\n * `dir=\"rtl\"`; in LTR they are the same as left/right.\n *\n * Shorthand: `items` renders one `Button` per entry, with the group's `variant` and `size`\n * unless an item sets its own. Composition: any children, plus `ButtonGroupSeparator` and\n * `ButtonGroupText`.\n */\n\nexport type ButtonGroupOrientation = 'horizontal' | 'vertical';\n\n/** One button in the `items` shorthand: any `Button` props. */\nexport type ButtonGroupItem = ButtonProps;\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `horizontal`. */\n orientation?: ButtonGroupOrientation;\n /** Shorthand: one `Button` per entry. Children render after them. */\n items?: readonly ButtonGroupItem[];\n /** The `variant` of each `items` button that doesn't set one. */\n variant?: ButtonVariant;\n /** The `size` of each `items` button that doesn't set one. */\n size?: ButtonSize;\n}\n\nconst BASE =\n \"group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-e-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\";\n\nconst ORIENTATION: Record<ButtonGroupOrientation, string> = {\n horizontal:\n '[&>*:not(:first-child)]:rounded-s-none [&>*:not(:first-child)]:border-s-0 [&>*:not(:last-child)]:rounded-e-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-e-lg!',\n vertical:\n 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!',\n};\n\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(function ButtonGroup(\n { orientation = 'horizontal', items, variant, size, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(BASE, ORIENTATION[orientation], className)}\n {...props}\n >\n {items?.map((item, index) => (\n <Button key={index} variant={variant} size={size} {...item} />\n ))}\n {children}\n </div>\n );\n});\n\nexport interface ButtonGroupTextProps extends HTMLAttributes<HTMLDivElement> {\n /** Render the child element instead, e.g. a `Label`. */\n asChild?: boolean;\n}\n\n/** Text inside a group, such as a label or a unit. */\nexport const ButtonGroupText = forwardRef<HTMLDivElement, ButtonGroupTextProps>(function ButtonGroupText(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n className={cn(\n \"flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface ButtonGroupSeparatorProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `vertical`. */\n orientation?: ButtonGroupOrientation;\n}\n\n/** Divides buttons within a group. Outline buttons don't need one; their borders already do. */\nexport const ButtonGroupSeparator = forwardRef<HTMLDivElement, ButtonGroupSeparatorProps>(\n function ButtonGroupSeparator({ orientation = 'vertical', className, ...props }, ref) {\n return (\n <div\n ref={ref}\n role=\"none\"\n data-slot=\"button-group-separator\"\n data-orientation={orientation}\n className={cn(\n 'relative shrink-0 self-stretch bg-input data-horizontal:mx-px data-horizontal:h-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto data-vertical:w-px',\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type SelectHTMLAttributes } from 'react';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useFieldContext, useFieldControl } from './field';\nimport type { SelectOption, SelectOptionGroup } from './select';\n\n/**\n * NativeSelect: a styled native `<select>`. Use it for form fields and anywhere on a phone: the\n * OS draws the picker, it is fast with long lists, and it submits and validates as any form\n * control does. Use `Select` where the open list must look like the other popup panels.\n *\n * Two ways to write one:\n * - Shorthand: `<NativeSelect options={[{ value, label }]} />` (groups become `<optgroup>`s);\n * the same option types as `Select`.\n * - Composition: `NativeSelect` > `NativeSelectOption`s, optionally in `NativeSelectOptGroup`s.\n *\n * `className` goes on the wrapper that holds the select and its chevron, so width and margin\n * apply to both. `onChange` is the native event. Inside a `Field` it takes the control id,\n * description, invalid, required and disabled state; otherwise name it with `aria-label`.\n */\n\nexport type NativeSelectSize = 'default' | 'sm';\n\nexport interface NativeSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {\n /** Default `default` (32px); `sm` is 28px. */\n size?: NativeSelectSize;\n /** Shorthand: flat options, or groups which render as `<optgroup>`. Use it or `children`. */\n options?: (SelectOption | SelectOptionGroup)[];\n}\n\nfunction isGroup(entry: SelectOption | SelectOptionGroup): entry is SelectOptionGroup {\n return 'options' in entry;\n}\n\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(function NativeSelect(\n { className, size = 'default', options, children, ...props },\n ref,\n) {\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n\n if (!fieldContext && !props['aria-label'] && !props['aria-labelledby'] && !props.id) {\n devWarn('NativeSelect outside a Field needs aria-label, aria-labelledby, or an id a <label> points at.');\n }\n\n return (\n <div\n data-slot=\"native-select-wrapper\"\n data-size={size}\n className={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}\n >\n <select\n ref={ref}\n data-slot=\"native-select\"\n data-size={size}\n {...field}\n required={field['aria-required']}\n className=\"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 ps-2.5 pe-8 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\"\n {...props}\n >\n {options\n ? options.map((entry, index) =>\n isGroup(entry) ? (\n <NativeSelectOptGroup key={`group-${index}`} label={entry.label}>\n {entry.options.map((option) => (\n <NativeSelectOption key={option.value} value={option.value} disabled={option.disabled}>\n {option.label}\n </NativeSelectOption>\n ))}\n </NativeSelectOptGroup>\n ) : (\n <NativeSelectOption key={entry.value} value={entry.value} disabled={entry.disabled}>\n {entry.label}\n </NativeSelectOption>\n ),\n )\n : children}\n </select>\n <ChevronDownIcon\n aria-hidden=\"true\"\n data-slot=\"native-select-icon\"\n className=\"pointer-events-none absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground select-none\"\n />\n </div>\n );\n});\n\n/** One option. Uses the system colours, so the native list reads in dark mode too. */\nexport const NativeSelectOption = forwardRef<HTMLOptionElement, ComponentPropsWithoutRef<'option'>>(\n function NativeSelectOption({ className, ...props }, ref) {\n return (\n <option\n ref={ref}\n data-slot=\"native-select-option\"\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n );\n },\n);\n\n/** A labelled group of options. */\nexport const NativeSelectOptGroup = forwardRef<HTMLOptGroupElement, ComponentPropsWithoutRef<'optgroup'>>(\n function NativeSelectOptGroup({ className, ...props }, ref) {\n return (\n <optgroup\n ref={ref}\n data-slot=\"native-select-optgroup\"\n className={cn('bg-[Canvas] text-[CanvasText]', className)}\n {...props}\n />\n );\n },\n);\n","import {\n forwardRef,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEventHandler,\n type FocusEventHandler,\n type InputHTMLAttributes,\n} from 'react';\nimport { CalendarIcon, ChevronDownIcon } from 'lucide-react';\nimport type { DateRange } from 'react-day-picker';\nimport { cn } from '../../lib/cn';\nimport { composeRefs } from '../../lib/slot';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlays/popover';\nimport { Button } from './button';\nimport { Calendar } from './calendar';\nimport { useFieldContext, useFieldControl } from './field';\n\n/** A range as ISO `YYYY-MM-DD` strings; `''` for an end that is not picked yet. */\nexport interface DatePickerRange {\n from: string;\n to: string;\n}\n\ninterface DatePickerCommonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'onChange'> {\n /** Red border and `aria-invalid`. Inside a `Field`, a `FieldError` with a message sets this. */\n invalid?: boolean;\n /** Shown when there is no date. Default \"Pick a date\". */\n placeholder?: string;\n /** BCP 47 tag for the shown date and the calendar. Default: the browser's. */\n locale?: string;\n /** 0 = Sunday, 1 = Monday. Default `1`. */\n weekStartsOn?: 0 | 1;\n /** `dropdown` puts month and year selects in the calendar header. Default `label`. */\n captionLayout?: 'label' | 'dropdown';\n /** First year in the year select. Default `min`'s year, else 100 years ago. */\n startYear?: number;\n /** Last year in the year select. Default `max`'s year, else 10 years ahead. */\n endYear?: number;\n /** Months shown side by side. Default 1, or 2 with `mode=\"range\"`. */\n numberOfMonths?: number;\n}\n\nexport interface DatePickerSingleProps extends DatePickerCommonProps {\n /** `single` (default) picks one date. */\n mode?: 'single';\n /** The selected date as an ISO `YYYY-MM-DD` string, `''` for none. Controlled. */\n value?: string;\n /** Initial ISO date when uncontrolled. */\n defaultValue?: string;\n /**\n * Called with a real change event from the underlying date input, so\n * `onChange={(e) => set(e.target.value)}` keeps working; `e.target.value` is the ISO date.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** The new ISO date. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface DatePickerRangeProps extends DatePickerCommonProps {\n /** `range` picks a start and an end date. */\n mode: 'range';\n /** The selected range. Controlled. */\n value?: DatePickerRange;\n /** Initial range when uncontrolled. */\n defaultValue?: DatePickerRange;\n /** The new range, on every pick (`to` is `''` until the second pick). */\n onValueChange?: (value: DatePickerRange) => void;\n onChange?: never;\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst EMPTY_RANGE: DatePickerRange = { from: '', to: '' };\n\nfunction parseIso(value: string | undefined): Date | undefined {\n const match = value ? ISO.exec(value) : null;\n if (!match) return undefined;\n const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\nfunction toIso(date: Date | undefined): string {\n if (!date) return '';\n const pad = (n: number) => String(n).padStart(2, '0');\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/** Sets an input's value the way the browser would, so React reports a real change event. */\nfunction setNativeValue(input: HTMLInputElement | null, value: string) {\n if (!input) return;\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, value);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n}\n\n/**\n * A date picker: an outline Button that opens the `Calendar` in a `Popover`. The same parts\n * compose by hand (`Popover` > `PopoverTrigger` > `Button`, `PopoverContent` > `Calendar`); this\n * is the shorthand for the common case.\n *\n * - The trigger is a `role=\"combobox\"` button with `aria-haspopup=\"dialog\"`, named by the label\n * and then the date (\"Start date June 1, 2026\"); that role carries the `aria-required` and\n * `aria-invalid` that `Field` supplies.\n * - Opening moves focus into the calendar grid, on the selected date or today. In `single` mode\n * picking a date closes the popover and returns focus to the trigger; Escape closes it without\n * a change. In `range` mode it stays open until dismissed.\n * - Bare: no label, hint or error of its own. Put it in a `Field` with a `FieldLabel`, or give it\n * an `aria-label`. The calendar dialog takes its name from either.\n * - A real, invisible input keeps the form contract: `name`, `value`, `required` (and `min` /\n * `max` in `single` mode) for forms and native validation; the forwarded ref points at it.\n * `single` mode uses a date input whose genuine change event reaches `onChange`. `range` mode\n * posts an ISO 8601 interval (`2026-01-20/2026-02-09`). When validation focuses it, focus is\n * handed to the trigger.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(props, ref) {\n const {\n mode = 'single',\n invalid = false,\n className,\n disabled,\n required,\n value: valueProp,\n defaultValue,\n onChange,\n onValueChange,\n onBlur,\n placeholder = 'Pick a date',\n locale,\n weekStartsOn,\n captionLayout = 'label',\n startYear,\n endYear,\n numberOfMonths,\n min: minProp,\n max: maxProp,\n 'aria-label': ariaLabel,\n name,\n ...inputProps\n } = props;\n const range = mode === 'range';\n\n const field = useFieldControl();\n const fieldContext = useFieldContext();\n const valueId = useId();\n const dialogId = useId();\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState<string | DatePickerRange>(\n (defaultValue as string | DatePickerRange | undefined) ?? (range ? EMPTY_RANGE : ''),\n );\n const current = (valueProp as string | DatePickerRange | undefined) ?? internal;\n const iso = range ? '' : (current as string);\n const isoRange = range ? ((current as DatePickerRange) ?? EMPTY_RANGE) : EMPTY_RANGE;\n const date = parseIso(iso);\n const from = parseIso(isoRange.from);\n const to = parseIso(isoRange.to);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const isInvalid = invalid || !!field['aria-invalid'];\n const isDisabled = disabled ?? field.disabled;\n const isRequired = required || !!field['aria-required'];\n // The calendar dialog is named after the field: the FieldLabel's text, else the aria-label.\n // Read when it opens, since the label is a sibling this control can't see as a prop.\n const [label, setLabel] = useState<string | undefined>(ariaLabel);\n const handleOpenChange = (next: boolean) => {\n if (next) {\n const labelText = fieldContext && typeof document !== 'undefined' ? document.getElementById(fieldContext.labelId)?.textContent : null;\n setLabel(labelText?.trim() || ariaLabel);\n }\n setOpen(next);\n };\n\n const longFormat = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'long' }), [locale]);\n const shortFormat = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: 'short', day: '2-digit', year: 'numeric' }),\n [locale],\n );\n const min = typeof minProp === 'number' ? String(minProp) : minProp;\n const max = typeof maxProp === 'number' ? String(maxProp) : maxProp;\n const minDate = parseIso(min);\n const maxDate = parseIso(max);\n const disabledDays = [...(minDate ? [{ before: minDate }] : []), ...(maxDate ? [{ after: maxDate }] : [])];\n\n const shown = range\n ? from\n ? to\n ? `${shortFormat.format(from)} - ${shortFormat.format(to)}`\n : shortFormat.format(from)\n : undefined\n : date\n ? longFormat.format(date)\n : undefined;\n const interval = isoRange.from && isoRange.to ? `${isoRange.from}/${isoRange.to}` : '';\n\n const commitSingle = (next: Date) => {\n const nextIso = toIso(next);\n if (valueProp === undefined) setInternal(nextIso);\n (onValueChange as ((value: string) => void) | undefined)?.(nextIso);\n // Let the real input report the change, so `onChange` gets a genuine ChangeEvent.\n setNativeValue(inputRef.current, nextIso);\n setOpen(false);\n };\n\n const commitRange = (next: DateRange | undefined) => {\n const nextRange = { from: toIso(next?.from), to: toIso(next?.to) };\n if (valueProp === undefined) setInternal(nextRange);\n (onValueChange as ((value: DatePickerRange) => void) | undefined)?.(nextRange);\n };\n\n const calendarCommon = {\n disabled: disabledDays,\n weekStartsOn: weekStartsOn ?? 1,\n captionLayout,\n startMonth: new Date(startYear ?? minDate?.getFullYear() ?? new Date().getFullYear() - 100, 0),\n endMonth: new Date(endYear ?? maxDate?.getFullYear() ?? new Date().getFullYear() + 10, 11),\n 'aria-label': label ?? 'Calendar',\n } as const;\n\n return (\n <div className={cn('relative flex items-center', className)}>\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={triggerRef}\n variant=\"outline\"\n // `role=\"combobox\"` with a dialog popup (APG date-picker combobox). A plain button\n // may not carry aria-required / aria-invalid, which Field supplies.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n // Only while open, so it never points at an element that does not exist.\n aria-controls={open ? dialogId : undefined}\n // Named by the label, then the value: \"Start date June 1, 2026\".\n aria-labelledby={fieldContext ? `${fieldContext.labelId} ${valueId}` : undefined}\n aria-label={fieldContext ? undefined : ariaLabel}\n data-empty={!shown}\n {...field}\n aria-invalid={isInvalid || undefined}\n aria-required={isRequired || undefined}\n disabled={isDisabled}\n onBlur={onBlur as unknown as FocusEventHandler<HTMLButtonElement>}\n className={cn(\n 'w-full font-normal data-[empty=true]:text-muted-foreground',\n range ? 'justify-start px-2.5' : 'justify-between text-start',\n )}\n >\n {range ? <CalendarIcon aria-hidden /> : null}\n <span id={valueId} className=\"truncate\">\n {shown ?? placeholder}\n </span>\n {range ? null : <ChevronDownIcon aria-hidden />}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n ref={contentRef}\n id={dialogId}\n aria-label={label ? `Choose ${label.toLowerCase()}` : range ? 'Choose dates' : 'Choose date'}\n align=\"start\"\n className=\"w-auto max-w-none overflow-hidden p-0\"\n onOpenAutoFocus={(event) => {\n // Land on the grid's roving cell (the selected date, else today), not on the first\n // focusable element, which would be the previous-month button or the month select.\n event.preventDefault();\n contentRef.current?.querySelector<HTMLElement>('[role=\"grid\"] [tabindex=\"0\"]')?.focus();\n }}\n >\n {range ? (\n <Calendar\n mode=\"range\"\n selected={from ? { from, to } : undefined}\n onSelect={commitRange}\n defaultMonth={from}\n numberOfMonths={numberOfMonths ?? 2}\n {...calendarCommon}\n />\n ) : (\n <Calendar\n mode=\"single\"\n required\n selected={date}\n onSelect={commitSingle}\n defaultMonth={date}\n numberOfMonths={numberOfMonths}\n {...calendarCommon}\n />\n )}\n </PopoverContent>\n </Popover>\n\n {/* The form contract: a real input for `name`, native `required` (and `min` / `max`)\n validation and the forwarded ref. Invisible, out of the tab order and hidden from\n assistive tech, which hears the trigger instead. */}\n <input\n ref={composeRefs(ref, inputRef)}\n type={range ? 'text' : 'date'}\n aria-hidden\n tabIndex={-1}\n {...inputProps}\n name={name}\n value={range ? interval : iso}\n min={range ? undefined : min}\n max={range ? undefined : max}\n required={isRequired}\n disabled={isDisabled}\n onChange={(event) => {\n if (range) return;\n if (valueProp === undefined) setInternal(event.target.value);\n (onChange as ChangeEventHandler<HTMLInputElement> | undefined)?.(event);\n }}\n onFocus={() => triggerRef.current?.focus()}\n className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0\"\n />\n </div>\n );\n});\n","import { useEffect, useRef, type ComponentProps } from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\nimport { DayPicker as PersianDayPicker } from 'react-day-picker/persian';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button, buttonVariants, type ButtonVariant } from './button';\n\n/**\n * Calendar: a date field component that allows users to enter and edit a date.\n *\n * Built on React DayPicker: every DayPicker prop works (`mode` `single` / `multiple` / `range`,\n * `selected`, `onSelect`, `disabled` matchers, `numberOfMonths`, `captionLayout=\"dropdown\"`,\n * `showWeekNumber`, `locale` from `react-day-picker/locale`, `timeZone`, `modifiers`,\n * `components`, `formatters`). The cell size is the `--cell-size` CSS variable\n * (`className=\"[--cell-size:--spacing(10)]\"`).\n *\n * Range corners and the nav chevrons use logical sides, so `dir=\"rtl\"` works without changes.\n */\n\nexport type CalendarProps = ComponentProps<typeof DayPicker> & {\n /** The variant of the previous / next month buttons. Default `ghost`. */\n buttonVariant?: ButtonVariant;\n};\n\nexport function Calendar(props: CalendarProps) {\n return <CalendarRoot picker={DayPicker} {...props} />;\n}\n\n/**\n * PersianCalendar: the same Calendar on the Persian (Solar Hijri / Jalali) calendar. Defaults to\n * the `faIR` locale, `dir=\"rtl\"` and Eastern Arabic numerals; pass `locale={enUS}` from\n * `react-day-picker/persian` for English labels.\n */\nexport function PersianCalendar(props: PersianCalendarProps) {\n // Same props apart from the narrower Jalali `locale` type, which PersianCalendarProps keeps.\n return <CalendarRoot picker={PersianDayPicker as unknown as typeof DayPicker} {...(props as CalendarProps)} />;\n}\n\nexport type PersianCalendarProps = ComponentProps<typeof PersianDayPicker> & {\n /** The variant of the previous / next month buttons. Default `ghost`. */\n buttonVariant?: ButtonVariant;\n};\n\nfunction CalendarRoot({\n picker: Picker,\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: CalendarProps & { picker: typeof DayPicker }) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <Picker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn(\n 'relative rounded-(--cell-radius) border border-input has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50',\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : 'flex h-6 items-center gap-1 rounded-(--cell-radius) ps-1.5 pe-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-[0.8rem] text-muted-foreground select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'relative isolate z-0 rounded-s-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:end-0 after:w-4 after:bg-muted',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'relative isolate z-0 rounded-e-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:start-0 after:w-4 after:bg-muted',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className: rootClassName, rootRef, ...rootProps }) => (\n <div data-slot=\"calendar\" ref={rootRef} className={cn(rootClassName)} {...rootProps} />\n ),\n Chevron: ({ className: iconClassName, orientation, ...iconProps }) => {\n if (orientation === 'left') return <ChevronLeftIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n if (orientation === 'right') return <ChevronRightIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n return <ChevronDownIcon className={cn('size-4', iconClassName)} {...iconProps} />;\n },\n DayButton: (dayProps) => <CalendarDayButton locale={locale} {...dayProps} />,\n WeekNumber: ({ children, ...weekProps }) => (\n <td {...weekProps}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n ),\n ...components,\n }}\n {...props}\n />\n );\n}\n\nexport type CalendarDayButtonProps = ComponentProps<typeof DayButton> & { locale?: Partial<Locale> };\n\n/** The day cell's button. Use it in `components.DayButton` to add content under the date. */\nexport function CalendarDayButton({ className, day, modifiers, locale, ...props }: CalendarDayButtonProps) {\n const defaultClassNames = getDefaultClassNames();\n const ref = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle}\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n","import { Children, type ComponentProps, type ReactNode } from 'react';\nimport {\n Questionnaire as QuestionnairePrimitive,\n type QuestionnaireChoiceDefinition,\n type QuestionnaireInputType,\n type QuestionnaireItemDefinition,\n type QuestionnaireItemStatus,\n type QuestionnaireShortcutMode,\n} from '../../vendor/headless/questionnaire';\nimport { CheckIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { buttonVariants, type ButtonSize, type ButtonVariant } from './button';\n\nexport type {\n QuestionnaireChoiceDefinition,\n QuestionnaireInputType,\n QuestionnaireItemDefinition,\n QuestionnaireItemStatus,\n QuestionnaireShortcutMode,\n};\n\n/**\n * Questionnaire: a multi-step form that asks one question at a time, with single-choice,\n * multiple-choice, freeform and skippable questions.\n *\n * Two ways to write one:\n * - Shorthand: `<Questionnaire items={items} onSubmit={…} />`. When it has no children and the\n * items carry `prompt` (and optionally `description`, `choices` with a `label`, `input`), it\n * renders the progress, every item, its choices, its error and the actions.\n * - Composition: `QuestionnaireProgress`, `QuestionnaireItem`s (title, description, choices,\n * input, error) and `QuestionnaireActions` (previous, skip, next, submit).\n *\n * It is a `<form>`: each item is a `fieldset` whose title is its `legend`, fixed choices are native\n * radios (checkboxes with `multiple`), and the answers arrive as `FormData` on submit. It owns the\n * active item, answers, validation, progress and navigation; the page, card or dialog around it\n * owns cancelling, persistence and branching. The behaviour comes from a headless engine (a\n * regular dependency); these parts add the look.\n */\n\nexport interface QuestionnaireShorthandChoice extends QuestionnaireChoiceDefinition {\n label?: ReactNode;\n description?: ReactNode;\n}\n\nexport interface QuestionnaireShorthandItem extends QuestionnaireItemDefinition {\n /** The question, rendered as the item's title. */\n prompt?: ReactNode;\n description?: ReactNode;\n multiple?: boolean;\n choices?: readonly QuestionnaireShorthandChoice[];\n /** A freeform answer field after the choices. `label` is its accessible name. */\n input?: { label: string; placeholder?: string; type?: QuestionnaireInputType };\n}\n\nexport type QuestionnaireProps = Omit<ComponentProps<typeof QuestionnairePrimitive.Root>, 'items'> & {\n items?: readonly QuestionnaireShorthandItem[];\n};\n\nexport function Questionnaire({ className, children, items, ...props }: QuestionnaireProps) {\n const shorthand = Children.count(children) === 0 && items?.some((item) => item.prompt != null);\n return (\n <QuestionnairePrimitive.Root\n data-slot=\"questionnaire\"\n items={items}\n className={cn('flex w-full min-w-0 flex-col gap-4', className)}\n {...props}\n >\n {shorthand && items ? <QuestionnaireShorthand items={items} /> : children}\n </QuestionnairePrimitive.Root>\n );\n}\n\nfunction QuestionnaireShorthand({ items }: { items: readonly QuestionnaireShorthandItem[] }) {\n const skippable = items.some((item) => !item.required);\n return (\n <>\n <QuestionnaireProgress />\n {items.map((item) => (\n <QuestionnaireItem\n key={item.name}\n name={item.name}\n required={item.required}\n multiple={item.multiple}\n disabled={item.disabled}\n >\n <QuestionnaireTitle>{item.prompt}</QuestionnaireTitle>\n {item.description != null && <QuestionnaireDescription>{item.description}</QuestionnaireDescription>}\n {(item.choices?.length || item.input) && (\n <QuestionnaireChoices>\n {item.choices?.map((choice) => (\n <QuestionnaireChoice key={choice.value} value={choice.value} disabled={choice.disabled}>\n <span className=\"font-medium\">{choice.label ?? choice.value}</span>\n {choice.description != null && (\n <QuestionnaireChoiceDescription>{choice.description}</QuestionnaireChoiceDescription>\n )}\n </QuestionnaireChoice>\n ))}\n {item.input && (\n <QuestionnaireInput\n aria-label={item.input.label}\n placeholder={item.input.placeholder}\n type={item.input.type}\n />\n )}\n </QuestionnaireChoices>\n )}\n <QuestionnaireError />\n </QuestionnaireItem>\n ))}\n <QuestionnaireActions>\n <QuestionnairePrevious />\n {skippable && <QuestionnaireSkip />}\n <QuestionnaireNext />\n <QuestionnaireSubmit />\n </QuestionnaireActions>\n </>\n );\n}\n\nexport type QuestionnaireProgressProps = ComponentProps<typeof QuestionnairePrimitive.Progress>;\n\nexport function QuestionnaireProgress({ className, ...props }: QuestionnaireProgressProps) {\n return (\n <QuestionnairePrimitive.Progress\n data-slot=\"questionnaire-progress\"\n className={cn('min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireItemProps = ComponentProps<typeof QuestionnairePrimitive.Item>;\n\nexport function QuestionnaireItem({ className, ...props }: QuestionnaireItemProps) {\n return (\n <QuestionnairePrimitive.Item\n data-slot=\"questionnaire-item\"\n className={cn('flex min-w-0 flex-col gap-4 border-0 p-0 outline-none', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireTitleProps = ComponentProps<typeof QuestionnairePrimitive.Title>;\n\nexport function QuestionnaireTitle({ className, ...props }: QuestionnaireTitleProps) {\n return (\n <QuestionnairePrimitive.Title\n data-slot=\"questionnaire-title\"\n className={cn(\n 'text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireDescriptionProps = ComponentProps<typeof QuestionnairePrimitive.Description>;\n\nexport function QuestionnaireDescription({ className, ...props }: QuestionnaireDescriptionProps) {\n return (\n <QuestionnairePrimitive.Description\n data-slot=\"questionnaire-description\"\n className={cn('text-sm text-pretty text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireChoicesProps = ComponentProps<typeof QuestionnairePrimitive.Choices>;\n\nexport function QuestionnaireChoices({ className, ...props }: QuestionnaireChoicesProps) {\n return (\n <QuestionnairePrimitive.Choices\n data-slot=\"questionnaire-choices\"\n className={cn('group/questionnaire-choices grid min-w-0 gap-2', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireChoiceProps = ComponentProps<typeof QuestionnairePrimitive.Choice>;\n\nexport function QuestionnaireChoice({ children, className, ...props }: QuestionnaireChoiceProps) {\n return (\n <QuestionnairePrimitive.Choice\n data-slot=\"questionnaire-choice\"\n className={cn(\n 'group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none',\n 'hover:bg-muted/50 data-checked:border-primary/40 data-checked:bg-muted data-invalid:border-destructive dark:bg-input/20 dark:data-checked:bg-muted',\n 'has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50',\n 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <QuestionnairePrimitive.ChoiceInput\n data-slot=\"questionnaire-choice-input\"\n className=\"absolute inset-0 z-10 size-full cursor-pointer opacity-0\"\n />\n <span\n aria-hidden=\"true\"\n data-slot=\"questionnaire-choice-indicator\"\n className={cn(\n 'pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-data-[type=radio]/questionnaire-choice:rounded-full dark:bg-input/30',\n 'group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:group-data-checked/questionnaire-choice:bg-primary',\n 'group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5',\n )}\n >\n <span\n data-slot=\"questionnaire-choice-indicator-dot\"\n className=\"hidden size-2 rounded-full bg-primary-foreground group-data-checked/questionnaire-choice:block group-data-[type=checkbox]/questionnaire-choice:hidden\"\n />\n <CheckIcon\n data-slot=\"questionnaire-choice-indicator-check\"\n className=\"hidden size-3.5 group-data-checked/questionnaire-choice:block group-data-[type=radio]/questionnaire-choice:hidden\"\n />\n </span>\n <QuestionnairePrimitive.ChoiceLabel\n data-slot=\"questionnaire-choice-label\"\n className=\"flex min-w-0 flex-1 flex-col gap-0.5 leading-snug\"\n >\n {children}\n </QuestionnairePrimitive.ChoiceLabel>\n <QuestionnairePrimitive.ChoiceShortcut\n data-slot=\"questionnaire-choice-shortcut\"\n className={cn(\n 'pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-data-[shortcut]/questionnaire-choice:inline-flex',\n 'group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5',\n )}\n />\n </QuestionnairePrimitive.Choice>\n );\n}\n\nexport type QuestionnaireChoiceDescriptionProps = ComponentProps<'span'>;\n\nexport function QuestionnaireChoiceDescription({ className, ...props }: QuestionnaireChoiceDescriptionProps) {\n return (\n <span data-slot=\"questionnaire-choice-description\" className={cn('text-muted-foreground', className)} {...props} />\n );\n}\n\nexport type QuestionnaireInputProps = ComponentProps<typeof QuestionnairePrimitive.Input>;\n\nexport function QuestionnaireInput({ className, ...props }: QuestionnaireInputProps) {\n return (\n <div data-slot=\"questionnaire-input-wrapper\" className=\"group/questionnaire-input relative w-full min-w-0\">\n <QuestionnairePrimitive.Input\n data-slot=\"questionnaire-input\"\n className={cn(\n 'h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none sm:min-h-0 md:text-sm dark:bg-input/30',\n 'selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80',\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nexport type QuestionnaireErrorProps = ComponentProps<typeof QuestionnairePrimitive.Error>;\n\nexport function QuestionnaireError({ className, ...props }: QuestionnaireErrorProps) {\n return (\n <QuestionnairePrimitive.Error\n data-slot=\"questionnaire-error\"\n className={cn('mt-2 text-sm text-destructive', className)}\n {...props}\n />\n );\n}\n\nexport type QuestionnaireActionsProps = ComponentProps<'div'>;\n\n/** Lays out Previous at the start and Skip / Next / Submit at the end. */\nexport function QuestionnaireActions({ className, ...props }: QuestionnaireActionsProps) {\n return (\n <div\n data-slot=\"questionnaire-actions\"\n className={cn(\n 'grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8',\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface NavigationButtonProps {\n size?: ButtonSize;\n variant?: ButtonVariant;\n}\n\nexport type QuestionnairePreviousProps = ComponentProps<typeof QuestionnairePrimitive.Previous> & NavigationButtonProps;\n\nexport function QuestionnairePrevious({\n children,\n className,\n size = 'default',\n variant = 'outline',\n ...props\n}: QuestionnairePreviousProps) {\n return (\n <QuestionnairePrimitive.Previous\n data-slot=\"questionnaire-previous\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Previous'}\n </QuestionnairePrimitive.Previous>\n );\n}\n\nexport type QuestionnaireSkipProps = ComponentProps<typeof QuestionnairePrimitive.Skip> & NavigationButtonProps;\n\nexport function QuestionnaireSkip({\n children,\n className,\n size = 'default',\n variant = 'outline',\n ...props\n}: QuestionnaireSkipProps) {\n return (\n <QuestionnairePrimitive.Skip\n data-slot=\"questionnaire-skip\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Skip'}\n </QuestionnairePrimitive.Skip>\n );\n}\n\nexport type QuestionnaireNextProps = ComponentProps<typeof QuestionnairePrimitive.Next> & NavigationButtonProps;\n\nexport function QuestionnaireNext({\n children,\n className,\n size = 'default',\n variant = 'default',\n ...props\n}: QuestionnaireNextProps) {\n return (\n <QuestionnairePrimitive.Next\n data-slot=\"questionnaire-next\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Next'}\n </QuestionnairePrimitive.Next>\n );\n}\n\nexport type QuestionnaireSubmitProps = ComponentProps<typeof QuestionnairePrimitive.Submit> & NavigationButtonProps;\n\nexport function QuestionnaireSubmit({\n children,\n className,\n size = 'default',\n variant = 'default',\n ...props\n}: QuestionnaireSubmitProps) {\n return (\n <QuestionnairePrimitive.Submit\n data-slot=\"questionnaire-submit\"\n data-size={size}\n data-variant={variant}\n className={cn(\n buttonVariants({ size, variant }),\n 'col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0',\n className,\n )}\n {...props}\n >\n {children ?? 'Submit'}\n </QuestionnairePrimitive.Submit>\n );\n}\n","import * as React from \"react\"\n\nimport { mergeProps, useRender } from \"../use-render\"\nimport {\n QuestionnaireChoiceContext,\n QuestionnaireContext,\n QuestionnaireItemContext,\n useQuestionnaireChoiceContext,\n useQuestionnaireContext,\n useQuestionnaireItemContext,\n} from \"./context\"\nimport type {\n QuestionnaireChoiceInputProps,\n QuestionnaireChoiceLabelProps,\n QuestionnaireChoiceProps,\n QuestionnaireChoiceShortcutProps,\n QuestionnaireChoicesProps,\n QuestionnaireDescriptionProps,\n QuestionnaireErrorProps,\n QuestionnaireInputProps,\n QuestionnaireItemProps,\n QuestionnaireNavigationState,\n QuestionnaireNextProps,\n QuestionnairePreviousProps,\n QuestionnaireProgressProps,\n QuestionnaireRootProps,\n QuestionnaireSkipProps,\n QuestionnaireSubmitProps,\n QuestionnaireTitleProps,\n} from \"./types\"\nimport { useQuestionnaireChoice } from \"./use-questionnaire-choice\"\nimport { useQuestionnaireInput } from \"./use-questionnaire-input\"\nimport { useQuestionnaireItem } from \"./use-questionnaire-item\"\nimport { useQuestionnaireRoot } from \"./use-questionnaire-root\"\n\nfunction QuestionnaireRoot({\n defaultItem,\n item,\n items,\n noValidate = true,\n onItemChange,\n onReset,\n onSubmit,\n ref,\n shortcuts,\n ...props\n}: QuestionnaireRootProps) {\n const { context, rootProps, state } = useQuestionnaireRoot({\n defaultItem,\n item,\n items,\n noValidate,\n onItemChange,\n onReset,\n onSubmit,\n ref,\n shortcuts,\n })\n const element = useRender({\n defaultTagName: \"form\",\n props: mergeProps<\"form\">({ ...rootProps, noValidate }, props),\n state,\n })\n\n return (\n <QuestionnaireContext.Provider value={context}>\n {element}\n </QuestionnaireContext.Provider>\n )\n}\n\nfunction QuestionnaireProgress({\n children,\n render,\n ...props\n}: QuestionnaireProgressProps) {\n const { current, first, last, total } = useQuestionnaireContext(\n \"Questionnaire.Progress\"\n )\n const label = total ? `Question ${current} of ${total}` : undefined\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n \"aria-label\": \"Questionnaire progress\",\n \"aria-live\": \"polite\",\n \"aria-valuemax\": total || undefined,\n \"aria-valuemin\": total ? 1 : undefined,\n \"aria-valuenow\": total ? current : undefined,\n \"aria-valuetext\": label,\n children: children ?? label,\n role: \"progressbar\",\n },\n props\n ),\n render,\n state: { current, first, last, total },\n })\n}\n\nfunction QuestionnaireItem({\n \"aria-describedby\": ariaDescribedBy,\n \"aria-keyshortcuts\": ariaKeyShortcuts,\n children,\n disabled = false,\n invalid = false,\n multiple = false,\n name,\n onStatusChange,\n ref,\n required = false,\n ...props\n}: QuestionnaireItemProps) {\n const { context, itemProps, state } = useQuestionnaireItem({\n \"aria-describedby\": ariaDescribedBy,\n \"aria-keyshortcuts\": ariaKeyShortcuts,\n disabled,\n invalid,\n multiple,\n name,\n onStatusChange,\n ref,\n required,\n })\n const element = useRender({\n defaultTagName: \"fieldset\",\n props: mergeProps<\"fieldset\">({ ...itemProps, children }, props),\n state,\n stateAttributesMapping: {\n active: (isActive) => ({\n \"data-active\": isActive ? \"\" : undefined,\n }),\n },\n })\n\n return (\n <QuestionnaireItemContext.Provider value={context}>\n {element}\n </QuestionnaireItemContext.Provider>\n )\n}\n\nfunction QuestionnaireTitle({ render, ...props }: QuestionnaireTitleProps) {\n useQuestionnaireItemContext(\"Questionnaire.Title\")\n\n return useRender({\n defaultTagName: \"legend\",\n props,\n render,\n })\n}\n\nfunction QuestionnaireDescription({\n id,\n render,\n ...props\n}: QuestionnaireDescriptionProps) {\n const { registerDescription } = useQuestionnaireItemContext(\n \"Questionnaire.Description\"\n )\n const generatedId = React.useId()\n const descriptionId = id ?? generatedId\n\n React.useLayoutEffect(\n () => registerDescription(descriptionId),\n [descriptionId, registerDescription]\n )\n\n return useRender({\n defaultTagName: \"p\",\n props: mergeProps<\"p\">({ id: descriptionId }, props),\n render,\n })\n}\n\nfunction QuestionnaireChoices({ render, ...props }: QuestionnaireChoicesProps) {\n const { shortcuts } = useQuestionnaireItemContext(\"Questionnaire.Choices\")\n\n return useRender({\n defaultTagName: \"div\",\n props,\n render,\n state: { shortcuts },\n })\n}\n\nfunction QuestionnaireChoice({\n checked,\n children,\n defaultChecked = false,\n disabled = false,\n onChange,\n render,\n value,\n ...props\n}: QuestionnaireChoiceProps) {\n const { inputProps, state } = useQuestionnaireChoice({\n checked,\n defaultChecked,\n disabled,\n onChange,\n value,\n })\n const element = useRender({\n defaultTagName: \"label\",\n props: mergeProps<\"label\">({ children }, props),\n render,\n state,\n stateAttributesMapping: {\n checked: (isChecked) => ({\n \"data-checked\": isChecked ? \"\" : undefined,\n \"data-unchecked\": isChecked ? undefined : \"\",\n }),\n },\n })\n\n return (\n <QuestionnaireChoiceContext.Provider value={{ inputProps, state }}>\n {element}\n </QuestionnaireChoiceContext.Provider>\n )\n}\n\nfunction QuestionnaireChoiceInput({\n render,\n ...props\n}: QuestionnaireChoiceInputProps) {\n const { inputProps, state } = useQuestionnaireChoiceContext(\n \"Questionnaire.ChoiceInput\"\n )\n\n return useRender({\n defaultTagName: \"input\",\n props: mergeProps<\"input\">(inputProps, props),\n render,\n state,\n stateAttributesMapping: {\n checked: (isChecked) => ({\n \"data-checked\": isChecked ? \"\" : undefined,\n \"data-unchecked\": isChecked ? undefined : \"\",\n }),\n },\n })\n}\n\nfunction QuestionnaireChoiceLabel({\n render,\n ...props\n}: QuestionnaireChoiceLabelProps) {\n useQuestionnaireChoiceContext(\"Questionnaire.ChoiceLabel\")\n\n return useRender({\n defaultTagName: \"span\",\n props,\n render,\n })\n}\n\nfunction QuestionnaireChoiceShortcut({\n children,\n render,\n ...props\n}: QuestionnaireChoiceShortcutProps) {\n const { state } = useQuestionnaireChoiceContext(\n \"Questionnaire.ChoiceShortcut\"\n )\n const shortcutState = { shortcut: state.shortcut }\n\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(\n {\n \"aria-hidden\": true,\n children: children ?? state.shortcut,\n hidden: state.shortcut === null,\n },\n props\n ),\n render,\n state: shortcutState,\n })\n}\n\nfunction QuestionnaireInput({\n defaultValue,\n disabled = false,\n onChange,\n ref,\n render,\n type = \"text\",\n value,\n ...props\n}: QuestionnaireInputProps) {\n const { inputProps, state } = useQuestionnaireInput({\n defaultValue,\n disabled,\n onChange,\n ref,\n type,\n value,\n })\n\n return useRender({\n defaultTagName: \"input\",\n props: mergeProps<\"input\">(inputProps, props),\n render,\n state,\n stateAttributesMapping: {\n filled: (isFilled) => ({\n \"data-empty\": isFilled ? undefined : \"\",\n \"data-filled\": isFilled ? \"\" : undefined,\n }),\n },\n })\n}\n\nfunction QuestionnaireError({\n children,\n id,\n render,\n ...props\n}: QuestionnaireErrorProps) {\n const { invalid, registerError, required } = useQuestionnaireItemContext(\n \"Questionnaire.Error\"\n )\n const generatedId = React.useId()\n const errorId = id ?? generatedId\n\n React.useLayoutEffect(() => registerError(errorId), [errorId, registerError])\n\n return useRender({\n defaultTagName: \"p\",\n props: mergeProps<\"p\">(\n {\n children:\n children ??\n (required\n ? \"Choose an answer to continue.\"\n : \"Choose an answer or skip this question.\"),\n hidden: !invalid,\n id: errorId,\n role: invalid ? \"alert\" : undefined,\n },\n props\n ),\n render,\n state: { invalid },\n })\n}\n\nfunction QuestionnairePrevious({\n children,\n disabled: disabledProp = false,\n onClick,\n render,\n tabIndex,\n type = \"button\",\n ...props\n}: QuestionnairePreviousProps) {\n const context = useQuestionnaireContext(\"Questionnaire.Previous\")\n const visible = context.total > 1 && !context.first\n\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n\n if (!event.defaultPrevented) {\n context.goPrevious()\n }\n }\n\n return useRenderNavigationButton({\n children: children ?? \"Previous\",\n disabled: disabledProp,\n onClick: handleClick,\n props,\n render,\n status: context.activeItemStatus,\n tabIndex,\n type,\n visible,\n })\n}\n\nfunction QuestionnaireSkip({\n children,\n disabled: disabledProp = false,\n onClick,\n render,\n tabIndex,\n type = \"button\",\n ...props\n}: QuestionnaireSkipProps) {\n const context = useQuestionnaireContext(\"Questionnaire.Skip\")\n const visible = context.activeItemRequired === false\n\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n\n if (!event.defaultPrevented) {\n context.skipCurrent()\n }\n }\n\n return useRenderNavigationButton({\n children: children ?? \"Skip\",\n disabled: disabledProp,\n onClick: handleClick,\n props,\n render,\n status: context.activeItemStatus,\n tabIndex,\n type,\n visible,\n })\n}\n\nfunction QuestionnaireNext({\n children,\n disabled: disabledProp = false,\n onClick,\n render,\n tabIndex,\n type = \"button\",\n ...props\n}: QuestionnaireNextProps) {\n const context = useQuestionnaireContext(\"Questionnaire.Next\")\n const visible = context.total > 1 && !context.last\n\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n\n if (!event.defaultPrevented) {\n context.goNext()\n }\n }\n\n return useRenderNavigationButton({\n children: children ?? \"Next\",\n disabled: disabledProp,\n onClick: handleClick,\n props,\n render,\n shortcut: \"Enter\",\n status: context.activeItemStatus,\n tabIndex,\n type,\n visible,\n })\n}\n\nfunction QuestionnaireSubmit({\n children,\n disabled: disabledProp = false,\n render,\n tabIndex,\n type = \"submit\",\n ...props\n}: QuestionnaireSubmitProps) {\n const context = useQuestionnaireContext(\"Questionnaire.Submit\")\n const visible = context.total > 0 && context.last\n\n return useRenderNavigationButton({\n children: children ?? \"Submit\",\n disabled: disabledProp,\n props,\n render,\n shortcut: \"Enter\",\n status: context.activeItemStatus,\n tabIndex,\n type,\n visible,\n })\n}\n\nfunction useRenderNavigationButton({\n children,\n disabled,\n onClick,\n props,\n render,\n shortcut,\n status,\n tabIndex,\n type,\n visible,\n}: {\n children: React.ReactNode\n disabled: boolean\n onClick?: React.MouseEventHandler<HTMLButtonElement>\n props: React.ComponentPropsWithRef<\"button\">\n render: QuestionnaireNextProps[\"render\"]\n shortcut?: \"Enter\"\n status: QuestionnaireNavigationState[\"status\"]\n tabIndex: number | undefined\n type: \"button\" | \"reset\" | \"submit\"\n visible: boolean\n}) {\n const activeShortcut = visible && !disabled ? (shortcut ?? null) : null\n const state: QuestionnaireNavigationState = {\n disabled,\n shortcut: activeShortcut,\n status,\n visible,\n }\n\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n \"aria-hidden\": !visible || undefined,\n \"aria-keyshortcuts\": activeShortcut ?? undefined,\n children,\n disabled,\n hidden: !visible,\n inert: !visible,\n onClick,\n tabIndex: visible ? tabIndex : -1,\n type,\n },\n props\n ),\n render,\n state,\n stateAttributesMapping: {\n visible: (isVisible) => ({\n \"data-hidden\": isVisible ? undefined : \"\",\n \"data-visible\": isVisible ? \"\" : undefined,\n }),\n },\n })\n}\n\nexport {\n QuestionnaireChoice,\n QuestionnaireChoiceInput,\n QuestionnaireChoiceLabel,\n QuestionnaireChoiceShortcut,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireError,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireNext,\n QuestionnairePrevious,\n QuestionnaireProgress,\n QuestionnaireRoot,\n QuestionnaireSkip,\n QuestionnaireSubmit,\n QuestionnaireTitle,\n}\n","// A poor man's version of base-ui useRender.\n// see https://base-ui.com/react/utils/use-render.\n// TODO: Replace if base-ui useRender is published as a package.\nimport * as React from \"react\"\n\ntype RenderState = Record<string, unknown>\n\ntype RenderFunction<TState extends RenderState> = (\n props: Record<string, unknown>,\n state: TState\n) => React.ReactElement | null\n\ntype RenderProp<TState extends RenderState> =\n | React.ReactElement\n | RenderFunction<TState>\n\ntype StateAttributesMapping<TState extends RenderState> = Partial<{\n [K in keyof TState]: (\n value: TState[K]\n ) => Record<string, string | undefined> | null | undefined\n}>\n\ntype UseRenderComponentProps<\n TElement extends React.ElementType,\n TState extends RenderState = RenderState,\n> = React.ComponentPropsWithRef<TElement> & {\n render?: RenderProp<TState>\n}\n\ntype UseRenderOptions<\n TElement extends React.ElementType,\n TState extends RenderState,\n> = {\n defaultTagName: TElement\n props?: React.ComponentPropsWithRef<TElement>\n render?: RenderProp<TState>\n state?: TState\n stateAttributesMapping?: StateAttributesMapping<TState>\n}\n\nfunction useRender<\n TElement extends React.ElementType,\n TState extends RenderState = RenderState,\n>({\n defaultTagName,\n props,\n render,\n state = {} as TState,\n stateAttributesMapping,\n}: UseRenderOptions<TElement, TState>) {\n const elementProps = mergeProps<TElement>(\n getStateAttributes(state, stateAttributesMapping),\n props\n )\n\n if (!render) {\n return React.createElement(defaultTagName, elementProps)\n }\n\n if (typeof render === \"function\") {\n return render(elementProps, state)\n }\n\n if (!React.isValidElement(render)) {\n return null\n }\n\n const renderProps = render.props as Record<string, unknown>\n const propsWithRenderProps = mergeProps<TElement>(elementProps, renderProps)\n const propsWithRef = {\n ...propsWithRenderProps,\n ref: composeRefs(\n elementProps.ref as React.Ref<unknown> | undefined,\n renderProps.ref as React.Ref<unknown> | undefined\n ),\n }\n\n return React.cloneElement(\n render,\n propsWithRef as React.Attributes & Record<string, unknown>\n )\n}\n\nfunction mergeProps<TElement extends React.ElementType>(\n ...sources: Array<\n React.ComponentPropsWithRef<TElement> | Record<string, unknown> | undefined\n >\n) {\n const result: Record<string, unknown> = {}\n\n for (const source of sources) {\n if (!source) {\n continue\n }\n\n const sourceProps = source as Record<string, unknown>\n\n for (const key of Object.keys(sourceProps)) {\n const value = sourceProps[key]\n\n if (value === undefined) {\n continue\n }\n\n const current = result[key]\n\n if (key === \"className\") {\n result[key] = [current, value].filter(Boolean).join(\" \")\n } else if (key === \"style\") {\n result[key] = {\n ...(current as React.CSSProperties | undefined),\n ...(value as React.CSSProperties | undefined),\n }\n } else if (key === \"ref\") {\n result[key] = composeRefs(\n current as React.Ref<unknown> | undefined,\n value as React.Ref<unknown> | undefined\n )\n } else if (\n isEventHandler(key) &&\n typeof current === \"function\" &&\n typeof value === \"function\"\n ) {\n result[key] = composeEventHandlers(\n value as EventHandler,\n current as EventHandler\n )\n } else {\n result[key] = value\n }\n }\n }\n\n return result as React.ComponentPropsWithRef<TElement>\n}\n\nfunction getStateAttributes<TState extends RenderState>(\n state: TState,\n mapping?: StateAttributesMapping<TState>\n) {\n const props: Record<string, unknown> = {}\n\n for (const key of Object.keys(state) as Array<keyof TState>) {\n const value = state[key]\n const attributes = mapping?.[key]?.(value)\n\n if (attributes) {\n Object.assign(props, attributes)\n continue\n }\n\n if (key === \"slot\") {\n props[\"data-slot\"] = value\n continue\n }\n\n const attribute = `data-${String(key).replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n )}`\n\n if (typeof value === \"boolean\") {\n props[attribute] = value ? \"\" : undefined\n } else if (value !== null && value !== undefined) {\n props[attribute] = String(value)\n }\n }\n\n return props\n}\n\ntype EventHandler = (event: React.SyntheticEvent) => void\n\nfunction composeEventHandlers(theirs: EventHandler, ours: EventHandler) {\n return function handleEvent(event: React.SyntheticEvent) {\n theirs(event)\n\n if (!event.defaultPrevented) {\n ours(event)\n }\n }\n}\n\nfunction isEventHandler(key: string) {\n return /^on[A-Z]/.test(key)\n}\n\nfunction composeRefs<T>(\n ...refs: Array<React.Ref<T> | undefined>\n): React.RefCallback<T> | undefined {\n const validRefs = refs.filter(Boolean)\n\n if (validRefs.length === 0) {\n return undefined\n }\n\n return (value) => {\n for (const ref of validRefs) {\n if (typeof ref === \"function\") {\n ref(value)\n } else if (ref) {\n ref.current = value\n }\n }\n }\n}\n\nexport { composeRefs, mergeProps, useRender, type UseRenderComponentProps }\n","import * as React from \"react\"\n\nimport type {\n QuestionnaireChoiceContextValue,\n QuestionnaireContextValue,\n QuestionnaireItemContextValue,\n} from \"./types\"\n\nconst QuestionnaireChoiceContext =\n React.createContext<QuestionnaireChoiceContextValue | null>(null)\nconst QuestionnaireContext =\n React.createContext<QuestionnaireContextValue | null>(null)\nconst QuestionnaireItemContext =\n React.createContext<QuestionnaireItemContextValue | null>(null)\n\nfunction useQuestionnaireContext(component: string) {\n const context = React.useContext(QuestionnaireContext)\n\n if (!context) {\n throw new Error(\n `${component} must be used within a Questionnaire.Root component.`\n )\n }\n\n return context\n}\n\nfunction useQuestionnaireChoiceContext(component: string) {\n const context = React.useContext(QuestionnaireChoiceContext)\n\n if (!context) {\n throw new Error(\n `${component} must be used within a Questionnaire.Choice component.`\n )\n }\n\n return context\n}\n\nfunction useQuestionnaireItemContext(component: string) {\n const context = React.useContext(QuestionnaireItemContext)\n\n if (!context) {\n throw new Error(\n `${component} must be used within a Questionnaire.Item component.`\n )\n }\n\n return context\n}\n\nexport {\n QuestionnaireChoiceContext,\n QuestionnaireContext,\n QuestionnaireItemContext,\n useQuestionnaireChoiceContext,\n useQuestionnaireContext,\n useQuestionnaireItemContext,\n}\n","import * as React from \"react\"\n\nimport { useQuestionnaireItemContext } from \"./context\"\nimport type {\n QuestionnaireChoiceProps,\n QuestionnaireChoiceState,\n} from \"./types\"\nimport { getAnswerKeyShortcuts } from \"./utils\"\n\ntype UseQuestionnaireChoiceParameters = Pick<\n QuestionnaireChoiceProps,\n \"checked\" | \"defaultChecked\" | \"disabled\" | \"onChange\" | \"value\"\n>\n\nfunction useQuestionnaireChoice({\n checked: controlledChecked,\n defaultChecked = false,\n disabled: choiceDisabled = false,\n onChange,\n value,\n}: UseQuestionnaireChoiceParameters) {\n const {\n disabled: itemDisabled,\n hasInputAnswer,\n invalid,\n multiple,\n name: itemName,\n registerAnswerControl,\n registerAnswerSelection,\n required,\n resetVersion,\n selectedAnswerIds,\n setAnswerDefault,\n setAnswerSelectionFromInteraction,\n shortcutByAnswerId,\n shortcutByChoiceValue,\n status,\n syncControlledAnswerSelection,\n } = useQuestionnaireItemContext(\"Questionnaire.Choice\")\n const answerId = React.useId()\n const [inputElement, setInputElement] =\n React.useState<HTMLInputElement | null>(null)\n const initialDefaultCheckedRef = React.useRef(defaultChecked)\n const controlled = controlledChecked !== undefined\n const disabled = itemDisabled || choiceDisabled\n const selected = selectedAnswerIds.includes(answerId)\n const checked = controlled\n ? status === \"skipped\"\n ? false\n : controlledChecked\n : selected\n const type = multiple ? \"checkbox\" : \"radio\"\n const shortcut =\n shortcutByChoiceValue?.get(value) ??\n shortcutByAnswerId.get(answerId) ??\n null\n\n React.useLayoutEffect(\n () => registerAnswerSelection(answerId, initialDefaultCheckedRef.current),\n [answerId, registerAnswerSelection]\n )\n React.useLayoutEffect(\n () => setAnswerDefault(answerId, defaultChecked),\n [answerId, defaultChecked, setAnswerDefault]\n )\n\n React.useLayoutEffect(() => {\n if (!inputElement) {\n return\n }\n\n return registerAnswerControl({\n disabled,\n element: inputElement,\n id: answerId,\n ownDisabled: choiceDisabled,\n type: \"choice\",\n value,\n })\n }, [\n answerId,\n choiceDisabled,\n disabled,\n inputElement,\n registerAnswerControl,\n value,\n ])\n\n React.useLayoutEffect(() => {\n if (controlled) {\n syncControlledAnswerSelection(answerId, controlledChecked)\n }\n }, [\n answerId,\n controlled,\n controlledChecked,\n resetVersion,\n syncControlledAnswerSelection,\n ])\n\n React.useLayoutEffect(() => {\n if (!inputElement) {\n return\n }\n\n // Keep the native reset target aligned with Questionnaire's owned default,\n // including controlled choices whose checked prop remains authoritative.\n inputElement.defaultChecked = controlled\n ? controlledChecked\n : defaultChecked\n\n if (resetVersion > 0) {\n inputElement.checked = checked\n }\n }, [\n checked,\n controlled,\n controlledChecked,\n defaultChecked,\n inputElement,\n resetVersion,\n ])\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n onChange?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n if (!controlled) {\n setAnswerSelectionFromInteraction(answerId, event.target.checked)\n return\n }\n\n if (status === \"skipped\" && controlledChecked === event.target.checked) {\n setAnswerSelectionFromInteraction(answerId, controlledChecked)\n }\n }\n\n const state: QuestionnaireChoiceState = {\n checked,\n disabled,\n invalid,\n shortcut,\n type,\n }\n\n return {\n inputProps: {\n ref: setInputElement,\n \"aria-invalid\": invalid || undefined,\n \"aria-keyshortcuts\": getAnswerKeyShortcuts(\n shortcut,\n !disabled && checked\n ),\n checked,\n disabled,\n id: answerId,\n name: status === \"skipped\" ? undefined : itemName,\n onChange: handleChange,\n required: required && !multiple && !hasInputAnswer,\n type,\n value,\n },\n state,\n }\n}\n\nexport { useQuestionnaireChoice }\n","import type {\n AnswerControlRegistration,\n ItemRegistration,\n QuestionnaireShortcutMode,\n} from \"./types\"\n\nfunction hasInputValue(value: unknown) {\n if (Array.isArray(value)) {\n return value.some((item) => String(item).trim().length > 0)\n }\n\n return (\n value !== undefined && value !== null && String(value).trim().length > 0\n )\n}\n\nfunction getShortcutKeys(shortcuts: QuestionnaireShortcutMode | null) {\n if (shortcuts === \"letters\") {\n return Array.from({ length: 26 }, (_, index) =>\n String.fromCharCode(65 + index)\n )\n }\n\n if (shortcuts === \"numbers\") {\n return Array.from({ length: 9 }, (_, index) => String(index + 1))\n }\n\n return []\n}\n\nfunction getShortcutFromKey(key: string, shortcuts: QuestionnaireShortcutMode) {\n const normalizedKey = shortcuts === \"letters\" ? key.toUpperCase() : key\n\n return getShortcutKeys(shortcuts).includes(normalizedKey)\n ? normalizedKey\n : null\n}\n\nfunction getAnswerKeyShortcuts(shortcut: string | null, filled: boolean) {\n return (\n [shortcut, filled ? \"Enter\" : null].filter(Boolean).join(\" \") || undefined\n )\n}\n\nfunction isAnswerFilled(answer: AnswerControlRegistration) {\n if (answer.type === \"choice\") {\n return answer.element.checked\n }\n\n return (\n answer.element.hasAttribute(\"name\") && hasInputValue(answer.element.value)\n )\n}\n\nfunction isEmptyNavigableInput(answer: AnswerControlRegistration | null) {\n return (\n answer?.type === \"input\" &&\n [\"email\", \"password\", \"search\", \"tel\", \"text\", \"url\"].includes(\n answer.element.type\n ) &&\n !hasInputValue(answer.element.value)\n )\n}\n\nfunction isTextEntryTarget(element: Element) {\n if (\n element instanceof HTMLTextAreaElement ||\n element instanceof HTMLSelectElement\n ) {\n return true\n }\n\n if (element instanceof HTMLInputElement) {\n return ![\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(\n element.type\n )\n }\n\n return element instanceof HTMLElement && element.isContentEditable\n}\n\nfunction isRadioTarget(element: Element) {\n return element instanceof HTMLInputElement && element.type === \"radio\"\n}\n\nfunction compareItemOrder(\n firstItem: ItemRegistration,\n secondItem: ItemRegistration\n) {\n if (firstItem.element === secondItem.element) {\n return 0\n }\n\n const position = firstItem.element.compareDocumentPosition(secondItem.element)\n\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n return -1\n }\n\n if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n return 1\n }\n\n return 0\n}\n\nfunction compareAnswerOrder(\n firstAnswer: AnswerControlRegistration,\n secondAnswer: AnswerControlRegistration\n) {\n if (firstAnswer.element === secondAnswer.element) {\n return 0\n }\n\n const position = firstAnswer.element.compareDocumentPosition(\n secondAnswer.element\n )\n\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n return -1\n }\n\n if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n return 1\n }\n\n return 0\n}\n\nexport {\n compareAnswerOrder,\n compareItemOrder,\n getAnswerKeyShortcuts,\n getShortcutFromKey,\n getShortcutKeys,\n hasInputValue,\n isAnswerFilled,\n isEmptyNavigableInput,\n isRadioTarget,\n isTextEntryTarget,\n}\n","import * as React from \"react\"\n\nimport { composeRefs } from \"../use-render\"\nimport { useQuestionnaireItemContext } from \"./context\"\nimport type { QuestionnaireInputProps, QuestionnaireInputState } from \"./types\"\nimport { getAnswerKeyShortcuts, hasInputValue } from \"./utils\"\n\ntype UseQuestionnaireInputParameters = Pick<\n QuestionnaireInputProps,\n \"defaultValue\" | \"disabled\" | \"onChange\" | \"ref\" | \"type\" | \"value\"\n>\n\nfunction useQuestionnaireInput({\n defaultValue,\n disabled: inputDisabled = false,\n onChange,\n ref,\n type = \"text\",\n value: controlledValue,\n}: UseQuestionnaireInputParameters) {\n const {\n disabled: itemDisabled,\n invalid,\n name: itemName,\n registerAnswerControl,\n registerAnswerSelection,\n resetVersion,\n selectedAnswerIds,\n setAnswerDefault,\n setAnswerSelectionFromInteraction,\n syncControlledAnswerSelection,\n } = useQuestionnaireItemContext(\"Questionnaire.Input\")\n const answerId = React.useId()\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n const initialDefaultFilledRef = React.useRef(hasInputValue(defaultValue))\n const controlled = controlledValue !== undefined\n const defaultFilled = hasInputValue(defaultValue)\n const controlledFilled = hasInputValue(controlledValue)\n const [uncontrolledFilled, setUncontrolledFilled] =\n React.useState(defaultFilled)\n const disabled = itemDisabled || inputDisabled\n const filled = controlled ? controlledFilled : uncontrolledFilled\n const selected = selectedAnswerIds.includes(answerId)\n\n React.useLayoutEffect(\n () => registerAnswerSelection(answerId, initialDefaultFilledRef.current),\n [answerId, registerAnswerSelection]\n )\n React.useLayoutEffect(\n () => setAnswerDefault(answerId, defaultFilled),\n [defaultFilled, answerId, setAnswerDefault]\n )\n\n React.useLayoutEffect(() => {\n const input = inputRef.current\n\n if (!input) {\n return\n }\n\n return registerAnswerControl({\n disabled,\n element: input,\n id: answerId,\n type: \"input\",\n })\n }, [disabled, answerId, registerAnswerControl])\n\n React.useLayoutEffect(() => {\n if (controlled) {\n syncControlledAnswerSelection(answerId, controlledFilled)\n return\n }\n\n if (resetVersion > 0) {\n setUncontrolledFilled(defaultFilled)\n }\n }, [\n controlled,\n controlledFilled,\n controlledValue,\n defaultFilled,\n answerId,\n resetVersion,\n syncControlledAnswerSelection,\n ])\n\n React.useLayoutEffect(() => {\n const input = inputRef.current\n\n if (!input || !controlled) {\n return\n }\n\n input.defaultValue = String(controlledValue)\n }, [controlled, controlledValue])\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n onChange?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n const nextFilled = event.target.value.trim().length > 0\n\n if (controlled) {\n return\n }\n\n setUncontrolledFilled(nextFilled)\n setAnswerSelectionFromInteraction(answerId, nextFilled)\n }\n\n const state: QuestionnaireInputState = {\n disabled,\n filled,\n invalid,\n }\n const setInputRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n inputRef.current = element\n composeRefs(ref)?.(element)\n },\n [ref]\n )\n\n return {\n inputProps: {\n \"aria-invalid\": invalid || undefined,\n \"aria-keyshortcuts\": getAnswerKeyShortcuts(\n null,\n !disabled && filled && selected\n ),\n defaultValue: controlled ? undefined : defaultValue,\n disabled,\n form: selected ? undefined : \"\",\n id: answerId,\n name: selected ? itemName : undefined,\n onChange: handleChange,\n ref: setInputRef,\n type,\n value: controlled ? controlledValue : undefined,\n },\n state,\n }\n}\n\nexport { useQuestionnaireInput }\n","import * as React from \"react\"\n\nimport { composeRefs } from \"../use-render\"\nimport { getShortcutByChoiceValue } from \"./collection\"\nimport { useQuestionnaireContext } from \"./context\"\nimport type {\n AnswerControlRegistration,\n QuestionnaireItemContextValue,\n QuestionnaireItemProps,\n QuestionnaireItemState,\n QuestionnaireItemStatus,\n} from \"./types\"\nimport {\n compareAnswerOrder,\n getShortcutKeys,\n isAnswerFilled,\n isEmptyNavigableInput,\n isRadioTarget,\n isTextEntryTarget,\n} from \"./utils\"\n\ntype UseQuestionnaireItemParameters = Pick<\n QuestionnaireItemProps,\n | \"aria-describedby\"\n | \"aria-keyshortcuts\"\n | \"disabled\"\n | \"invalid\"\n | \"multiple\"\n | \"name\"\n | \"onStatusChange\"\n | \"ref\"\n | \"required\"\n>\n\nfunction useQuestionnaireItem({\n \"aria-describedby\": ariaDescribedBy,\n \"aria-keyshortcuts\": ariaKeyShortcuts,\n disabled = false,\n invalid: externallyInvalid = false,\n multiple = false,\n name,\n onStatusChange,\n ref,\n required = false,\n}: UseQuestionnaireItemParameters) {\n const {\n activeItemName,\n domVersion,\n first,\n itemDefinitionByName,\n last,\n nativeValidation,\n registerItem,\n shortcuts,\n } = useQuestionnaireContext(\"Questionnaire.Item\")\n const [element, setElement] = React.useState<HTMLFieldSetElement | null>(null)\n const [answerControlRegistrations, setAnswerControlRegistrations] =\n React.useState<AnswerControlRegistration[]>([])\n const [validationAttempted, setValidationAttempted] = React.useState(false)\n const [selectedAnswerIds, setSelectedAnswerIds] = React.useState<string[]>([])\n const [skipped, setSkipped] = React.useState(false)\n const [resetVersion, setResetVersion] = React.useState(0)\n const [descriptionIds, setDescriptionIds] = React.useState<string[]>([])\n const [errorIds, setErrorIds] = React.useState<string[]>([])\n const defaultSelectedAnswerIdsRef = React.useRef<string[]>([])\n const multipleRef = React.useRef(multiple)\n const previousMultipleRef = React.useRef(multiple)\n multipleRef.current = multiple\n const active = !disabled && activeItemName === name\n const answerControls = React.useMemo(\n () => [...answerControlRegistrations].sort(compareAnswerOrder),\n [answerControlRegistrations, domVersion]\n )\n const answers = React.useMemo(\n () => answerControls.filter((registration) => !registration.disabled),\n [answerControls]\n )\n const answered = answers.some((answer) =>\n selectedAnswerIds.includes(answer.id)\n )\n const status: QuestionnaireItemStatus = skipped\n ? \"skipped\"\n : answered\n ? \"answered\"\n : \"unanswered\"\n const intentionallySkipped = status === \"skipped\" && !required\n const valid =\n disabled ||\n intentionallySkipped ||\n (!externallyInvalid && status === \"answered\")\n const invalid =\n !disabled &&\n !intentionallySkipped &&\n (externallyInvalid || (validationAttempted && !valid))\n const hasInputAnswer = answers.some((answer) => answer.type === \"input\")\n const previousStatusRef = React.useRef(status)\n const itemDefinition = itemDefinitionByName?.get(name)\n const shortcutByChoiceValue = React.useMemo(\n () =>\n itemDefinitionByName\n ? getShortcutByChoiceValue(itemDefinition, shortcuts)\n : null,\n [itemDefinition, itemDefinitionByName, shortcuts]\n )\n const shortcutByAnswerId = React.useMemo(() => {\n if (shortcutByChoiceValue) {\n return new Map<string, string>()\n }\n\n const keys = getShortcutKeys(shortcuts)\n const shortcutAnswers = answers.filter((answer) => answer.type === \"choice\")\n\n return new Map(\n shortcutAnswers\n .slice(0, keys.length)\n .map((answer, index) => [answer.id, keys[index]])\n )\n }, [answers, shortcutByChoiceValue, shortcuts])\n\n const registerAnswerControl = React.useCallback(\n (registration: AnswerControlRegistration) => {\n setAnswerControlRegistrations((currentRegistrations) => [\n ...currentRegistrations.filter(\n (currentRegistration) =>\n currentRegistration.element !== registration.element &&\n currentRegistration.id !== registration.id\n ),\n registration,\n ])\n\n return () => {\n setAnswerControlRegistrations((currentRegistrations) =>\n currentRegistrations.filter(\n (currentRegistration) => currentRegistration !== registration\n )\n )\n }\n },\n []\n )\n\n React.useLayoutEffect(() => {\n if (previousStatusRef.current === status) {\n return\n }\n\n previousStatusRef.current = status\n\n onStatusChange?.(status)\n }, [onStatusChange, status])\n\n const updateAnswerSelected = React.useCallback(\n (answerId: string, selected: boolean) => {\n setSelectedAnswerIds((currentAnswerIds) => {\n if (!selected) {\n return currentAnswerIds.filter(\n (currentAnswerId) => currentAnswerId !== answerId\n )\n }\n\n if (!multiple) {\n return [answerId]\n }\n\n return currentAnswerIds.includes(answerId)\n ? currentAnswerIds\n : [...currentAnswerIds, answerId]\n })\n },\n [multiple]\n )\n const setAnswerSelectionFromInteraction = React.useCallback(\n (answerId: string, selected: boolean) => {\n setSkipped(false)\n updateAnswerSelected(answerId, selected)\n },\n [updateAnswerSelected]\n )\n const syncControlledAnswerSelection = React.useCallback(\n (answerId: string, selected: boolean) => {\n if (selected) {\n setSkipped(false)\n }\n\n updateAnswerSelected(answerId, selected)\n },\n [updateAnswerSelected]\n )\n\n const registerAnswerSelection = React.useCallback(\n (answerId: string, defaultSelected: boolean) => {\n if (defaultSelected) {\n defaultSelectedAnswerIdsRef.current = [\n ...defaultSelectedAnswerIdsRef.current.filter(\n (currentAnswerId) => currentAnswerId !== answerId\n ),\n answerId,\n ]\n setSelectedAnswerIds((currentAnswerIds) => {\n if (!multipleRef.current) {\n return currentAnswerIds.length ? currentAnswerIds : [answerId]\n }\n\n return currentAnswerIds.includes(answerId)\n ? currentAnswerIds\n : [...currentAnswerIds, answerId]\n })\n }\n\n return () => {\n defaultSelectedAnswerIdsRef.current =\n defaultSelectedAnswerIdsRef.current.filter(\n (currentAnswerId) => currentAnswerId !== answerId\n )\n setSelectedAnswerIds((currentAnswerIds) =>\n currentAnswerIds.filter(\n (currentAnswerId) => currentAnswerId !== answerId\n )\n )\n }\n },\n []\n )\n const setAnswerDefault = React.useCallback(\n (answerId: string, defaultSelected: boolean) => {\n if (defaultSelected) {\n defaultSelectedAnswerIdsRef.current =\n defaultSelectedAnswerIdsRef.current.includes(answerId)\n ? defaultSelectedAnswerIdsRef.current\n : [...defaultSelectedAnswerIdsRef.current, answerId]\n return\n }\n\n defaultSelectedAnswerIdsRef.current =\n defaultSelectedAnswerIdsRef.current.filter(\n (currentAnswerId) => currentAnswerId !== answerId\n )\n },\n []\n )\n\n const registerDescription = React.useCallback(\n (registeredDescriptionId: string) => {\n setDescriptionIds((currentDescriptionIds) =>\n currentDescriptionIds.includes(registeredDescriptionId)\n ? currentDescriptionIds\n : [...currentDescriptionIds, registeredDescriptionId]\n )\n\n return () => {\n setDescriptionIds((currentDescriptionIds) =>\n currentDescriptionIds.filter(\n (currentDescriptionId) =>\n currentDescriptionId !== registeredDescriptionId\n )\n )\n }\n },\n []\n )\n\n const registerError = React.useCallback((registeredErrorId: string) => {\n setErrorIds((currentErrorIds) =>\n currentErrorIds.includes(registeredErrorId)\n ? currentErrorIds\n : [...currentErrorIds, registeredErrorId]\n )\n\n return () => {\n setErrorIds((currentErrorIds) =>\n currentErrorIds.filter(\n (currentErrorId) => currentErrorId !== registeredErrorId\n )\n )\n }\n }, [])\n\n const validate = React.useCallback(() => {\n setValidationAttempted(true)\n\n if (!valid) {\n return false\n }\n\n if (!nativeValidation) {\n return true\n }\n\n const invalidAnswer = answers.find(\n (answer) =>\n isAnswerFilled(answer) &&\n answer.element.willValidate &&\n !answer.element.validity.valid\n )\n\n if (!invalidAnswer) {\n return true\n }\n\n invalidAnswer.element.focus()\n invalidAnswer.element.reportValidity()\n\n return false\n }, [answers, nativeValidation, valid])\n\n const focus = React.useCallback(() => {\n element?.focus()\n }, [element])\n\n const focusInvalid = React.useCallback(() => {\n const selectedInput = element?.querySelector<HTMLInputElement>(\n \"input[data-filled][name]:not(:disabled)\"\n )\n const firstControl = element?.querySelector<HTMLElement>(\n \"input:not([type=hidden]):not(:disabled), textarea:not(:disabled)\"\n )\n\n ;(selectedInput ?? firstControl ?? element)?.focus()\n }, [element])\n\n const reset = React.useCallback(() => {\n setValidationAttempted(false)\n setSkipped(false)\n setSelectedAnswerIds(\n multiple\n ? [...defaultSelectedAnswerIdsRef.current]\n : defaultSelectedAnswerIdsRef.current.slice(0, 1)\n )\n setResetVersion((version) => version + 1)\n }, [multiple])\n\n const skip = React.useCallback(() => {\n if (required) {\n return\n }\n\n setSelectedAnswerIds([])\n setSkipped(true)\n }, [required])\n\n React.useLayoutEffect(() => {\n const wasMultiple = previousMultipleRef.current\n previousMultipleRef.current = multiple\n\n if (!wasMultiple || multiple) {\n return\n }\n\n setSelectedAnswerIds((currentAnswerIds) => {\n const selectedAnswer = answers.find((answer) =>\n currentAnswerIds.includes(answer.id)\n )\n\n return selectedAnswer ? [selectedAnswer.id] : []\n })\n }, [answers, multiple])\n\n const getAnswerByElement = React.useCallback(\n (answerElement: Element) =>\n answers.find((answer) => answer.element === answerElement) ?? null,\n [answers]\n )\n const getAnswerByShortcut = React.useCallback(\n (shortcut: string) => {\n if (shortcutByChoiceValue) {\n const choiceValue = Array.from(shortcutByChoiceValue.entries()).find(\n ([, choiceShortcut]) => choiceShortcut === shortcut\n )?.[0]\n\n return (\n answers.find(\n (answer) => answer.type === \"choice\" && answer.value === choiceValue\n ) ?? null\n )\n }\n\n const answerId = Array.from(shortcutByAnswerId.entries()).find(\n ([, answerShortcut]) => answerShortcut === shortcut\n )?.[0]\n\n return answers.find((answer) => answer.id === answerId) ?? null\n },\n [answers, shortcutByAnswerId, shortcutByChoiceValue]\n )\n const moveAnswerFocus = React.useCallback(\n (currentElement: Element, direction: \"next\" | \"previous\") => {\n const currentIndex = answers.findIndex(\n (answer) => answer.element === currentElement\n )\n const currentAnswer =\n currentIndex < 0 ? null : (answers[currentIndex] ?? null)\n\n if (\n !answers.length ||\n (isTextEntryTarget(currentElement) &&\n !isEmptyNavigableInput(currentAnswer)) ||\n (currentIndex < 0 && currentElement !== element)\n ) {\n return false\n }\n\n const nextAnswer =\n currentIndex < 0\n ? (answers.find(isAnswerFilled) ??\n (direction === \"next\" ? answers[0] : answers[answers.length - 1]))\n : answers[\n (currentIndex +\n (direction === \"next\" ? 1 : -1) +\n answers.length) %\n answers.length\n ]\n\n if (!nextAnswer || nextAnswer.element === currentElement) {\n return false\n }\n\n if (\n currentIndex >= 0 &&\n isRadioTarget(currentElement) &&\n isRadioTarget(nextAnswer.element)\n ) {\n return false\n }\n\n nextAnswer.element.focus()\n\n if (nextAnswer.type === \"choice\" && isRadioTarget(nextAnswer.element)) {\n nextAnswer.element.click()\n }\n\n return true\n },\n [answers, element]\n )\n\n React.useLayoutEffect(() => {\n if (!element) {\n return\n }\n\n return registerItem({\n choices: answerControls.flatMap((answer) =>\n answer.type === \"choice\"\n ? [{ disabled: answer.ownDisabled, value: answer.value }]\n : []\n ),\n disabled,\n element,\n focus,\n focusInvalid,\n getAnswerByElement,\n getAnswerByShortcut,\n moveAnswerFocus,\n name,\n required,\n reset,\n skip,\n status,\n validate,\n })\n }, [\n answerControls,\n disabled,\n element,\n focus,\n focusInvalid,\n getAnswerByElement,\n getAnswerByShortcut,\n moveAnswerFocus,\n name,\n registerItem,\n required,\n reset,\n skip,\n status,\n validate,\n ])\n\n const context = React.useMemo<QuestionnaireItemContextValue>(\n () => ({\n active,\n disabled,\n hasInputAnswer,\n invalid,\n multiple,\n name,\n registerAnswerControl,\n registerAnswerSelection,\n registerDescription,\n registerError,\n required,\n resetVersion,\n selectedAnswerIds,\n setAnswerDefault,\n setAnswerSelectionFromInteraction,\n shortcutByAnswerId,\n shortcutByChoiceValue,\n shortcuts,\n status,\n syncControlledAnswerSelection,\n }),\n [\n active,\n disabled,\n hasInputAnswer,\n invalid,\n multiple,\n name,\n registerAnswerControl,\n registerAnswerSelection,\n registerDescription,\n registerError,\n required,\n resetVersion,\n selectedAnswerIds,\n setAnswerDefault,\n setAnswerSelectionFromInteraction,\n shortcutByAnswerId,\n shortcutByChoiceValue,\n shortcuts,\n status,\n syncControlledAnswerSelection,\n ]\n )\n const setItemRef = React.useCallback(\n (nextElement: HTMLFieldSetElement | null) => {\n setElement(nextElement)\n composeRefs(ref)?.(nextElement)\n },\n [ref]\n )\n const describedBy =\n [...descriptionIds, ...(invalid ? errorIds : []), ariaDescribedBy]\n .filter(Boolean)\n .join(\" \") || undefined\n const keyShortcuts =\n [\n ariaKeyShortcuts,\n active ? \"Meta+Enter Control+Enter\" : undefined,\n active && answers.length ? \"ArrowUp ArrowDown\" : undefined,\n active && !first ? \"ArrowLeft\" : undefined,\n active && !last && status !== \"unanswered\" ? \"ArrowRight\" : undefined,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n const state: QuestionnaireItemState = {\n active,\n disabled,\n invalid,\n multiple,\n required,\n status,\n }\n\n return {\n context,\n itemProps: {\n \"aria-describedby\": describedBy,\n \"aria-invalid\": invalid || undefined,\n \"aria-keyshortcuts\": keyShortcuts,\n disabled,\n hidden: !active,\n inert: !active,\n ref: setItemRef,\n tabIndex: -1,\n },\n state,\n }\n}\n\nexport { useQuestionnaireItem }\n","import type {\n ItemRegistration,\n QuestionnaireItemDefinition,\n QuestionnaireShortcutMode,\n} from \"./types\"\nimport { getShortcutKeys } from \"./utils\"\n\ntype QuestionnaireCollection = {\n enabledItems: readonly QuestionnaireItemDefinition[]\n itemByName: ReadonlyMap<string, QuestionnaireItemDefinition>\n items: readonly QuestionnaireItemDefinition[]\n}\n\nfunction createQuestionnaireCollection(\n items: readonly QuestionnaireItemDefinition[] | undefined\n): QuestionnaireCollection | null {\n if (items === undefined) {\n return null\n }\n\n return {\n enabledItems: items.filter((item) => !item.disabled),\n itemByName: new Map(items.map((item) => [item.name, item])),\n items,\n }\n}\n\nfunction getInitialItemName(\n collection: QuestionnaireCollection | null,\n defaultItem: string | undefined\n) {\n if (!collection) {\n return defaultItem ?? null\n }\n\n const defaultDefinition = defaultItem\n ? collection.itemByName.get(defaultItem)\n : undefined\n\n if (defaultDefinition && !defaultDefinition.disabled) {\n return defaultDefinition.name\n }\n\n return collection.enabledItems[0]?.name ?? null\n}\n\nfunction getShortcutByChoiceValue(\n item: QuestionnaireItemDefinition | undefined,\n shortcuts: QuestionnaireShortcutMode | null\n) {\n const shortcutByChoiceValue = new Map<string, string>()\n\n if (!item || !shortcuts) {\n return shortcutByChoiceValue\n }\n\n const keys = getShortcutKeys(shortcuts)\n let shortcutIndex = 0\n\n for (const choice of item.choices ?? []) {\n if (choice.disabled) {\n continue\n }\n\n const shortcut = keys[shortcutIndex]\n\n if (!shortcut) {\n break\n }\n\n shortcutByChoiceValue.set(choice.value, shortcut)\n shortcutIndex += 1\n }\n\n return shortcutByChoiceValue\n}\n\nfunction getCollectionDefinitionWarnings(\n collection: QuestionnaireCollection,\n defaultItem: string | undefined\n) {\n const warnings: string[] = []\n const itemNames = new Set<string>()\n\n for (const item of collection.items) {\n if (itemNames.has(item.name)) {\n warnings.push(`Item name \"${item.name}\" is defined more than once.`)\n }\n\n itemNames.add(item.name)\n\n const choiceValues = new Set<string>()\n\n for (const choice of item.choices ?? []) {\n if (choiceValues.has(choice.value)) {\n warnings.push(\n `Choice value \"${choice.value}\" is defined more than once in item \"${item.name}\".`\n )\n }\n\n choiceValues.add(choice.value)\n }\n }\n\n if (defaultItem) {\n const defaultDefinition = collection.itemByName.get(defaultItem)\n\n if (!defaultDefinition || defaultDefinition.disabled) {\n warnings.push(\n `defaultItem \"${defaultItem}\" does not identify an enabled item. The first enabled item will be used instead.`\n )\n }\n }\n\n return warnings\n}\n\nfunction getCollectionRegistrationWarnings(\n collection: QuestionnaireCollection,\n registrations: readonly ItemRegistration[],\n shortcuts: QuestionnaireShortcutMode | null\n) {\n const warnings: string[] = []\n const registrationByName = new Map(\n registrations.map((registration) => [registration.name, registration])\n )\n\n for (const definition of collection.items) {\n const registration = registrationByName.get(definition.name)\n\n if (!registration) {\n if (!definition.disabled) {\n warnings.push(\n `Item \"${definition.name}\" is defined but has no rendered Questionnaire.Item.`\n )\n }\n\n continue\n }\n\n if (registration.disabled !== Boolean(definition.disabled)) {\n warnings.push(\n `Item \"${definition.name}\" has different disabled values in Root.items and Questionnaire.Item.`\n )\n }\n\n if (registration.required !== Boolean(definition.required)) {\n warnings.push(\n `Item \"${definition.name}\" has different required values in Root.items and Questionnaire.Item.`\n )\n }\n\n const definedChoices = definition.choices ?? []\n const definedChoiceByValue = new Map(\n definedChoices.map((choice) => [choice.value, choice])\n )\n const registeredChoiceByValue = new Map(\n registration.choices.map((choice) => [choice.value, choice])\n )\n\n for (const choice of definedChoices) {\n const registeredChoice = registeredChoiceByValue.get(choice.value)\n\n if (!registeredChoice) {\n warnings.push(\n `Choice \"${choice.value}\" is defined for item \"${definition.name}\" but has no rendered Questionnaire.Choice.`\n )\n continue\n }\n\n if (registeredChoice.disabled !== Boolean(choice.disabled)) {\n warnings.push(\n `Choice \"${choice.value}\" in item \"${definition.name}\" has different disabled values in Root.items and Questionnaire.Choice.`\n )\n }\n }\n\n if (shortcuts) {\n for (const choice of registration.choices) {\n if (!definedChoiceByValue.has(choice.value)) {\n warnings.push(\n `Rendered choice \"${choice.value}\" in item \"${definition.name}\" is missing from Root.items and will not receive a shortcut.`\n )\n }\n }\n\n const definedOrder = definedChoices\n .filter((choice) => !choice.disabled)\n .map((choice) => choice.value)\n const registeredOrder = registration.choices\n .filter((choice) => !choice.disabled)\n .map((choice) => choice.value)\n\n const sameChoices =\n definedOrder.length > 0 &&\n definedOrder.length === registeredOrder.length &&\n definedOrder.every((choiceValue) =>\n registeredOrder.includes(choiceValue)\n )\n\n if (\n sameChoices &&\n definedOrder.some(\n (choiceValue, index) => choiceValue !== registeredOrder[index]\n )\n ) {\n warnings.push(\n `Choice order for item \"${definition.name}\" differs between Root.items and the rendered Questionnaire.Choice elements.`\n )\n }\n }\n }\n\n for (const registration of registrations) {\n if (\n !registration.disabled &&\n !collection.itemByName.has(registration.name)\n ) {\n warnings.push(\n `Rendered item \"${registration.name}\" is missing from Root.items and is excluded from the questionnaire collection.`\n )\n }\n }\n\n return warnings\n}\n\nexport {\n createQuestionnaireCollection,\n getCollectionDefinitionWarnings,\n getCollectionRegistrationWarnings,\n getInitialItemName,\n getShortcutByChoiceValue,\n}\n","import * as React from \"react\"\n\nimport { composeRefs } from \"../use-render\"\nimport {\n createQuestionnaireCollection,\n getCollectionDefinitionWarnings,\n getCollectionRegistrationWarnings,\n getInitialItemName,\n} from \"./collection\"\nimport type {\n ItemRegistration,\n PendingFocus,\n QuestionnaireContextValue,\n QuestionnaireRootProps,\n QuestionnaireRootState,\n} from \"./types\"\nimport {\n compareItemOrder,\n getShortcutFromKey,\n isAnswerFilled,\n isRadioTarget,\n isTextEntryTarget,\n} from \"./utils\"\n\n// platned: the DS has no Node typings. Module-scoped, so bundlers still replace process.env.NODE_ENV.\ndeclare const process: { env: { NODE_ENV?: string } }\n\ntype UseQuestionnaireRootParameters = Pick<\n QuestionnaireRootProps,\n | \"defaultItem\"\n | \"item\"\n | \"items\"\n | \"noValidate\"\n | \"onItemChange\"\n | \"onReset\"\n | \"onSubmit\"\n | \"ref\"\n | \"shortcuts\"\n>\n\nfunction useQuestionnaireRoot({\n defaultItem,\n item: controlledItem,\n items: itemDefinitions,\n noValidate,\n onItemChange,\n onReset,\n onSubmit,\n ref,\n shortcuts: shortcutMode,\n}: UseQuestionnaireRootParameters) {\n const collection = React.useMemo(\n () => createQuestionnaireCollection(itemDefinitions),\n [itemDefinitions]\n )\n const [registrations, setRegistrations] = React.useState<ItemRegistration[]>(\n []\n )\n const [uncontrolledItem, setUncontrolledItem] = React.useState<string | null>(\n () => getInitialItemName(collection, defaultItem)\n )\n const [rootElement, setRootElement] = React.useState<HTMLFormElement | null>(\n null\n )\n const [domVersion, setDomVersion] = React.useState(0)\n const pendingFocusRef = React.useRef<PendingFocus | null>(null)\n const controlled = controlledItem !== undefined\n const activeItemName = controlled ? controlledItem : uncontrolledItem\n const previousActiveItemNameRef = React.useRef(activeItemName)\n const nativeValidation = noValidate === false\n const shortcuts = shortcutMode ?? null\n\n const activeWarningsRef = React.useRef(new Set<string>())\n\n React.useLayoutEffect(() => {\n if (process.env.NODE_ENV === \"production\") {\n return\n }\n\n if (!collection || !rootElement) {\n activeWarningsRef.current.clear()\n return\n }\n\n let cancelled = false\n\n queueMicrotask(() => {\n if (cancelled) {\n return\n }\n\n const warnings = [\n ...getCollectionDefinitionWarnings(collection, defaultItem),\n ...getCollectionRegistrationWarnings(\n collection,\n registrations,\n shortcuts\n ),\n ]\n const activeWarnings = new Set(warnings)\n\n activeWarnings.forEach((warning) => {\n if (!activeWarningsRef.current.has(warning)) {\n console.warn(`[Questionnaire] ${warning}`)\n }\n })\n\n activeWarningsRef.current = activeWarnings\n })\n\n return () => {\n cancelled = true\n }\n }, [collection, defaultItem, registrations, rootElement, shortcuts])\n\n React.useLayoutEffect(() => {\n if (!rootElement || typeof MutationObserver === \"undefined\") {\n return\n }\n\n const observer = new MutationObserver(() => {\n setDomVersion((version) => version + 1)\n })\n\n observer.observe(rootElement, { childList: true, subtree: true })\n\n return () => observer.disconnect()\n }, [rootElement])\n\n const runtimeItems = React.useMemo(\n () =>\n registrations\n .filter((registration) => !registration.disabled)\n .sort(compareItemOrder),\n [domVersion, registrations]\n )\n const runtimeItemByName = React.useMemo(\n () =>\n new Map(\n runtimeItems.map((runtimeItem) => [runtimeItem.name, runtimeItem])\n ),\n [runtimeItems]\n )\n const logicalItems = collection?.enabledItems ?? runtimeItems\n const currentIndex = logicalItems.findIndex(\n (logicalItem) => logicalItem.name === activeItemName\n )\n const activeItem =\n currentIndex < 0 || !activeItemName\n ? null\n : (runtimeItemByName.get(activeItemName) ?? null)\n const activeDefinition = activeItemName\n ? collection?.itemByName.get(activeItemName)\n : undefined\n const activeItemRequired =\n currentIndex < 0\n ? null\n : activeDefinition\n ? Boolean(activeDefinition.required)\n : (activeItem?.required ?? false)\n const activeItemStatus =\n currentIndex < 0\n ? null\n : (activeItem?.status ?? (activeItemName ? \"unanswered\" : null))\n const orderedRegistrations = React.useMemo(\n () =>\n collection\n ? collection.enabledItems.flatMap((definition) => {\n const registration = runtimeItemByName.get(definition.name)\n\n return registration ? [registration] : []\n })\n : runtimeItems,\n [collection, runtimeItemByName, runtimeItems]\n )\n const total = logicalItems.length\n const current = currentIndex < 0 ? 0 : currentIndex + 1\n const first = total > 0 && currentIndex === 0\n const last = total > 0 && currentIndex === total - 1\n\n const setItem = React.useCallback(\n (nextItem: string, focusTarget: PendingFocus[\"target\"] = \"item\") => {\n if (nextItem === activeItemName) {\n return\n }\n\n pendingFocusRef.current = {\n name: nextItem,\n target: focusTarget,\n }\n\n if (!controlled) {\n setUncontrolledItem(nextItem)\n }\n\n onItemChange?.(nextItem)\n },\n [activeItemName, controlled, onItemChange]\n )\n\n React.useLayoutEffect(() => {\n if (total === 0) {\n return\n }\n\n if (currentIndex < 0) {\n if (!controlled && activeItemName === null) {\n setUncontrolledItem(logicalItems[0].name)\n return\n }\n\n setItem(logicalItems[0].name)\n return\n }\n\n const pendingFocus = pendingFocusRef.current\n const activeItemChanged =\n previousActiveItemNameRef.current !== activeItemName\n\n previousActiveItemNameRef.current = activeItemName\n\n if (!pendingFocus || pendingFocus.name !== activeItemName) {\n if (controlled && activeItemChanged) {\n pendingFocusRef.current = null\n activeItem?.focus()\n }\n\n return\n }\n\n if (pendingFocus.target === \"invalid\") {\n activeItem?.focusInvalid()\n } else {\n activeItem?.focus()\n }\n\n pendingFocusRef.current = null\n }, [\n activeItem,\n activeItemName,\n controlled,\n currentIndex,\n logicalItems,\n setItem,\n total,\n ])\n\n const registerItem = React.useCallback((registration: ItemRegistration) => {\n setRegistrations((currentRegistrations) => [\n ...currentRegistrations.filter(\n (currentRegistration) =>\n currentRegistration.element !== registration.element &&\n currentRegistration.name !== registration.name\n ),\n registration,\n ])\n\n return () => {\n setRegistrations((currentRegistrations) =>\n currentRegistrations.filter(\n (currentRegistration) => currentRegistration !== registration\n )\n )\n }\n }, [])\n\n const goPrevious = React.useCallback(() => {\n if (currentIndex <= 0) {\n return\n }\n\n setItem(logicalItems[currentIndex - 1].name)\n }, [currentIndex, logicalItems, setItem])\n\n const goNext = React.useCallback(() => {\n if (!activeItem || currentIndex >= total - 1) {\n return\n }\n\n if (!activeItem.validate()) {\n activeItem.focusInvalid()\n return\n }\n\n setItem(logicalItems[currentIndex + 1].name)\n }, [activeItem, currentIndex, logicalItems, setItem, total])\n\n const confirmCurrent = React.useCallback(() => {\n if (!activeItem) {\n return\n }\n\n if (!activeItem.validate()) {\n activeItem.focusInvalid()\n return\n }\n\n if (last) {\n rootElement?.requestSubmit()\n return\n }\n\n setItem(logicalItems[currentIndex + 1].name)\n }, [activeItem, currentIndex, last, logicalItems, rootElement, setItem])\n\n const skipCurrent = React.useCallback(() => {\n if (!activeItem || activeItem.required) {\n return\n }\n\n activeItem.skip()\n\n if (!last) {\n setItem(logicalItems[currentIndex + 1].name)\n return\n }\n\n queueMicrotask(() => {\n rootElement?.requestSubmit()\n })\n }, [activeItem, currentIndex, last, logicalItems, rootElement, setItem])\n\n function handleReset(event: React.FormEvent<HTMLFormElement>) {\n onReset?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n for (const registration of registrations) {\n registration.reset()\n }\n\n const resetItemName = collection\n ? getInitialItemName(collection, defaultItem)\n : (runtimeItems.find((registration) => registration.name === defaultItem)\n ?.name ?? runtimeItems[0]?.name)\n\n if (resetItemName) {\n setItem(resetItemName)\n }\n }\n\n function handleSubmit(event: React.SubmitEvent<HTMLFormElement>) { // platned: @types/react 19.3\n const firstInvalidItem = orderedRegistrations.find(\n (registration) => !registration.validate()\n )\n\n if (firstInvalidItem) {\n event.preventDefault()\n setItem(firstInvalidItem.name, \"invalid\")\n\n if (firstInvalidItem.name === activeItemName) {\n firstInvalidItem.focusInvalid()\n pendingFocusRef.current = null\n }\n\n return\n }\n\n onSubmit?.(event)\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLFormElement>) {\n if (\n event.defaultPrevented ||\n event.nativeEvent.isComposing ||\n event.keyCode === 229 ||\n !activeItem ||\n !(event.target instanceof Element)\n ) {\n return\n }\n\n if (\n event.key === \"Enter\" &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !event.shiftKey\n ) {\n event.preventDefault()\n\n if (!event.repeat) {\n confirmCurrent()\n }\n\n return\n }\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n const moved = activeItem.moveAnswerFocus(\n event.target,\n event.key === \"ArrowDown\" ? \"next\" : \"previous\"\n )\n\n if (moved) {\n event.preventDefault()\n return\n }\n }\n\n if (\n (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") &&\n !isTextEntryTarget(event.target) &&\n !isRadioTarget(event.target)\n ) {\n event.preventDefault()\n\n if (event.repeat) {\n return\n }\n\n if (event.key === \"ArrowLeft\") {\n goPrevious()\n } else if (activeItem.status !== \"unanswered\") {\n goNext()\n }\n\n return\n }\n\n if (event.key === \"Enter\") {\n const answer = activeItem.getAnswerByElement(event.target)\n\n if (!answer) {\n return\n }\n\n event.preventDefault()\n\n if (!event.repeat && isAnswerFilled(answer)) {\n confirmCurrent()\n }\n\n return\n }\n\n if (!shortcuts || isTextEntryTarget(event.target)) {\n return\n }\n\n const shortcut = getShortcutFromKey(event.key, shortcuts)\n const answer = shortcut ? activeItem.getAnswerByShortcut(shortcut) : null\n\n if (!answer) {\n return\n }\n\n event.preventDefault()\n\n if (event.repeat) {\n return\n }\n\n answer.element.focus()\n\n if (answer.type === \"choice\") {\n answer.element.click()\n }\n }\n\n const state: QuestionnaireRootState = {\n current,\n first,\n last,\n total,\n }\n const context = React.useMemo<QuestionnaireContextValue>(\n () => ({\n ...state,\n activeItem,\n activeItemName,\n activeItemRequired,\n activeItemStatus,\n domVersion,\n goNext,\n goPrevious,\n itemDefinitionByName: collection?.itemByName ?? null,\n nativeValidation,\n registerItem,\n shortcuts,\n skipCurrent,\n }),\n [\n activeItem,\n activeItemName,\n activeItemRequired,\n activeItemStatus,\n collection,\n current,\n domVersion,\n first,\n goNext,\n goPrevious,\n last,\n nativeValidation,\n registerItem,\n shortcuts,\n skipCurrent,\n total,\n ]\n )\n const setRootRef = React.useCallback(\n (element: HTMLFormElement | null) => {\n setRootElement(element)\n composeRefs(ref)?.(element)\n },\n [ref]\n )\n\n return {\n context,\n rootProps: {\n \"data-shortcuts\": shortcuts ?? undefined,\n onKeyDown: handleKeyDown,\n onReset: handleReset,\n onSubmit: handleSubmit,\n ref: setRootRef,\n },\n state,\n }\n}\n\nexport { useQuestionnaireRoot }\n","import {\n QuestionnaireChoice as Choice,\n QuestionnaireChoiceInput as ChoiceInput,\n QuestionnaireChoiceLabel as ChoiceLabel,\n QuestionnaireChoices as Choices,\n QuestionnaireChoiceShortcut as ChoiceShortcut,\n QuestionnaireDescription as Description,\n QuestionnaireError as Error,\n QuestionnaireInput as Input,\n QuestionnaireItem as Item,\n QuestionnaireNext as Next,\n QuestionnairePrevious as Previous,\n QuestionnaireProgress as Progress,\n QuestionnaireRoot as Root,\n QuestionnaireSkip as Skip,\n QuestionnaireSubmit as Submit,\n QuestionnaireTitle as Title,\n} from \"./components\"\n\nexport const Questionnaire = {\n Root,\n Progress,\n Item,\n Title,\n Description,\n Choices,\n Choice,\n ChoiceInput,\n ChoiceLabel,\n ChoiceShortcut,\n Input,\n Error,\n Previous,\n Skip,\n Next,\n Submit,\n}\n\nexport type {\n QuestionnaireChoiceDefinition,\n QuestionnaireInputType,\n QuestionnaireItemDefinition,\n QuestionnaireItemStatus,\n QuestionnaireShortcutMode,\n} from \"./types\"\n","import { forwardRef, useId, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Switch as SwitchPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\n\nexport type SwitchSize = 'default' | 'sm';\n\nexport interface SwitchProps extends ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {\n size?: SwitchSize;\n /** Shorthand: the label at the start of the row; the switch sits at the end. */\n label?: ReactNode;\n /** Shorthand: a second line under the label. */\n description?: ReactNode;\n}\n\n/**\n * Switch: a control that allows the user to toggle between checked and not checked. A setting\n * that takes effect at once; for a pressed-state button, use `Toggle`.\n *\n * Built on Radix Switch: `role=\"switch\"`, `checked` / `defaultChecked` / `onCheckedChange`, and\n * `name` / `value` / `required` to submit and validate with a form. Mark an error with\n * `aria-invalid`.\n *\n * Shorthand: `label` (and `description`) render the horizontal field, the label first and the\n * switch at the end. Without them, compose with `Field` / `FieldLabel` and give the switch an\n * `id`, or an `aria-label`.\n *\n * Inside a `<form>`, Radix measures the switch with `ResizeObserver`, which a bare jsdom lacks:\n * tests that render a Switch in a form need a stub (`src/components/cards/resize-observer.test-stub.ts`).\n */\nexport const Switch = forwardRef<ElementRef<typeof SwitchPrimitive.Root>, SwitchProps>(function Switch(\n { className, size = 'default', label, description, id, ...props },\n ref,\n) {\n const generatedId = useId();\n const controlId = id ?? (label != null ? generatedId : undefined);\n const descriptionId = `${controlId ?? generatedId}-description`;\n\n const control = (\n <SwitchPrimitive.Root\n ref={ref}\n id={controlId}\n data-slot=\"switch\"\n data-size={size}\n aria-describedby={description != null ? descriptionId : undefined}\n className={cn(\n 'peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none motion-reduce:transition-none after:absolute after:-inset-x-3 after:-inset-y-2',\n 'data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',\n 'group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n 'data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]',\n label == null && className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n 'pointer-events-none block rounded-full bg-background ring-0 transition-transform motion-reduce:transition-none dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground',\n 'group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3',\n 'data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0 rtl:data-checked:-translate-x-[calc(100%-2px)]',\n )}\n />\n </SwitchPrimitive.Root>\n );\n\n if (label == null) return control;\n\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation=\"horizontal\"\n data-disabled={props.disabled || undefined}\n className={cn(\n 'group/field flex w-full flex-row items-center gap-2 has-[>[data-slot=field-content]]:items-start',\n className,\n )}\n >\n <div data-slot=\"field-content\" className=\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\">\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className=\"flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </label>\n {description != null && (\n <p id={descriptionId} data-slot=\"field-description\" className=\"text-sm leading-normal text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {control}\n </div>\n );\n});\n","import { createContext, forwardRef, useContext, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { OTPInput, OTPInputContext, type OTPInputProps } from 'input-otp';\nimport { MinusIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { useFieldControl } from './field';\n\nexport { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';\n\n/**\n * InputOTP: a one-time-code field, the boxed characters of a 2FA or email-verification step.\n *\n * Two ways to write one:\n * - Shorthand: `<InputOTP maxLength={6} groupSize={3} />` renders the groups, slots and\n * separators itself.\n * - Composition: `InputOTP` > `InputOTPGroup` > `InputOTPSlot index`, with `InputOTPSeparator`\n * between groups.\n *\n * Built on `input-otp`: one real input holds the whole value (so paste, SMS autofill via\n * `autocomplete=\"one-time-code\"`, undo and screen readers get the real value) and the slots are\n * drawn from its state. Its password-manager check calls `document.elementFromPoint`, which\n * jsdom lacks, so tests that render it stub it (`src/components/forms/input-otp.test-stub.ts`).\n *\n * Inside a `Field` it takes the control id, description, invalid, required and disabled state.\n * `aria-invalid` on the root (or the Field's error) marks every slot invalid; a slot's own\n * `aria-invalid` wins.\n */\n\nconst InvalidContext = createContext<boolean | undefined>(undefined);\n\ntype InputOTPBaseProps = Omit<OTPInputProps, 'render' | 'children'>;\n\nexport type InputOTPProps = InputOTPBaseProps & {\n /** The parts. Leave out for the shorthand, which renders `maxLength` slots. */\n children?: ReactNode;\n /** Shorthand: slots per group, with a separator between groups. Default: one group. */\n groupSize?: number;\n};\n\nexport const InputOTP = forwardRef<HTMLInputElement, InputOTPProps>(function InputOTP(\n { className, containerClassName, children, groupSize, maxLength, value: valueProp, defaultValue, onChange, ...props },\n ref,\n) {\n const field = useFieldControl();\n // Held here so the input is always controlled: input-otp reads `defaultValue` but also passes it\n // on to the input next to its own `value`, which React warns about.\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: typeof defaultValue === 'string' ? defaultValue : '',\n onChange: onChange as ((value: string) => void) | undefined,\n });\n const invalid = props['aria-invalid'] ?? field['aria-invalid'];\n const content = children ?? <InputOTPSlots maxLength={maxLength} groupSize={groupSize} />;\n\n return (\n <InvalidContext.Provider value={invalid === true || invalid === 'true' || undefined}>\n <OTPInput\n ref={ref}\n data-slot=\"input-otp\"\n maxLength={maxLength}\n value={value}\n onChange={setValue}\n {...field}\n required={field['aria-required']}\n containerClassName={cn('relative flex items-center gap-2 has-disabled:opacity-50', containerClassName)}\n spellCheck={false}\n className={cn('disabled:cursor-not-allowed', className)}\n {...props}\n >\n {content}\n </OTPInput>\n </InvalidContext.Provider>\n );\n});\n\nfunction InputOTPSlots({ maxLength, groupSize }: { maxLength: number; groupSize?: number }) {\n const size = groupSize && groupSize > 0 ? groupSize : maxLength;\n const groups = Array.from({ length: Math.ceil(maxLength / size) }, (_, g) =>\n Array.from({ length: Math.min(size, maxLength - g * size) }, (_, i) => g * size + i),\n );\n return (\n <>\n {groups.map((indexes, g) => (\n <InputOTPSlotGroup key={indexes[0]} indexes={indexes} separator={g > 0} />\n ))}\n </>\n );\n}\n\nfunction InputOTPSlotGroup({ indexes, separator }: { indexes: number[]; separator: boolean }) {\n return (\n <>\n {separator && <InputOTPSeparator />}\n <InputOTPGroup>\n {indexes.map((index) => (\n <InputOTPSlot key={index} index={index} />\n ))}\n </InputOTPGroup>\n </>\n );\n}\n\nexport const InputOTPGroup = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function InputOTPGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-group\"\n className={cn(\n 'flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /** Which character of the value this slot shows. */\n index: number;\n}\n\nexport const InputOTPSlot = forwardRef<HTMLDivElement, InputOTPSlotProps>(function InputOTPSlot(\n { index, className, ...props },\n ref,\n) {\n const otp = useContext(OTPInputContext);\n const invalid = useContext(InvalidContext);\n const { char, hasFakeCaret, isActive } = otp?.slots[index] ?? {};\n\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-slot\"\n data-active={isActive}\n aria-invalid={invalid}\n className={cn(\n 'relative flex size-8 items-center justify-center border-y border-e border-input text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg dark:bg-input/30',\n 'data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50',\n 'aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\n </div>\n )}\n </div>\n );\n});\n\nexport const InputOTPSeparator = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(function InputOTPSeparator(\n { className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"input-otp-separator\"\n role=\"separator\"\n className={cn(\"flex items-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children ?? <MinusIcon aria-hidden />}\n </div>\n );\n});\n","import { forwardRef, useRef, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';\nimport { CheckIcon, ChevronDownIcon, XIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { usePortalContainer } from '../overlays/portal';\nimport { Button } from './button';\nimport { useFieldControl } from './field';\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group';\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport function ComboboxValue(props: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\nexport const ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxPrimitive.Trigger.Props>(function ComboboxTrigger(\n { className, children, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Trigger\n ref={ref}\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </ComboboxPrimitive.Trigger>\n );\n});\n\nconst ComboboxClear = forwardRef<HTMLButtonElement, ComboboxPrimitive.Clear.Props>(function ComboboxClear(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Clear\n ref={ref}\n data-slot=\"combobox-clear\"\n aria-label=\"Clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={className}\n {...props}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n});\n\nexport interface ComboboxInputProps extends ComboboxPrimitive.Input.Props {\n /** The chevron button that opens the list. Default `true`. */\n showTrigger?: boolean;\n /** A button that clears the value. Default `false`. */\n showClear?: boolean;\n}\n\n/** The text field: an `InputGroup` with the typed query, and the trigger and clear buttons. */\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(function ComboboxInput(\n {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n},\n ref,\n) {\n // Base UI gives the input an id of its own; inside a Field, the Field's id keeps its label working.\n const field = useFieldControl();\n return (\n <InputGroup className={cn('w-auto', className)}>\n <ComboboxPrimitive.Input\n ref={ref}\n render={<InputGroupInput disabled={disabled} />}\n {...props}\n id={props.id ?? field.id}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n {/* The chevron alone has no name. */}\n <ComboboxTrigger aria-label=\"Show suggestions\" />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n});\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>;\n\n/** The popup, portalled and positioned under the input (or the chips `anchor`). */\nexport const ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>(function ComboboxContent(\n {\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n},\n ref,\n) {\n // Inside a Dialog or Drawer, portal into it: a modal dialog treats anything outside as inert.\n const container = usePortalContainer();\n return (\n <ComboboxPrimitive.Portal container={container ?? undefined}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-popover\"\n >\n <ComboboxPrimitive.Popup\n ref={ref}\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n 'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 max-h-72 min-w-36 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)',\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n});\n\nexport const ComboboxList = forwardRef<HTMLDivElement, ComboboxPrimitive.List.Props>(function ComboboxList(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.List\n ref={ref}\n data-slot=\"combobox-list\"\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overscroll-contain',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ComboboxItem = forwardRef<HTMLDivElement, ComboboxPrimitive.Item.Props>(function ComboboxItem(\n { className, children, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Item\n ref={ref}\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n});\n\nexport const ComboboxGroup = forwardRef<HTMLDivElement, ComboboxPrimitive.Group.Props>(function ComboboxGroup(\n { className, ...props },\n ref,\n) {\n return <ComboboxPrimitive.Group ref={ref} data-slot=\"combobox-group\" className={className} {...props} />;\n});\n\nexport const ComboboxLabel = forwardRef<HTMLDivElement, ComboboxPrimitive.GroupLabel.Props>(function ComboboxLabel(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.GroupLabel\n ref={ref}\n data-slot=\"combobox-label\"\n className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}\n {...props}\n />\n );\n});\n\nexport function ComboboxCollection(props: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />;\n}\n\nexport const ComboboxEmpty = forwardRef<HTMLDivElement, ComboboxPrimitive.Empty.Props>(function ComboboxEmpty(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Empty\n ref={ref}\n data-slot=\"combobox-empty\"\n className={cn(\n 'text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ComboboxSeparator = forwardRef<HTMLDivElement, ComboboxPrimitive.Separator.Props>(function ComboboxSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Separator\n ref={ref}\n data-slot=\"combobox-separator\"\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\n\nexport const ComboboxChips = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props>(function ComboboxChips({\n className,\n ...props\n}: ComponentPropsWithoutRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props, ref) {\n return (\n <ComboboxPrimitive.Chips\n ref={ref}\n data-slot=\"combobox-chips\"\n className={cn(\n 'dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface ComboboxChipProps extends ComboboxPrimitive.Chip.Props {\n /** The remove button. Default `true`. */\n showRemove?: boolean;\n}\n\nexport const ComboboxChip = forwardRef<HTMLDivElement, ComboboxChipProps>(function ComboboxChip(\n { className, children, showRemove = true, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Chip\n ref={ref}\n data-slot=\"combobox-chip\"\n className={cn(\n 'bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-data-[slot=combobox-chip-remove]:pr-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n});\n\nexport const ComboboxChipsInput = forwardRef<HTMLInputElement, ComboboxPrimitive.Input.Props>(function ComboboxChipsInput(\n { className, ...props },\n ref,\n) {\n return (\n <ComboboxPrimitive.Input\n ref={ref}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n );\n});\n\n/** A ref for `ComboboxChips`, passed to `ComboboxContent anchor` so the popup lines up with the chips. */\nexport function useComboboxAnchor() {\n return useRef<HTMLDivElement | null>(null);\n}\n\n// ── Root + shorthand ───────────────────────────────────────────────────────────\n\n/** The `{ value, label }` item shape: the input shows `label`, a form submits `value`, no `itemToStringLabel` needed. */\nexport interface ComboboxOption {\n value: string;\n label: string;\n description?: string;\n disabled?: boolean;\n}\n\ninterface ComboboxGroupItems<Item> {\n value: string;\n items: readonly Item[];\n}\n\nfunction isGroups<Item>(items: readonly unknown[] | undefined): items is readonly ComboboxGroupItems<Item>[] {\n return !!items?.length && typeof items[0] === 'object' && items[0] !== null && Array.isArray((items[0] as { items?: unknown }).items);\n}\n\nfunction labelOf(item: unknown, toLabel?: (item: never) => string): string {\n if (toLabel) return toLabel(item as never);\n if (item && typeof item === 'object' && 'label' in item) return String((item as { label: unknown }).label);\n return String(item);\n}\n\nexport type ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<\n Value,\n Multiple\n> & {\n /** Shorthand: the input's placeholder. Used when `children` is left out. */\n placeholder?: string;\n /** Shorthand: a button that clears the value. Default `false`. */\n showClear?: boolean;\n /** Shorthand: the chevron that opens the list. Default `true`. */\n showTrigger?: boolean;\n /** Shorthand: shown when nothing matches. Default `No items found.` */\n empty?: ReactNode;\n /** Shorthand: the content of each item. Default: its label (`itemToStringLabel`, `item.label`, or the string). */\n renderItem?: (item: Value) => ReactNode;\n /** Shorthand: the input's id, accessible name and invalid state. Inside a `Field`, the Field sets them. */\n id?: string;\n 'aria-label'?: string;\n 'aria-invalid'?: boolean;\n /** Shorthand: layout of the input (or the chips with `multiple`). */\n className?: string;\n};\n\n/**\n * Autocomplete input with a list of suggestions, on Base UI's Combobox.\n *\n * Compose the parts, or leave out `children` and pass `items` for the shorthand: an input\n * (chips with `multiple`), the list, and \"No items found.\" Items are strings, `{ value, label }`\n * objects, anything with `itemToStringLabel`, or groups `{ value, items }`. The value is the item.\n */\nexport function Combobox<Value, Multiple extends boolean | undefined = false>({\n children,\n placeholder,\n showClear = false,\n showTrigger = true,\n empty = 'No items found.',\n renderItem,\n id,\n 'aria-label': ariaLabel,\n 'aria-invalid': ariaInvalid,\n className,\n ...props\n}: ComboboxProps<Value, Multiple>) {\n const anchor = useComboboxAnchor();\n if (children !== undefined) {\n return <ComboboxPrimitive.Root {...props}>{children}</ComboboxPrimitive.Root>;\n }\n const toLabel = props.itemToStringLabel as ((item: never) => string) | undefined;\n const renderOne = (item: Value) => {\n const disabled = !!item && typeof item === 'object' && 'disabled' in item && !!(item as { disabled?: boolean }).disabled;\n return (\n <ComboboxItem key={labelOf(item, toLabel)} value={item} disabled={disabled}>\n {renderItem ? renderItem(item) : labelOf(item, toLabel)}\n </ComboboxItem>\n );\n };\n const inputProps = { id, placeholder, 'aria-label': ariaLabel, 'aria-invalid': ariaInvalid || undefined };\n const grouped = isGroups<Value>(props.items as readonly unknown[] | undefined);\n return (\n <ComboboxPrimitive.Root {...props}>\n {props.multiple ? (\n <ComboboxChips ref={anchor} className={className}>\n <ComboboxValue>\n {(values: Value[]) => (\n <>\n {values.map((item) => (\n <ComboboxChip key={labelOf(item, toLabel)}>{labelOf(item, toLabel)}</ComboboxChip>\n ))}\n <ComboboxChipsInput {...inputProps} />\n </>\n )}\n </ComboboxValue>\n </ComboboxChips>\n ) : (\n <ComboboxInput\n {...inputProps}\n disabled={props.disabled}\n showClear={showClear}\n showTrigger={showTrigger}\n className={className}\n />\n )}\n <ComboboxContent anchor={props.multiple ? anchor : undefined}>\n <ComboboxEmpty>{empty}</ComboboxEmpty>\n <ComboboxList>\n {grouped\n ? (group: ComboboxGroupItems<Value>, index: number) => (\n <ComboboxGroup key={group.value} items={group.items as Value[]}>\n {index > 0 && <ComboboxSeparator />}\n <ComboboxLabel>{group.value}</ComboboxLabel>\n <ComboboxCollection>{(item: Value) => renderOne(item)}</ComboboxCollection>\n </ComboboxGroup>\n )\n : (item: Value) => renderOne(item)}\n </ComboboxList>\n </ComboboxContent>\n </ComboboxPrimitive.Root>\n );\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cn } from '../../lib/cn';\nimport { devWarn } from '../../lib/dev-warn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport { CHOICE_CARD } from './field';\n\n/**\n * RadioGroup: a set of checkable buttons, known as radio buttons, where no more than one can be\n * checked at a time.\n *\n * Built on real `<input type=\"radio\">` elements sharing a `name`, which gives the whole keyboard\n * contract for free (arrow keys move and select, only the checked radio is a tab stop, the group\n * is announced as \"2 of 4\") and submits with a form. Nothing in it needs browser APIs a test\n * environment lacks.\n *\n * Three ways to write one:\n * - `options`: `<RadioGroup options={[{ value, label, description?, card?, disabled? }]} />`.\n * - Item shorthand: `<RadioGroupItem value label description card />` renders the field around it.\n * - Composition: `RadioGroupItem` with an `id`, labelled by `Field` / `FieldLabel`.\n *\n * Name the group with `aria-label` or a `FieldSet` + `FieldLegend`. `aria-invalid` on the group\n * marks every item; on an item it marks that item.\n */\n\ninterface RadioGroupContextValue {\n name: string;\n value: string | undefined;\n setValue: (value: string) => void;\n disabled: boolean;\n required: boolean;\n invalid: boolean;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\n/** One radio as data: the `RadioGroupItem` shorthand it renders with. */\nexport interface RadioGroupOption {\n value: string;\n label: ReactNode;\n description?: ReactNode;\n /** Render this option as a choice card. */\n card?: boolean;\n disabled?: boolean;\n}\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\nexport interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'dir'> {\n /** The parts: `RadioGroupItem`s. Omit when passing `options`. */\n children?: ReactNode;\n /** Shorthand: the radios as data, each rendered as a `RadioGroupItem`. */\n options?: readonly RadioGroupOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Shared `name` of the inputs, which submit with a form. Generated when omitted. */\n name?: string;\n /** Announced to assistive tech. Lay the items out with `className` (`flex gap-6`). */\n orientation?: RadioGroupOrientation;\n disabled?: boolean;\n required?: boolean;\n dir?: 'ltr' | 'rtl';\n}\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function RadioGroup(\n {\n children,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n orientation,\n disabled = false,\n required = false,\n className,\n ...props\n },\n ref,\n) {\n const generatedName = useId();\n const [value, setValue] = useControllableState<string | undefined>({\n value: valueProp,\n defaultValue,\n onChange: onValueChange as ((next: string | undefined) => void) | undefined,\n });\n const invalid = props['aria-invalid'] === true || props['aria-invalid'] === 'true';\n\n return (\n <RadioGroupContext.Provider\n value={{ name: name ?? generatedName, value, setValue: (next) => setValue(next), disabled, required, invalid }}\n >\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-required={required || undefined}\n aria-orientation={orientation}\n data-slot=\"radio-group\"\n data-disabled={disabled || undefined}\n className={cn('grid w-full gap-2', className)}\n {...props}\n >\n {options\n ? options.map((option) => (\n <RadioGroupItem\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n card={option.card}\n disabled={option.disabled}\n />\n ))\n : children}\n </div>\n </RadioGroupContext.Provider>\n );\n});\n\nexport interface RadioGroupItemProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'type' | 'onChange' | 'checked' | 'defaultChecked' | 'size' | 'name'\n> {\n value: string;\n /** Shorthand: the label beside the radio. */\n label?: ReactNode;\n /** Shorthand: a second line under the label. */\n description?: ReactNode;\n /** Shorthand: render the labelled field as a choice card. Needs `label`. */\n card?: boolean;\n}\n\nconst RADIO =\n 'peer relative flex size-4 shrink-0 cursor-pointer appearance-none rounded-full border border-input bg-transparent outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary aria-invalid:data-checked:border-primary group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input group-has-[:focus-visible]/field-label:data-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-checked:bg-primary';\n\nexport const RadioGroupItem = forwardRef<HTMLInputElement, RadioGroupItemProps>(function RadioGroupItem(\n { value, label, description, card = false, id, className, disabled, ...props },\n ref,\n) {\n const group = useContext(RadioGroupContext);\n if (!group) devWarn('<RadioGroupItem> must be rendered inside a <RadioGroup>.');\n const generatedId = useId();\n const controlId = id ?? (label != null ? generatedId : undefined);\n const descriptionId = `${controlId ?? generatedId}-description`;\n const checked = group?.value === value;\n const isDisabled = disabled ?? group?.disabled ?? false;\n\n const radio = (\n <span className={cn('relative inline-flex size-4 shrink-0', label == null && className)}>\n <input\n ref={ref}\n id={controlId}\n type=\"radio\"\n name={group?.name}\n value={value}\n checked={checked}\n disabled={isDisabled}\n required={group?.required || undefined}\n data-slot=\"radio-group-item\"\n data-state={checked ? 'checked' : 'unchecked'}\n aria-describedby={description != null && !card ? descriptionId : undefined}\n onChange={() => group?.setValue(value)}\n className={RADIO}\n // The group's aria-invalid marks each item, as an item's own aria-invalid does: it drives\n // the invalid look, and assistive tech reads it on the radio.\n {...(group?.invalid ? { 'aria-invalid': true as const } : {})}\n {...props}\n />\n <span\n aria-hidden\n data-slot=\"radio-group-indicator\"\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n >\n {checked && <span className=\"size-2 rounded-full bg-primary-foreground\" />}\n </span>\n </span>\n );\n\n if (label == null) return radio;\n\n // In a card the title is a div (FieldTitle): the card is the label, and labels do not nest.\n const labelElement = card ? (\n <div\n data-slot=\"field-label\"\n className=\"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </div>\n ) : (\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className=\"group/field-label peer/field-label flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none group-data-[disabled=true]/field:opacity-50\"\n >\n {label}\n </label>\n );\n\n const content =\n description != null ? (\n <div data-slot=\"field-content\" className=\"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\">\n {labelElement}\n <p\n id={descriptionId}\n data-slot=\"field-description\"\n className=\"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance\"\n >\n {description}\n </p>\n </div>\n ) : (\n labelElement\n );\n\n const field = (\n <div\n // Not a group inside a card: the card is the label, and a group between a label and its\n // input hides the label text from accessible-name checks.\n role={card ? undefined : 'group'}\n data-slot=\"field\"\n data-orientation=\"horizontal\"\n data-disabled={isDisabled || undefined}\n className={cn(\n 'group/field flex w-full flex-row items-center gap-2 has-[>[data-slot=field-content]]:items-start data-[invalid=true]:text-destructive has-[>[data-slot=field-content]]:[&>span:first-child]:mt-px *:data-[slot=field-label]:flex-auto',\n !card && className,\n )}\n >\n {/* A card puts the radio at the end, after its title and description. */}\n {card ? (\n <>\n {content}\n {radio}\n </>\n ) : (\n <>\n {radio}\n {content}\n </>\n )}\n </div>\n );\n\n if (!card) return field;\n return (\n <label\n htmlFor={controlId}\n data-slot=\"field-label\"\n className={cn('group/field-label peer/field-label text-sm', CHOICE_CARD, className)}\n >\n {field}\n </label>\n );\n});\n","import { forwardRef, useId, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Slider as SliderPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\n\n/**\n * Slider: an input where the user selects a value from within a given range.\n *\n * Built on Radix Slider. `value` / `defaultValue` are arrays: one value is one thumb, two make a\n * range, more give more thumbs. `orientation=\"vertical\"` stands it up. Each thumb is a\n * `role=\"slider\"` with arrow keys, Page Up/Down and Home/End.\n *\n * Shorthand: `label` (and `description`) render the label row and the line under the slider,\n * `showValue` shows the current value at the end of the label row, and `formatValue` formats\n * it, both on screen and as each thumb's `aria-valuetext` (\"£70\", not \"70\").\n *\n * Radix measures each thumb with `ResizeObserver`, which a bare jsdom lacks: tests that render a\n * Slider need a stub (`src/components/cards/resize-observer.test-stub.ts`).\n */\n\nexport interface SliderProps extends ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {\n /** Shorthand: the label above the slider; names every thumb. */\n label?: ReactNode;\n /** Shorthand: a line under the slider. */\n description?: ReactNode;\n /** Shorthand: show the current value (or values) at the end of the label row. */\n showValue?: boolean;\n /** Formats a value for display and for each thumb's `aria-valuetext`. */\n formatValue?: (value: number) => string;\n}\n\nexport const Slider = forwardRef<ElementRef<typeof SliderPrimitive.Root>, SliderProps>(function Slider(\n {\n className,\n defaultValue,\n value: valueProp,\n onValueChange,\n min = 0,\n max = 100,\n label,\n description,\n showValue = false,\n formatValue,\n ...props\n },\n ref,\n) {\n const [values, setValues] = useControllableState<number[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [min, max],\n onChange: onValueChange,\n });\n const labelId = useId();\n const descriptionId = useId();\n const format = (value: number) => (formatValue ? formatValue(value) : String(value));\n\n const slider = (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n value={values}\n onValueChange={setValues}\n min={min}\n max={max}\n className={cn(\n 'relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col',\n label == null && description == null && className,\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className=\"relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1\"\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full\"\n />\n </SliderPrimitive.Track>\n {values.map((value, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={index}\n aria-labelledby={label != null ? labelId : undefined}\n aria-describedby={description != null ? descriptionId : undefined}\n aria-valuetext={formatValue ? format(value) : undefined}\n className=\"relative block size-3 shrink-0 rounded-full border border-ring bg-(--prim-white-1000) ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50\"\n />\n ))}\n </SliderPrimitive.Root>\n );\n\n if (label == null && description == null) return slider;\n\n return (\n <div data-slot=\"slider-field\" className={cn('flex w-full flex-col gap-3', className)}>\n {(label != null || showValue) && (\n <div className=\"flex items-center justify-between gap-2 text-sm\">\n {label != null && (\n <span id={labelId} className=\"font-medium\">\n {label}\n </span>\n )}\n {showValue && <span className=\"text-muted-foreground tabular-nums\">{values.map(format).join(' – ')}</span>}\n </div>\n )}\n {slider}\n {description != null && (\n <p id={descriptionId} className=\"text-sm text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n );\n});\n","import { forwardRef, type ComponentProps, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Tooltip as TooltipPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { usePortalContainer } from './portal';\n\n/**\n * Tooltip: a popup that displays information related to an element when the element receives\n * keyboard focus or the mouse hovers over it.\n *\n * Built on Radix Tooltip: it opens on focus as well as hover, closes on Escape (only the\n * tooltip, not a dialog around it), stays open while the pointer moves onto it (WCAG 1.4.13),\n * and describes its trigger with `aria-describedby`. It is never focused, so it holds a short\n * label and nothing interactive; use `Popover` for that. An icon-only trigger still needs its\n * own `aria-label`.\n *\n * Mount one `TooltipProvider` at the app root (`SidebarProvider` includes one). A Tooltip\n * outside a provider throws.\n *\n * Two ways to write one:\n * - Shorthand: `<Tooltip content=\"Add to library\" side=\"right\"><Button /></Tooltip>` makes the\n * child the trigger and renders the content.\n * - Composition: `Tooltip` > `TooltipTrigger asChild` + `TooltipContent`.\n */\n\nexport function TooltipProvider({ delayDuration = 0, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>) {\n return <TooltipPrimitive.Provider data-slot=\"tooltip-provider\" delayDuration={delayDuration} {...props} />;\n}\n\nexport interface TooltipProps extends ComponentProps<typeof TooltipPrimitive.Root> {\n /** Shorthand: the tooltip text. The child becomes the trigger. */\n content?: ReactNode;\n /** Shorthand: the content's side. Default `top`. */\n side?: ComponentProps<typeof TooltipPrimitive.Content>['side'];\n /** Shorthand: the content's alignment. Default `center`. */\n align?: ComponentProps<typeof TooltipPrimitive.Content>['align'];\n}\n\nexport function Tooltip({ content, side, align, children, ...props }: TooltipProps) {\n return (\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props}>\n {content != null ? (\n <>\n <TooltipTrigger asChild>{children}</TooltipTrigger>\n <TooltipContent side={side} align={align}>\n {content}\n </TooltipContent>\n </>\n ) : (\n children\n )}\n </TooltipPrimitive.Root>\n );\n}\n\nexport const TooltipTrigger = forwardRef<\n ElementRef<typeof TooltipPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(function TooltipTrigger(props, ref) {\n return <TooltipPrimitive.Trigger ref={ref} data-slot=\"tooltip-trigger\" {...props} />;\n});\n\nexport const TooltipContent = forwardRef<\n ElementRef<typeof TooltipPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(function TooltipContent({ className, sideOffset = 0, children, ...props }, ref) {\n const container = usePortalContainer();\n return (\n <TooltipPrimitive.Portal container={container ?? undefined}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n 'z-tooltip inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n 'has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"z-tooltip size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport type { FloatingAlign, FloatingSide } from './floating';\nimport { usePortalContainer } from './portal';\n\n/**\n * HoverCard: a preview panel that appears on hover or focus — a user card on an @mention, a\n * page preview on a link.\n *\n * Two ways to write one:\n * - Shorthand: `<HoverCard content={…}>{trigger}</HoverCard>`.\n * - Composition: `HoverCard` > `HoverCardTrigger` + `HoverCardContent`.\n *\n * It sits between `Tooltip` and `Popover`, and the difference is intent: a Tooltip is a short\n * label that cannot be entered; a HoverCard is supplementary content that *can* be entered\n * (the panel stays open while the pointer is inside it); a Popover is opened deliberately by\n * click. Hover has no touch equivalent, so nothing may be reachable only here.\n *\n * Built on Radix HoverCard: the delays, the pointer grace area and Escape through the shared\n * layer stack come from Radix. Ours on top: the panel is a `group` named by the trigger, and the\n * trigger is described by the panel while it is open (Radix gives the panel no role).\n */\n\ninterface HoverCardIds {\n triggerId: string;\n contentId: string;\n open: boolean;\n}\n\nconst HoverCardContext = createContext<HoverCardIds | null>(null);\n\nexport const HoverCardTrigger = forwardRef<\n HTMLAnchorElement,\n ComponentPropsWithoutRef<typeof HoverCardPrimitive.Trigger>\n>(function HoverCardTrigger(props, ref) {\n const ids = useContext(HoverCardContext);\n return (\n <HoverCardPrimitive.Trigger\n ref={ref}\n data-slot=\"hover-card-trigger\"\n id={ids?.triggerId}\n // Not `aria-haspopup`: nothing here is triggered by activation, and claiming a popup on a\n // plain link makes a screen reader promise an interaction that does not exist.\n aria-describedby={ids?.open ? ids.contentId : undefined}\n {...props}\n />\n );\n});\n\nexport interface HoverCardContentProps extends ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content> {\n /** Where to portal the panel. Default: the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const HoverCardContent = forwardRef<HTMLDivElement, HoverCardContentProps>(function HoverCardContent(\n { className, align = 'center', sideOffset = 4, container, ...props },\n ref,\n) {\n const ids = useContext(HoverCardContext);\n const inherited = usePortalContainer();\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\" container={container ?? inherited ?? undefined}>\n <HoverCardPrimitive.Content\n ref={ref}\n data-slot=\"hover-card-content\"\n id={ids?.contentId}\n // `group`, not `dialog`: it was not opened deliberately and traps nothing.\n role=\"group\"\n aria-labelledby={ids?.triggerId}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={8}\n className={cn(\n 'z-popover w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2',\n className,\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n );\n});\n\nexport interface HoverCardProps extends ComponentPropsWithoutRef<typeof HoverCardPrimitive.Root> {\n /**\n * The parts (`HoverCardTrigger`, `HoverCardContent`); with `content`, the trigger element\n * itself (a single focusable element, normally a link).\n */\n children?: ReactNode;\n /** Shorthand: the panel content. The children become the trigger. */\n content?: ReactNode;\n /** Shorthand: where the panel opens. */\n side?: FloatingSide;\n align?: FloatingAlign;\n /** Shorthand: classes for the panel. */\n className?: string;\n}\n\nexport function HoverCard({\n children,\n content,\n side,\n align,\n className,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n ...props\n}: HoverCardProps) {\n const baseId = useId();\n // Tracked here as well as in Radix, because the trigger is described by the panel only while it exists.\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const ids = { triggerId: `${baseId}-trigger`, contentId: `${baseId}-content`, open };\n\n return (\n <HoverCardContext.Provider value={ids}>\n <HoverCardPrimitive.Root data-slot=\"hover-card\" open={open} onOpenChange={setOpen} {...props}>\n {content !== undefined ? (\n <>\n <HoverCardTrigger asChild>{children as ReactElement}</HoverCardTrigger>\n <HoverCardContent side={side} align={align} className={className}>\n {content}\n </HoverCardContent>\n </>\n ) : (\n children\n )}\n </HoverCardPrimitive.Root>\n </HoverCardContext.Provider>\n );\n}\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { ContextMenu as ContextMenuPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { useControllableState } from '../../lib/use-controllable-state';\nimport {\n createMenuParts,\n type MenuClasses,\n focusMenuEdge,\n stopToAncestors,\n type MenuItemDef,\n} from './menu-core';\nimport { usePortalContainer } from './portal';\n\nconst CONTEXT_MENU_CLASSES: MenuClasses = {\n item:\n \"group/context-menu-item focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n checkboxItem:\n \"focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n radioItem:\n \"focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n indicator:\n 'absolute end-2',\n label:\n 'text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:ps-7',\n separator:\n 'bg-border -mx-1 my-1 h-px',\n shortcut:\n 'text-muted-foreground group-focus/context-menu-item:text-accent-foreground ms-auto text-xs tracking-widest',\n subTrigger:\n \"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n subContent:\n 'z-popover origin-(--radix-context-menu-content-transform-origin) overflow-hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-32 rounded-lg border p-1 shadow-lg duration-100',\n};\n\nconst CONTENT_CLASSES =\n 'z-popover max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto scrollbar-thin data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 ring-foreground/10 bg-popover text-popover-foreground min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100';\n\nexport interface ContextMenuProps {\n /**\n * The parts (`ContextMenuTrigger`, `ContextMenuContent`), or, with `items`, the area that\n * responds to right-click.\n */\n children: ReactNode;\n /**\n * The menu as data. New in 0.8.0. `children` then becomes the right-click area, wrapped in a\n * `ContextMenuTrigger` for you. The same `MenuItemDef` shape as `DropdownMenu` and `Menubar`.\n */\n items?: readonly MenuItemDef[];\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Locks page scroll and outside pointer events while open. Default `true`. */\n modal?: boolean;\n dir?: 'ltr' | 'rtl';\n}\n\n/**\n * Right-click menu, built on Radix ContextMenu from 0.7.0.\n *\n * Shares every item and the whole keyboard contract with `DropdownMenu` (see `menu-core`);\n * the only difference is how it opens — at the pointer, with no trigger element to anchor\n * to.\n *\n * **A context menu must never be the only way to reach an action.** `contextmenu` fires on\n * right-click and on the Windows Menu / Shift+F10 keys, but not on touch, and plenty of\n * users never right-click at all. `ContextMenuTrigger` therefore also opens on Shift+F10 and\n * the ContextMenu key even where the browser would not, and anything in here should have a\n * visible equivalent elsewhere — usually a `DropdownMenu` on the same row.\n *\n * Radix ContextMenu has no `open` prop (it is opened by the pointer only), so a controlled\n * `open={false}` closes it, but `open={true}` cannot open it without a position.\n */\nexport function ContextMenu({ children, items, open: openProp, defaultOpen = false, onOpenChange, modal, dir }: ContextMenuProps) {\n const [, setOpen] = useControllableState({\n value: openProp,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <ContextMenuPrimitive.Root data-slot=\"context-menu\" onOpenChange={setOpen} modal={modal} dir={dir}>\n {items ? (\n <>\n <ContextMenuTrigger>{children}</ContextMenuTrigger>\n <ContextMenuContent>\n <ContextMenuItems items={items} />\n </ContextMenuContent>\n </>\n ) : (\n children\n )}\n </ContextMenuPrimitive.Root>\n );\n}\n\nexport interface ContextMenuTriggerProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n disabled?: boolean;\n}\n\n/**\n * The area that responds to right-click. A wrapper with no tab stop of its own: the keyboard\n * path is Shift+F10 or the ContextMenu key from whatever inside it has focus.\n */\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(\n function ContextMenuTrigger({ children, disabled = false, className, onKeyDown, ...rest }, ref) {\n const openFromKeyboard = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (disabled || event.defaultPrevented) return;\n if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {\n // Cancelling the key also stops the browser's own `contextmenu`, so the menu opens\n // exactly once, at the focused element rather than wherever the pointer happens to be.\n event.preventDefault();\n const source = event.target instanceof HTMLElement ? event.target : event.currentTarget;\n const rect = source.getBoundingClientRect();\n source.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n cancelable: true,\n clientX: rect.left + rect.width / 2,\n clientY: rect.top + rect.height / 2,\n }),\n );\n }\n };\n\n return (\n <ContextMenuPrimitive.Trigger asChild disabled={disabled}>\n {/* The key handler only catches Shift+F10 / ContextMenu bubbling up from focusable\n content inside. The wrapper is deliberately not focusable and takes no role: its\n actions have a visible equivalent elsewhere, and a tab stop here would add an\n unexplained one in the middle of, say, a table row. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={ref}\n data-slot=\"context-menu-trigger\"\n className={cn('select-none', className)}\n onKeyDown={openFromKeyboard}\n {...rest}\n >\n {children}\n </div>\n </ContextMenuPrimitive.Trigger>\n );\n },\n);\n\nexport interface ContextMenuContentProps\n extends Omit<ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>, 'children'> {\n children: ReactNode;\n /** Which side of the pointer the menu prefers. Default `right`. */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const ContextMenuContent = forwardRef<HTMLDivElement, ContextMenuContentProps>(\n function ContextMenuContent(\n { children, collisionPadding, container, className, onClick, onKeyDown, onFocus, ...rest },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <ContextMenuPrimitive.Portal container={container ?? inherited ?? undefined}>\n <ContextMenuPrimitive.Content\n ref={ref}\n collisionPadding={collisionPadding}\n loop\n className={cn(CONTENT_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n if (event.key === 'Tab') {\n // Tab leaves the menu, as in DropdownMenu. Radix has no imperative close for a\n // context menu, so Escape is replayed on the panel to dismiss it.\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n );\n }\n }}\n {...rest}\n >\n {children}\n </ContextMenuPrimitive.Content>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(ContextMenuPrimitive, 'context-menu', CONTEXT_MENU_CLASSES);\n\n/** Renders `MenuItemDef[]` inside your own `ContextMenuContent`. New in 0.8.0. */\nexport const ContextMenuItems = parts.Items;\nexport const ContextMenuItem = parts.Item;\nexport const ContextMenuCheckboxItem = parts.CheckboxItem;\nexport const ContextMenuRadioGroup = parts.RadioGroup;\nexport const ContextMenuRadioItem = parts.RadioItem;\nexport const ContextMenuGroup = parts.Group;\nexport const ContextMenuLabel = parts.Label;\nexport const ContextMenuSeparator = parts.Separator;\nexport const ContextMenuShortcut = parts.Shortcut;\nexport const ContextMenuSub = parts.Sub;\nexport const ContextMenuSubTrigger = parts.SubTrigger;\nexport const ContextMenuSubContent = parts.SubContent;\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { Menubar as MenubarPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/compose-event-handlers';\nimport { createMenuParts, type MenuClasses, focusMenuEdge, stopToAncestors, type MenuItemDef } from './menu-core';\nimport { usePortalContainer } from './portal';\n\nconst MENUBAR_CLASSES: MenuClasses = {\n item: \"group/menubar-item focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive! not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-disabled:opacity-50 data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n checkboxItem:\n 'focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-1.5 ps-7 text-sm data-inset:ps-7',\n radioItem:\n \"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-1.5 ps-7 text-sm data-disabled:opacity-50 data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n indicator: \"absolute flex items-center justify-center start-1.5 size-4 [&_svg:not([class*='size-'])]:size-4\",\n label: 'px-1.5 py-1 text-sm font-medium data-inset:ps-7',\n separator: 'bg-border -mx-1 my-1 h-px',\n shortcut: 'text-muted-foreground group-focus/menubar-item:text-accent-foreground text-xs tracking-widest ms-auto',\n subTrigger:\n \"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4\",\n subContent:\n 'z-popover origin-(--radix-menubar-content-transform-origin) overflow-hidden bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg p-1 shadow-lg ring-1 duration-100',\n};\n\nconst CONTENT_CLASSES =\n 'z-popover origin-(--radix-menubar-content-transform-origin) overflow-hidden bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 ring-foreground/10 min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100';\n\n/** One menu of a data-driven `Menubar`. New in 0.8.0. */\nexport interface MenubarMenuDef {\n /** Identifies the menu within the bar; what `value` / `onValueChange` report. */\n value: string;\n label: ReactNode;\n items: readonly MenuItemDef[];\n hidden?: boolean;\n}\n\nexport interface MenubarProps extends ComponentPropsWithoutRef<typeof MenubarPrimitive.Root> {\n /** The parts: `MenubarMenu`s. Omit when passing `menus`. */\n children?: ReactNode;\n /**\n * The bar as data: a trigger and its items per menu, rendered through the parts. New in 0.8.0.\n * Use it or `children`, not both.\n */\n menus?: readonly MenubarMenuDef[];\n}\n\n/**\n * A persistent horizontal bar of menus, as in a desktop application's File / Edit / View.\n *\n * Two ways to write one:\n * - Shorthand: `<Menubar menus={[{ value, label, items }]} />`.\n * - Composition: `Menubar` > `MenubarMenu` > `MenubarTrigger` + `MenubarContent` > items.\n *\n * Built on Radix Menubar, which supplies the contract: one tab stop for the whole bar,\n * Left/Right along it, Down/Up into a menu, Left/Right from inside an open menu to its sibling,\n * and moving the pointer across the bar switching menus once one is open. Items are the same\n * parts as `DropdownMenu` (see `menu-core`). Name the bar with `aria-label` when the page has\n * more than one.\n */\nexport const Menubar = forwardRef<ElementRef<typeof MenubarPrimitive.Root>, MenubarProps>(function Menubar(\n { children, menus, className, ...props },\n ref,\n) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n loop\n data-slot=\"menubar\"\n className={cn('flex h-8 items-center gap-0.5 rounded-lg border p-[3px]', className)}\n {...props}\n >\n {menus\n ? menus\n .filter((menu) => !menu.hidden)\n .map((menu) => (\n <MenubarMenu key={menu.value} value={menu.value}>\n <MenubarTrigger>{menu.label}</MenubarTrigger>\n <MenubarContent>\n <MenubarItems items={menu.items} />\n </MenubarContent>\n </MenubarMenu>\n ))\n : children}\n </MenubarPrimitive.Root>\n );\n});\n\nexport type MenubarMenuProps = ComponentPropsWithoutRef<typeof MenubarPrimitive.Menu>;\n\nexport function MenubarMenu(props: MenubarMenuProps) {\n return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />;\n}\n\nexport function MenubarPortal(props: ComponentPropsWithoutRef<typeof MenubarPrimitive.Portal>) {\n return <MenubarPrimitive.Portal data-slot=\"menubar-portal\" {...props} />;\n}\n\nexport type MenubarTriggerProps = ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>;\n\nexport const MenubarTrigger = forwardRef<ElementRef<typeof MenubarPrimitive.Trigger>, MenubarTriggerProps>(\n function MenubarTrigger({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n data-slot=\"menubar-trigger\"\n className={cn(\n 'flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface MenubarContentProps extends ComponentPropsWithoutRef<typeof MenubarPrimitive.Content> {\n /** Where to portal the menu. Defaults to the enclosing dialog, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const MenubarContent = forwardRef<ElementRef<typeof MenubarPrimitive.Content>, MenubarContentProps>(\n function MenubarContent(\n { container, className, align = 'start', alignOffset = -4, sideOffset = 8, onClick, onKeyDown, onFocus, ...props },\n ref,\n ) {\n const inherited = usePortalContainer();\n return (\n <MenubarPrimitive.Portal container={container ?? inherited ?? undefined}>\n <MenubarPrimitive.Content\n ref={ref}\n data-slot=\"menubar-content\"\n align={align}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n collisionPadding={8}\n loop\n className={cn(CONTENT_CLASSES, className)}\n onFocus={composeEventHandlers(onFocus, (event) => focusMenuEdge(event, 'start'))}\n onClick={(event) => {\n onClick?.(event);\n stopToAncestors(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n stopToAncestors(event);\n // Tab leaves the menu, as in DropdownMenu and ContextMenu. Radix keeps Tab inside an\n // open menu and has no imperative close here, so Escape is replayed on the panel.\n if (event.key === 'Tab') {\n event.currentTarget.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));\n }\n }}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n },\n);\n\nconst parts = createMenuParts(MenubarPrimitive, 'menubar', MENUBAR_CLASSES);\n\n/** Renders `MenuItemDef[]` inside your own `MenubarContent`. New in 0.8.0. */\nexport const MenubarItems = parts.Items;\nexport const MenubarItem = parts.Item;\nexport const MenubarCheckboxItem = parts.CheckboxItem;\nexport const MenubarRadioGroup = parts.RadioGroup;\nexport const MenubarRadioItem = parts.RadioItem;\nexport const MenubarGroup = parts.Group;\nexport const MenubarLabel = parts.Label;\nexport const MenubarSeparator = parts.Separator;\nexport const MenubarShortcut = parts.Shortcut;\nexport const MenubarSub = parts.Sub;\nexport const MenubarSubTrigger = parts.SubTrigger;\nexport const MenubarSubContent = parts.SubContent;\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { Drawer as DrawerPrimitive } from 'vaul';\nimport { cn } from '../../lib/cn';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { composeRefs } from '../../lib/slot';\nimport { deferEscapeToInnerPopup } from './overlay-stack';\nimport { PortalContainerProvider, usePortalContainer } from './portal';\nimport { isInsideToaster } from './toaster-guard';\n\n/**\n * Drawer: a panel that slides in from an edge of the screen and can be dragged away. Built on\n * Vaul, which adds the drag to Radix Dialog's modal behaviour (focus trap, scroll lock, Escape,\n * the page behind hidden from assistive tech).\n *\n * Two ways to write one:\n * - Shorthand: `<Drawer trigger title description footer>{body}</Drawer>` renders the content,\n * header, scrolling body and footer for you.\n * - Composition: `Drawer` > `DrawerTrigger` + `DrawerContent` > `DrawerHeader` (`DrawerTitle`,\n * `DrawerDescription`) + body + `DrawerFooter`.\n *\n * `direction` sets the edge: `bottom` (default), `top`, `left` or `right`. On top of Vaul:\n * - Focus moves into the drawer on open, and returns to whatever held it on close, so a\n * controlled drawer opened by an ordinary button still hands focus back.\n * - Escape closes an open popup inside the drawer (a Select, a Combobox list) before the drawer.\n * - Pressing a toast is not an outside press.\n * - Popups inside the drawer that are not Radix parts portal into it.\n *\n * Vaul calls `window.matchMedia` when a drawer opens and `setPointerCapture` when one is pressed;\n * jsdom has neither, so a test environment needs both stubbed.\n */\n\nexport type DrawerDirection = 'top' | 'right' | 'bottom' | 'left';\n\n// ── Naming ──────────────────────────────────────────────────────────────────────\n\n/**\n * Lets the content know which naming parts are rendered: without a `DrawerTitle`, `label`\n * becomes a visually hidden title; without a `DrawerDescription`, `aria-describedby` is left\n * off instead of pointing at an id that is not in the document.\n */\ninterface DrawerNamingContext {\n registerTitle: (present: boolean) => void;\n registerDescription: (present: boolean) => void;\n}\n\nconst DrawerNaming = createContext<DrawerNamingContext | null>(null);\n\n// ── Parts ───────────────────────────────────────────────────────────────────────\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>>(\n function DrawerTrigger(props, ref) {\n return <DrawerPrimitive.Trigger ref={ref} data-slot=\"drawer-trigger\" {...props} />;\n },\n);\n\nexport function DrawerPortal({ container, ...props }: ComponentProps<typeof DrawerPrimitive.Portal>) {\n const provided = usePortalContainer();\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" container={container ?? provided ?? undefined} {...props} />;\n}\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Close>>(\n function DrawerClose(props, ref) {\n return <DrawerPrimitive.Close ref={ref} data-slot=\"drawer-close\" {...props} />;\n },\n);\n\nexport const DrawerOverlay = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>>(\n function DrawerOverlay({ className, ...props }, ref) {\n return (\n <DrawerPrimitive.Overlay\n ref={ref}\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface DrawerContentProps extends ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> {\n /** Accessible name when the drawer renders no `DrawerTitle` (a visually hidden title). */\n label?: string;\n /** Focus this on open instead of the first tabbable element. */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Where to portal the drawer. Default: the enclosing dialog or drawer, else `document.body`. */\n container?: HTMLElement | null;\n}\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { container, ...props },\n ref,\n) {\n return (\n <DrawerPortal container={container ?? undefined}>\n <DrawerOverlay />\n <DrawerPanel ref={ref} {...props} />\n </DrawerPortal>\n );\n});\n\n/**\n * The panel itself. A separate component inside the portal, so it mounts only while the drawer\n * is open: the element to return focus to is read on open.\n */\nconst DrawerPanel = forwardRef<HTMLDivElement, Omit<DrawerContentProps, 'container'>>(function DrawerPanel(\n {\n className,\n children,\n label,\n initialFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n ...props\n },\n ref,\n) {\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null);\n // Read during the first render, before focus moves into the panel.\n const [returnFocusTo] = useState(() =>\n typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null),\n );\n\n return (\n <DrawerPrimitive.Content\n ref={composeRefs(ref, setContentNode)}\n data-slot=\"drawer-content\"\n // Only point at a description that exists.\n {...(hasDescription ? {} : { 'aria-describedby': undefined })}\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t',\n 'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b',\n className,\n )}\n onOpenAutoFocus={(event) => {\n onOpenAutoFocus?.(event);\n const target = initialFocus?.current;\n if (target && !event.defaultPrevented) {\n event.preventDefault();\n target.focus();\n }\n }}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n // Radix returns focus only to its own trigger; a controlled drawer opened by an\n // ordinary button would drop focus to <body>.\n if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {\n event.preventDefault();\n returnFocusTo.focus();\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);\n }}\n onPointerDownOutside={(event) => {\n if (isInsideToaster(event.target)) {\n event.preventDefault();\n return;\n }\n onPointerDownOutside?.(event);\n }}\n {...props}\n >\n <div\n data-slot=\"drawer-handle\"\n aria-hidden\n className=\"mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block\"\n />\n {!hasTitle && label && <DrawerPrimitive.Title className=\"sr-only\">{label}</DrawerPrimitive.Title>}\n <DrawerNaming.Provider value={{ registerTitle: setHasTitle, registerDescription: setHasDescription }}>\n <PortalContainerProvider container={contentNode}>{children}</PortalContainerProvider>\n </DrawerNaming.Provider>\n </DrawerPrimitive.Content>\n );\n});\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"drawer-header\"\n className={cn(\n 'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-start',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"drawer-footer\" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />\n );\n});\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>>(\n function DrawerTitle({ className, ...props }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerTitle(true);\n return () => naming?.registerTitle(false);\n }, [naming]);\n return (\n <DrawerPrimitive.Title\n ref={ref}\n data-slot=\"drawer-title\"\n className={cn('text-base font-medium text-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nexport const DrawerDescription = forwardRef<\n HTMLParagraphElement,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(function DrawerDescription({ className, ...props }, ref) {\n const naming = useContext(DrawerNaming);\n useEffect(() => {\n naming?.registerDescription(true);\n return () => naming?.registerDescription(false);\n }, [naming]);\n return (\n <DrawerPrimitive.Description\n ref={ref}\n data-slot=\"drawer-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\n// ── Root (with the shorthand) ───────────────────────────────────────────────────\n\nexport interface DrawerShorthandProps {\n /** Shorthand: an element that opens the drawer (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: the title. With it, the drawer renders its own content, header, body and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: the footer's content, usually the buttons. */\n footer?: ReactNode;\n /** Shorthand: classes for the content panel. */\n className?: string;\n /** Shorthand: props for the content panel (`label`, `initialFocus`, `onEscapeKeyDown`, …). */\n contentProps?: Omit<DrawerContentProps, 'children' | 'className'>;\n}\n\nexport type DrawerProps = ComponentProps<typeof DrawerPrimitive.Root> & DrawerShorthandProps;\n\nexport function Drawer({\n trigger,\n title,\n description,\n footer,\n className,\n contentProps,\n children,\n autoFocus = true,\n ...props\n}: DrawerProps) {\n // Vaul's `autoFocus` moves focus into the drawer on open (Radix's default), not onto a field\n // on page load, which is what the lint rule is about.\n const root = { ...props, autoFocus };\n\n if (title === undefined) {\n return (\n <DrawerPrimitive.Root {...root}>\n {trigger && <DrawerTrigger asChild>{trigger}</DrawerTrigger>}\n {children}\n </DrawerPrimitive.Root>\n );\n }\n\n return (\n <DrawerPrimitive.Root {...root}>\n {trigger && <DrawerTrigger asChild>{trigger}</DrawerTrigger>}\n <DrawerContent className={className} {...contentProps}>\n <DrawerHeader>\n <DrawerTitle>{title}</DrawerTitle>\n {description !== undefined && <DrawerDescription>{description}</DrawerDescription>}\n </DrawerHeader>\n {children !== undefined && (\n <ScrollArea data-slot=\"drawer-body\" className=\"min-h-0 flex-1\" viewportProps={{ className: 'px-4' }}>\n {children}\n </ScrollArea>\n )}\n {footer !== undefined && <DrawerFooter>{footer}</DrawerFooter>}\n </DrawerContent>\n </DrawerPrimitive.Root>\n );\n}\n","import { forwardRef, useCallback, useEffect, useRef, useState, type ComponentPropsWithoutRef, type ElementRef, type Ref } from 'react';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\n\nimport { cn } from '../../lib/cn';\n\nexport { SCROLLBAR_CLASSES } from '../../lib/scrollbar';\n\n/**\n * ScrollArea: augments native scroll functionality for custom, cross-browser styling.\n *\n * Built on Radix ScrollArea: the content scrolls natively in a viewport, and the scrollbars are\n * drawn (a 10px track with a rounded thumb) so they look the same in every browser.\n *\n * Two ways to write one:\n * - Shorthand: `<ScrollArea axis=\"horizontal\">` renders the scrollbars for the axis\n * (`vertical`, the default, `horizontal` or `both`).\n * - Composition: a `<ScrollBar orientation=\"horizontal\" />` child adds a horizontal scrollbar\n * next to the default vertical one.\n *\n * A scroll container is not keyboard focusable in Chrome or Safari, so the viewport becomes a\n * tab stop, and a region named by `aria-label`, only while it actually overflows.\n *\n * Radix measures the viewport with `ResizeObserver`, which a bare jsdom lacks: tests that render\n * a ScrollArea (the `Sidebar` has one) need a stub.\n */\n\nexport type ScrollAreaAxis = 'vertical' | 'horizontal' | 'both';\n\nexport interface ScrollAreaProps extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /** Shorthand: which scrollbars to render. Default `vertical`. */\n axis?: ScrollAreaAxis;\n /** Names the viewport, which becomes a focusable region while it overflows. */\n 'aria-label'?: string;\n /** Props for the viewport, the element that scrolls. */\n viewportProps?: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Viewport>;\n /** A ref to the viewport, the element that scrolls (to read or set its scroll position). */\n viewportRef?: Ref<HTMLDivElement>;\n}\n\nexport const ScrollArea = forwardRef<ElementRef<typeof ScrollAreaPrimitive.Root>, ScrollAreaProps>(function ScrollArea(\n { className, children, axis = 'vertical', 'aria-label': ariaLabel, viewportProps, viewportRef: outerRef, ...props },\n ref,\n) {\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const setViewport = useCallback(\n (node: HTMLDivElement | null) => {\n viewportRef.current = node;\n if (typeof outerRef === 'function') outerRef(node);\n else if (outerRef) (outerRef as { current: HTMLDivElement | null }).current = node;\n },\n [outerRef],\n );\n const [overflows, setOverflows] = useState(false);\n\n useEffect(() => {\n const node = viewportRef.current;\n if (!node) return;\n const measure = () =>\n setOverflows(node.scrollHeight > node.clientHeight + 1 || node.scrollWidth > node.clientWidth + 1);\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n if (node.firstElementChild) observer.observe(node.firstElementChild);\n return () => observer.disconnect();\n }, [children]);\n\n return (\n <ScrollAreaPrimitive.Root ref={ref} data-slot=\"scroll-area\" className={cn('relative', className)} {...props}>\n <ScrollAreaPrimitive.Viewport\n {...viewportProps}\n ref={setViewport}\n data-slot=\"scroll-area-viewport\"\n // Only a focusable, named region while it overflows: otherwise no tab stop, no landmark.\n role={overflows && ariaLabel ? 'region' : undefined}\n aria-label={overflows ? ariaLabel : undefined}\n tabIndex={overflows ? 0 : undefined}\n className={cn(\n 'size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1',\n viewportProps?.className,\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n {axis !== 'horizontal' && <ScrollBar />}\n {axis !== 'vertical' && <ScrollBar orientation=\"horizontal\" />}\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n});\n\nexport type ScrollBarProps = ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>;\n\nexport const ScrollBar = forwardRef<ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>, ScrollBarProps>(\n function ScrollBar({ className, orientation = 'vertical', ...props }, ref) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n data-orientation={orientation}\n orientation={orientation}\n className={cn(\n 'flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"relative flex-1 rounded-full bg-border\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Dialog as SheetPrimitive } from 'radix-ui';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { ScrollArea } from '../cards/scroll-area';\nimport { Button } from '../forms/button';\n\n/**\n * Sheet: extends the Dialog component to display content that complements the main content of\n * the screen.\n *\n * Built on Radix Dialog: a modal panel that slides in from an edge (`side`: top, right — the\n * default — bottom or left). Use it for a side panel of filters, settings or navigation; for a\n * draggable panel from the bottom, use `Drawer`.\n *\n * Two ways to write one:\n * - Shorthand: `<Sheet trigger={…} title=\"Edit profile\" description=\"…\" footer={…}>{body}</Sheet>`\n * renders the content, header and footer; `side`, `showCloseButton` and `className` go to the\n * panel, `contentProps` to `SheetContent`.\n * - Composition: `SheetTrigger` and `SheetContent` > `SheetHeader` (`SheetTitle`,\n * `SheetDescription`), the body, `SheetFooter`.\n */\n\nexport type SheetSide = 'top' | 'right' | 'bottom' | 'left';\n\nexport const SheetTrigger = forwardRef<\n ElementRef<typeof SheetPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Trigger>\n>(function SheetTrigger(props, ref) {\n return <SheetPrimitive.Trigger ref={ref} data-slot=\"sheet-trigger\" {...props} />;\n});\n\nexport const SheetClose = forwardRef<\n ElementRef<typeof SheetPrimitive.Close>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Close>\n>(function SheetClose(props, ref) {\n return <SheetPrimitive.Close ref={ref} data-slot=\"sheet-close\" {...props} />;\n});\n\nexport function SheetPortal(props: ComponentPropsWithoutRef<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nexport const SheetOverlay = forwardRef<\n ElementRef<typeof SheetPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(function SheetOverlay({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Overlay\n ref={ref}\n data-slot=\"sheet-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface SheetContentProps extends ComponentPropsWithoutRef<typeof SheetPrimitive.Content> {\n /** The edge the sheet slides in from. Default `right`. */\n side?: SheetSide;\n /** The × button in the top corner. Default `true`. */\n showCloseButton?: boolean;\n}\n\nexport const SheetContent = forwardRef<ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(\n function SheetContent({ className, children, side = 'right', showCloseButton = true, ...props }, ref) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n ref={ref}\n data-slot=\"sheet-content\"\n data-side={side}\n className={cn(\n 'fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out',\n 'data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t',\n 'data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:sm:max-w-sm',\n 'data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:sm:max-w-sm',\n 'data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b',\n 'data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10',\n 'data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <SheetPrimitive.Close data-slot=\"sheet-close\" asChild>\n <Button variant=\"ghost\" size=\"icon-sm\" className=\"absolute top-3 right-3\">\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </Button>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n );\n },\n);\n\nexport const SheetHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function SheetHeader(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"sheet-header\" className={cn('flex flex-col gap-0.5 p-4', className)} {...props} />;\n});\n\nexport const SheetFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function SheetFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"sheet-footer\" className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />\n );\n});\n\nexport const SheetTitle = forwardRef<\n ElementRef<typeof SheetPrimitive.Title>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(function SheetTitle({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Title\n ref={ref}\n data-slot=\"sheet-title\"\n className={cn('text-base font-medium text-foreground', className)}\n {...props}\n />\n );\n});\n\nexport const SheetDescription = forwardRef<\n ElementRef<typeof SheetPrimitive.Description>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(function SheetDescription({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Description\n ref={ref}\n data-slot=\"sheet-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\nexport interface SheetProps extends ComponentPropsWithoutRef<typeof SheetPrimitive.Root> {\n /** Shorthand: an element that opens the sheet (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: the title. With it, the sheet renders its own content, header and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: the footer's content, usually the buttons. */\n footer?: ReactNode;\n /** Shorthand: the edge the sheet slides in from. Default `right`. */\n side?: SheetSide;\n /** Shorthand: the × button. Default `true`. */\n showCloseButton?: boolean;\n /** Shorthand: classes for the panel, e.g. a width (`sm:max-w-md`). */\n className?: string;\n /** Shorthand: props for `SheetContent` (`onEscapeKeyDown`, `onOpenAutoFocus`, …). */\n contentProps?: Omit<SheetContentProps, 'children' | 'className' | 'side' | 'showCloseButton'>;\n}\n\nexport function Sheet({\n trigger,\n title,\n description,\n footer,\n side,\n showCloseButton,\n className,\n contentProps,\n children,\n ...props\n}: SheetProps) {\n if (title === undefined) {\n return (\n <SheetPrimitive.Root data-slot=\"sheet\" {...props}>\n {trigger && <SheetTrigger asChild>{trigger}</SheetTrigger>}\n {children}\n </SheetPrimitive.Root>\n );\n }\n\n return (\n <SheetPrimitive.Root data-slot=\"sheet\" {...props}>\n {trigger && <SheetTrigger asChild>{trigger}</SheetTrigger>}\n <SheetContent side={side} showCloseButton={showCloseButton} className={className} {...contentProps}>\n <SheetHeader>\n <SheetTitle>{title}</SheetTitle>\n {description !== undefined && <SheetDescription>{description}</SheetDescription>}\n </SheetHeader>\n {children !== undefined && (\n <ScrollArea data-slot=\"sheet-body\" className=\"min-h-0 flex-1\" viewportProps={{ className: 'px-4' }}>\n {children}\n </ScrollArea>\n )}\n {footer !== undefined && <SheetFooter>{footer}</SheetFooter>}\n </SheetContent>\n </SheetPrimitive.Root>\n );\n}\n","import {\n forwardRef,\n useState,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react';\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonProps } from '../forms/button';\nimport { usePortalContainer } from './portal';\n\n/**\n * AlertDialog: a modal dialog that interrupts the user with important content and expects a\n * response. Use it to confirm or cancel; for anything with a form inside, use a Dialog.\n *\n * Two ways to write one:\n * - Shorthand: `<AlertDialog open title description confirmLabel onConfirm onOpenChange />`,\n * the confirm preset (it replaces `ConfirmDialog`). If `onConfirm` returns a promise the\n * confirm button spins and the dialog closes when it settles; pass `isConfirming` to drive\n * that yourself.\n * - Composition: the standard parts, from `AlertDialogTrigger` to `AlertDialogAction`.\n *\n * Built on Radix AlertDialog: `role=\"alertdialog\"`, focus starts on Cancel, an outside press\n * does not dismiss, Escape does (except while confirming). Every part carries `data-slot`.\n */\n\nexport type AlertDialogSize = 'default' | 'sm';\nexport type AlertDialogTone = 'default' | 'destructive' | 'success' | 'warning' | 'info';\n\nconst TONE_MEDIA: Record<AlertDialogTone, string> = {\n default: 'bg-muted text-foreground',\n destructive: 'bg-destructive/10 text-destructive',\n success: 'bg-success/10 text-success',\n warning: 'bg-warning/10 text-warning',\n info: 'bg-primary/10 text-primary',\n};\n\nconst TONE_ICON: Record<Exclude<AlertDialogTone, 'default'>, ReactNode> = {\n destructive: <CircleAlertIcon />,\n success: <CircleCheckIcon />,\n warning: <TriangleAlertIcon />,\n info: <InfoIcon />,\n};\n\n// ── Parts ───────────────────────────────────────────────────────────────────────\n\nexport const AlertDialogTrigger = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Trigger>>(\n function AlertDialogTrigger(props, ref) {\n return <AlertDialogPrimitive.Trigger ref={ref} data-slot=\"alert-dialog-trigger\" {...props} />;\n },\n);\n\nexport function AlertDialogPortal({ container, ...props }: ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Portal>) {\n const provided = usePortalContainer();\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" container={container ?? provided ?? undefined} {...props} />;\n}\n\nexport const AlertDialogOverlay = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>>(\n function AlertDialogOverlay({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n 'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface AlertDialogContentProps extends ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n size?: AlertDialogSize;\n}\n\nexport const AlertDialogContent = forwardRef<HTMLDivElement, AlertDialogContentProps>(function AlertDialogContent(\n { className, size = 'default', ...props },\n ref,\n) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n 'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none',\n 'data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm',\n 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n );\n});\n\nexport function AlertDialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n 'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center',\n 'has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4',\n 'sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left',\n 'sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function AlertDialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n '-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4',\n 'group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport const AlertDialogTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>>(\n function AlertDialogTitle({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n className={cn(\n 'text-base font-medium',\n 'sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const AlertDialogDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>>(\n function AlertDialogDescription({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n className={cn(\n 'text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport interface AlertDialogMediaProps extends HTMLAttributes<HTMLDivElement> {\n /** Platned addition: tints the media box with a theme role. Default `default` (muted). */\n tone?: AlertDialogTone;\n}\n\nexport function AlertDialogMedia({ className, tone = 'default', ...props }: AlertDialogMediaProps) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n data-tone={tone}\n className={cn(\n \"mb-2 inline-flex size-10 items-center justify-center rounded-md *:[svg:not([class*='size-'])]:size-6\",\n 'sm:group-data-[size=default]/alert-dialog-content:row-span-2',\n TONE_MEDIA[tone],\n className,\n )}\n {...props}\n />\n );\n}\n\ntype ButtonLook = Pick<ButtonProps, 'variant' | 'size'>;\n\nexport const AlertDialogAction = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> & ButtonLook & Pick<ButtonProps, 'loading' | 'loadingLabel'>>(\n function AlertDialogAction({ className, variant = 'default', size = 'default', loading, loadingLabel, children, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Action asChild {...props}>\n <Button ref={ref} data-slot=\"alert-dialog-action\" variant={variant} size={size} loading={loading} loadingLabel={loadingLabel} className={className}>\n {children}\n </Button>\n </AlertDialogPrimitive.Action>\n );\n },\n);\n\nexport const AlertDialogCancel = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> & ButtonLook>(\n function AlertDialogCancel({ className, variant = 'outline', size = 'default', children, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Cancel asChild {...props}>\n <Button ref={ref} data-slot=\"alert-dialog-cancel\" variant={variant} size={size} className={className}>\n {children}\n </Button>\n </AlertDialogPrimitive.Cancel>\n );\n },\n);\n\n// ── Root (with the confirm shorthand) ───────────────────────────────────────────────\n\nexport interface AlertDialogProps extends ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root> {\n /** Shorthand: the title. With it, the dialog renders its own content, header and footer. */\n title?: ReactNode;\n /** Shorthand: the description under the title. */\n description?: ReactNode;\n /** Shorthand: an icon or image in the media box. Default: the tone's icon (none for `default`). */\n media?: ReactNode;\n /** Shorthand: tints the media box. Default `default`. */\n tone?: AlertDialogTone;\n /** Shorthand: an element that opens the dialog (rendered as the trigger, `asChild`). */\n trigger?: ReactNode;\n /** Shorthand: content size. Default `default`. */\n size?: AlertDialogSize;\n confirmLabel?: ReactNode;\n cancelLabel?: ReactNode;\n /** Shorthand: the confirm button's look. Default `primary`. */\n confirmVariant?: ButtonProps['variant'];\n /** Shorthand: disables only the confirm button; Cancel and Escape still dismiss. */\n confirmDisabled?: boolean;\n /**\n * Shorthand: a request is in flight. The confirm button spins, Cancel is disabled and the\n * dialog cannot be dismissed. While this prop is set, confirming does not close the dialog;\n * you close it.\n */\n isConfirming?: boolean;\n /** Announced on the confirm button while confirming. Default \"Working…\". */\n confirmingLabel?: string;\n /** Shorthand: called on confirm. Return a promise to keep the dialog open until it settles. */\n onConfirm?: () => void | Promise<unknown>;\n}\n\nexport function AlertDialog({\n title,\n description,\n media,\n tone = 'default',\n trigger,\n size,\n confirmLabel = 'Continue',\n cancelLabel = 'Cancel',\n confirmVariant = 'default',\n confirmDisabled = false,\n isConfirming,\n confirmingLabel = 'Working…',\n onConfirm,\n open: openProp,\n defaultOpen,\n onOpenChange,\n children,\n ...rest\n}: AlertDialogProps) {\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const [pending, setPending] = useState(false);\n const controlled = openProp !== undefined;\n const open = controlled ? openProp : innerOpen;\n const busy = Boolean(isConfirming) || pending;\n\n const setOpen = (next: boolean) => {\n if (!next && busy) return;\n if (!controlled) setInnerOpen(next);\n onOpenChange?.(next);\n };\n\n if (title === undefined) {\n return (\n <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" open={openProp} defaultOpen={defaultOpen} onOpenChange={onOpenChange} {...rest}>\n {children}\n </AlertDialogPrimitive.Root>\n );\n }\n\n const handleConfirm = (event: MouseEvent<HTMLButtonElement>) => {\n const result = onConfirm?.();\n if (isConfirming !== undefined) {\n event.preventDefault();\n return;\n }\n if (result && typeof (result as Promise<unknown>).then === 'function') {\n event.preventDefault();\n setPending(true);\n (result as Promise<unknown>).then(\n () => {\n setPending(false);\n if (!controlled) setInnerOpen(false);\n onOpenChange?.(false);\n },\n () => setPending(false),\n );\n }\n };\n\n const glyph = media ?? (tone === 'default' ? null : TONE_ICON[tone]);\n\n return (\n <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" open={open} onOpenChange={setOpen} {...rest}>\n {trigger && <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger>}\n <AlertDialogContent size={size} onEscapeKeyDown={(e) => busy && e.preventDefault()}>\n <AlertDialogHeader>\n {glyph && <AlertDialogMedia tone={tone}>{glyph}</AlertDialogMedia>}\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {description !== undefined ? (\n <AlertDialogDescription>{description}</AlertDialogDescription>\n ) : (\n // Radix warns without a description; an empty, hidden one keeps it quiet.\n <AlertDialogDescription className=\"sr-only\" />\n )}\n </AlertDialogHeader>\n {children}\n <AlertDialogFooter>\n <AlertDialogCancel disabled={busy}>{cancelLabel}</AlertDialogCancel>\n <AlertDialogAction\n variant={confirmVariant}\n disabled={confirmDisabled}\n loading={busy}\n loadingLabel={confirmingLabel}\n onClick={handleConfirm}\n >\n {busy ? confirmingLabel : confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialogPrimitive.Root>\n );\n}\n","import type { ReactNode } from 'react';\nimport { Direction } from 'radix-ui';\nimport { DirectionProvider as BaseDirectionProvider } from '@base-ui/react/direction-provider';\n\nexport type TextDirection = 'ltr' | 'rtl';\n\nexport interface DirectionProviderProps {\n /** The reading direction for everything inside. */\n direction?: TextDirection;\n /** Same as `direction`; `direction` wins when both are set. */\n dir?: TextDirection;\n children?: ReactNode;\n}\n\n/**\n * Sets the text direction (`ltr` or `rtl`) for the components inside it: menus, popovers,\n * selects, sliders, tabs and comboboxes read it for keyboard arrows, side and alignment.\n *\n * It does not set the `dir` attribute: put `dir=\"rtl\"` on `<html>` (or a wrapper) as well, so\n * the browser lays text out right to left and the logical classes (`ms-*`, `start-*`) flip.\n *\n * Feeds both the Radix and the Base UI direction contexts, since the library uses both.\n */\nexport function DirectionProvider({ direction, dir, children }: DirectionProviderProps) {\n const value = direction ?? dir ?? 'ltr';\n return (\n <Direction.DirectionProvider dir={value}>\n <BaseDirectionProvider direction={value}>{children}</BaseDirectionProvider>\n </Direction.DirectionProvider>\n );\n}\n\n/** The direction set by the nearest `DirectionProvider`, else `ltr`. */\nexport function useDirection(): TextDirection {\n return Direction.useDirection() ?? 'ltr';\n}\n","import { Children, isValidElement, type ElementType, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Card: displays a card with header, content, and footer.\n *\n * `size` (`default` / `sm`) sets the `--card-spacing` variable (16px / 12px) that every part uses\n * for its inset and the gap between sections; override the variable for other spacings.\n *\n * Shorthand: `title`, `description`, `action`, `image` and `footer` render the matching parts,\n * and plain children go in `CardContent`. Composition: `CardHeader` (`CardTitle`,\n * `CardDescription`, `CardAction`), `CardContent`, `CardFooter`; an `<img>` placed first goes edge\n * to edge.\n */\n\nexport type CardSize = 'default' | 'sm';\n\nexport interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Default `default`. */\n size?: CardSize;\n /** Shorthand: the `CardTitle`. */\n title?: ReactNode;\n /** Shorthand: the `CardDescription`. */\n description?: ReactNode;\n /** Shorthand: the `CardAction`, top right of the header. */\n action?: ReactNode;\n /** Shorthand: an `<img>` before the header, edge to edge. */\n image?: ReactNode;\n /** Shorthand: the `CardFooter` content. */\n footer?: ReactNode;\n}\n\nconst PARTS = new Set<unknown>();\n/** Composition when any child is a Card part; otherwise the children are the content. */\nconst isComposed = (children: ReactNode) =>\n Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n\nexport function Card({ size = 'default', title, description, action, image, footer, className, children, ...props }: CardProps) {\n const hasHeader = title != null || description != null || action != null;\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n >\n {image}\n {hasHeader && (\n <CardHeader>\n {title != null && <CardTitle>{title}</CardTitle>}\n {description != null && <CardDescription>{description}</CardDescription>}\n {action != null && <CardAction>{action}</CardAction>}\n </CardHeader>\n )}\n {children == null || isComposed(children) ? children : <CardContent>{children}</CardContent>}\n {footer != null && <CardFooter>{footer}</CardFooter>}\n </div>\n );\n}\n\nexport function CardHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLElement> {\n /** The element, e.g. `h2` to make the title a heading. Default `div`. */\n as?: ElementType;\n}\n\nexport function CardTitle({ as: Tag = 'div', className, ...props }: CardTitleProps) {\n return (\n <Tag\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nexport function CardDescription({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"card-description\" className={cn('text-sm text-muted-foreground', className)} {...props} />;\n}\n\n/** Content at the top end of the header, e.g. a button or a badge. */\nexport function CardAction({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nexport function CardContent({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nPARTS.add(CardHeader);\nPARTS.add(CardContent);\nPARTS.add(CardFooter);\n","import { createContext, useContext, useLayoutEffect, type ReactNode } from 'react';\n\nimport type { MenuItemDef } from '../overlays/menu-core';\n\n/**\n * How a dashboard (`@platned/ui/blocks`) tells its cards they are being arranged. In Customize mode\n * each slot provides this; a card that reads it (the blocks' card frame, StatCard) draws the\n * controls in its own header: the drag handle before its title, and Size and Remove in its `⋯`\n * menu. A card that does not read it (an app's own widget) gets the controls on its corner.\n *\n * It lives in the main entry so the blocks and map entries, which import this one, share it.\n * Internal to the library's blocks: apps don't provide or read it.\n */\nexport interface DashboardEditControls {\n /** The widget's name, for the controls' labels. */\n name: string;\n /** Locked widgets can't be moved, resized or removed: no handle, a lock in place of the menu. */\n locked: boolean;\n /** The drag handle, drawn before the card's title. */\n handle?: ReactNode;\n /** The arranging entries for the card's `⋯` menu (Size, Remove), replacing its own actions. */\n menu: MenuItemDef[];\n /** Called by a card that draws the controls itself, so the slot adds none on its corner. */\n claim: () => void;\n}\n\nexport const DashboardEditContext = createContext<DashboardEditControls | null>(null);\n\n/** The arranging controls when the card sits in a dashboard being customized, else `null`. */\nexport function useDashboardEdit(): DashboardEditControls | null {\n const edit = useContext(DashboardEditContext);\n useLayoutEffect(() => edit?.claim(), [edit]);\n return edit;\n}\n","import {\n createContext,\n forwardRef,\n useContext,\n type ComponentPropsWithoutRef,\n type ForwardedRef,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { Accordion as AccordionPrimitive } from 'radix-ui';\nimport { ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Accordion: a vertically stacked set of headings that each reveal a section of content.\n *\n * Three ways to write one, all rendering the same parts:\n * 1. Data: `items={[{ title, content }]}`, or any objects plus `renderTitle` / `renderContent`.\n * 2. Shorthand: `<AccordionItem value=\"a\" title=\"…\">content</AccordionItem>`.\n * 3. Composition: `AccordionItem` > `AccordionTrigger` + `AccordionContent`, the standard parts.\n *\n * Built on Radix Accordion. Every part takes the Radix part's props (`asChild`, `dir`,\n * `orientation`, `forceMount`, …) and carries `data-slot` and `data-state`. Closed content is\n * unmounted (kept only while the close animation runs), so a closed section is never tabbable.\n * `headingLevel` sets the heading that wraps each trigger (h3 by default).\n */\n\nexport type AccordionType = 'single' | 'multiple';\n\nconst HeadingLevel = createContext<2 | 3 | 4 | 5 | 6>(3);\n\n/** One section as data, for `items`. `value` defaults to the item's index. */\nexport interface AccordionItemDef {\n value?: string;\n title: ReactNode;\n /** A muted second line under the title. */\n description?: ReactNode;\n /** An icon before the title. */\n icon?: ReactNode;\n /** Something after the title, before the chevron: a badge, a count. */\n badge?: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n hidden?: boolean;\n}\n\ntype RootPrimitiveProps = Omit<\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>,\n 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'collapsible' | 'children'\n>;\n\nexport interface AccordionProps<T = AccordionItemDef> extends RootPrimitiveProps {\n /** The parts. Omit when passing `items`. */\n children?: ReactNode;\n /** The sections as data. Use it or `children`, not both. */\n items?: readonly T[];\n /** The value of a data item. Default: `item.value`, else its index. */\n getValue?: (item: T, index: number) => string;\n /** The trigger content of a data item. Default: `item.title` (with `icon`, `description`, `badge`). */\n renderTitle?: (item: T, index: number) => ReactNode;\n /** The content of a data item. Default: `item.content`. */\n renderContent?: (item: T, index: number) => ReactNode;\n /** Whether a data item is disabled. Default: `item.disabled`. */\n getDisabled?: (item: T, index: number) => boolean;\n /** `single` opens one item at a time; `multiple` lets any number be open. Default `single`. */\n type?: AccordionType;\n /** Open item value(s): a string for `single`, an array for `multiple`. */\n value?: string | string[];\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** In `single` mode, allow closing the open item by clicking it. Default `false`. */\n collapsible?: boolean;\n /** Heading level wrapping each trigger. Default `3`. Match the surrounding page outline. */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n}\n\nconst field = <K extends keyof AccordionItemDef>(item: unknown, key: K) =>\n (item as Partial<AccordionItemDef> | null)?.[key];\n\nfunction AccordionRoot<T>(\n {\n children: childrenProp,\n items,\n getValue,\n renderTitle,\n renderContent,\n getDisabled,\n type = 'single',\n value,\n defaultValue,\n onValueChange,\n collapsible = false,\n headingLevel = 3,\n className,\n ...rest\n }: AccordionProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const children = items\n ? items.map((item, index) => {\n if (field(item, 'hidden')) return null;\n const itemValue = getValue ? getValue(item, index) : (field(item, 'value') ?? String(index));\n return (\n <AccordionItem\n key={itemValue}\n value={itemValue}\n disabled={getDisabled ? getDisabled(item, index) : Boolean(field(item, 'disabled'))}\n title={renderTitle ? renderTitle(item, index) : field(item, 'title')}\n description={renderTitle ? undefined : field(item, 'description')}\n icon={renderTitle ? undefined : field(item, 'icon')}\n badge={renderTitle ? undefined : field(item, 'badge')}\n >\n {renderContent ? renderContent(item, index) : field(item, 'content')}\n </AccordionItem>\n );\n })\n : childrenProp;\n\n const shared = { ref, 'data-slot': 'accordion', className: cn('flex w-full flex-col', className), ...rest };\n\n const root =\n type === 'multiple' ? (\n <AccordionPrimitive.Root\n type=\"multiple\"\n value={value === undefined ? undefined : toArray(value)}\n defaultValue={defaultValue === undefined ? undefined : toArray(defaultValue)}\n onValueChange={onValueChange as ((value: string[]) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n ) : (\n <AccordionPrimitive.Root\n type=\"single\"\n collapsible={collapsible}\n value={value === undefined ? undefined : toSingle(value)}\n defaultValue={defaultValue === undefined ? undefined : toSingle(defaultValue)}\n onValueChange={onValueChange as ((value: string) => void) | undefined}\n {...shared}\n >\n {children}\n </AccordionPrimitive.Root>\n );\n\n return <HeadingLevel.Provider value={headingLevel}>{root}</HeadingLevel.Provider>;\n}\n\n/** Generic over the item type, so `renderTitle(item)` is typed by what you pass to `items`. */\nexport const Accordion = forwardRef(AccordionRoot) as <T = AccordionItemDef>(\n props: AccordionProps<T> & RefAttributes<HTMLDivElement>,\n) => ReactElement | null;\n\nconst toArray = (value: string | string[]) => (Array.isArray(value) ? value : value ? [value] : []);\nconst toSingle = (value: string | string[]) => (Array.isArray(value) ? (value[0] ?? '') : value);\n\nexport interface AccordionItemProps extends Omit<ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>, 'title'> {\n /**\n * Shorthand: with `title`, the item renders its own trigger, and its children become the\n * content. Without it, compose `AccordionTrigger` and `AccordionContent` yourself.\n */\n title?: ReactNode;\n /** Shorthand: a muted second line under the title. */\n description?: ReactNode;\n /** Shorthand: an icon before the title. */\n icon?: ReactNode;\n /** Shorthand: something after the title, before the chevron. */\n badge?: ReactNode;\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(function AccordionItem(\n { className, title, description, icon, badge, children, ...rest },\n ref,\n) {\n const shorthand = title !== undefined && title !== null;\n return (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n className={cn('not-last:border-b', className)}\n {...rest}\n >\n {shorthand ? (\n <>\n <AccordionTrigger className={hasSlots({ description, icon, badge }) ? 'hover:no-underline' : undefined}>\n <AccordionTitle title={title} description={description} icon={icon} badge={badge} />\n </AccordionTrigger>\n <AccordionContent>{children}</AccordionContent>\n </>\n ) : (\n children\n )}\n </AccordionPrimitive.Item>\n );\n});\n\nconst hasSlots = ({ description, icon, badge }: Pick<AccordionItemProps, 'description' | 'icon' | 'badge'>) =>\n Boolean(description || icon || badge);\n\n/**\n * The shorthand trigger layout. First line: icon, title, badge. Second line: the description,\n * starting at the trigger's start edge (under the icon), not indented under the title.\n *\n * Only the title underlines on hover. A text decoration on the trigger would run through the\n * badge and the description too (CSS gives descendants no way to opt out), so with slots the\n * trigger drops its own underline and the title takes it from the trigger's hover group.\n */\nfunction AccordionTitle({ title, description, icon, badge }: Pick<AccordionItemProps, 'title' | 'description' | 'icon' | 'badge'>) {\n if (!hasSlots({ description, icon, badge })) return <>{title}</>;\n return (\n <span data-slot=\"accordion-title\" className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"flex min-w-0 items-start gap-3\">\n {icon && (\n <span aria-hidden className=\"flex h-5 shrink-0 items-center text-muted-foreground [&_svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 underline-offset-4 group-hover/accordion-trigger:underline\">{title}</span>\n {badge && <span className=\"flex shrink-0 items-center\">{badge}</span>}\n </span>\n {description && <span className=\"font-normal text-muted-foreground\">{description}</span>}\n </span>\n );\n}\n\nexport interface AccordionTriggerProps extends ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {\n /** Hide the chevron, for a trigger that supplies its own affordance. */\n hideIndicator?: boolean;\n}\n\nexport const AccordionTrigger = forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n function AccordionTrigger({ children, hideIndicator = false, className, ...rest }, ref) {\n const level = useContext(HeadingLevel);\n const Heading = `h${level}` as 'h3';\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"m-0 flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n 'group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none',\n 'hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring',\n 'disabled:pointer-events-none disabled:opacity-50',\n '**:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground',\n className,\n )}\n {...rest}\n >\n {children}\n {!hideIndicator && (\n <>\n <ChevronDownIcon\n aria-hidden\n data-slot=\"accordion-trigger-icon\"\n className=\"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden\"\n />\n <ChevronUpIcon\n aria-hidden\n data-slot=\"accordion-trigger-icon\"\n className=\"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline\"\n />\n </>\n )}\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n },\n);\n\nexport type AccordionContentProps = ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>;\n\n/** `className` styles the inner box (the padding), so the height animation stays on the outer one. */\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n function AccordionContent({ className, children, ...rest }, ref) {\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className=\"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up\"\n {...rest}\n >\n <div\n className={cn(\n 'h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',\n className,\n )}\n >\n {children}\n </div>\n </AccordionPrimitive.Content>\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type ReactNode } from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\n\nexport interface CollapsibleProps extends ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root> {\n /**\n * Shorthand: the trigger's label. Renders a full-width ghost button with a chevron that turns\n * when open, and wraps `children` in `CollapsibleContent`. Leave it out to compose the parts.\n */\n trigger?: ReactNode;\n}\n\n/**\n * A show/hide region with a trigger, on Radix Collapsible. The trigger carries `aria-expanded`\n * and `aria-controls`, the content is removed while closed, and every part has\n * `data-state=\"open\" | \"closed\"`. The open content exposes `--radix-collapsible-content-height`\n * for a height animation.\n */\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { trigger, className, children, ...props },\n ref,\n) {\n if (trigger === undefined) {\n return (\n <CollapsiblePrimitive.Root ref={ref} data-slot=\"collapsible\" className={className} {...props}>\n {children}\n </CollapsiblePrimitive.Root>\n );\n }\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n data-slot=\"collapsible\"\n className={cn('rounded-md data-[state=open]:bg-muted', className)}\n {...props}\n >\n <CollapsibleTrigger asChild>\n <Button variant=\"ghost\" className=\"group w-full\">\n {trigger}\n <ChevronDownIcon className=\"ml-auto group-data-[state=open]:rotate-180\" />\n </Button>\n </CollapsibleTrigger>\n <CollapsibleContent className=\"flex flex-col items-start gap-2 p-2.5 pt-0 text-sm\">{children}</CollapsibleContent>\n </CollapsiblePrimitive.Root>\n );\n});\n\nexport type CollapsibleTriggerProps = ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleTrigger>;\n\nexport const CollapsibleTrigger = forwardRef<HTMLButtonElement, CollapsibleTriggerProps>(\n function CollapsibleTrigger(props, ref) {\n return <CollapsiblePrimitive.CollapsibleTrigger ref={ref} data-slot=\"collapsible-trigger\" {...props} />;\n },\n);\n\nexport type CollapsibleContentProps = ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>;\n\nexport const CollapsibleContent = forwardRef<HTMLDivElement, CollapsibleContentProps>(\n function CollapsibleContent(props, ref) {\n return <CollapsiblePrimitive.CollapsibleContent ref={ref} data-slot=\"collapsible-content\" {...props} />;\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport { AspectRatio as AspectRatioPrimitive } from 'radix-ui';\n\nexport type AspectRatioProps = ComponentPropsWithoutRef<typeof AspectRatioPrimitive.Root>;\n\n/**\n * AspectRatio: displays content within a desired ratio.\n *\n * Built on Radix AspectRatio: an outer box padded to the ratio and an absolutely positioned\n * inner box (this element, with `data-slot=\"aspect-ratio\"`). `ratio` is width ÷ height\n * (`16 / 9`, `1`, `9 / 16`), default `1`. The content is not resized for you: give an image\n * `className=\"size-full object-cover\"` (and the same rounding as the box) so it fills and crops.\n */\nexport const AspectRatio = forwardRef<HTMLDivElement, AspectRatioProps>(function AspectRatio(props, ref) {\n return <AspectRatioPrimitive.Root ref={ref} data-slot=\"aspect-ratio\" {...props} />;\n});\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Button } from '../forms/button';\n\n/**\n * Carousel: a carousel with motion and swipe built using Embla.\n *\n * `opts` are Embla options (`align`, `loop`, `direction`…), `plugins` Embla plugins (e.g.\n * `Autoplay` from `embla-carousel-autoplay`), `setApi` hands back the Embla API for counters,\n * dots or events. Item size is a `basis-*` class on `CarouselItem`; spacing is `ps-*` on the items\n * with a matching negative `-ms-*` on `CarouselContent`.\n *\n * Shorthand: `items` renders `CarouselContent`, one `CarouselItem` per entry (with\n * `itemClassName`), and the previous / next buttons.\n *\n * Accessibility on top of the engine: each slide is named by its position (\"2 of 5\") unless it has\n * its own `aria-label`, and slides out of view are `inert`, so Tab never lands in a hidden slide.\n *\n * Where the browser APIs Embla needs are missing (ResizeObserver, IntersectionObserver, matchMedia,\n * as in a bare jsdom test), the engine is never started and the slides render as a static row.\n */\n\nexport type CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\nexport type CarouselProps = ComponentProps<'div'> & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n /** Default `horizontal`. */\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n /** Shorthand: one `CarouselItem` per entry, plus the previous / next buttons. */\n items?: readonly ReactNode[];\n /** Shorthand: classes for every item, e.g. `basis-1/3`. */\n itemClassName?: string;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & Pick<CarouselProps, 'opts' | 'plugins' | 'orientation' | 'setApi'>;\n\nconst CarouselContext = createContext<CarouselContextProps | null>(null);\n\nexport function useCarousel() {\n const context = useContext(CarouselContext);\n if (!context) throw new Error('useCarousel must be used within a <Carousel />');\n return context;\n}\n\n/** Embla observes size, visibility and media queries; without those APIs it throws on mount. */\nconst canRunEngine = () =>\n typeof window !== 'undefined' &&\n 'ResizeObserver' in window &&\n 'IntersectionObserver' in window &&\n typeof window.matchMedia === 'function';\n\nexport function Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n items,\n itemClassName,\n className,\n children,\n ...props\n}: CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n // A slide counts as in view (and stays out of `inert`) once half of it shows; Embla's\n // default of any pixel would keep the neighbour's padding edge reachable.\n inViewThreshold: 0.5,\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = useState(false);\n const [canScrollNext, setCanScrollNext] = useState(false);\n\n const onSelect = useCallback((emblaApi: CarouselApi) => {\n if (!emblaApi) return;\n setCanScrollPrev(emblaApi.canScrollPrev());\n setCanScrollNext(emblaApi.canScrollNext());\n }, []);\n\n const scrollPrev = useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n useEffect(() => {\n if (!api || !setApi) return;\n setApi(api);\n }, [api, setApi]);\n\n useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n // Slides out of view are inert, so their links and buttons leave the tab order and the\n // accessibility tree; a scrolled-away slide otherwise stays reachable by Tab.\n useEffect(() => {\n if (!api) return;\n const syncInert = () => {\n const inView = new Set(api.slidesInView());\n api.slideNodes().forEach((node, index) => node.toggleAttribute('inert', !inView.has(index)));\n };\n syncInert();\n api.on('slidesInView', syncInert);\n api.on('reInit', syncInert);\n return () => {\n api.off('slidesInView', syncInert);\n api.off('reInit', syncInert);\n };\n }, [api]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {items ? (\n <>\n <CarouselContent>\n {items.map((item, index) => (\n <CarouselItem key={index} className={itemClassName}>\n {item}\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </>\n ) : null}\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\nexport function CarouselContent({ className, ...props }: ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n const trackRef = useRef<HTMLDivElement>(null);\n\n // Name each slide by its position (\"2 of 5\") unless the caller named it.\n useLayoutEffect(() => {\n const slides = trackRef.current?.querySelectorAll<HTMLElement>(':scope > [data-slot=\"carousel-item\"]') ?? [];\n slides.forEach((slide, index) => {\n if (slide.hasAttribute('aria-label') && !slide.hasAttribute('data-auto-label')) return;\n slide.setAttribute('aria-label', `${index + 1} of ${slides.length}`);\n slide.setAttribute('data-auto-label', '');\n });\n });\n\n // Without the engine's browser APIs, leave the viewport unattached so Embla never starts.\n return (\n <div ref={canRunEngine() ? carouselRef : undefined} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div\n ref={trackRef}\n className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n}\n\nexport function CarouselItem({ className, ...props }: ComponentProps<'div'>) {\n const { orientation } = useCarousel();\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nexport function CarouselPrevious({ className, variant = 'outline', size = 'icon-sm', ...props }: ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal' ? 'inset-y-0 -start-12 my-auto' : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nexport function CarouselNext({ className, variant = 'outline', size = 'icon-sm', ...props }: ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal' ? 'inset-y-0 -end-12 my-auto' : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n","import { Fragment, type ReactNode } from 'react';\nimport { Group, Panel, Separator, type GroupProps, type PanelProps, type SeparatorProps } from 'react-resizable-panels';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Resizable: accessible resizable panel groups and layouts with keyboard support.\n *\n * Built on `react-resizable-panels` (a regular dependency). Any number of panels, nested groups,\n * min / max / collapsible panels, and layout persistence through `onLayoutChange`. Sizes are\n * strings (`\"50%\"`, `\"240px\"`) or numbers (percentages). Each handle is a focusable separator:\n * the arrow keys resize, Home / End go to the bounds, Enter collapses a collapsible panel.\n *\n * Two ways to write one:\n * - Shorthand: `<ResizablePanelGroup panels={[{ content, defaultSize }]} withHandle />` renders\n * the panels with a handle between each pair.\n * - Composition: `ResizablePanelGroup` > `ResizablePanel`, `ResizableHandle`, `ResizablePanel`.\n *\n * A group measures itself with `ResizeObserver`, which a bare jsdom lacks: tests that render one\n * need a stub (see `resizable.test.tsx`).\n */\n\n/** One panel as data, for the `panels` shorthand: the content plus the `ResizablePanel` props. */\nexport interface ResizablePanelDefinition extends Omit<PanelProps, 'children' | 'content'> {\n content: ReactNode;\n}\n\nexport type ResizablePanelGroupProps = GroupProps & {\n /** Shorthand: the panels as data, rendered with a `ResizableHandle` between each pair. */\n panels?: readonly ResizablePanelDefinition[];\n /** Shorthand: show the grip on the handles the `panels` shorthand renders. */\n withHandle?: boolean;\n};\n\nexport function ResizablePanelGroup({ className, panels, withHandle, children, ...props }: ResizablePanelGroupProps) {\n return (\n <Group\n data-slot=\"resizable-panel-group\"\n className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}\n {...props}\n >\n {panels\n ? panels.map(({ content, ...panel }, index) => (\n <Fragment key={panel.id ?? index}>\n {index > 0 && <ResizableHandle withHandle={withHandle} />}\n <ResizablePanel {...panel}>{content}</ResizablePanel>\n </Fragment>\n ))\n : children}\n </Group>\n );\n}\n\nexport type ResizablePanelProps = PanelProps;\n\nexport function ResizablePanel(props: ResizablePanelProps) {\n return <Panel data-slot=\"resizable-panel\" {...props} />;\n}\n\nexport type ResizableHandleProps = SeparatorProps & {\n /** Show a visible grip on the handle. */\n withHandle?: boolean;\n};\n\nexport function ResizableHandle({ withHandle, className, ...props }: ResizableHandleProps) {\n return (\n <Separator\n data-slot=\"resizable-handle\"\n className={cn(\n 'relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',\n className,\n )}\n {...props}\n >\n {withHandle && <div className=\"z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border\" />}\n </Separator>\n );\n}\n\nexport type {\n GroupImperativeHandle as ResizablePanelGroupHandle,\n PanelImperativeHandle as ResizablePanelHandle,\n Layout as ResizableLayout,\n} from 'react-resizable-panels';\n","import {\n createContext,\n forwardRef,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ComponentProps,\n type ComponentType,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefAttributes,\n} from 'react';\nimport { Slot } from 'radix-ui';\nimport { ChevronRightIcon, PanelLeftIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { useMediaQuery } from '../../lib/use-media-query';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../cards/collapsible';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../overlays/dropdown-menu';\nimport { Skeleton } from '../feedback/skeleton';\nimport { Button, type ButtonProps } from '../forms/button';\nimport { Input, type InputProps } from '../forms/input';\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '../overlays/sheet';\nimport { Tooltip, TooltipProvider } from '../overlays/tooltip';\nimport { Separator, type SeparatorProps } from './separator';\n\n/**\n * Sidebar: a composable, themeable and customizable sidebar component.\n *\n * `SidebarProvider` holds the state (`open` / `defaultOpen` / `onOpenChange`, saved in the\n * `sidebar_state` cookie; Cmd/Ctrl+B toggles it) and the widths (`--sidebar-width` 16rem,\n * `--sidebar-width-icon` 3rem). Below `md` the sidebar is a Sheet opened by `SidebarTrigger`.\n *\n * Two ways to write one:\n * - Shorthand: `<Sidebar groups={nav} footerNav brand footer linkComponent currentPath />`\n * renders the header, the grouped menu (nested rows, foldable groups, badges, group actions)\n * and the footer from data, with the current row worked out from `currentPath`.\n * - Composition: `Sidebar` > `SidebarHeader`, `SidebarContent` (`SidebarGroup` >\n * `SidebarGroupLabel`, `SidebarGroupContent` > `SidebarMenu` > `SidebarMenuItem` >\n * `SidebarMenuButton`), `SidebarFooter`, beside a `SidebarInset` for the page.\n */\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state';\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n/** Below `md` the sidebar leaves the page and becomes a sheet. */\nconst MOBILE_QUERY = '(max-width: 767.98px)';\n\n// ── Provider ───────────────────────────────────────────────────────────────────\n\nexport interface SidebarContextValue {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\nexport function useSidebar(): SidebarContextValue {\n const context = useContext(SidebarContext);\n if (!context) throw new Error('useSidebar must be used within a SidebarProvider.');\n return context;\n}\n\nexport interface SidebarProviderProps extends ComponentProps<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nexport function SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n}: SidebarProviderProps) {\n const isMobile = useMediaQuery(MOBILE_QUERY);\n const [openMobile, setOpenMobile] = useState(false);\n\n // The internal state, unless `open` / `onOpenChange` control it from outside.\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) setOpenProp(openState);\n else _setOpen(openState);\n // Kept in a cookie, so a server render can open the sidebar the way the user left it.\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n },\n [setOpenProp, open],\n );\n\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Cmd/Ctrl+B toggles the sidebar.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextValue>(\n () => ({ state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n { '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON, ...style } as CSSProperties\n }\n className={cn('group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar', className)}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\n// ── Sidebar ────────────────────────────────────────────────────────────────────\n\nexport type SidebarSide = 'left' | 'right';\nexport type SidebarVariant = 'sidebar' | 'floating' | 'inset';\nexport type SidebarCollapsible = 'offcanvas' | 'icon' | 'none';\n\nexport interface SidebarFrameProps extends ComponentProps<'div'> {\n side?: SidebarSide;\n variant?: SidebarVariant;\n collapsible?: SidebarCollapsible;\n}\n\nfunction SidebarFrame({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n dir,\n ...props\n}: SidebarFrameProps) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn('flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground', className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n dir={dir}\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as CSSProperties}\n side={side}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-sidebar-foreground md:block\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* Holds the sidebar's room in the page layout on desktop. */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n 'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating' || variant === 'inset'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n data-side={side}\n className={cn(\n 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex',\n variant === 'floating' || variant === 'inset'\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'\n : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nexport interface SidebarTriggerProps extends ButtonProps {}\n\nexport const SidebarTrigger = forwardRef<HTMLButtonElement, SidebarTriggerProps>(function SidebarTrigger(\n { className, onClick, ...props },\n ref,\n) {\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n ref={ref}\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon-sm\"\n className={className}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n});\n\nexport function SidebarRail({ className, ...props }: ComponentProps<'button'>) {\n const { toggleSidebar } = useSidebar();\n return (\n <button\n type=\"button\"\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n 'absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2',\n 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',\n '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',\n '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarInset({ className, ...props }: ComponentProps<'main'>) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n 'relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarInput({ className, ...props }: InputProps) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn('h-8 w-full bg-background shadow-none', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarHeader({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarFooter({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n}\n\nexport type SidebarSeparatorProps = SeparatorProps;\n\nexport function SidebarSeparator({ className, ...props }: SidebarSeparatorProps) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n 'no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroup({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupLabel({\n className,\n asChild = false,\n ...props\n}: ComponentProps<'div'> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'div';\n return (\n <Comp\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupAction({\n className,\n asChild = false,\n ...props\n}: ComponentProps<'button'> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : 'button';\n return (\n <Comp\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n 'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarGroupContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn('w-full text-sm', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarMenu({ className, ...props }: ComponentProps<'ul'>) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn('flex w-full min-w-0 flex-col gap-0', className)}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuItem({ className, ...props }: ComponentProps<'li'>) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn('group/menu-item relative', className)}\n {...props}\n />\n );\n}\n\nexport type SidebarMenuButtonVariant = 'default' | 'outline';\nexport type SidebarMenuButtonSize = 'default' | 'sm' | 'lg';\n\nconst MENU_BUTTON_VARIANT: Record<SidebarMenuButtonVariant, string> = {\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n outline:\n 'bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',\n};\n\nconst MENU_BUTTON_SIZE: Record<SidebarMenuButtonSize, string> = {\n default: 'h-8 text-sm',\n sm: 'h-7 text-xs',\n lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',\n};\n\nexport interface SidebarMenuButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n isActive?: boolean;\n variant?: SidebarMenuButtonVariant;\n size?: SidebarMenuButtonSize;\n /** Shown beside the button while the sidebar is collapsed to icons. */\n tooltip?: ReactNode;\n}\n\nexport const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(function SidebarMenuButton(\n { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot.Root : 'button';\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding]',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground',\n 'data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n 'group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2!',\n '[&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate',\n MENU_BUTTON_VARIANT[variant],\n MENU_BUTTON_SIZE[size],\n className,\n )}\n {...props}\n />\n );\n\n // The label is on screen unless the sidebar is collapsed to icons.\n if (!tooltip || state !== 'collapsed' || isMobile) return button;\n return (\n <Tooltip content={tooltip} side=\"right\" align=\"center\">\n {button}\n </Tooltip>\n );\n});\n\nexport function SidebarMenuAction({\n className,\n asChild = false,\n showOnHover = false,\n ...props\n}: ComponentProps<'button'> & { asChild?: boolean; showOnHover?: boolean }) {\n const Comp = asChild ? Slot.Root : 'button';\n return (\n <Comp\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n 'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',\n showOnHover &&\n 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuBadge({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n 'pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: ComponentProps<'div'> & { showIcon?: boolean }) {\n // A width between 50 and 90%, so a list of skeletons does not look like a ruled block.\n const [width] = useState(() => `${Math.floor(Math.random() * 40) + 50}%`);\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={{ '--skeleton-width': width } as CSSProperties}\n />\n </div>\n );\n}\n\nexport function SidebarMenuSub({ className, ...props }: ComponentProps<'ul'>) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function SidebarMenuSubItem({ className, ...props }: ComponentProps<'li'>) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn('group/menu-sub-item relative', className)}\n {...props}\n />\n );\n}\n\nexport interface SidebarMenuSubButtonProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n asChild?: boolean;\n size?: 'sm' | 'md';\n isActive?: boolean;\n}\n\nexport const SidebarMenuSubButton = forwardRef<HTMLAnchorElement, SidebarMenuSubButtonProps>(\n function SidebarMenuSubButton({ asChild = false, size = 'md', isActive = false, className, ...props }, ref) {\n const Comp = asChild ? Slot.Root : 'a';\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n 'data-[size=md]:text-sm data-[size=sm]:text-xs [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\n// ── Shorthand: the nav as data ─────────────────────────────────────────────────\n\nexport interface SidebarNavItem {\n /** Stable key. Falls back to `to`, then `href`, then `label`. */\n id?: string;\n /**\n * An in-app destination, rendered through `linkComponent`. May carry a hash\n * (`/docs/floating#tooltip`): that row is current only when the hash matches too, and the\n * page's own plain row steps aside while it is.\n */\n to?: string;\n /** An external destination, opened in a new tab as a plain `<a>`. */\n href?: string;\n label: string;\n icon?: ReactNode;\n /** A count or short status at the end of the row (`SidebarMenuBadge`). */\n badge?: ReactNode;\n /** Match the path exactly rather than as a prefix. Needed for an index route. */\n end?: boolean;\n /** A destination that exists but cannot be opened right now. */\n disabled?: boolean;\n /** Overrides route matching. */\n isActive?: boolean;\n /**\n * Child rows, one level deep, in a foldable sub-menu. With a `to` or `href` of its own (from 1.1.1), the row opens\n * that page (a section's overview, say) and a chevron button beside it folds the children.\n */\n children?: SidebarNavItem[];\n /** Whether the children start open. Default: open when one of them is the current route. */\n defaultOpen?: boolean;\n /** A button at the end of the row, such as a menu of row actions (`SidebarMenuAction`). Shows on hover. */\n action?: ReactNode;\n}\n\nexport interface SidebarNavGroup {\n /** Stable key. Falls back to `title`. */\n id?: string;\n /** The group's label. Omit for an ungrouped run of rows. */\n title?: string;\n items: SidebarNavItem[];\n /** Make the label a toggle that folds the group away. Needs a `title`. */\n collapsible?: boolean;\n /** With `collapsible`: whether the group starts open. Default `true`. */\n defaultOpen?: boolean;\n /** A button at the end of the label — an \"add\" action, say (`SidebarGroupAction`). */\n action?: ReactNode;\n /** Anything below the rows, or in place of them with `items: []`: a tree, a calendar, a card. */\n content?: ReactNode;\n /** Classes for the group, e.g. `mt-auto` to pin it to the bottom of the nav. */\n className?: string;\n}\n\nexport interface SidebarLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n href: string;\n}\n\n/** Renders an in-app row's link; it must forward its ref to the anchor (`next/link` and react-router's `Link` do). */\nexport type SidebarLinkComponent = ComponentType<SidebarLinkProps & RefAttributes<HTMLAnchorElement>>;\n\nexport interface SidebarRenderState {\n /** Collapsed to icons. */\n collapsed: boolean;\n}\n\nexport interface SidebarProps extends SidebarFrameProps {\n /** Shorthand: the grouped nav. One untitled group is a flat list. */\n groups?: SidebarNavGroup[];\n /** Shorthand: rows pinned below the nav — settings, help. */\n footerNav?: SidebarNavItem[];\n /** Shorthand: the header's content. A function gets the render state. */\n brand?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Shorthand: the footer's content, below `footerNav`. A function gets the render state. */\n footer?: ReactNode | ((state: SidebarRenderState) => ReactNode);\n /** Shorthand: the current pathname, which decides the current row. */\n currentPath?: string;\n /** Shorthand: the current hash, for rows that link to a section. */\n currentHash?: string;\n /** Shorthand: renders in-app links. Default a plain `<a>`. */\n linkComponent?: SidebarLinkComponent;\n /** Shorthand: called when a row is pressed, after the mobile sheet has closed. */\n onNavigate?: () => void;\n /** Shorthand: names the nav landmark. Default \"Primary\". */\n label?: string;\n /** Shorthand: add a `SidebarRail` to toggle the sidebar from its edge. */\n rail?: boolean;\n /**\n * Shorthand: how rows with children open. `collapsible` (default) folds them open below the\n * row; `dropdown` opens them in a menu beside it, which also works when collapsed to icons.\n */\n submenus?: 'collapsible' | 'dropdown';\n}\n\nexport function Sidebar({\n groups,\n footerNav,\n brand,\n footer,\n currentPath,\n currentHash,\n linkComponent,\n onNavigate,\n label = 'Primary',\n rail = false,\n submenus = 'collapsible',\n children,\n ...props\n}: SidebarProps) {\n if (!groups) return <SidebarFrame {...props}>{children}</SidebarFrame>;\n return (\n <SidebarFrame {...props}>\n <SidebarFromData\n groups={groups}\n footerNav={footerNav}\n brand={brand}\n footer={footer}\n currentPath={currentPath}\n currentHash={currentHash}\n linkComponent={linkComponent ?? DefaultLink}\n onNavigate={onNavigate}\n label={label}\n submenus={submenus}\n collapsible={props.collapsible ?? 'offcanvas'}\n />\n {rail && <SidebarRail />}\n </SidebarFrame>\n );\n}\n\nconst DefaultLink = forwardRef<HTMLAnchorElement, SidebarLinkProps>(function DefaultLink({ children, ...rest }, ref) {\n return (\n <a ref={ref} {...rest}>\n {children}\n </a>\n );\n});\n\ninterface RowContext {\n path?: string;\n hash?: string;\n hashTargets: Set<string>;\n Link: SidebarLinkComponent;\n onNavigate: () => void;\n submenus: 'collapsible' | 'dropdown';\n isMobile: boolean;\n}\n\nconst Row = createContext<RowContext | null>(null);\n\nfunction useRow(): RowContext {\n const value = useContext(Row);\n if (!value) throw new Error('Sidebar rows must be rendered by <Sidebar groups>');\n return value;\n}\n\nfunction SidebarFromData({\n groups,\n footerNav,\n brand,\n footer,\n currentPath,\n currentHash,\n linkComponent,\n onNavigate,\n label,\n submenus,\n collapsible,\n}: Required<Pick<SidebarProps, 'groups' | 'linkComponent' | 'label' | 'submenus'>> &\n Pick<SidebarProps, 'footerNav' | 'brand' | 'footer' | 'currentPath' | 'currentHash' | 'onNavigate'> & {\n collapsible: SidebarCollapsible;\n }) {\n const { state, isMobile, setOpenMobile } = useSidebar();\n const renderState: SidebarRenderState = { collapsed: !isMobile && state === 'collapsed' && collapsible === 'icon' };\n\n const hashTargets = useMemo(\n () =>\n new Set(\n [...groups.flatMap((group) => group.items), ...(footerNav ?? [])]\n .flatMap((item) => [item, ...(item.children ?? [])])\n .map((item) => item.to)\n .filter((to): to is string => to?.includes('#') ?? false),\n ),\n [groups, footerNav],\n );\n\n const row = useMemo<RowContext>(\n () => ({\n path: currentPath,\n hash: currentHash,\n hashTargets,\n Link: linkComponent,\n onNavigate: () => {\n setOpenMobile(false);\n onNavigate?.();\n },\n submenus,\n isMobile,\n }),\n [currentPath, currentHash, hashTargets, linkComponent, setOpenMobile, onNavigate, submenus, isMobile],\n );\n\n const brandNode = typeof brand === 'function' ? brand(renderState) : brand;\n const footerNode = typeof footer === 'function' ? footer(renderState) : footer;\n\n return (\n <Row.Provider value={row}>\n {brandNode != null && <SidebarHeader>{brandNode}</SidebarHeader>}\n <SidebarContent>\n <nav aria-label={label} className=\"flex flex-1 flex-col\">\n {groups.map((group, index) => (\n <NavGroup key={group.id ?? group.title ?? index} group={group} />\n ))}\n </nav>\n </SidebarContent>\n {(footerNav?.length || footerNode != null) && (\n <SidebarFooter>\n {footerNav?.length ? (\n <SidebarMenu>\n {footerNav.map((item) => (\n <NavRow key={itemKey(item)} item={item} />\n ))}\n </SidebarMenu>\n ) : null}\n {footerNode}\n </SidebarFooter>\n )}\n </Row.Provider>\n );\n}\n\nfunction itemKey(item: SidebarNavItem): string {\n return item.id ?? item.to ?? item.href ?? item.label;\n}\n\nfunction NavGroup({ group }: { group: SidebarNavGroup }) {\n const menu = (\n <>\n {group.items.length > 0 && (\n <SidebarGroupContent>\n <SidebarMenu>\n {group.items.map((item) => (\n <NavRow key={itemKey(item)} item={item} />\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n )}\n {group.content}\n </>\n );\n const action =\n group.action == null ? null : isValidElement(group.action) ? (\n <SidebarGroupAction asChild>{group.action}</SidebarGroupAction>\n ) : (\n <SidebarGroupAction>{group.action}</SidebarGroupAction>\n );\n\n if (group.collapsible && group.title) {\n return (\n <Collapsible defaultOpen={group.defaultOpen ?? true} className=\"group/collapsible\">\n <SidebarGroup className={group.className}>\n <SidebarGroupLabel asChild>\n <CollapsibleTrigger>\n {group.title}\n <ChevronRightIcon className=\"ms-auto transition-transform group-data-[state=open]/collapsible:rotate-90 rtl:rotate-180\" />\n </CollapsibleTrigger>\n </SidebarGroupLabel>\n {action}\n <CollapsibleContent>{menu}</CollapsibleContent>\n </SidebarGroup>\n </Collapsible>\n );\n }\n\n return (\n <SidebarGroup className={group.className}>\n {group.title && <SidebarGroupLabel>{group.title}</SidebarGroupLabel>}\n {action}\n {menu}\n </SidebarGroup>\n );\n}\n\n/**\n * Whether a row is the current one. Hash-aware: with rows linking to sections of one page,\n * only the row naming the shown section is current, and the page's plain row steps aside.\n */\nfunction isRowActive(item: SidebarNavItem, row: RowContext): boolean {\n if (item.isActive !== undefined) return item.isActive;\n if (!item.to || row.path === undefined) return false;\n const [path, hash] = item.to.split('#');\n const pathMatches = item.end\n ? row.path === path\n : row.path === path || row.path.startsWith(`${path.replace(/\\/$/, '')}/`);\n if (!pathMatches) return false;\n if (hash !== undefined) return row.hash === `#${hash}`;\n return !row.hashTargets.has(`${row.path}${row.hash ?? ''}`);\n}\n\n/** Runs the row's own handler, then the sidebar's — unless the row refused the press. */\nfunction navigateHandler(row: RowContext, disabled?: boolean) {\n return (event: ReactMouseEvent<HTMLElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n if (!event.defaultPrevented) row.onNavigate();\n };\n}\n\n/** The row's anchor. `asChild` parts merge their classes and state onto it, so it forwards everything. */\nconst RowLink = forwardRef<\n HTMLAnchorElement,\n AnchorHTMLAttributes<HTMLAnchorElement> & { item: SidebarNavItem; row: RowContext }\n>(function RowLink({ item, row, children, onClick, ...rest }, ref) {\n const disabledProps = item.disabled ? { 'aria-disabled': true, tabIndex: -1 } : {};\n const handleClick = (event: ReactMouseEvent<HTMLAnchorElement>) => {\n onClick?.(event);\n navigateHandler(row, item.disabled)(event);\n };\n if (item.href) {\n return (\n <a ref={ref} {...rest} href={item.href} target=\"_blank\" rel=\"noreferrer\" onClick={handleClick} {...disabledProps}>\n {children}\n </a>\n );\n }\n const { Link } = row;\n return (\n <Link ref={ref} {...rest} href={item.to!} onClick={handleClick} {...disabledProps}>\n {children}\n </Link>\n );\n});\n\nfunction RowLabel({ item }: { item: SidebarNavItem }) {\n return (\n <>\n {item.icon}\n <span>{item.label}</span>\n </>\n );\n}\n\nfunction NavRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n if (item.children?.length) return <NavParentRow item={item} />;\n const active = isRowActive(item, row);\n const current = active ? { 'aria-current': 'page' as const } : {};\n\n return (\n <SidebarMenuItem>\n {item.to || item.href ? (\n <SidebarMenuButton asChild isActive={active} tooltip={item.label} {...current}>\n <RowLink item={item} row={row}>\n <RowLabel item={item} />\n </RowLink>\n </SidebarMenuButton>\n ) : (\n <SidebarMenuButton isActive={active} tooltip={item.label} disabled={item.disabled}>\n <RowLabel item={item} />\n </SidebarMenuButton>\n )}\n {item.badge != null && <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>}\n {rowAction(item)}\n </SidebarMenuItem>\n );\n}\n\n/** The row's own action: an element becomes the `SidebarMenuAction` (asChild), anything else goes inside one. */\nfunction rowAction(item: SidebarNavItem) {\n if (item.action == null) return null;\n return isValidElement(item.action) ? (\n <SidebarMenuAction asChild showOnHover>\n {item.action}\n </SidebarMenuAction>\n ) : (\n <SidebarMenuAction showOnHover>{item.action}</SidebarMenuAction>\n );\n}\n\nfunction NavParentRow({ item }: { item: SidebarNavItem }) {\n const row = useRow();\n const children = item.children ?? [];\n const childActive = children.some((child) => isRowActive(child, row));\n // A parent with a destination of its own opens it; current when its own page or one of its children is.\n const links = Boolean(item.to || item.href);\n const ownActive = links && !childActive && isRowActive(item, row);\n const ownCurrent = ownActive ? { 'aria-current': 'page' as const } : {};\n\n if (row.submenus === 'dropdown') {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n tooltip={item.label}\n isActive={childActive || ownActive}\n disabled={item.disabled}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n <RowLabel item={item} />\n <ChevronRightIcon className=\"ms-auto rtl:rotate-180\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent side={row.isMobile ? 'bottom' : 'right'} align=\"start\" className=\"min-w-48\">\n {links && (\n <>\n <DropdownMenuItem asChild disabled={item.disabled}>\n <RowLink item={item} row={row} {...ownCurrent}>\n {item.label}\n </RowLink>\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n </>\n )}\n {children.map((child) => {\n const active = isRowActive(child, row);\n return (\n <DropdownMenuItem key={itemKey(child)} asChild disabled={child.disabled}>\n <RowLink item={child} row={row} {...(active ? { 'aria-current': 'page' } : {})}>\n <RowLabel item={child} />\n </RowLink>\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n {rowAction(item)}\n </SidebarMenuItem>\n );\n }\n\n const sub = (\n <CollapsibleContent>\n <SidebarMenuSub>\n {children.map((child) => {\n const active = isRowActive(child, row);\n return (\n <SidebarMenuSubItem key={itemKey(child)}>\n <SidebarMenuSubButton asChild isActive={active} {...(active ? { 'aria-current': 'page' } : {})}>\n <RowLink item={child} row={row}>\n <RowLabel item={child} />\n </RowLink>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n );\n })}\n </SidebarMenuSub>\n </CollapsibleContent>\n );\n\n if (links) {\n // The row is a link to its own page; the chevron beside it is the fold, a button of its own.\n return (\n <Collapsible asChild defaultOpen={item.defaultOpen ?? (childActive || ownActive)} className=\"group/collapsible\">\n <SidebarMenuItem>\n <SidebarMenuButton asChild tooltip={item.label} isActive={childActive || ownActive} {...ownCurrent}>\n <RowLink item={item} row={row}>\n <RowLabel item={item} />\n </RowLink>\n </SidebarMenuButton>\n <CollapsibleTrigger asChild>\n <SidebarMenuAction aria-label={`${item.label} pages`} disabled={item.disabled} className=\"data-[state=open]:[&>svg]:rotate-90\">\n <ChevronRightIcon className=\"transition-transform duration-200 rtl:rotate-180\" />\n </SidebarMenuAction>\n </CollapsibleTrigger>\n {sub}\n </SidebarMenuItem>\n </Collapsible>\n );\n }\n\n return (\n <Collapsible asChild defaultOpen={item.defaultOpen ?? childActive} className=\"group/collapsible\">\n <SidebarMenuItem>\n <CollapsibleTrigger asChild>\n <SidebarMenuButton\n tooltip={item.label}\n isActive={childActive}\n disabled={item.disabled}\n // From its own state, not the nearest open collapsible: the row may sit in a foldable group.\n className=\"data-[state=open]:[&>svg:last-child]:rotate-90\"\n >\n <RowLabel item={item} />\n <ChevronRightIcon className=\"ms-auto transition-transform duration-200 rtl:rotate-180\" />\n </SidebarMenuButton>\n </CollapsibleTrigger>\n {sub}\n </SidebarMenuItem>\n </Collapsible>\n );\n}\n\n// ── filterNav ──────────────────────────────────────────────────────────────────\n\ninterface NavTreeItem {\n to?: string;\n href?: string;\n children?: NavTreeItem[];\n}\n\n/**\n * The nav a user may see: drops every item `isVisible` refuses, then every parent left with\n * no children and nowhere of its own to go, then every group left empty.\n *\n * The sidebar does not know about permissions and should not; this is where an app's rule\n * meets its nav data. Hiding a row is not access control — the route and the API still have\n * to refuse.\n *\n * const visible = filterNav(navConfig, (item) => !item.requires || item.requires.some(can));\n */\nexport function filterNav<G extends { items: NavTreeItem[] }>(\n groups: readonly G[],\n isVisible: (item: G['items'][number]) => boolean,\n): G[] {\n return groups\n .map((group) => ({ ...group, items: filterNavItems(group.items, isVisible) }))\n .filter((group) => group.items.length > 0);\n}\n\n/** `filterNav` for a single list of items, e.g. `footerNav`. */\nexport function filterNavItems<I extends NavTreeItem>(items: readonly I[], isVisible: (item: I) => boolean): I[] {\n return items.flatMap((item) => {\n if (!isVisible(item)) return [];\n if (!item.children) return [item];\n const children = filterNavItems(item.children as I[], isVisible);\n if (children.length === 0 && !item.to && !item.href) return [];\n return [{ ...item, children }];\n });\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/**\n * Whether a CSS media query matches, kept in sync as the viewport changes.\n *\n * `false` on the server and wherever `matchMedia` is missing — jsdom has none, and a\n * consumer's test setup should not have to polyfill it for a component to render — so the\n * first client render agrees with the server's and hydration does not warn.\n */\nexport function useMediaQuery(query: string): boolean {\n const subscribe = useCallback(\n (onChange: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const list = window.matchMedia(query);\n list.addEventListener('change', onChange);\n return () => list.removeEventListener('change', onChange);\n },\n [query],\n );\n const getSnapshot = () =>\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(query).matches\n : false;\n return useSyncExternalStore(subscribe, getSnapshot, () => false);\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Kbd: a keyboard key. Renders a real `<kbd>`, so assistive tech announces it as key input\n * rather than as a stray glyph (`⌘K` read as plain text is \"place of interest sign K\").\n *\n * Two ways to write a shortcut:\n * - Shorthand: `<KbdGroup keys={['Ctrl', 'B']} />`.\n * - Composition: `<KbdGroup><Kbd>Ctrl</Kbd><Kbd>B</Kbd></KbdGroup>`.\n *\n * One key per `Kbd`, so a shortcut reads as separate keys. Inside a tooltip the keys take the\n * tooltip's inverted colours.\n */\nexport type KbdProps = HTMLAttributes<HTMLElement>;\n\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd({ className, ...props }, ref) {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(\n \"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface KbdGroupProps extends HTMLAttributes<HTMLElement> {\n /** Shorthand: one `Kbd` per key, in order. */\n keys?: ReactNode[];\n}\n\nexport const KbdGroup = forwardRef<HTMLElement, KbdGroupProps>(function KbdGroup(\n { className, keys, children, ...props },\n ref,\n) {\n return (\n <kbd ref={ref} data-slot=\"kbd-group\" className={cn('inline-flex items-center gap-1', className)} {...props}>\n {keys ? keys.map((key, i) => <Kbd key={i}>{key}</Kbd>) : children}\n </kbd>\n );\n});\n","import { Fragment, forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';\nimport { ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Breadcrumb: displays the path to the current resource using a hierarchy of links.\n *\n * Two ways to write one:\n * - Data: `<Breadcrumb items={[{ label: 'Home', href: '/' }, { label: 'Settings' }]} />`. The last\n * item is the current page, separators are added for you, `renderLink` renders router links and\n * `maxItems` collapses the middle of a long trail into an ellipsis.\n * - Composition: `BreadcrumbList`, `BreadcrumbItem`, `BreadcrumbLink`, `BreadcrumbPage`,\n * `BreadcrumbSeparator`, `BreadcrumbEllipsis`.\n *\n * A `<nav>` around an ordered list: the order is the hierarchy, and the landmark lets a screen\n * reader user jump to the trail. Separators and the ellipsis are hidden from assistive tech.\n */\n\n/** One crumb as data. */\nexport interface BreadcrumbItemDef {\n label: ReactNode;\n /** Omit on the current page. */\n href?: string;\n /** Stable key. Default the position, which suits a static trail. */\n id?: string;\n /** Default: the last item is the current page. */\n current?: boolean;\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n /** The trail as data, root first. Use it or children (the parts), not both. */\n items?: readonly BreadcrumbItemDef[];\n /** With `items`: render each link yourself, e.g. a router `Link`. It gets the link styling. */\n renderLink?: (item: BreadcrumbItemDef) => ReactElement;\n /** With `items`: keep the root and the last `maxItems - 1` items, and collapse the rest. */\n maxItems?: number;\n}\n\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n { className, items, renderLink, maxItems, children, ...props },\n ref,\n) {\n return (\n <nav ref={ref} aria-label=\"breadcrumb\" data-slot=\"breadcrumb\" className={className} {...props}>\n {items ? <BreadcrumbList>{renderItems(items, renderLink, maxItems)}</BreadcrumbList> : children}\n </nav>\n );\n});\n\nfunction renderItems(\n items: readonly BreadcrumbItemDef[],\n renderLink: BreadcrumbProps['renderLink'],\n maxItems: number | undefined,\n) {\n const last = items.length - 1;\n const collapse = maxItems !== undefined && maxItems >= 2 && items.length > maxItems;\n const shown = collapse\n ? [0, ...items.map((_, i) => i).slice(items.length - (maxItems - 1))]\n : items.map((_, i) => i);\n\n return shown.map((index, position) => {\n const item = items[index];\n const current = item.current ?? index === last;\n return (\n <Fragment key={item.id ?? index}>\n {position > 0 && <BreadcrumbSeparator />}\n <BreadcrumbItem>\n {current ? (\n <BreadcrumbPage>{item.label}</BreadcrumbPage>\n ) : renderLink ? (\n <BreadcrumbLink asChild>{renderLink(item)}</BreadcrumbLink>\n ) : (\n <BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>\n )}\n </BreadcrumbItem>\n {collapse && position === 0 && (\n <>\n <BreadcrumbSeparator />\n <BreadcrumbItem>\n <BreadcrumbEllipsis />\n </BreadcrumbItem>\n </>\n )}\n </Fragment>\n );\n });\n}\n\nexport const BreadcrumbList = forwardRef<HTMLOListElement, HTMLAttributes<HTMLOListElement>>(function BreadcrumbList(\n { className, ...props },\n ref,\n) {\n return (\n <ol\n ref={ref}\n data-slot=\"breadcrumb-list\"\n className={cn('flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground', className)}\n {...props}\n />\n );\n});\n\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, HTMLAttributes<HTMLLIElement>>(function BreadcrumbItem(\n { className, ...props },\n ref,\n) {\n return <li ref={ref} data-slot=\"breadcrumb-item\" className={cn('inline-flex items-center gap-1', className)} {...props} />;\n});\n\nexport interface BreadcrumbLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Render the child element, e.g. a router `Link`. */\n asChild?: boolean;\n}\n\nexport const BreadcrumbLink = forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(function BreadcrumbLink(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'a';\n return (\n <Comp ref={ref} data-slot=\"breadcrumb-link\" className={cn('transition-colors hover:text-foreground', className)} {...props} />\n );\n});\n\n/** The current page: text, not a link. */\nexport const BreadcrumbPage = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function BreadcrumbPage(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"breadcrumb-page\"\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn('font-normal text-foreground', className)}\n {...props}\n />\n );\n});\n\nexport interface BreadcrumbSeparatorProps extends HTMLAttributes<HTMLLIElement> {\n /** A custom separator. Default a chevron. */\n children?: ReactNode;\n}\n\nexport const BreadcrumbSeparator = forwardRef<HTMLLIElement, BreadcrumbSeparatorProps>(function BreadcrumbSeparator(\n { children, className, ...props },\n ref,\n) {\n return (\n <li\n ref={ref}\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('[&>svg]:size-3.5', className)}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"rtl:rotate-180\" />}\n </li>\n );\n});\n\n/** Stands in for collapsed items. Wrap it in a `DropdownMenuTrigger` to make them reachable. */\nexport const BreadcrumbEllipsis = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function BreadcrumbEllipsis(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('flex size-5 items-center justify-center [&>svg]:size-4', className)}\n {...props}\n >\n <MoreHorizontalIcon />\n <span className=\"sr-only\">More</span>\n </span>\n );\n});\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type Ref,\n} from 'react';\nimport clsx from 'clsx';\nimport { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonSize } from '../forms/button';\nimport { Select } from '../forms/select';\n\n/**\n * Pagination: page navigation with previous and next.\n *\n * Two ways to write one:\n * - Shorthand: `<Pagination page={3} pageCount={10} onPageChange={setPage} />` works out the\n * page window (first, last, the current page and `siblingCount` either side, with ellipses)\n * and renders the parts. Pages are buttons, or links when you pass `getHref`.\n * - Composition: `Pagination` > `PaginationContent` > `PaginationItem`s holding a\n * `PaginationPrevious`, `PaginationLink`s, a `PaginationEllipsis` and a `PaginationNext`.\n *\n * A `<nav>` landmark named \"pagination\" (override with `aria-label`). The current page carries\n * `aria-current=\"page\"`; the ellipsis is hidden from assistive tech.\n */\n\nconst GAP = '…';\n\n/**\n * Builds the visible page list with ellipses.\n *\n * Always returns first and last, the current page, and `siblingCount` either side. The\n * window is widened rather than allowed to shrink near the ends, so the control does not\n * change width as the user pages through — a row of buttons that reflows under the cursor\n * is how you mis-click.\n */\nexport function paginationRange(page: number, pageCount: number, siblingCount = 1): (number | typeof GAP)[] {\n // first + last + current + 2 siblings + 2 possible gaps\n const totalSlots = siblingCount * 2 + 5;\n if (pageCount <= totalSlots) {\n return Array.from({ length: pageCount }, (_, i) => i + 1);\n }\n\n const left = Math.max(page - siblingCount, 1);\n const right = Math.min(page + siblingCount, pageCount);\n\n const showLeftGap = left > 3;\n const showRightGap = right < pageCount - 2;\n\n if (!showLeftGap && showRightGap) {\n const count = siblingCount * 2 + 3;\n return [...Array.from({ length: count }, (_, i) => i + 1), GAP, pageCount];\n }\n\n if (showLeftGap && !showRightGap) {\n const count = siblingCount * 2 + 3;\n return [1, GAP, ...Array.from({ length: count }, (_, i) => pageCount - count + 1 + i)];\n }\n\n return [1, GAP, ...Array.from({ length: right - left + 1 }, (_, i) => left + i), GAP, pageCount];\n}\n\n// ── Parts ──────────────────────────────────────────────────────────────────────\n\nexport interface PaginationProps extends HTMLAttributes<HTMLElement> {\n /** Shorthand: the current page, 1-based. With `pageCount` and `onPageChange` it renders the parts. */\n page?: number;\n /** Shorthand: the total number of pages. Below 1 renders nothing. */\n pageCount?: number;\n /** Shorthand: called with the page to go to. */\n onPageChange?: (page: number) => void;\n /** Shorthand: numbered pages either side of the current one. Default `1`. */\n siblingCount?: number;\n /** Shorthand: render pages as links to these URLs instead of buttons. */\n getHref?: (page: number) => string;\n}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { className, children, page, pageCount, onPageChange, siblingCount = 1, getHref, ...props },\n ref,\n) {\n const shorthand = page !== undefined && pageCount !== undefined;\n if (shorthand && pageCount < 1) return null;\n\n return (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n className={cn('mx-auto flex w-full justify-center', className)}\n {...props}\n >\n {shorthand ? (\n <PaginationPages\n page={page}\n pageCount={pageCount}\n onPageChange={onPageChange}\n siblingCount={siblingCount}\n getHref={getHref}\n />\n ) : (\n children\n )}\n </nav>\n );\n});\n\nfunction PaginationPages({\n page,\n pageCount,\n onPageChange,\n siblingCount,\n getHref,\n}: {\n page: number;\n pageCount: number;\n onPageChange?: (page: number) => void;\n siblingCount: number;\n getHref?: (page: number) => string;\n}) {\n const go = (next: number) => (event: MouseEvent) => {\n const clamped = Math.min(Math.max(next, 1), pageCount);\n if (clamped === page) return;\n if (onPageChange) {\n if (getHref) event.preventDefault();\n onPageChange(clamped);\n }\n };\n const target = (n: number) => (getHref ? { href: getHref(n) } : {});\n\n return (\n <PaginationContent>\n <PaginationItem>\n <PaginationPrevious {...target(page - 1)} disabled={page <= 1} onClick={go(page - 1)} />\n </PaginationItem>\n {paginationRange(page, pageCount, siblingCount).map((entry, index) =>\n entry === GAP ? (\n <PaginationItem key={`gap-${index}`}>\n <PaginationEllipsis />\n </PaginationItem>\n ) : (\n <PaginationItem key={entry}>\n {/* \"3\" alone does not say what activating it does. */}\n <PaginationLink\n {...target(entry)}\n aria-label={`Page ${entry}`}\n isActive={entry === page}\n onClick={go(entry)}\n >\n {entry}\n </PaginationLink>\n </PaginationItem>\n ),\n )}\n <PaginationItem>\n <PaginationNext {...target(page + 1)} disabled={page >= pageCount} onClick={go(page + 1)} />\n </PaginationItem>\n </PaginationContent>\n );\n}\n\nexport const PaginationContent = forwardRef<HTMLUListElement, ComponentPropsWithoutRef<'ul'>>(\n function PaginationContent({ className, ...props }, ref) {\n return (\n <ul ref={ref} data-slot=\"pagination-content\" className={cn('flex items-center gap-0.5', className)} {...props} />\n );\n },\n);\n\nexport const PaginationItem = forwardRef<HTMLLIElement, ComponentPropsWithoutRef<'li'>>(\n function PaginationItem(props, ref) {\n return <li ref={ref} data-slot=\"pagination-item\" {...props} />;\n },\n);\n\nexport interface PaginationLinkProps extends Omit<ComponentPropsWithoutRef<'a'>, 'onClick'> {\n /** The current page: outlined, with `aria-current=\"page\"`. */\n isActive?: boolean;\n size?: ButtonSize;\n /** Blocks the link (`aria-disabled`, out of the tab order) or disables the button. */\n disabled?: boolean;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n}\n\n/**\n * A page: an `<a>` with `href`, or a `<button>` without one (for pages driven by state). Styled\n * as a ghost icon Button, outlined when `isActive`.\n */\nexport const PaginationLink = forwardRef<HTMLElement, PaginationLinkProps>(function PaginationLink(\n { className, isActive, size = 'icon', disabled, href, children, ...props },\n ref,\n) {\n const common = {\n 'aria-current': isActive ? ('page' as const) : undefined,\n 'data-slot': 'pagination-link',\n 'data-active': isActive || undefined,\n };\n if (href === undefined) {\n return (\n <Button\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n variant={isActive ? 'outline' : 'ghost'}\n size={size}\n disabled={disabled}\n className={className}\n {...common}\n {...(props as ComponentPropsWithoutRef<'button'>)}\n >\n {children}\n </Button>\n );\n }\n return (\n <Button asChild variant={isActive ? 'outline' : 'ghost'} size={size} className={className}>\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n // Still a link to assistive tech, announced as unavailable, out of the tab order and inert.\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n {...common}\n {...props}\n onClick={(event) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n props.onClick?.(event);\n }}\n className={cn(disabled && 'pointer-events-none opacity-50')}\n >\n {children}\n </a>\n </Button>\n );\n});\n\nexport interface PaginationArrowProps extends PaginationLinkProps {\n /** The visible text (shown from `sm`). Default \"Previous\" / \"Next\". */\n text?: ReactNode;\n}\n\nexport const PaginationPrevious = forwardRef<HTMLElement, PaginationArrowProps>(function PaginationPrevious(\n { className, text = 'Previous', ...props },\n ref,\n) {\n return (\n <PaginationLink\n ref={ref}\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn('ps-1.5!', className)}\n {...props}\n >\n <ChevronLeftIcon data-icon=\"inline-start\" className=\"rtl:rotate-180\" />\n <span className=\"hidden sm:block\">{text}</span>\n </PaginationLink>\n );\n});\n\nexport const PaginationNext = forwardRef<HTMLElement, PaginationArrowProps>(function PaginationNext(\n { className, text = 'Next', ...props },\n ref,\n) {\n return (\n <PaginationLink\n ref={ref}\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn('pe-1.5!', className)}\n {...props}\n >\n <span className=\"hidden sm:block\">{text}</span>\n <ChevronRightIcon data-icon=\"inline-end\" className=\"rtl:rotate-180\" />\n </PaginationLink>\n );\n});\n\nexport const PaginationEllipsis = forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<'span'>>(\n function PaginationEllipsis({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n <MoreHorizontalIcon />\n <span className=\"sr-only\">More pages</span>\n </span>\n );\n },\n);\n\n// ── PaginationBar ──────────────────────────────────────────────────────────────\n\nexport interface PaginationBarProps {\n /** 1-based. */\n page: number;\n /** Rows per page. */\n pageSize: number;\n /** Total rows across every page. */\n total: number;\n onPageChange: (page: number) => void;\n /** Offer a page-size selector. Omit it, or pass `[]` as `pageSizeOptions`, to hide one. */\n onPageSizeChange?: (pageSize: number) => void;\n /** Page sizes on offer. Default `[10, 20, 50]`. */\n pageSizeOptions?: number[];\n /** Replaces the \"Showing 1–10 of 57\" summary. */\n summary?: ReactNode;\n /** Names the page-button landmark. Default \"Pages\". */\n label?: string;\n className?: string;\n}\n\n/**\n * A full pager row for a list that is not a DataTable: a range summary, an optional page-size\n * selector, and the page buttons. A DataTable uses `DataTablePagination` instead. Slated to\n * become a block.\n *\n * Only the page buttons are the `<nav>` landmark. The summary and the size selector sit beside\n * it, because a landmark should hold navigation and nothing else.\n */\nexport function PaginationBar({\n page,\n pageSize,\n total,\n onPageChange,\n onPageSizeChange,\n pageSizeOptions = [10, 20, 50],\n summary,\n label = 'Pages',\n className,\n}: PaginationBarProps) {\n const pageCount = Math.max(1, Math.ceil(total / pageSize));\n const from = total === 0 ? 0 : (page - 1) * pageSize + 1;\n const to = Math.min(total, page * pageSize);\n const showSize = Boolean(onPageSizeChange) && pageSizeOptions.length > 0;\n const options = pageSizeOptions.includes(pageSize)\n ? pageSizeOptions\n : [...pageSizeOptions, pageSize].sort((a, b) => a - b);\n\n return (\n <div\n data-slot=\"pagination-bar\"\n className={clsx('flex flex-wrap items-center justify-between gap-x-4 gap-y-3', className)}\n >\n <p className=\"text-sm text-muted-foreground\">\n {summary ?? (\n <>\n Showing {from}–{to} of {total}\n </>\n )}\n </p>\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-3\">\n {showSize && (\n <div className=\"flex items-center gap-2\">\n <span aria-hidden className=\"text-sm font-medium\">\n Rows per page\n </span>\n <Select\n aria-label=\"Rows per page\"\n size=\"sm\"\n className=\"w-20\"\n value={String(pageSize)}\n options={options.map((size) => ({ value: String(size), label: String(size) }))}\n onValueChange={(value) => onPageSizeChange?.(Number(value))}\n />\n </div>\n )}\n <Pagination\n className=\"mx-0 w-auto\"\n aria-label={label}\n page={page}\n pageCount={pageCount}\n onPageChange={onPageChange}\n />\n </div>\n </div>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * NavigationMenu: a site's header navigation — top-level links, and triggers that open panels of\n * links (the \"mega-menu\" pattern). For in-app navigation use the Sidebar.\n *\n * Two ways to write one:\n * - Shorthand: `<NavigationMenu items={[{ label, href }, { label, children: [{ label, href,\n * description }] }]} />`.\n * - Composition: `NavigationMenu` > `NavigationMenuList` > `NavigationMenuItem` >\n * `NavigationMenuTrigger` + `NavigationMenuContent` (of `NavigationMenuLink`s), or a single\n * `NavigationMenuLink` styled with `navigationMenuTriggerStyle`.\n *\n * Built on Radix NavigationMenu: the keyboard model, hover intent and the panel that slides\n * between triggers come from it. It measures the open panel with `ResizeObserver`, which jsdom\n * lacks, so tests that open a panel need a stub.\n */\n\n/** Classes for a top-level link that sits beside the triggers. */\nexport const navigationMenuTriggerStyle = () =>\n 'group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted data-active:bg-muted/50';\n\n/** One entry of the `items` shorthand: a link, or a trigger with a panel of links. */\nexport interface NavigationMenuItemDef {\n label: ReactNode;\n /** A top-level link. Leave out when the entry has `children`. */\n href?: string;\n /** The current page: sets `aria-current=\"page\"` and the active look. */\n active?: boolean;\n /** The panel's links. */\n children?: Array<{ label: ReactNode; href: string; description?: ReactNode; active?: boolean }>;\n}\n\nexport interface NavigationMenuProps extends ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> {\n /** Render the shared viewport the panels open into. Default `true`; `false` opens each under its trigger. */\n viewport?: boolean;\n /** Shorthand: the menu as data. Use it or `children`. */\n items?: NavigationMenuItemDef[];\n}\n\nexport const NavigationMenu = forwardRef<ElementRef<typeof NavigationMenuPrimitive.Root>, NavigationMenuProps>(\n function NavigationMenu({ className, children, viewport = true, items, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Root\n ref={ref}\n data-slot=\"navigation-menu\"\n data-viewport={viewport}\n className={cn('group/navigation-menu relative flex max-w-max flex-1 items-center justify-center', className)}\n {...props}\n >\n {items ? <NavigationMenuItems items={items} /> : children}\n {viewport && <NavigationMenuViewport />}\n </NavigationMenuPrimitive.Root>\n );\n },\n);\n\nfunction NavigationMenuItems({ items }: { items: NavigationMenuItemDef[] }) {\n return (\n <NavigationMenuList>\n {items.map((item, index) => (\n <NavigationMenuItem key={index}>\n {item.children ? (\n <>\n <NavigationMenuTrigger>{item.label}</NavigationMenuTrigger>\n <NavigationMenuContent>\n <ul className=\"grid w-96 gap-1\">\n {item.children.map((child, childIndex) => (\n <li key={childIndex}>\n <NavigationMenuLink href={child.href} active={child.active}>\n <div className=\"flex flex-col gap-1\">\n <div className=\"leading-none font-medium\">{child.label}</div>\n {child.description != null && (\n <div className=\"line-clamp-2 text-muted-foreground\">{child.description}</div>\n )}\n </div>\n </NavigationMenuLink>\n </li>\n ))}\n </ul>\n </NavigationMenuContent>\n </>\n ) : (\n <NavigationMenuLink href={item.href} active={item.active} className={navigationMenuTriggerStyle()}>\n {item.label}\n </NavigationMenuLink>\n )}\n </NavigationMenuItem>\n ))}\n </NavigationMenuList>\n );\n}\n\nexport const NavigationMenuList = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.List>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>\n>(function NavigationMenuList({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.List\n ref={ref}\n data-slot=\"navigation-menu-list\"\n className={cn('group flex flex-1 list-none items-center justify-center gap-0', className)}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuItem = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Item>\n>(function NavigationMenuItem({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Item\n ref={ref}\n data-slot=\"navigation-menu-item\"\n className={cn('relative', className)}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuTrigger = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>\n>(function NavigationMenuTrigger({ className, children, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n data-slot=\"navigation-menu-trigger\"\n className={cn(navigationMenuTriggerStyle(), 'group', className)}\n {...props}\n >\n {children}{' '}\n <ChevronDownIcon\n aria-hidden=\"true\"\n className=\"relative top-px ms-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180\"\n />\n </NavigationMenuPrimitive.Trigger>\n );\n});\n\nexport const NavigationMenuContent = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>\n>(function NavigationMenuContent({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Content\n ref={ref}\n data-slot=\"navigation-menu-content\"\n className={cn(\n 'start-0 top-0 w-full p-1 ease-[cubic-bezier(0.22,1,0.36,1)] **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto',\n 'data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52',\n 'group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuViewport = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>\n>(function NavigationMenuViewport({ className, ...props }, ref) {\n return (\n <div className=\"absolute start-0 top-full isolate z-popover flex justify-center\">\n <NavigationMenuPrimitive.Viewport\n ref={ref}\n data-slot=\"navigation-menu-viewport\"\n className={cn(\n 'relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full origin-top overflow-hidden rounded-lg bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100 data-open:animate-in data-open:zoom-in-90 data-closed:animate-out data-closed:zoom-out-90 md:w-(--radix-navigation-menu-viewport-width)',\n className,\n )}\n {...props}\n />\n </div>\n );\n});\n\nexport const NavigationMenuLink = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Link>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Link>\n>(function NavigationMenuLink({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Link\n ref={ref}\n data-slot=\"navigation-menu-link\"\n className={cn(\n \"flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted in-data-[slot=navigation-menu-content]:rounded-md [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuIndicator = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>\n>(function NavigationMenuIndicator({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Indicator\n ref={ref}\n data-slot=\"navigation-menu-indicator\"\n className={cn(\n 'top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in',\n className,\n )}\n {...props}\n >\n <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n </NavigationMenuPrimitive.Indicator>\n );\n});\n","import { forwardRef, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Typography: styles for headings, paragraphs, lists, etc., one component per style.\n *\n * Each pins the classes of one style and nothing else. All take `asChild`, because the right\n * element depends on the outline: an `h2` style on an `h3` is\n * `<TypographyH2 asChild><h3>…</h3></TypographyH2>`. `className` is merged last, so a caller\n * can override any class (`cn`).\n *\n * Sides are logical (`ms-6`, `border-s-2`, `text-start`), so the styles follow `dir=\"rtl\"`.\n *\n * Two lists of data have a shorthand: `TypographyList items={[…]}` and\n * `TypographyTable headers={[…]} rows={[[…]]}`.\n */\n\ntype TypographyProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n /** Render onto the single child instead of the default element. */\n asChild?: boolean;\n};\n\n/** Factory for the styles that differ only by element and classes. */\nfunction typography(\n displayName: string,\n slot: string,\n element: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'blockquote' | 'code' | 'div' | 'small',\n classes: string,\n) {\n const Component = forwardRef<HTMLElement, TypographyProps>(function Typography(\n { asChild = false, className, ...props },\n ref,\n ) {\n const Root = (asChild ? Slot : element) as 'p';\n return <Root ref={ref as never} data-slot={slot} className={cn(classes, className)} {...props} />;\n });\n Component.displayName = displayName;\n return Component;\n}\n\nexport type TypographyH1Props = TypographyProps;\nexport type TypographyH2Props = TypographyProps;\nexport type TypographyH3Props = TypographyProps;\nexport type TypographyH4Props = TypographyProps;\nexport type TypographyPProps = TypographyProps;\nexport type TypographyBlockquoteProps = TypographyProps;\nexport type TypographyInlineCodeProps = TypographyProps;\nexport type TypographyLeadProps = TypographyProps;\nexport type TypographyLargeProps = TypographyProps;\nexport type TypographySmallProps = TypographyProps;\nexport type TypographyMutedProps = TypographyProps;\n\nexport const TypographyH1 = typography(\n 'TypographyH1',\n 'typography-h1',\n 'h1',\n 'scroll-m-20 text-4xl font-extrabold tracking-tight text-balance',\n);\n\nexport const TypographyH2 = typography(\n 'TypographyH2',\n 'typography-h2',\n 'h2',\n 'scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0',\n);\n\nexport const TypographyH3 = typography(\n 'TypographyH3',\n 'typography-h3',\n 'h3',\n 'scroll-m-20 text-2xl font-semibold tracking-tight',\n);\n\nexport const TypographyH4 = typography(\n 'TypographyH4',\n 'typography-h4',\n 'h4',\n 'scroll-m-20 text-xl font-semibold tracking-tight',\n);\n\nexport const TypographyP = typography('TypographyP', 'typography-p', 'p', 'leading-7 [&:not(:first-child)]:mt-6');\n\nexport const TypographyBlockquote = typography(\n 'TypographyBlockquote',\n 'typography-blockquote',\n 'blockquote',\n 'mt-6 border-s-2 ps-6 italic',\n);\n\nexport const TypographyInlineCode = typography(\n 'TypographyInlineCode',\n 'typography-inline-code',\n 'code',\n 'relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold',\n);\n\nexport const TypographyLead = typography('TypographyLead', 'typography-lead', 'p', 'text-xl text-muted-foreground');\n\nexport const TypographyLarge = typography('TypographyLarge', 'typography-large', 'div', 'text-lg font-semibold');\n\nexport const TypographySmall = typography(\n 'TypographySmall',\n 'typography-small',\n 'small',\n 'text-sm leading-none font-medium',\n);\n\nexport const TypographyMuted = typography('TypographyMuted', 'typography-muted', 'p', 'text-sm text-muted-foreground');\n\n// ── List ───────────────────────────────────────────────────────────────────────\n\nexport interface TypographyListProps extends HTMLAttributes<HTMLUListElement> {\n /** Shorthand: one `<li>` per entry. Leave it out to pass `<li>` children. */\n items?: ReactNode[];\n /** Render onto the single child, such as an `<ol>`. */\n asChild?: boolean;\n}\n\nexport const TypographyList = forwardRef<HTMLUListElement, TypographyListProps>(function TypographyList(\n { items, asChild = false, className, children, ...props },\n ref,\n) {\n const Root = (asChild ? Slot : 'ul') as 'ul';\n return (\n <Root ref={ref} data-slot=\"typography-list\" className={cn('my-6 ms-6 list-disc [&>li]:mt-2', className)} {...props}>\n {items ? items.map((item, index) => <li key={index}>{item}</li>) : children}\n </Root>\n );\n});\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n\nexport interface TypographyTableProps extends HTMLAttributes<HTMLDivElement> {\n /** Shorthand: the header cells. */\n headers?: ReactNode[];\n /** Shorthand: the body rows, one array of cells per row. */\n rows?: ReactNode[][];\n}\n\n/**\n * A table for running text: a scrolling wrapper around a `<table>`. Its `thead`, `tbody`, `tr`,\n * `th` and `td` are styled from here, so composition is plain table markup inside it.\n */\nexport const TypographyTable = forwardRef<HTMLDivElement, TypographyTableProps>(function TypographyTable(\n { headers, rows, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"typography-table\"\n className={cn(\n 'my-6 w-full scrollbar-thin overflow-y-auto',\n '[&_table]:w-full [&_tr]:m-0 [&_tr]:border-t [&_tr]:p-0 [&_tr]:even:bg-muted',\n '[&_th]:border [&_th]:px-4 [&_th]:py-2 [&_th]:text-start [&_th]:font-bold [&_th[align=center]]:text-center [&_th[align=right]]:text-right',\n '[&_td]:border [&_td]:px-4 [&_td]:py-2 [&_td]:text-start [&_td[align=center]]:text-center [&_td[align=right]]:text-right',\n className,\n )}\n {...props}\n >\n {headers || rows ? (\n <table>\n {headers && (\n <thead>\n <tr>\n {headers.map((header, index) => (\n <th key={index}>{header}</th>\n ))}\n </tr>\n </thead>\n )}\n {rows && (\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <td key={cellIndex}>{cell}</td>\n ))}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n ) : (\n children\n )}\n </div>\n );\n});\n\n// ── Link ───────────────────────────────────────────────────────────────────────\n\n/**\n * `brand` (default) is the underlined link for running text. `neutral` is a default-coloured\n * link that underlines on hover, for links that stand alone in a list or tree, where a column of\n * brand underlines would be noise. Don't use `neutral` inside a sentence: there, colour and\n * underline are what mark it as a link.\n */\nexport type TextLinkTone = 'brand' | 'neutral';\n\nexport interface TextLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n children?: ReactNode;\n asChild?: boolean;\n tone?: TextLinkTone;\n}\n\nconst TEXT_LINK_TONE: Record<TextLinkTone, string> = {\n brand: 'text-primary underline decoration-1 hover:text-primary/80',\n neutral: 'text-foreground no-underline decoration-1 hover:underline',\n};\n\n/**\n * A link in text. Underlined rather than colour-only: colour alone is not a sufficient\n * distinction for a link inside a run of text (WCAG 1.4.1).\n */\nexport const TextLink = forwardRef<HTMLAnchorElement, TextLinkProps>(function TextLink(\n { children, asChild = false, tone = 'brand', className, ...rest },\n ref,\n) {\n const Root = (asChild ? Slot : 'a') as 'a';\n return (\n <Root\n ref={ref}\n data-tone={tone}\n className={clsx(\n 'rounded underline-offset-2 transition-colors',\n TEXT_LINK_TONE[tone],\n 'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',\n className,\n )}\n {...rest}\n >\n {children}\n </Root>\n );\n});\n","import {\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Separator, type SeparatorProps } from '../chrome/separator';\n\n/**\n * Item: a flex row for content — media, a title, a description and actions. Group items in an\n * `ItemGroup` to make a list. For a form control with a label, use `Field` instead.\n *\n * Two ways to write one:\n * - Shorthand: `<Item media={<Icon />} mediaVariant=\"icon\" title=\"…\" description=\"…\" actions={…} />`.\n * - Composition: `Item` > `ItemMedia` + `ItemContent` (`ItemTitle`, `ItemDescription`) +\n * `ItemActions`, with `ItemHeader` / `ItemFooter` spanning the full width.\n *\n * An item is not interactive by itself: render it onto a link or button with `asChild` and the\n * hover and focus styles apply to that element.\n */\n\n/** Set by ItemGroup, so its items are list items. */\nconst InGroupContext = createContext(false);\n\nexport const ItemGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemGroup(\n { className, ...props },\n ref,\n) {\n return (\n <InGroupContext.Provider value>\n <div\n ref={ref}\n role=\"list\"\n data-slot=\"item-group\"\n className={cn(\n 'group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2',\n className,\n )}\n {...props}\n />\n </InGroupContext.Provider>\n );\n});\n\nexport const ItemSeparator = forwardRef<HTMLDivElement, SeparatorProps>(function ItemSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <Separator\n ref={ref}\n data-slot=\"item-separator\"\n orientation=\"horizontal\"\n className={cn('my-2', className)}\n {...props}\n />\n );\n});\n\nexport type ItemVariant = 'default' | 'outline' | 'muted';\nexport type ItemSize = 'default' | 'sm' | 'xs';\nexport type ItemMediaVariant = 'default' | 'icon' | 'image';\n\nconst VARIANT: Record<ItemVariant, string> = {\n default: 'border-transparent',\n outline: 'border-border',\n muted: 'border-transparent bg-muted/50',\n};\n\nconst SIZE: Record<ItemSize, string> = {\n default: 'gap-2.5 px-3 py-2.5',\n sm: 'gap-2.5 px-3 py-2.5',\n xs: 'gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0',\n};\n\nexport interface ItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n variant?: ItemVariant;\n size?: ItemSize;\n /** Render onto the single child (a link or button), which takes the item's look. */\n asChild?: boolean;\n /** Shorthand: the `ItemMedia` content. */\n media?: ReactNode;\n /** Shorthand: the `ItemMedia` variant. Default `default`. */\n mediaVariant?: ItemMediaVariant;\n /** Shorthand: the `ItemTitle`. */\n title?: ReactNode;\n /** Shorthand: the `ItemDescription`. */\n description?: ReactNode;\n /** Shorthand: the `ItemActions` content. */\n actions?: ReactNode;\n /** Shorthand: an `ItemHeader` above the row. */\n header?: ReactNode;\n /** Shorthand: an `ItemFooter` below the row. */\n footer?: ReactNode;\n}\n\nexport const Item = forwardRef<HTMLDivElement, ItemProps>(function Item(\n {\n className,\n variant = 'default',\n size = 'default',\n asChild = false,\n media,\n mediaVariant = 'default',\n title,\n description,\n actions,\n header,\n footer,\n children,\n ...props\n },\n ref,\n) {\n const inGroup = useContext(InGroupContext);\n const shorthand = [media, title, description, actions, header, footer].some((part) => part != null);\n\n const parts = (extra: ReactNode) => (\n <>\n {header != null && <ItemHeader>{header}</ItemHeader>}\n {media != null && <ItemMedia variant={mediaVariant}>{media}</ItemMedia>}\n {(title != null || description != null || extra != null) && (\n <ItemContent>\n {title != null && <ItemTitle>{title}</ItemTitle>}\n {description != null && <ItemDescription>{description}</ItemDescription>}\n {extra}\n </ItemContent>\n )}\n {actions != null && <ItemActions>{actions}</ItemActions>}\n {footer != null && <ItemFooter>{footer}</ItemFooter>}\n </>\n );\n\n const rootProps = {\n 'data-slot': 'item',\n 'data-variant': variant,\n 'data-size': size,\n className: cn(\n 'group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted',\n VARIANT[variant],\n SIZE[size],\n className,\n ),\n ...props,\n };\n\n if (asChild) {\n const child = children as ReactElement<{ children?: ReactNode }>;\n return (\n <Slot ref={ref} {...rootProps} wrapChildren={shorthand ? (own) => parts(own) : undefined}>\n {isValidElement(child) ? child : null}\n </Slot>\n );\n }\n\n return (\n // A list item inside an ItemGroup. An asChild item keeps its link or button role.\n <div ref={ref} role={inGroup ? 'listitem' : undefined} {...rootProps}>\n {shorthand ? parts(children) : children}\n </div>\n );\n});\n\nexport interface ItemMediaProps extends HTMLAttributes<HTMLDivElement> {\n variant?: ItemMediaVariant;\n}\n\nconst MEDIA_VARIANT: Record<ItemMediaVariant, string> = {\n default: 'bg-transparent',\n icon: \"[&_svg:not([class*='size-'])]:size-4\",\n image:\n 'size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover',\n};\n\nexport const ItemMedia = forwardRef<HTMLDivElement, ItemMediaProps>(function ItemMedia(\n { className, variant = 'default', ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-media\"\n data-variant={variant}\n className={cn(\n 'flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none',\n MEDIA_VARIANT[variant],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-content\"\n className={cn(\n 'flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemTitle = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-title\"\n className={cn(\n 'line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ItemDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(\n function ItemDescription({ className, ...props }, ref) {\n return (\n <p\n ref={ref}\n data-slot=\"item-description\"\n className={cn(\n 'line-clamp-2 text-start text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const ItemActions = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemActions(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"item-actions\" className={cn('flex items-center gap-2', className)} {...props} />;\n});\n\nexport const ItemHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-header\"\n className={cn('flex basis-full items-center justify-between gap-2', className)}\n {...props}\n />\n );\n});\n\nexport const ItemFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function ItemFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"item-footer\"\n className={cn('flex basis-full items-center justify-between gap-2', className)}\n {...props}\n />\n );\n});\n","import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\nimport { Button, type ButtonProps } from '../forms/button';\n\n/**\n * Attachment: displays a file or image attachment with media, metadata, upload state, and\n * actions.\n *\n * Two ways to write one:\n * - Shorthand: `<Attachment title=\"report.pdf\" description=\"PDF · 2.4 MB\" media={<FileTextIcon />}\n * actions={<AttachmentAction aria-label=\"Remove report.pdf\"><XIcon /></AttachmentAction>} />`.\n * - Composition: `AttachmentMedia`, `AttachmentContent` (`AttachmentTitle`,\n * `AttachmentDescription`), `AttachmentActions` (`AttachmentAction`) and an optional\n * `AttachmentTrigger` that makes the whole card a button or link.\n *\n * `state` follows the upload lifecycle: `idle` (dashed), `uploading` / `processing` (the title\n * shimmers), `error` (destructive) and `done`. Every part carries `data-slot`.\n */\n\nexport type AttachmentState = 'idle' | 'uploading' | 'processing' | 'error' | 'done';\nexport type AttachmentSize = 'default' | 'sm' | 'xs';\nexport type AttachmentOrientation = 'horizontal' | 'vertical';\nexport type AttachmentMediaVariant = 'icon' | 'image';\n\nconst ROOT =\n 'group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/30 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed';\n\nconst SIZE: Record<AttachmentSize, string> = {\n default:\n 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',\n sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',\n xs: 'gap-1.5 rounded-xl text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1',\n};\n\nconst ORIENTATION: Record<AttachmentOrientation, string> = {\n horizontal: 'min-w-40 items-center',\n vertical: 'w-24 flex-col has-data-[slot=attachment-content]:w-30',\n};\n\nexport interface AttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The upload state. Drives styling and the shimmer. Default `done`. */\n state?: AttachmentState;\n /** Default `default`. */\n size?: AttachmentSize;\n /** Lay the media beside (`horizontal`) or above (`vertical`) the content. */\n orientation?: AttachmentOrientation;\n /** Shorthand: the file name. With it, the attachment renders its own parts. */\n title?: ReactNode;\n /** Shorthand: secondary metadata, e.g. type and size, or the failure reason. */\n description?: ReactNode;\n /** Shorthand: an icon, or an `<img>` (with `mediaVariant=\"image\"`). */\n media?: ReactNode;\n /** Shorthand: what `media` holds. Default `icon`. */\n mediaVariant?: AttachmentMediaVariant;\n /** Shorthand: one or more `AttachmentAction`s. */\n actions?: ReactNode;\n}\n\nexport const Attachment = forwardRef<HTMLDivElement, AttachmentProps>(function Attachment(\n {\n className,\n state = 'done',\n size = 'default',\n orientation = 'horizontal',\n title,\n description,\n media,\n mediaVariant = 'icon',\n actions,\n children,\n ...props\n },\n ref,\n) {\n const shorthand = title !== undefined || description !== undefined || media !== undefined || actions !== undefined;\n return (\n <div\n ref={ref}\n data-slot=\"attachment\"\n data-state={state}\n data-size={size}\n data-orientation={orientation}\n className={cn(ROOT, SIZE[size], ORIENTATION[orientation], className)}\n {...props}\n >\n {shorthand ? (\n <>\n {media !== undefined && <AttachmentMedia variant={mediaVariant}>{media}</AttachmentMedia>}\n {(title !== undefined || description !== undefined) && (\n <AttachmentContent>\n {title !== undefined && <AttachmentTitle>{title}</AttachmentTitle>}\n {description !== undefined && <AttachmentDescription>{description}</AttachmentDescription>}\n </AttachmentContent>\n )}\n {actions !== undefined && <AttachmentActions>{actions}</AttachmentActions>}\n {children}\n </>\n ) : (\n children\n )}\n </div>\n );\n});\n\nconst MEDIA_VARIANT: Record<AttachmentMediaVariant, string> = {\n icon: '',\n image:\n 'opacity-60 group-data-[state=idle]/attachment:opacity-100 group-data-[state=done]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover',\n};\n\nexport interface AttachmentMediaProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the media holds an icon or an `<img>`. Default `icon`. */\n variant?: AttachmentMediaVariant;\n}\n\nexport const AttachmentMedia = forwardRef<HTMLDivElement, AttachmentMediaProps>(function AttachmentMedia(\n { className, variant = 'icon', ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-media\"\n data-variant={variant}\n className={cn(\n 'relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground',\n 'group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[orientation=vertical]/attachment:w-full',\n 'group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive',\n \"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5\",\n \"group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6!\",\n MEDIA_VARIANT[variant],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const AttachmentContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-content\"\n className={cn('max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1', className)}\n {...props}\n />\n );\n});\n\nexport const AttachmentTitle = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function AttachmentTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"attachment-title\"\n className={cn(\n 'block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const AttachmentDescription = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(\n function AttachmentDescription({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n data-slot=\"attachment-description\"\n className={cn(\n 'mt-0.5 block max-w-full min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const AttachmentActions = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentActions(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-actions\"\n className={cn(\n 'relative z-20 flex shrink-0 items-center',\n 'group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type AttachmentActionProps = ButtonProps;\n\n/**\n * An icon action: a `Button`, ghost and `icon-xs` unless you pass `variant` / `size`. Name it with\n * `aria-label` (\"Remove report.pdf\"); `asChild` renders a link instead.\n */\nexport const AttachmentAction = forwardRef<HTMLButtonElement, AttachmentActionProps>(function AttachmentAction(\n { variant = 'ghost', size = 'icon-xs', ...props },\n ref,\n) {\n return <Button ref={ref} data-slot=\"attachment-action\" variant={variant} size={size} {...props} />;\n});\n\nexport interface AttachmentTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child element instead, such as a link. */\n asChild?: boolean;\n}\n\n/**\n * A full-card overlay that opens the attachment. It sits behind the actions, so both stay\n * clickable. It has no text of its own: give it an `aria-label`.\n */\nexport const AttachmentTrigger = forwardRef<HTMLButtonElement, AttachmentTriggerProps>(function AttachmentTrigger(\n { className, asChild = false, type, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-slot=\"attachment-trigger\"\n type={asChild ? undefined : (type ?? 'button')}\n className={cn('absolute inset-0 z-10 outline-none', className)}\n {...props}\n />\n );\n});\n\n/** Lays out attachments in a horizontally scrollable, snapping row with an edge fade. */\nexport const AttachmentGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AttachmentGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"attachment-group\"\n className={cn(\n 'flex min-w-0 snap-x snap-mandatory scroll-px-1 gap-3 overflow-x-auto overscroll-x-contain py-1 scroll-fade-x scrollbar-none',\n '*:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start',\n className,\n )}\n {...props}\n />\n );\n});\n\n","export { Button } from './components/forms/button';\nexport type { ButtonProps, ButtonVariant, ButtonSize } from './components/forms/button';\n\nexport { ButtonGroup, ButtonGroupText, ButtonGroupSeparator } from './components/forms/button-group';\nexport type {\n ButtonGroupProps,\n ButtonGroupItem,\n ButtonGroupOrientation,\n ButtonGroupTextProps,\n ButtonGroupSeparatorProps,\n} from './components/forms/button-group';\n\nexport {\n Avatar,\n AvatarImage,\n AvatarFallback,\n AvatarBadge,\n AvatarGroup,\n AvatarGroupCount,\n} from './components/avatar/avatar';\nexport type {\n AvatarProps,\n AvatarImageProps,\n AvatarFallbackProps,\n AvatarBadgeProps,\n AvatarGroupProps,\n AvatarGroupCountProps,\n AvatarSize,\n AvatarShape,\n} from './components/avatar/avatar';\n\n// ── Field ──────────────────────────────────────────────────────────────────────\n// The label / description / error / control wiring. From 0.10.0 the only place a field's text\n// lives: the controls are bare, and a form (or `Form`) composes them inside a Field.\n\nexport {\n Field,\n FieldLabel,\n FieldContent,\n FieldTitle,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldSet,\n FieldLegend,\n FieldSeparator,\n useFieldContext,\n useFieldControl,\n} from './components/forms/field';\nexport type {\n FieldProps,\n FieldLabelProps,\n FieldTextProps,\n FieldErrorProps,\n FieldGroupProps,\n FieldSetProps,\n FieldLegendProps,\n FieldSeparatorProps,\n FieldOrientation,\n FieldContextValue,\n FieldPart,\n} from './components/forms/field';\n\nexport { Input } from './components/forms/input';\nexport type { InputProps } from './components/forms/input';\n\nexport { Textarea } from './components/forms/textarea';\nexport type { TextareaProps } from './components/forms/textarea';\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from './components/forms/select';\nexport type {\n SelectProps,\n SelectTriggerProps,\n SelectSize,\n SelectOption,\n SelectOptionGroup,\n} from './components/forms/select';\n\nexport { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from './components/forms/native-select';\nexport type { NativeSelectProps, NativeSelectSize } from './components/forms/native-select';\n\nexport { DatePicker } from './components/forms/date-picker';\nexport type {\n DatePickerProps,\n DatePickerSingleProps,\n DatePickerRangeProps,\n DatePickerRange,\n} from './components/forms/date-picker';\n\nexport {\n Questionnaire,\n QuestionnaireActions,\n QuestionnaireChoice,\n QuestionnaireChoiceDescription,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireError,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireNext,\n QuestionnairePrevious,\n QuestionnaireProgress,\n QuestionnaireSkip,\n QuestionnaireSubmit,\n QuestionnaireTitle,\n} from './components/forms/questionnaire';\nexport type {\n QuestionnaireActionsProps,\n QuestionnaireChoiceDefinition,\n QuestionnaireChoiceDescriptionProps,\n QuestionnaireChoiceProps,\n QuestionnaireChoicesProps,\n QuestionnaireDescriptionProps,\n QuestionnaireErrorProps,\n QuestionnaireInputProps,\n QuestionnaireInputType,\n QuestionnaireItemDefinition,\n QuestionnaireItemProps,\n QuestionnaireItemStatus,\n QuestionnaireNextProps,\n QuestionnairePreviousProps,\n QuestionnaireProgressProps,\n QuestionnaireProps,\n QuestionnaireShortcutMode,\n QuestionnaireShorthandChoice,\n QuestionnaireShorthandItem,\n QuestionnaireSkipProps,\n QuestionnaireSubmitProps,\n QuestionnaireTitleProps,\n} from './components/forms/questionnaire';\n\n/**\n * On/off setting. Was named `Toggle` through 0.3.0 — see the CHANGELOG rename table. The\n * name `Toggle` now belongs to the pressed-state button, as it does in Radix.\n */\nexport { Switch } from './components/forms/switch';\nexport type { SwitchProps, SwitchSize } from './components/forms/switch';\n\n/** Pressed-state button, and a group of them. New in 0.4.0. */\nexport { Toggle, ToggleGroup, ToggleGroupItem, toggleVariants } from './components/forms/toggle';\nexport type {\n ToggleProps,\n ToggleSize,\n ToggleVariant,\n ToggleGroupProps,\n ToggleGroupOption,\n ToggleGroupItemProps,\n} from './components/forms/toggle';\n\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n REGEXP_ONLY_CHARS,\n REGEXP_ONLY_DIGITS,\n REGEXP_ONLY_DIGITS_AND_CHARS,\n} from './components/forms/input-otp';\nexport type { InputOTPProps, InputOTPSlotProps } from './components/forms/input-otp';\n\nexport { Badge, BADGE_COLORS } from './components/status/badge';\nexport type { BadgeProps, BadgeColor, BadgeVariant } from './components/status/badge';\n\n/** Single-select autocomplete. ARIA 1.2 combobox pattern. */\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n} from './components/forms/combobox';\nexport type {\n ComboboxProps,\n ComboboxOption,\n ComboboxInputProps,\n ComboboxContentProps,\n ComboboxChipProps,\n} from './components/forms/combobox';\n\n/** ⌘K command palette body; `CommandDialog` puts it in a `Dialog`. */\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from './components/forms/command';\nexport type {\n CommandProps,\n CommandItemDef,\n CommandDialogProps,\n CommandInputProps,\n CommandGroupProps,\n CommandSeparatorProps,\n CommandItemProps,\n} from './components/forms/command';\n\n// ── Selection ──────────────────────────────────────────────────────────────────\n\nexport { Checkbox } from './components/forms/checkbox';\nexport type { CheckboxProps, CheckedState } from './components/forms/checkbox';\n\nexport { RadioGroup, RadioGroupItem } from './components/forms/radio-group';\n\nexport type {\n RadioGroupProps,\n RadioGroupOption,\n RadioGroupItemProps,\n RadioGroupOrientation,\n} from './components/forms/radio-group';\n\n\nexport { Slider } from './components/forms/slider';\nexport type { SliderProps } from './components/forms/slider';\n\nexport { Label } from './components/forms/label';\nexport type { LabelProps } from './components/forms/label';\n\nexport { Calendar, PersianCalendar, CalendarDayButton } from './components/forms/calendar';\nexport type { CalendarProps, PersianCalendarProps, CalendarDayButtonProps } from './components/forms/calendar';\n/** The `range` selection type, from the calendar engine, so apps needn't import it themselves. */\nexport type { DateRange } from 'react-day-picker';\n\nexport {\n InputGroup,\n InputGroupInput,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupTextarea,\n} from './components/forms/input-group';\nexport type {\n InputGroupProps,\n InputGroupInputProps,\n InputGroupAddonProps,\n InputGroupTextProps,\n InputGroupButtonProps,\n InputGroupButtonSize,\n InputGroupTextareaProps,\n InputGroupAlign,\n} from './components/forms/input-group';\n\n// ── Overlays ───────────────────────────────────────────────────────────────────\n\nexport {\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogClose,\n DialogOverlay,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/overlays/dialog';\nexport type { DialogProps, DialogContentProps, DialogFooterProps } from './components/overlays/dialog';\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './components/overlays/tooltip';\nexport type { TooltipProps } from './components/overlays/tooltip';\n\n/** Anchored panel for **interactive** content — unlike `Tooltip`, which cannot be entered. */\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverAnchor,\n} from './components/overlays/popover';\nexport type { PopoverProps, PopoverTriggerProps, PopoverContentProps } from './components/overlays/popover';\n\n/** Hover preview that can be entered. Supplementary by contract — hover has no touch equivalent. */\nexport { HoverCard, HoverCardTrigger, HoverCardContent } from './components/overlays/hover-card';\nexport type { HoverCardProps, HoverCardContentProps } from './components/overlays/hover-card';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItems,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n} from './components/overlays/context-menu';\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n} from './components/overlays/context-menu';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarPortal,\n MenubarTrigger,\n MenubarContent,\n MenubarItems,\n MenubarItem,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarGroup,\n MenubarLabel,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubTrigger,\n MenubarSubContent,\n} from './components/overlays/menubar';\nexport type {\n MenubarProps,\n MenubarMenuDef,\n MenubarMenuProps,\n MenubarTriggerProps,\n MenubarContentProps,\n} from './components/overlays/menubar';\n\nexport {\n Drawer,\n DrawerTrigger,\n DrawerPortal,\n DrawerOverlay,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './components/overlays/drawer';\nexport type {\n DrawerProps,\n DrawerShorthandProps,\n DrawerContentProps,\n DrawerDirection,\n} from './components/overlays/drawer';\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetPortal,\n SheetOverlay,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from './components/overlays/sheet';\nexport type { SheetProps, SheetContentProps, SheetSide } from './components/overlays/sheet';\n\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogMedia,\n AlertDialogAction,\n AlertDialogCancel,\n} from './components/overlays/alert-dialog';\nexport type {\n AlertDialogProps,\n AlertDialogContentProps,\n AlertDialogMediaProps,\n AlertDialogSize,\n AlertDialogTone,\n} from './components/overlays/alert-dialog';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuItems,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n} from './components/overlays/dropdown-menu';\nexport type {\n /** One menu entry as data, shared by DropdownMenu, ContextMenu and Menubar. New in 0.8.0. */\n MenuItemDef,\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuContentProps,\n DropdownMenuItemProps,\n DropdownMenuItemVariant,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuSeparatorProps,\n DropdownMenuShortcutProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './components/overlays/dropdown-menu';\n\nexport { Portal, PortalContainerProvider, usePortalContainer } from './components/overlays/portal';\nexport type { PortalProps } from './components/overlays/portal';\n\n// ── Utilities ──────────────────────────────────────────────────────────────────\n\n/** `clsx` + `tailwind-merge` — for compositions where your className must win. */\nexport { cn } from './lib/cn';\n\n/**\n * What makes `asChild` work: renders its props onto its single child. Exported from 0.7.0\n * so a composition of your own can offer the same `asChild` contract.\n */\nexport { composeRefs } from './lib/slot';\n\n/** The text direction (ltr / rtl) for the components inside. */\nexport { DirectionProvider, useDirection } from './lib/direction';\nexport type { DirectionProviderProps, TextDirection } from './lib/direction';\n\n/** The library's keyboard focus ring, for controls you build yourself. New in 0.7.0. */\nexport { FOCUS_RING, FOCUS_RING_INSET } from './lib/focus-ring';\n\n// ── Cards & containers ─────────────────────────────────────────────────────────\n\nexport {\n Card,\n CardHeader,\n CardTitle,\n CardDescription,\n CardAction,\n CardContent,\n CardFooter,\n} from './components/cards/card';\nexport type { CardProps, CardSize, CardTitleProps } from './components/cards/card';\n/** Internal: how the blocks' Dashboard reaches its cards while arranging. */\nexport { DashboardEditContext, useDashboardEdit } from './components/cards/dashboard-edit-context';\nexport type { DashboardEditControls } from './components/cards/dashboard-edit-context';\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/cards/accordion';\nexport type {\n AccordionProps,\n AccordionItemDef,\n AccordionItemProps,\n AccordionTriggerProps,\n AccordionContentProps,\n AccordionType,\n} from './components/cards/accordion';\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent } from './components/cards/collapsible';\nexport type {\n CollapsibleProps,\n CollapsibleTriggerProps,\n CollapsibleContentProps,\n} from './components/cards/collapsible';\n\nexport { AspectRatio } from './components/cards/aspect-ratio';\nexport type { AspectRatioProps } from './components/cards/aspect-ratio';\n\nexport { ScrollArea, ScrollBar } from './components/cards/scroll-area';\nexport type { ScrollAreaProps, ScrollAreaAxis, ScrollBarProps } from './components/cards/scroll-area';\n\n// The scrollbar styling on its own, for a component that must own its own overflow — a\n// table wrapper, a tab strip, a floating panel. Use `ScrollArea` for a region of content.\nexport { SCROLLBAR_CLASSES } from './lib/scrollbar';\n\nexport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n useCarousel,\n} from './components/cards/carousel';\nexport type { CarouselProps, CarouselApi } from './components/cards/carousel';\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle } from './components/cards/resizable';\nexport type {\n ResizablePanelGroupProps,\n ResizablePanelDefinition,\n ResizablePanelProps,\n ResizableHandleProps,\n ResizablePanelGroupHandle,\n ResizablePanelHandle,\n ResizableLayout,\n} from './components/cards/resizable';\n\n// ── Page chrome ────────────────────────────────────────────────────────────────\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/chrome/tabs';\nexport type {\n TabsProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabItem,\n TabsVariant,\n} from './components/chrome/tabs';\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n filterNav,\n filterNavItems,\n} from './components/chrome/sidebar';\nexport type {\n SidebarProps,\n SidebarFrameProps,\n SidebarSide,\n SidebarVariant,\n SidebarCollapsible,\n SidebarProviderProps,\n SidebarContextValue,\n SidebarTriggerProps,\n SidebarSeparatorProps,\n SidebarMenuButtonProps,\n SidebarMenuButtonVariant,\n SidebarMenuButtonSize,\n SidebarMenuSubButtonProps,\n SidebarNavItem,\n SidebarNavGroup,\n SidebarLinkProps,\n SidebarLinkComponent,\n SidebarRenderState,\n} from './components/chrome/sidebar';\n\nexport { Separator } from './components/chrome/separator';\nexport type { SeparatorProps, SeparatorOrientation } from './components/chrome/separator';\n\nexport { Kbd, KbdGroup } from './components/chrome/kbd';\nexport type { KbdProps, KbdGroupProps } from './components/chrome/kbd';\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n} from './components/chrome/breadcrumb';\nexport type {\n BreadcrumbProps,\n BreadcrumbItemDef,\n BreadcrumbLinkProps,\n BreadcrumbSeparatorProps,\n} from './components/chrome/breadcrumb';\n\nexport {\n Pagination,\n PaginationBar,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n paginationRange,\n} from './components/chrome/pagination';\nexport type {\n PaginationArrowProps,\n PaginationBarProps,\n PaginationLinkProps,\n PaginationProps,\n} from './components/chrome/pagination';\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuIndicator,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n NavigationMenuViewport,\n navigationMenuTriggerStyle,\n} from './components/chrome/navigation-menu';\nexport type { NavigationMenuItemDef, NavigationMenuProps } from './components/chrome/navigation-menu';\n\n// ── Typography ─────────────────────────────────────────────────────────────────\n// The type ramp as components, mirroring Figma's `Text*` primitives. Every one takes\n// `asChild`, because the right element depends on the surrounding document outline.\n\nexport {\n TypographyH1,\n TypographyH2,\n TypographyH3,\n TypographyH4,\n TypographyP,\n TypographyBlockquote,\n TypographyTable,\n TypographyList,\n TypographyInlineCode,\n TypographyLead,\n TypographyLarge,\n TypographySmall,\n TypographyMuted,\n TextLink,\n} from './components/chrome/typography';\nexport type {\n TypographyH1Props,\n TypographyH2Props,\n TypographyH3Props,\n TypographyH4Props,\n TypographyPProps,\n TypographyBlockquoteProps,\n TypographyTableProps,\n TypographyListProps,\n TypographyInlineCodeProps,\n TypographyLeadProps,\n TypographyLargeProps,\n TypographySmallProps,\n TypographyMutedProps,\n TextLinkProps,\n TextLinkTone,\n} from './components/chrome/typography';\n\n// ── Data visualisation ─────────────────────────────────────────────────────────\n// Charts are `@platned/ui/chart` (kept out of this entry so it never bundles Recharts).\n\n// ── Lists & rows ───────────────────────────────────────────────────────────────\n\nexport {\n Item,\n ItemActions,\n ItemContent,\n ItemDescription,\n ItemFooter,\n ItemGroup,\n ItemHeader,\n ItemMedia,\n ItemSeparator,\n ItemTitle,\n} from './components/lists/item';\nexport type { ItemMediaProps, ItemMediaVariant, ItemProps, ItemSize, ItemVariant } from './components/lists/item';\n\nexport {\n Attachment,\n AttachmentMedia,\n AttachmentContent,\n AttachmentTitle,\n AttachmentDescription,\n AttachmentActions,\n AttachmentAction,\n AttachmentTrigger,\n AttachmentGroup,\n} from './components/lists/attachment';\nexport type {\n AttachmentProps,\n AttachmentMediaProps,\n AttachmentActionProps,\n AttachmentTriggerProps,\n AttachmentState,\n AttachmentSize,\n AttachmentOrientation,\n AttachmentMediaVariant,\n} from './components/lists/attachment';\n\n// ── Values ─────────────────────────────────────────────────────────────────────\n// Value types: a value shown by what it is, from a JSON descriptor. Shared by DataTable, Form and\n// the blocks (`@platned/ui/blocks`), with locale and currency from one FormatProvider.\n\nexport { Value, renderValue } from './components/lists/value';\nexport type { ValueProps } from './components/lists/value';\nexport {\n FormatProvider,\n useFormat,\n formatValue,\n formatDate,\n formatRelative,\n getValueAt,\n isEmptyValue,\n isNumericType,\n humanize,\n toDate,\n} from './lib/format';\nexport type { FormatOptions, FormatProviderProps, FieldPath, ValueType, ValueFormat, ValueField } from './lib/format';\n\n// ── Table ──────────────────────────────────────────────────────────────────────\n// The composable primitive, for the tables `DataTable`'s column config cannot express —\n// grouped headers, footers, colspans. `DataTable` remains the right default.\n\nexport {\n Table,\n TableCaption,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableHead,\n TableCell,\n} from './components/lists/table';\nexport type {\n TableProps,\n TableColumn,\n TableCaptionProps,\n TableHeaderProps,\n TableBodyProps,\n TableFooterProps,\n TableRowProps,\n TableHeadProps,\n TableCellProps,\n} from './components/lists/table';\n\n// ── Data table ─────────────────────────────────────────────────────────────────\n// DataTable, its parts and the TanStack Table types live in the `@platned/ui/data-table` entry\n// from 0.9.4 (src/data-table.tsx); the build keeps them in that file, so the main entry pulls in\n// TanStack only when a DataTable is actually used.\n\nexport * from './data-table';\n\n// The cells need no TanStack, so they are also exported straight from their module: a page that\n// renders a cell outside a DataTable does not load the table.\nexport {\n TableCellLeadText,\n TableCellText,\n TableCellBadge,\n TableCellProgress,\n} from './components/lists/data-table-cells';\n\n/** Measures an element's width, for layouts that switch structure by available space. New in 0.7.0. */\nexport { useElementWidth } from './lib/use-element-width';\n\n// ── Feedback ───────────────────────────────────────────────────────────────────\n\nexport { Alert, AlertTitle, AlertDescription, AlertAction } from './components/feedback/alert';\nexport type { AlertProps, AlertVariant } from './components/feedback/alert';\n\nexport {\n Empty,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n EmptyDescription,\n EmptyContent,\n} from './components/feedback/empty';\nexport type {\n EmptyProps,\n EmptyHeaderProps,\n EmptyMediaProps,\n EmptyMediaVariant,\n EmptyTitleProps,\n EmptyDescriptionProps,\n EmptyContentProps,\n} from './components/feedback/empty';\n\nexport { Progress } from './components/feedback/progress';\nexport type { ProgressProps, ProgressTone } from './components/feedback/progress';\n\nexport { Spinner } from './components/feedback/spinner';\nexport type { SpinnerProps } from './components/feedback/spinner';\n\nexport { Skeleton } from './components/feedback/skeleton';\nexport type { SkeletonProps } from './components/feedback/skeleton';\n\n/** Transient notifications. Mount `<Toaster />` once at the app root, then call `toast()` anywhere. */\nexport { Toaster, toast } from './components/feedback/sonner';\nexport type { ToasterProps, ToastOptions } from './components/feedback/sonner';\n\n// ── AI surfaces ────────────────────────────────────────────────────────────────\n\n/** Chat transcript pieces. New in 0.7.0, from SCIC. */\nexport {\n Message,\n MessageAvatar,\n MessageContent,\n MessageFooter,\n MessageGroup,\n MessageHeader,\n} from './components/ai/message';\nexport type { MessageAlign, MessageProps } from './components/ai/message';\nexport {\n MessageScroller,\n MessageScrollerButton,\n MessageScrollerContent,\n MessageScrollerItem,\n MessageScrollerProvider,\n MessageScrollerViewport,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n} from './components/ai/message-scroller';\nexport type {\n MessageScrollerButtonProps,\n MessageScrollerContentProps,\n MessageScrollerDefaultScrollPosition,\n MessageScrollerItemProps,\n MessageScrollerProps,\n MessageScrollerProviderProps,\n MessageScrollerScrollOptions,\n MessageScrollerViewportProps,\n} from './components/ai/message-scroller';\nexport { Marker, MarkerContent, MarkerIcon } from './components/ai/marker';\nexport type { MarkerProps, MarkerVariant } from './components/ai/marker';\nexport {\n Trace,\n TraceLine,\n TraceIcon,\n TraceTitle,\n TraceDescription,\n TraceCollapsible,\n TraceCollapsibleTrigger,\n TraceCollapsibleContent,\n} from './components/ai/trace';\nexport type {\n TraceLineProps,\n TraceStatus,\n TraceCollapsibleProps,\n TraceCollapsibleTriggerProps,\n TraceCollapsibleContentProps,\n} from './components/ai/trace';\n\nexport { Bubble, BubbleContent, BubbleReactions, BubbleGroup } from './components/ai/bubble';\nexport type { BubbleProps, BubbleVariant, BubbleContentProps, BubbleReactionsProps } from './components/ai/bubble';\n\nexport {\n CodeBlock,\n CodeBlockHeader,\n CodeBlockTitle,\n CodeBlockActions,\n CodeBlockCopyButton,\n CodeBlockContent,\n CodeBlockLine,\n CodeBlockFooter,\n} from './components/ai/code-block';\nexport type {\n CodeBlockProps,\n CodeBlockVariant,\n CodeBlockSize,\n CodeBlockLineVariant,\n CodeBlockCopyButtonProps,\n CodeBlockContentProps,\n CodeBlockLineProps,\n} from './components/ai/code-block';\n\n// Icons are not re-exported. Import them straight from `lucide-react` — the nine filled\n// 20×20 `Solid*` marks that used to live here were used by no component in this library,\n// only by its own documentation, and they were the one place the library shipped a second\n// icon set. Charts remain the sole exception to Lucide, because their SVG is geometry.\n","import { Children, isValidElement, type HTMLAttributes, type ReactNode } from 'react';\nimport { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react';\nimport { cn } from '../../lib/cn';\n\n/**\n * Alert: displays a callout for user attention.\n *\n * Two ways to write one:\n * - Shorthand: `<Alert variant=\"success\" title=\"…\" description=\"…\" action={…} />`, or plain\n * children, which become the description. A default icon per variant is added.\n * - Composition: an icon (`<svg>`), `AlertTitle`, `AlertDescription`, `AlertAction` as children,\n * the standard anatomy. Bring your own icon, or pass `icon` to add the default one.\n *\n * Variants: `default` and `destructive`, plus the Platned `success`, `warning` and `info`. The\n * coloured variants are tinted (the role at 10% behind, 30% border). `destructive` is announced\n * immediately (`role=\"alert\"`); the others are polite (`role=\"status\"`) so they don't interrupt\n * a screen reader mid-sentence. Override with `role`.\n */\n\nexport type AlertVariant = 'default' | 'destructive' | 'success' | 'warning' | 'info';\n\nconst VARIANT: Record<AlertVariant, string> = {\n default: 'bg-card text-card-foreground',\n destructive:\n 'border-destructive/30 bg-destructive/10 text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current',\n success: 'border-success/30 bg-success/10 text-success *:data-[slot=alert-description]:text-success/90',\n warning: 'border-warning/30 bg-warning/10 text-warning *:data-[slot=alert-description]:text-warning/90',\n info: 'border-primary/30 bg-primary/10 text-primary *:data-[slot=alert-description]:text-primary/90',\n};\n\nconst ICON: Record<AlertVariant, ReactNode> = {\n default: <InfoIcon />,\n destructive: <CircleAlertIcon />,\n success: <CircleCheckIcon />,\n warning: <TriangleAlertIcon />,\n info: <InfoIcon />,\n};\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n variant?: AlertVariant;\n /** Shorthand: the title line. */\n title?: ReactNode;\n /** Shorthand: the description. Plain children are used when this is not set. */\n description?: ReactNode;\n /** Shorthand: an action in the top-right corner, e.g. a small button. */\n action?: ReactNode;\n /**\n * The icon. Default: the variant's icon in shorthand, none in composition (bring your own\n * `<svg>` as the first child). `null` hides it; any node replaces it.\n */\n icon?: ReactNode | null;\n /** Live-region role. Default `alert` for `destructive`, `status` for the rest. */\n role?: 'alert' | 'status';\n}\n\nconst PARTS = new Set<unknown>();\n\n/** Composition when any child is an Alert part; otherwise the children are the description. */\nfunction isComposed(children: ReactNode) {\n return Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n}\n\nexport function Alert({\n variant = 'default',\n title,\n description,\n action,\n icon,\n role,\n className,\n children,\n ...rest\n}: AlertProps) {\n const composed = title === undefined && description === undefined && action === undefined && isComposed(children);\n const glyph = icon === undefined ? (composed ? null : ICON[variant]) : icon;\n\n return (\n <div\n data-slot=\"alert\"\n data-variant={variant}\n role={role ?? (variant === 'destructive' ? 'alert' : 'status')}\n className={cn(\n 'group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm',\n 'has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18',\n \"has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4\",\n VARIANT[variant],\n className,\n )}\n {...rest}\n >\n {glyph}\n {composed ? (\n children\n ) : (\n <>\n {title !== undefined && <AlertTitle>{title}</AlertTitle>}\n {(description ?? children) !== undefined && <AlertDescription>{description ?? children}</AlertDescription>}\n {action !== undefined && <AlertAction>{action}</AlertAction>}\n </>\n )}\n </div>\n );\n}\n\nexport function AlertTitle({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn(\n 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',\n className,\n )}\n {...rest}\n />\n );\n}\n\nexport function AlertDescription({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-sm text-balance text-muted-foreground md:text-pretty [&_p:not(:last-child)]:mb-4',\n '[&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',\n className,\n )}\n {...rest}\n />\n );\n}\n\n/** An action in the top-right corner. The alert reserves room for it on the right. */\nexport function AlertAction({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"alert-action\" className={cn('absolute top-2 right-2', className)} {...rest} />;\n}\n\nPARTS.add(AlertTitle);\nPARTS.add(AlertDescription);\nPARTS.add(AlertAction);\n","import { useEffect, useState, type CSSProperties } from 'react';\nimport { Toaster as Sonner, toast, type ExternalToast, type ToasterProps } from 'sonner';\nimport { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from 'lucide-react';\n\nexport { toast };\nexport type { ExternalToast as ToastOptions, ToasterProps };\n\n/**\n * Toaster: an opinionated toast component, built on Sonner (a regular dependency).\n *\n * Mount one `<Toaster />` near the root of the app, then fire toasts from anywhere with\n * `toast('Event has been created.')`, `toast.success` / `info` / `warning` / `error` /\n * `loading` / `promise`, with a `description` and an `action`.\n *\n * The theme follows the `.dark` class on `<html>` rather than the system setting, so a toast\n * matches the page around it (and nothing calls `matchMedia`, which a test environment lacks).\n */\nexport function Toaster({ theme, style, toastOptions, ...props }: ToasterProps) {\n const pageTheme = usePageTheme();\n return (\n <Sonner\n theme={theme ?? pageTheme}\n className=\"toaster group\"\n icons={{\n success: <CircleCheckIcon className=\"size-4\" />,\n info: <InfoIcon className=\"size-4\" />,\n warning: <TriangleAlertIcon className=\"size-4\" />,\n error: <OctagonXIcon className=\"size-4\" />,\n loading: <Loader2Icon className=\"size-4 animate-spin\" />,\n }}\n style={\n {\n '--normal-bg': 'var(--popover)',\n '--normal-text': 'var(--popover-foreground)',\n '--normal-border': 'var(--border)',\n '--border-radius': 'var(--radius)',\n ...style,\n } as CSSProperties\n }\n toastOptions={{ ...toastOptions, classNames: { toast: 'rounded-2xl', ...toastOptions?.classNames } }}\n {...props}\n />\n );\n}\n\n/** `dark` while `<html>` has the `.dark` class, kept in sync as the theme changes. */\nfunction usePageTheme(): 'light' | 'dark' {\n const read = () =>\n typeof document !== 'undefined' && document.documentElement.classList.contains('dark') ? 'dark' : 'light';\n const [theme, setTheme] = useState<'light' | 'dark'>(read);\n useEffect(() => {\n if (typeof MutationObserver === 'undefined') return;\n const observer = new MutationObserver(() => setTheme(read()));\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n return () => observer.disconnect();\n }, []);\n return theme;\n}\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Message: one row of a conversation — the avatar, the alignment, a header and a footer around\n * the message surface (a `Bubble`). For the scroll container around a conversation, see\n * `MessageScroller`; for an in-progress line (\"Checking the logs...\"), a status `Marker`.\n *\n * Two ways to write one:\n * - Shorthand: `<Message align=\"end\" avatar={<Avatar … />} header=\"Ana\" footer=\"Delivered\">\n * <Bubble>…</Bubble></Message>` — the children are the surface.\n * - Composition: `Message` > `MessageAvatar` + `MessageContent` (`MessageHeader`, the surface,\n * `MessageFooter`). `MessageGroup` stacks consecutive messages from one sender.\n *\n * Presentational: the content inside carries the semantics. Give icon-only footer actions an\n * `aria-label`.\n */\n\nexport const MessageGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"message-group\" className={cn('flex min-w-0 flex-col gap-2', className)} {...props} />\n );\n});\n\nexport type MessageAlign = 'start' | 'end';\n\nexport interface MessageProps extends HTMLAttributes<HTMLDivElement> {\n /** Which side of the conversation the row sits on. Default `start`. */\n align?: MessageAlign;\n /** Shorthand: the `MessageAvatar` content, e.g. an `Avatar`. */\n avatar?: ReactNode;\n /** Shorthand: a `MessageHeader`, e.g. the sender's name. */\n header?: ReactNode;\n /** Shorthand: a `MessageFooter`, e.g. a status or actions. */\n footer?: ReactNode;\n}\n\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n { className, align = 'start', avatar, header, footer, children, ...props },\n ref,\n) {\n const shorthand = avatar != null || header != null || footer != null;\n return (\n <div\n ref={ref}\n data-slot=\"message\"\n data-align={align}\n className={cn(\n 'group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse',\n className,\n )}\n {...props}\n >\n {shorthand ? (\n <>\n {avatar != null && <MessageAvatar>{avatar}</MessageAvatar>}\n <MessageContent>\n {header != null && <MessageHeader>{header}</MessageHeader>}\n {children}\n {footer != null && <MessageFooter>{footer}</MessageFooter>}\n </MessageContent>\n </>\n ) : (\n children\n )}\n </div>\n );\n});\n\nexport const MessageAvatar = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageAvatar(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-avatar\"\n className={cn(\n // Anchored to the bottom of the message; with a footer it moves up to the surface.\n 'flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const MessageContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageContent(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-content\"\n className={cn(\n 'flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end',\n className,\n )}\n {...props}\n />\n );\n});\n\nconst META = 'text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0';\n\nexport const MessageHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageHeader(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-header\"\n className={cn('flex max-w-full min-w-0 items-center', META, className)}\n {...props}\n />\n );\n});\n\nexport const MessageFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function MessageFooter(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"message-footer\"\n className={cn('flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end', META, className)}\n {...props}\n />\n );\n});\n","import { Children, isValidElement, type ComponentProps, type ReactNode } from 'react';\nimport {\n MessageScroller as MessageScrollerPrimitive,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n type MessageScrollerDefaultScrollPosition,\n type MessageScrollerScrollOptions,\n} from '../../vendor/headless/message-scroller';\nimport { ArrowDownIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\nimport { Button, type ButtonSize, type ButtonVariant } from '../forms/button';\n\nexport { useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility };\nexport type { MessageScrollerDefaultScrollPosition, MessageScrollerScrollOptions };\n\n/**\n * MessageScroller: the scroll container of a chat transcript. It places each new turn near the\n * top with a strip of the previous one still showing, follows a streamed reply only while the\n * reader is at the live edge, reopens a saved thread at its last turn, keeps the reader's place\n * when older messages load above, and offers a \"jump to latest\" button.\n *\n * Two ways to write one:\n * - Shorthand: `<MessageScroller autoScroll>{items}</MessageScroller>` renders the provider,\n * viewport, content and button around the `MessageScrollerItem`s you pass; the provider's\n * props go on `MessageScroller`.\n * - Composition: `MessageScrollerProvider` > `MessageScroller` > `MessageScrollerViewport` >\n * `MessageScrollerContent` > `MessageScrollerItem`s, plus `MessageScrollerButton`.\n *\n * It fills its parent, so put it in a height-constrained container. The behaviour comes from a\n * headless engine (a regular dependency); these parts add the look. It owns scrolling only: the\n * messages, streaming and persistence stay in the app.\n */\n\nexport type MessageScrollerProviderProps = ComponentProps<typeof MessageScrollerPrimitive.Provider>;\n\nexport function MessageScrollerProvider(props: MessageScrollerProviderProps) {\n return <MessageScrollerPrimitive.Provider {...props} />;\n}\n\nexport type MessageScrollerProps = ComponentProps<typeof MessageScrollerPrimitive.Root> &\n Omit<MessageScrollerProviderProps, 'children'>;\n\nexport function MessageScroller({\n className,\n children,\n autoScroll,\n defaultScrollPosition,\n scrollEdgeThreshold,\n scrollPreviousItemPeek,\n scrollMargin,\n ...props\n}: MessageScrollerProps) {\n // Composition when the viewport is passed in; otherwise the children are the rows.\n const composed = Children.toArray(children).some(\n (child) => isValidElement(child) && child.type === MessageScrollerViewport,\n );\n\n const root = (\n <MessageScrollerPrimitive.Root\n data-slot=\"message-scroller\"\n className={cn('group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden', className)}\n {...props}\n >\n {composed ? (\n children\n ) : (\n <>\n <MessageScrollerViewport>\n <MessageScrollerContent>{children}</MessageScrollerContent>\n </MessageScrollerViewport>\n <MessageScrollerButton />\n </>\n )}\n </MessageScrollerPrimitive.Root>\n );\n\n if (composed) return root;\n return (\n <MessageScrollerProvider\n autoScroll={autoScroll}\n defaultScrollPosition={defaultScrollPosition}\n scrollEdgeThreshold={scrollEdgeThreshold}\n scrollPreviousItemPeek={scrollPreviousItemPeek}\n scrollMargin={scrollMargin}\n >\n {root}\n </MessageScrollerProvider>\n );\n}\n\nexport type MessageScrollerViewportProps = ComponentProps<typeof MessageScrollerPrimitive.Viewport>;\n\n/** The scrollable element: a focusable region named \"Messages\" by default. */\nexport function MessageScrollerViewport({ className, ...props }: MessageScrollerViewportProps) {\n return (\n <MessageScrollerPrimitive.Viewport\n data-slot=\"message-scroller-viewport\"\n className={cn(\n 'size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerContentProps = ComponentProps<typeof MessageScrollerPrimitive.Content>;\n\n/** The transcript: `role=\"log\"` with `aria-relevant=\"additions\"`. Pass `aria-busy` while a turn streams. */\nexport function MessageScrollerContent({ className, ...props }: MessageScrollerContentProps) {\n return (\n <MessageScrollerPrimitive.Content\n data-slot=\"message-scroller-content\"\n className={cn('flex h-max min-h-full flex-col gap-6', className)}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerItemProps = ComponentProps<typeof MessageScrollerPrimitive.Item>;\n\n/**\n * One transcript row: a message, marker, typing line or \"load earlier\" row. `messageId` makes it\n * addressable; `scrollAnchor` marks the row that starts a turn.\n */\nexport function MessageScrollerItem({ className, scrollAnchor = false, ...props }: MessageScrollerItemProps) {\n return (\n <MessageScrollerPrimitive.Item\n data-slot=\"message-scroller-item\"\n scrollAnchor={scrollAnchor}\n className={cn('min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]', className)}\n {...props}\n />\n );\n}\n\nexport type MessageScrollerButtonProps = ComponentProps<typeof MessageScrollerPrimitive.Button> & {\n variant?: ButtonVariant;\n size?: ButtonSize;\n children?: ReactNode;\n};\n\n/** Scrolls to the end (or start) of the transcript; hidden and inert until there is somewhere to go. */\nexport function MessageScrollerButton({\n direction = 'end',\n className,\n children,\n render,\n variant = 'secondary',\n size = 'icon-sm',\n ...props\n}: MessageScrollerButtonProps) {\n return (\n <MessageScrollerPrimitive.Button\n data-slot=\"message-scroller-button\"\n data-direction={direction}\n direction={direction}\n className={cn(\n 'absolute start-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground rtl:translate-x-1/2',\n 'data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)]',\n 'data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)]',\n 'data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full data-[direction=start]:[&_svg]:rotate-180',\n className,\n )}\n render={render ?? <Button variant={variant} size={size} />}\n {...props}\n >\n {children ?? (\n <>\n <ArrowDownIcon />\n <span className=\"sr-only\">{direction === 'end' ? 'Scroll to end' : 'Scroll to start'}</span>\n </>\n )}\n </MessageScrollerPrimitive.Button>\n );\n}\n","import * as React from \"react\"\n\nimport { composeRefs, mergeProps, useRender } from \"../use-render\"\nimport { USER_SCROLL_KEYS } from \"./types\"\nimport type {\n MessageScrollerButtonProps,\n MessageScrollerContentProps,\n MessageScrollerContextValue,\n MessageScrollerItemProps,\n MessageScrollerProps,\n MessageScrollerProviderProps,\n MessageScrollerRegisterMessage,\n MessageScrollerViewportProps,\n} from \"./types\"\nimport { useMessageScrollerController } from \"./use-message-scroller-controller\"\nimport { useLatest } from \"./utils\"\n\nconst MessageScrollerContext =\n React.createContext<MessageScrollerContextValue | null>(null)\nconst MessageScrollerItemContext =\n React.createContext<MessageScrollerRegisterMessage | null>(null)\n\nfunction useMessageScrollerContext() {\n const context = React.useContext(MessageScrollerContext)\n\n if (!context) {\n throw new Error(\"useMessageScroller must be used within a MessageScroller.\")\n }\n\n return context\n}\n\nfunction useMessageScrollerItemContext() {\n const context = React.useContext(MessageScrollerItemContext)\n\n if (!context) {\n throw new Error(\n \"MessageScrollerItem must be used within a MessageScroller.\"\n )\n }\n\n return context\n}\n\nfunction useMessageScroller() {\n const { scrollToEnd, scrollToMessage, scrollToStart } =\n useMessageScrollerContext()\n\n return React.useMemo(\n () => ({\n scrollToEnd,\n scrollToMessage,\n scrollToStart,\n }),\n [scrollToEnd, scrollToMessage, scrollToStart]\n )\n}\n\nfunction useMessageScrollerScrollable() {\n const { stateStore } = useMessageScrollerContext()\n\n return React.useSyncExternalStore(\n stateStore.subscribe,\n stateStore.getSnapshot,\n stateStore.getSnapshot\n )\n}\n\nfunction useMessageScrollerVisibility() {\n const { observeVisibility, unobserveVisibility, visibilityStore } =\n useMessageScrollerContext()\n const subscribe = React.useCallback(\n (listener: () => void) =>\n visibilityStore.subscribe(\n listener,\n observeVisibility,\n unobserveVisibility\n ),\n [observeVisibility, unobserveVisibility, visibilityStore]\n )\n\n return React.useSyncExternalStore(\n subscribe,\n visibilityStore.getSnapshot,\n visibilityStore.getSnapshot\n )\n}\n\nfunction MessageScrollerProvider({\n autoScroll = false,\n children,\n defaultScrollPosition = \"end\",\n scrollEdgeThreshold,\n scrollPreviousItemPeek,\n scrollMargin,\n}: MessageScrollerProviderProps) {\n const { context, registerMessage } = useMessageScrollerController({\n autoScroll,\n defaultScrollPosition,\n scrollEdgeThreshold,\n scrollPreviousItemPeek,\n scrollMargin,\n })\n\n return (\n <MessageScrollerContext.Provider value={context}>\n <MessageScrollerItemContext.Provider value={registerMessage}>\n {children}\n </MessageScrollerItemContext.Provider>\n </MessageScrollerContext.Provider>\n )\n}\n\nfunction usePendingDefaultScroll() {\n const { pendingDefaultScrollStore } = useMessageScrollerContext()\n\n return React.useSyncExternalStore(\n pendingDefaultScrollStore.subscribe,\n pendingDefaultScrollStore.getSnapshot,\n pendingDefaultScrollStore.getSnapshot\n )\n}\n\nfunction MessageScroller({ children, ...props }: MessageScrollerProps) {\n const { setRootElement } = useMessageScrollerContext()\n const pendingDefaultScroll = usePendingDefaultScroll()\n\n return (\n <div\n ref={setRootElement}\n {...props}\n {...(pendingDefaultScroll ? { \"data-pending-scroll\": \"\" } : null)}\n >\n {children}\n </div>\n )\n}\n\nfunction MessageScrollerViewport({\n \"aria-label\": ariaLabel,\n children,\n onKeyDown,\n onScroll,\n onTouchMove,\n onWheel,\n preserveScrollOnPrepend = true,\n ref,\n role,\n tabIndex,\n ...props\n}: MessageScrollerViewportProps) {\n const {\n handleResize,\n preserveScrollOnPrependRef,\n setViewportElement,\n syncAfterScroll,\n userScrollIntent,\n viewportRef,\n } = useMessageScrollerContext()\n const pendingDefaultScroll = usePendingDefaultScroll()\n\n preserveScrollOnPrependRef.current = preserveScrollOnPrepend\n\n const setViewportRef = React.useCallback(\n (element: HTMLDivElement | null) => {\n setViewportElement(element)\n composeRefs(ref)?.(element)\n },\n [ref, setViewportElement]\n )\n\n function handleScroll(event: React.UIEvent<HTMLDivElement>) {\n syncAfterScroll()\n onScroll?.(event)\n }\n\n function handleWheel(event: React.WheelEvent<HTMLDivElement>) {\n userScrollIntent()\n onWheel?.(event)\n }\n\n function handleTouchMove(event: React.TouchEvent<HTMLDivElement>) {\n userScrollIntent()\n onTouchMove?.(event)\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (USER_SCROLL_KEYS.has(event.key)) {\n userScrollIntent()\n }\n\n onKeyDown?.(event)\n }\n\n React.useEffect(() => {\n const viewport = viewportRef.current\n\n if (!viewport || typeof ResizeObserver === \"undefined\") {\n return\n }\n\n // Coalesce into rAF: handleResize mutates the spacer inside the observed\n // content, and resizing an observed element during delivery fires\n // \"ResizeObserver loop completed with undelivered notifications\".\n let frame = 0\n\n const observer = new ResizeObserver(() => {\n window.cancelAnimationFrame(frame)\n frame = window.requestAnimationFrame(handleResize)\n })\n\n observer.observe(viewport)\n\n return () => {\n window.cancelAnimationFrame(frame)\n observer.disconnect()\n }\n }, [handleResize, viewportRef])\n\n return (\n <div\n ref={setViewportRef}\n role={role ?? \"region\"}\n aria-label={ariaLabel ?? \"Messages\"}\n tabIndex={tabIndex ?? 0}\n onKeyDown={handleKeyDown}\n onScroll={handleScroll}\n onTouchMove={handleTouchMove}\n onWheel={handleWheel}\n {...props}\n {...(pendingDefaultScroll ? { \"data-pending-scroll\": \"\" } : null)}\n >\n {children}\n </div>\n )\n}\n\nfunction MessageScrollerContent({\n \"aria-relevant\": ariaRelevant,\n children,\n ref,\n role,\n spacerClassName,\n ...props\n}: MessageScrollerContentProps) {\n const {\n handleContentChange,\n handleResize,\n setContentElement,\n setSpacerElement,\n } = useMessageScrollerContext()\n const contentRef = React.useRef<HTMLDivElement | null>(null)\n\n const setContentRef = React.useCallback(\n (element: HTMLDivElement | null) => {\n contentRef.current = element\n setContentElement(element)\n composeRefs(ref)?.(element)\n },\n [ref, setContentElement]\n )\n\n React.useLayoutEffect(() => {\n const content = contentRef.current\n\n if (!content) {\n return\n }\n\n handleContentChange()\n\n if (typeof MutationObserver === \"undefined\") {\n return\n }\n\n const observer = new MutationObserver(() => {\n handleContentChange()\n })\n\n observer.observe(content, { childList: true })\n\n return () => observer.disconnect()\n }, [handleContentChange])\n\n React.useEffect(() => {\n const content = contentRef.current\n\n if (!content || typeof ResizeObserver === \"undefined\") {\n return\n }\n\n // Coalesce into rAF: handleResize mutates the spacer inside this observed\n // element, and resizing an observed element during delivery fires\n // \"ResizeObserver loop completed with undelivered notifications\".\n let frame = 0\n\n const observer = new ResizeObserver(() => {\n window.cancelAnimationFrame(frame)\n frame = window.requestAnimationFrame(handleResize)\n })\n\n observer.observe(content)\n\n return () => {\n window.cancelAnimationFrame(frame)\n observer.disconnect()\n }\n }, [handleResize])\n\n return (\n <div\n ref={setContentRef}\n role={role ?? \"log\"}\n aria-relevant={ariaRelevant ?? \"additions\"}\n {...props}\n >\n {children}\n <div\n ref={setSpacerElement}\n aria-hidden=\"true\"\n data-message-scroller-spacer=\"\"\n hidden\n className={spacerClassName}\n />\n </div>\n )\n}\n\nfunction MessageScrollerItem({\n messageId,\n ref,\n scrollAnchor = false,\n ...props\n}: MessageScrollerItemProps) {\n const registerMessage = useMessageScrollerItemContext()\n const elementRef = React.useRef<HTMLDivElement | null>(null)\n\n const setItemRef = React.useCallback(\n (element: HTMLDivElement | null) => {\n const previousElement = elementRef.current\n\n elementRef.current = element\n\n if (messageId) {\n registerMessage(messageId, element, previousElement)\n }\n\n composeRefs(ref)?.(element)\n },\n [messageId, ref, registerMessage]\n )\n\n return (\n <div\n ref={setItemRef}\n data-message-id={messageId}\n data-scroll-anchor={scrollAnchor ? \"true\" : \"false\"}\n {...props}\n />\n )\n}\n\nfunction MessageScrollerButton({\n behavior = \"smooth\",\n children,\n direction = \"end\",\n onClick,\n render,\n tabIndex,\n type = \"button\",\n ...props\n}: MessageScrollerButtonProps) {\n const { scrollToEnd, scrollToStart, stateStore } = useMessageScrollerContext()\n const onClickRef = useLatest(onClick)\n const subscribe = React.useCallback(\n (listener: () => void) => stateStore.subscribe(listener),\n [stateStore]\n )\n const getSnapshot = React.useCallback(() => {\n const state = stateStore.getSnapshot()\n\n return direction === \"start\" ? state.start : state.end\n }, [direction, stateStore])\n const isActive = React.useSyncExternalStore(\n subscribe,\n getSnapshot,\n getSnapshot\n )\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n if (!isActive) {\n return\n }\n\n onClickRef.current?.(event)\n\n if (!event.defaultPrevented) {\n event.currentTarget.blur()\n\n if (direction === \"start\") {\n scrollToStart({ behavior })\n } else {\n scrollToEnd({ behavior })\n }\n }\n },\n [behavior, direction, isActive, onClickRef, scrollToEnd, scrollToStart]\n )\n\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n type,\n inert: !isActive,\n tabIndex: isActive ? tabIndex : -1,\n children: children ?? <span>Scroll to {direction}</span>,\n onClick: handleClick,\n },\n props\n ),\n render,\n state: {\n active: isActive,\n direction,\n },\n stateAttributesMapping: {\n active: (value) => ({\n \"data-active\": value ? \"true\" : \"false\",\n }),\n },\n })\n}\n\nexport {\n MessageScroller,\n MessageScrollerButton,\n MessageScrollerContent,\n MessageScrollerItem,\n MessageScrollerProvider,\n MessageScrollerViewport,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n}\n","import * as React from \"react\"\n\nimport type { UseRenderComponentProps } from \"../use-render\"\n\n// Default scrollEdgeThreshold. Sub-pixel tolerance so edge detection does not\n// flicker across engines that round scrollTop differently.\nconst DEFAULT_SCROLL_EDGE_THRESHOLD = 8\n\n// Default scrollPreviousItemPeek. Pixels of the previous item kept visible above\n// a newly anchored row.\nconst DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK = 64\n\n// Default scrollMargin for scrollToMessage and programmatic targets.\nconst DEFAULT_SCROLL_MARGIN = 0\n\n// Two fractional scrollTop values within this range are treated as equal, to\n// absorb zoom and HiDPI rounding drift.\nconst SCROLL_POSITION_EPSILON = 0.5\n\n// How long (ms) data-autoscrolling stays set during a programmatic smooth scroll\n// before clearing.\nconst AUTOSCROLLING_CLEAR_DELAY = 180\n\n// Viewport keys that count as deliberate scroll intent and release follow-bottom.\nconst USER_SCROLL_KEYS = new Set([\n \"ArrowDown\",\n \"ArrowUp\",\n \"End\",\n \"Home\",\n \"PageDown\",\n \"PageUp\",\n \" \", // Space key.\n])\n\n// Internal scroll mode. Derived from intent and commands; decides how the\n// viewport reacts to content and resize.\ntype MessageScrollerMode =\n | \"following-bottom\" // autoScroll on, pinned to the latest message.\n | \"free-scrolling\" // reader scrolled away; position left alone (prepends still preserved).\n | \"anchored-to-message\" // holding a turn at the reading line while it streams.\n | \"settling-jump\" // a programmatic jump is animating; intent detection suppressed until it settles.\n\n// Where a saved transcript opens on the first non-empty render.\ntype MessageScrollerDefaultScrollPosition = \"start\" | \"end\" | \"last-anchor\"\n\n// Which transcript edge MessageScrollerButton scrolls toward.\ntype MessageScrollerButtonDirection = \"start\" | \"end\"\n\n// Viewport alignment for scrollToMessage and programmatic jumps.\ntype MessageScrollerScrollAlign = \"start\" | \"center\" | \"end\" | \"nearest\"\n\n// Options for scrollToMessage, scrollToEnd, and scrollToStart.\ntype MessageScrollerScrollOptions = {\n // Viewport edge or center to align the target to.\n align?: MessageScrollerScrollAlign\n // Native scroll behavior.\n behavior?: ScrollBehavior\n // Margin on the aligned edge, in pixels. Defaults to the provider scrollMargin.\n scrollMargin?: number\n}\n\n// Scroll snapshot from useMessageScrollerScrollable: which edges the viewport can\n// still scroll toward.\ntype MessageScrollerScrollable = {\n // The viewport can scroll toward the start (content is hidden above).\n start: boolean\n // The viewport can scroll toward the end (content is hidden below).\n end: boolean\n}\n\n// Visibility snapshot from useMessageScrollerVisibility.\ntype MessageScrollerVisibilityState = {\n // The anchored turn the reader is in, or null. Stays set after the anchor\n // scrolls above the viewport.\n currentAnchorId: string | null\n // messageId values intersecting the viewport, in document order.\n visibleMessageIds: string[]\n}\n\n// Headless provider for a chat transcript scroller. Owns scroll behavior and\n// state; renders no DOM.\ntype MessageScrollerProviderProps = {\n children?: React.ReactNode\n // Follow new content at the bottom while the viewport is already at the end.\n autoScroll?: boolean\n // Opening position on the first non-empty render, applied once.\n defaultScrollPosition?: MessageScrollerDefaultScrollPosition\n // Distance from an edge that still counts as at-top/at-bottom. Defaults to 8.\n scrollEdgeThreshold?: number\n // Extra top margin for a newly anchored row, added to scrollMargin. Defaults to 64.\n scrollPreviousItemPeek?: number\n // Default margin on the aligned edge for commands and visibility. Defaults to 0.\n scrollMargin?: number\n}\n\n// Frame container for a chat transcript scroller. Must render inside a\n// MessageScrollerProvider.\ntype MessageScrollerProps = React.ComponentProps<\"div\">\n\n// Scrollable viewport. Owns native scroll events and prepend preservation.\ntype MessageScrollerViewportProps = React.ComponentProps<\"div\"> & {\n // Keep the first visible messageId row stable on prepend. Defaults to true.\n preserveScrollOnPrepend?: boolean\n}\n\n// Transcript row container. Every direct child should be a MessageScrollerItem.\ntype MessageScrollerContentProps = React.ComponentProps<\"div\"> & {\n // Class name for the internal tail spacer used when anchoring turns near the top.\n spacerClassName?: string\n}\n\n// One transcript row: a message, marker, typing row, separator, or load-more row.\ntype MessageScrollerItemProps = React.ComponentProps<\"div\"> & {\n // Stable row id for scrollToMessage, visibility, and prepend preservation.\n messageId?: string\n // Marks a turn boundary that newly appended anchors and last-anchor restore use.\n scrollAnchor?: boolean\n}\n\n// State passed to MessageScrollerButton's render prop.\ntype MessageScrollerButtonRenderState = {\n // Whether overflow exists toward this button's direction.\n active: boolean\n direction: MessageScrollerButtonDirection\n}\n\n// Scroll control for the start or end of the transcript.\ntype MessageScrollerButtonProps = UseRenderComponentProps<\n \"button\",\n MessageScrollerButtonRenderState\n> & {\n // Native scroll behavior when clicked. Defaults to \"smooth\".\n behavior?: ScrollBehavior\n // Transcript edge to scroll toward. Defaults to \"end\".\n direction?: MessageScrollerButtonDirection\n}\n\n// Minimal external store backing useMessageScrollerScrollable, consumed via\n// useSyncExternalStore.\ntype MessageScrollerStore<T> = {\n getSnapshot: () => T\n setSnapshot: (nextSnapshot: T) => void\n subscribe: (listener: () => void) => () => void\n}\n\n// External store backing useMessageScrollerVisibility. Adds reference-counting so\n// tracking stays lazy.\ntype MessageScrollerVisibilityStore = {\n getSnapshot: () => MessageScrollerVisibilityState\n hasListeners: () => boolean\n setSnapshot: (nextSnapshot: MessageScrollerVisibilityState) => void\n subscribe: (\n listener: () => void,\n onFirstSubscribe: () => void,\n onLastUnsubscribe: () => void\n ) => () => void\n}\n\n// Registers (or, with removedElement, unregisters) a MessageScrollerItem node by\n// messageId.\ntype MessageScrollerRegisterMessage = (\n messageId: string,\n element: HTMLElement | null,\n removedElement?: HTMLElement | null\n) => void\n\n// Internal context wiring the parts together. Not part of the public API.\ntype MessageScrollerContextValue = {\n handleContentChange: () => void\n handleResize: () => void\n observeVisibility: () => void\n preserveScrollOnPrependRef: React.RefObject<boolean>\n scrollToEnd: (options?: MessageScrollerScrollOptions) => boolean\n scrollToMessage: (\n messageId: string,\n options?: MessageScrollerScrollOptions\n ) => boolean\n scrollToStart: (options?: MessageScrollerScrollOptions) => boolean\n setContentElement: (element: HTMLDivElement | null) => void\n setRootElement: (element: HTMLDivElement | null) => void\n setSpacerElement: (element: HTMLDivElement | null) => void\n setViewportElement: (element: HTMLDivElement | null) => void\n pendingDefaultScrollStore: MessageScrollerStore<boolean>\n stateStore: MessageScrollerStore<MessageScrollerScrollable>\n syncAfterScroll: () => void\n unobserveVisibility: () => void\n userScrollIntent: () => void\n viewportRef: React.RefObject<HTMLDivElement | null>\n visibilityStore: MessageScrollerVisibilityStore\n}\n\n// Initial MessageScrollerScrollable before measurement. Stable reference for the\n// server and first-render snapshot.\nconst EMPTY_MESSAGE_SCROLLER_SCROLLABLE: MessageScrollerScrollable = {\n start: false,\n end: false,\n}\n\n// Shared empty array so empty visibility snapshots stay referentially stable.\nconst EMPTY_VISIBLE_MESSAGE_IDS: string[] = []\n\n// Initial MessageScrollerVisibilityState. Nothing tracked, no current anchor.\nconst EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE: MessageScrollerVisibilityState =\n {\n currentAnchorId: null,\n visibleMessageIds: EMPTY_VISIBLE_MESSAGE_IDS,\n }\n\nexport {\n AUTOSCROLLING_CLEAR_DELAY,\n DEFAULT_SCROLL_EDGE_THRESHOLD,\n DEFAULT_SCROLL_MARGIN,\n DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK,\n EMPTY_MESSAGE_SCROLLER_SCROLLABLE,\n EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE,\n EMPTY_VISIBLE_MESSAGE_IDS,\n SCROLL_POSITION_EPSILON,\n USER_SCROLL_KEYS,\n}\n\nexport type {\n MessageScrollerButtonDirection,\n MessageScrollerButtonProps,\n MessageScrollerButtonRenderState,\n MessageScrollerContentProps,\n MessageScrollerContextValue,\n MessageScrollerDefaultScrollPosition,\n MessageScrollerItemProps,\n MessageScrollerMode,\n MessageScrollerProps,\n MessageScrollerProviderProps,\n MessageScrollerRegisterMessage,\n MessageScrollerScrollAlign,\n MessageScrollerScrollOptions,\n MessageScrollerScrollable,\n MessageScrollerStore,\n MessageScrollerViewportProps,\n MessageScrollerVisibilityState,\n MessageScrollerVisibilityStore,\n}\n","import * as React from \"react\"\n\nimport {\n getContentBottom,\n getElementTop,\n getElementViewportTop,\n getFirstVisibleMessageItem,\n getFlexGap,\n getLastScrollAnchor,\n getMessageScrollerItems,\n getMessageScrollerScrollable,\n getMessageScrollerVisibilityState,\n getNewScrollAnchor,\n getUnanchoredScrollAnchor,\n hasMultipleNewScrollAnchors,\n} from \"./geometry\"\nimport {\n DEFAULT_SCROLL_EDGE_THRESHOLD,\n DEFAULT_SCROLL_MARGIN,\n DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK,\n EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE,\n SCROLL_POSITION_EPSILON,\n} from \"./types\"\nimport type {\n MessageScrollerContextValue,\n MessageScrollerProviderProps,\n MessageScrollerRegisterMessage,\n MessageScrollerScrollable,\n} from \"./types\"\nimport { useMessageScrollerCommands } from \"./use-message-scroller-commands\"\nimport {\n clearPendingDefaultScroll,\n markDefaultScrollPositionApplied,\n useMessageScrollerRefs,\n} from \"./use-message-scroller-refs\"\n\n// Builds a ref callback that stores the node and runs onMount once it attaches.\nfunction useElementRef(\n elementRef: React.RefObject<HTMLDivElement | null>,\n onMount: () => void\n) {\n return React.useCallback(\n (element: HTMLDivElement | null) => {\n elementRef.current = element\n\n if (element) {\n onMount()\n }\n },\n [elementRef, onMount]\n )\n}\n\n// Orchestrator hook. Decides when to scroll and delegates the moves to\n// useMessageScrollerCommands; state and visibility commits are coalesced on a\n// requestAnimationFrame and torn down on cleanup for StrictMode safety.\nfunction useMessageScrollerController({\n autoScroll = false,\n defaultScrollPosition = \"end\",\n scrollEdgeThreshold = DEFAULT_SCROLL_EDGE_THRESHOLD,\n scrollPreviousItemPeek = DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK,\n scrollMargin = DEFAULT_SCROLL_MARGIN,\n}: MessageScrollerProviderProps) {\n const refs = useMessageScrollerRefs({\n autoScroll,\n defaultScrollPosition,\n scrollEdgeThreshold,\n scrollMargin,\n scrollPreviousItemPeek,\n })\n\n const {\n streamingTurnRef,\n autoScrollRef,\n autoscrollingRef,\n autoscrollingTimeoutRef,\n contentRef,\n defaultScrollPositionAppliedRef,\n firstItemRef,\n itemCountRef,\n lastScrollTopRef,\n messageElementsRef,\n modeRef,\n pendingScrollFrameRef,\n pendingScrollToMessageRef,\n prependRestoreRef,\n preserveScrollOnPrependRef,\n pendingDefaultScrollStore,\n rootRef,\n scrollEdgeThresholdRef,\n scrollMarginRef,\n scrollPreviousItemPeekRef,\n spacerGapRef,\n spacerHeightRef,\n spacerRef,\n stateFrameRef,\n stateStore,\n viewportRef,\n visibilityFrameRef,\n visibilityObserverRef,\n visibilityStore,\n visibleMessageIdsRef,\n handledScrollAnchorsRef,\n } = refs\n\n const previousDefaultScrollPositionRef = React.useRef(defaultScrollPosition)\n\n if (previousDefaultScrollPositionRef.current !== defaultScrollPosition) {\n previousDefaultScrollPositionRef.current = defaultScrollPosition\n defaultScrollPositionAppliedRef.current = false\n // The pending-scroll hold is mount-only. A live prop change re-applies the\n // opening position in layout; it does not hide the viewport again.\n }\n\n const writeStateAttributes = React.useCallback(\n (state: MessageScrollerScrollable) => {\n const root = rootRef.current\n const viewport = viewportRef.current\n const scrollable = [state.start && \"start\", state.end && \"end\"]\n .filter(Boolean)\n .join(\" \")\n const autoScrolling = autoscrollingRef.current\n\n for (const element of [root, viewport]) {\n if (!element) {\n continue\n }\n\n if (scrollable) {\n element.setAttribute(\"data-scrollable\", scrollable)\n } else {\n element.removeAttribute(\"data-scrollable\")\n }\n\n element.toggleAttribute(\"data-autoscrolling\", autoScrolling)\n }\n },\n []\n )\n\n // Owns the one follow-bottom transition: arm at the bottom, release on any\n // scroll away (including a scrollbar drag), suppressed during a programmatic\n // scroll so the auto-scroll animation cannot release itself. Arming also\n // skips the anchored-to-message hold: the tail spacer makes a freshly\n // anchored turn read as \"at the end\", and re-arming there would let the\n // first streamed chunk yank the reader off the anchor. The hold hands back\n // to following in handleResize, once the reply consumes the tail spacer.\n const reconcileFollowMode = React.useCallback(\n (scrollable: MessageScrollerScrollable) => {\n const scrollTop = viewportRef.current?.scrollTop ?? 0\n // Content growing past the live edge also reads as \"not at the end\", but\n // only a scrollbar drag moves scrollTop up. Growth must not release\n // follow-output: the resize handler is coalesced onto a frame, so a state\n // commit can observe the grown content before follow catches up.\n const scrolledUp =\n scrollTop < lastScrollTopRef.current - SCROLL_POSITION_EPSILON\n\n lastScrollTopRef.current = scrollTop\n\n if (\n autoScrollRef.current &&\n !scrollable.end &&\n modeRef.current !== \"settling-jump\" &&\n modeRef.current !== \"anchored-to-message\"\n ) {\n modeRef.current = \"following-bottom\"\n } else if (\n modeRef.current === \"following-bottom\" &&\n scrollable.end &&\n scrolledUp &&\n !autoscrollingRef.current\n ) {\n modeRef.current = \"free-scrolling\"\n }\n },\n []\n )\n\n const commitScrollState = React.useCallback(() => {\n const nextState = getMessageScrollerScrollable({\n content: contentRef.current,\n scrollEdgeThreshold: scrollEdgeThresholdRef.current,\n spacer: spacerRef.current,\n viewport: viewportRef.current,\n })\n\n reconcileFollowMode(nextState)\n\n // While follow-output is engaged the scroller is already closing any gap a\n // streamed chunk just opened, so publishing it as scrollable toward the\n // end would strobe the scroll button once per chunk. Reconcile runs on the\n // raw geometry first, so a commit that releases follow still publishes the\n // gap it released over.\n const publishedState =\n modeRef.current === \"following-bottom\"\n ? { ...nextState, end: false }\n : nextState\n\n writeStateAttributes(publishedState)\n stateStore.setSnapshot(publishedState)\n }, [reconcileFollowMode, stateStore, writeStateAttributes])\n\n const scheduleStateCommit = React.useCallback(() => {\n if (stateFrameRef.current !== null) {\n return\n }\n\n stateFrameRef.current = window.requestAnimationFrame(() => {\n stateFrameRef.current = null\n commitScrollState()\n })\n }, [commitScrollState])\n\n const scheduleVisibilitySync = React.useCallback(() => {\n if (!visibilityStore.hasListeners()) {\n return\n }\n\n if (visibilityFrameRef.current !== null) {\n return\n }\n\n visibilityFrameRef.current = window.requestAnimationFrame(() => {\n visibilityFrameRef.current = null\n\n // A frame can outlive the last unsubscribe. Recomputing here would\n // overwrite the EMPTY snapshot that teardown just wrote, leaving a stale\n // value for the next subscriber to read.\n if (!visibilityStore.hasListeners()) {\n return\n }\n\n visibilityStore.setSnapshot(\n getMessageScrollerVisibilityState({\n content: contentRef.current,\n scrollMargin: scrollMarginRef.current,\n scrollPreviousItemPeek: scrollPreviousItemPeekRef.current,\n spacer: spacerRef.current,\n viewport: viewportRef.current,\n visibleMessageIds: visibleMessageIdsRef.current,\n })\n )\n })\n }, [visibilityStore])\n\n const {\n flushPendingScrollToMessage,\n reanchorToAnchoredMessage,\n scrollToElement,\n scrollToEnd,\n scrollToMessage,\n scrollToStart,\n } = useMessageScrollerCommands({\n refs,\n commitScrollState,\n scheduleStateCommit,\n scheduleVisibilitySync,\n })\n\n const restorePrependedAnchor = React.useCallback(() => {\n const anchor = prependRestoreRef.current\n const viewport = viewportRef.current\n\n if (!anchor || !viewport || !anchor.element.isConnected) {\n return false\n }\n\n // Compare the anchor relative to the viewport, not to the content. Native\n // scroll anchoring leaves the viewport-relative position unchanged, so this\n // is a no-op where the browser already handled the prepend and only corrects\n // the scroll where it did not (e.g. Safari) — without trusting a capability\n // flag, which some engines report incorrectly.\n const nextViewportTop = getElementViewportTop(anchor.element, viewport)\n const delta = nextViewportTop - anchor.viewportTop\n\n if (Math.abs(delta) <= SCROLL_POSITION_EPSILON) {\n return false\n }\n\n viewport.scrollTop += delta\n anchor.viewportTop = getElementViewportTop(anchor.element, viewport)\n scheduleStateCommit()\n scheduleVisibilitySync()\n\n return true\n }, [scheduleStateCommit, scheduleVisibilitySync])\n\n const capturePrependAnchor = React.useCallback(() => {\n const content = contentRef.current\n const viewport = viewportRef.current\n\n if (!content || !viewport) {\n prependRestoreRef.current = null\n return\n }\n\n const anchor = getFirstVisibleMessageItem({\n content,\n spacer: spacerRef.current,\n viewport,\n })\n\n prependRestoreRef.current = anchor\n ? {\n element: anchor,\n viewportTop: getElementViewportTop(anchor, viewport),\n }\n : null\n }, [])\n\n const schedulePendingScrollToMessageFlush = React.useCallback(() => {\n if (pendingScrollFrameRef.current !== null) {\n return\n }\n\n pendingScrollFrameRef.current = window.requestAnimationFrame(() => {\n pendingScrollFrameRef.current = null\n\n if (flushPendingScrollToMessage()) {\n capturePrependAnchor()\n }\n })\n }, [capturePrependAnchor, flushPendingScrollToMessage])\n\n const applyDefaultScrollPosition = React.useCallback(() => {\n if (\n !defaultScrollPosition ||\n defaultScrollPositionAppliedRef.current ||\n itemCountRef.current === 0\n ) {\n return false\n }\n\n let handled = false\n\n if (defaultScrollPosition === \"last-anchor\") {\n const content = contentRef.current\n const viewport = viewportRef.current\n const anchor =\n content && viewport\n ? getLastScrollAnchor(\n getMessageScrollerItems(content, spacerRef.current)\n )\n : null\n\n if (!content || !viewport || !anchor) {\n handled = scrollToEnd({ behavior: \"auto\" })\n } else {\n const anchorTop = getElementTop(anchor, viewport)\n const contentBottom = getContentBottom({\n content,\n spacer: spacerRef.current,\n viewport,\n })\n // A short last turn already fits below the anchor, so opening at the end\n // shows the whole turn without leaving a blank gap beneath it.\n const lastTurnFits = contentBottom - anchorTop <= viewport.clientHeight\n\n handled = lastTurnFits\n ? scrollToEnd({ behavior: \"auto\" })\n : scrollToElement(\n anchor,\n { align: \"start\" },\n { keepPreviousPeek: true }\n )\n }\n } else {\n handled =\n defaultScrollPosition === \"end\"\n ? scrollToEnd({ behavior: \"auto\" })\n : scrollToStart({ behavior: \"auto\" })\n }\n\n if (!handled) {\n return false\n }\n\n markDefaultScrollPositionApplied(refs)\n\n return true\n }, [defaultScrollPosition, scrollToElement, scrollToEnd, scrollToStart])\n\n const handleContentChange = React.useCallback(() => {\n const content = contentRef.current\n\n if (!content) {\n return\n }\n\n const items = getMessageScrollerItems(content, spacerRef.current)\n const previousItemCount = itemCountRef.current\n const previousFirstItem = firstItemRef.current\n\n itemCountRef.current = items.length\n firstItemRef.current = items[0] ?? null\n\n // Reconcile the scroll position with the new content. Every path re-captures\n // the prepend anchor afterward, so each branch just returns.\n //\n // Branch order is load-bearing: first-content, prepended, appended, updated.\n const reconcileScrollPosition = () => {\n if (flushPendingScrollToMessage()) {\n return\n }\n\n if (previousItemCount === 0) {\n if (applyDefaultScrollPosition()) {\n return\n }\n\n if (\n items.length > 0 &&\n autoScrollRef.current &&\n scrollToEnd({ behavior: \"auto\" })\n ) {\n return\n }\n\n commitScrollState()\n scheduleVisibilitySync()\n return\n }\n\n const previousFirstItemIndex = previousFirstItem\n ? items.indexOf(previousFirstItem)\n : -1\n const didPrepend =\n preserveScrollOnPrependRef.current && previousFirstItemIndex > 0\n\n if (didPrepend) {\n // Prepended rows are not new appends. Restore the prior scroll position.\n // The restore is a no-op where native scroll anchoring already did it.\n restorePrependedAnchor()\n return\n }\n\n if (items.length > previousItemCount) {\n const anchor = getNewScrollAnchor(items, previousItemCount)\n\n if (anchor) {\n // While the reader is following the live end, a batch of several\n // anchored turns arriving at once should keep following the end — not\n // yank back to anchor the first turn of the batch. A single new anchor\n // still moves to the top as usual.\n if (\n autoScrollRef.current &&\n modeRef.current === \"following-bottom\" &&\n hasMultipleNewScrollAnchors(items, previousItemCount)\n ) {\n scrollToEnd({ behavior: \"auto\" })\n return\n }\n\n scrollToElement(\n anchor,\n { align: \"start\" },\n { keepPreviousPeek: true }\n )\n handledScrollAnchorsRef.current.add(anchor)\n return\n }\n }\n\n if (items.length === previousItemCount) {\n const anchor = getUnanchoredScrollAnchor(\n items,\n handledScrollAnchorsRef.current\n )\n\n if (anchor) {\n scrollToElement(\n anchor,\n { align: \"start\" },\n { keepPreviousPeek: true }\n )\n handledScrollAnchorsRef.current.add(anchor)\n return\n }\n }\n\n // Appends with no new anchor (and content-only updates) fall through here:\n // keep following the end if we still are, otherwise just recommit state.\n if (modeRef.current === \"following-bottom\" && autoScrollRef.current) {\n scrollToEnd({ behavior: \"auto\" })\n } else {\n commitScrollState()\n scheduleVisibilitySync()\n }\n }\n\n reconcileScrollPosition()\n capturePrependAnchor()\n }, [\n applyDefaultScrollPosition,\n capturePrependAnchor,\n commitScrollState,\n flushPendingScrollToMessage,\n restorePrependedAnchor,\n scheduleVisibilitySync,\n scrollToElement,\n scrollToEnd,\n ])\n\n const handleResize = React.useCallback(() => {\n if (modeRef.current === \"following-bottom\" && autoScrollRef.current) {\n scrollToEnd({ behavior: \"auto\" })\n return\n }\n\n // Hold the anchored turn in place as content below it resizes (a reply\n // streaming in, or a transient marker collapsing) — otherwise the shrinking\n // content lets the browser clamp scrollTop and the turn drops.\n const previousSpacerHeight = spacerHeightRef.current\n\n if (reanchorToAnchoredMessage()) {\n // The reply streaming below the anchor consumes the tail spacer as it\n // grows. Once the last of it is gone the reply has filled the viewport\n // and the reader is genuinely at the live edge, so autoScroll hands off\n // from the anchor hold to following the bottom. Requiring the >0 → 0\n // transition keeps a turn taller than the viewport (placed with no\n // spacer) held instead of yanked to the end.\n if (\n autoScrollRef.current &&\n previousSpacerHeight > 0 &&\n spacerHeightRef.current === 0\n ) {\n scrollToEnd({ behavior: \"auto\" })\n }\n\n return\n }\n\n scheduleStateCommit()\n scheduleVisibilitySync()\n }, [\n reanchorToAnchoredMessage,\n scheduleStateCommit,\n scheduleVisibilitySync,\n scrollToEnd,\n ])\n\n const observeVisibility = React.useCallback(() => {\n const viewport = viewportRef.current\n\n if (!viewport || !visibilityStore.hasListeners()) {\n return\n }\n\n if (typeof IntersectionObserver === \"undefined\") {\n scheduleVisibilitySync()\n return\n }\n\n if (!visibilityObserverRef.current) {\n visibilityObserverRef.current = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const messageId = (entry.target as HTMLElement).dataset.messageId\n\n if (!messageId) {\n continue\n }\n\n if (entry.isIntersecting) {\n visibleMessageIdsRef.current.add(messageId)\n } else {\n visibleMessageIdsRef.current.delete(messageId)\n }\n }\n\n scheduleVisibilitySync()\n },\n {\n root: viewport,\n // Shrink the root's top edge to the anchoring line so a previous turn\n // peeking in the scrollMargin + peek band is not reported as visible,\n // keeping visibleMessageIds consistent with currentAnchorId. Captured\n // at observe time; a prop change rebuilds the observer on resubscribe.\n rootMargin: `${-(\n scrollMarginRef.current + scrollPreviousItemPeekRef.current\n )}px 0px 0px 0px`,\n threshold: [0, 0.01, 0.5, 1],\n }\n )\n }\n\n messageElementsRef.current.forEach((element) => {\n visibilityObserverRef.current?.observe(element)\n })\n scheduleVisibilitySync()\n }, [scheduleVisibilitySync, visibilityStore])\n\n const unobserveVisibility = React.useCallback(() => {\n if (visibilityFrameRef.current !== null) {\n window.cancelAnimationFrame(visibilityFrameRef.current)\n visibilityFrameRef.current = null\n }\n\n visibilityObserverRef.current?.disconnect()\n visibilityObserverRef.current = null\n visibleMessageIdsRef.current.clear()\n visibilityStore.setSnapshot(EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE)\n }, [visibilityStore])\n\n const registerMessage = React.useCallback<MessageScrollerRegisterMessage>(\n (messageId, element, removedElement) => {\n if (element) {\n messageElementsRef.current.set(messageId, element)\n visibilityObserverRef.current?.observe(element)\n scheduleVisibilitySync()\n\n if (pendingScrollToMessageRef.current?.messageId === messageId) {\n schedulePendingScrollToMessageFlush()\n }\n\n return\n }\n\n if (\n removedElement &&\n messageElementsRef.current.get(messageId) === removedElement\n ) {\n messageElementsRef.current.delete(messageId)\n visibleMessageIdsRef.current.delete(messageId)\n visibilityObserverRef.current?.unobserve(removedElement)\n scheduleVisibilitySync()\n }\n },\n [schedulePendingScrollToMessageFlush, scheduleVisibilitySync]\n )\n\n const userScrollIntent = React.useCallback(() => {\n if (\n modeRef.current === \"following-bottom\" ||\n modeRef.current === \"anchored-to-message\" ||\n modeRef.current === \"settling-jump\"\n ) {\n // A deliberate gesture releases auto-follow, turn-anchoring, and an in-flight\n // programmatic jump so re-pinning (and re-arming) never fights the reader.\n streamingTurnRef.current = null\n modeRef.current = \"free-scrolling\"\n }\n }, [])\n\n const mirrorStateAttributes = React.useCallback(\n () => writeStateAttributes(stateStore.getSnapshot()),\n [stateStore, writeStateAttributes]\n )\n\n const setRootElement = useElementRef(rootRef, mirrorStateAttributes)\n const setViewportElement = useElementRef(viewportRef, mirrorStateAttributes)\n\n const setContentElement = React.useCallback(\n (element: HTMLDivElement | null) => {\n contentRef.current = element\n },\n []\n )\n\n const setSpacerElement = React.useCallback(\n (element: HTMLDivElement | null) => {\n spacerRef.current = element\n spacerGapRef.current = getFlexGap(element?.parentElement ?? null)\n },\n []\n )\n\n const syncAfterScroll = React.useCallback(() => {\n commitScrollState()\n scheduleVisibilitySync()\n capturePrependAnchor()\n }, [capturePrependAnchor, commitScrollState, scheduleVisibilitySync])\n\n const context = React.useMemo<MessageScrollerContextValue>(\n () => ({\n handleContentChange,\n handleResize,\n observeVisibility,\n pendingDefaultScrollStore,\n preserveScrollOnPrependRef,\n scrollToEnd,\n scrollToMessage,\n scrollToStart,\n setContentElement,\n setRootElement,\n setSpacerElement,\n setViewportElement,\n stateStore,\n syncAfterScroll,\n unobserveVisibility,\n userScrollIntent,\n viewportRef,\n visibilityStore,\n }),\n [\n handleContentChange,\n handleResize,\n observeVisibility,\n pendingDefaultScrollStore,\n scrollToEnd,\n scrollToMessage,\n scrollToStart,\n setContentElement,\n setRootElement,\n setSpacerElement,\n setViewportElement,\n stateStore,\n syncAfterScroll,\n unobserveVisibility,\n userScrollIntent,\n visibilityStore,\n ]\n )\n\n React.useLayoutEffect(() => {\n if (applyDefaultScrollPosition()) {\n return\n }\n\n if (itemCountRef.current === 0) {\n clearPendingDefaultScroll(refs)\n }\n }, [applyDefaultScrollPosition])\n\n React.useEffect(() => {\n return () => {\n // Reset every ref after cancelling. StrictMode replays effects on the same\n // refs (unmount then remount), so a frame id left non-null here makes the\n // scheduler on remount think a frame is still pending and never reschedule.\n if (stateFrameRef.current !== null) {\n window.cancelAnimationFrame(stateFrameRef.current)\n stateFrameRef.current = null\n }\n\n if (visibilityFrameRef.current !== null) {\n window.cancelAnimationFrame(visibilityFrameRef.current)\n visibilityFrameRef.current = null\n }\n\n if (autoscrollingTimeoutRef.current !== null) {\n window.clearTimeout(autoscrollingTimeoutRef.current)\n autoscrollingTimeoutRef.current = null\n }\n\n if (pendingScrollFrameRef.current !== null) {\n window.cancelAnimationFrame(pendingScrollFrameRef.current)\n pendingScrollFrameRef.current = null\n }\n\n visibilityObserverRef.current?.disconnect()\n visibilityObserverRef.current = null\n }\n }, [])\n\n React.useLayoutEffect(() => {\n if (\n autoScroll &&\n modeRef.current === \"following-bottom\" &&\n itemCountRef.current > 0\n ) {\n scrollToEnd({ behavior: \"auto\" })\n return\n }\n\n commitScrollState()\n }, [autoScroll, commitScrollState, scrollToEnd])\n\n return {\n context,\n registerMessage,\n }\n}\n\nexport { useMessageScrollerController }\n","import {\n EMPTY_MESSAGE_SCROLLER_SCROLLABLE,\n EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE,\n SCROLL_POSITION_EPSILON,\n} from \"./types\"\nimport type {\n MessageScrollerScrollable,\n MessageScrollerScrollAlign,\n MessageScrollerVisibilityState,\n} from \"./types\"\n\nfunction getMessageScrollerScrollable({\n content,\n scrollEdgeThreshold,\n spacer,\n viewport,\n}: {\n content: HTMLElement | null\n scrollEdgeThreshold: number\n spacer: HTMLElement | null\n viewport: HTMLElement | null\n}): MessageScrollerScrollable {\n if (!viewport || !content) {\n return EMPTY_MESSAGE_SCROLLER_SCROLLABLE\n }\n\n const contentBottom = getContentBottom({ content, spacer, viewport })\n\n return {\n start: viewport.scrollTop > scrollEdgeThreshold,\n end:\n contentBottom - viewport.scrollTop - viewport.clientHeight >\n scrollEdgeThreshold,\n }\n}\n\nfunction getMessageScrollerVisibilityState({\n content,\n scrollMargin,\n scrollPreviousItemPeek,\n spacer,\n viewport,\n visibleMessageIds,\n}: {\n content: HTMLElement | null\n scrollMargin: number\n scrollPreviousItemPeek: number\n spacer: HTMLElement | null\n viewport: HTMLElement | null\n visibleMessageIds: Set<string>\n}): MessageScrollerVisibilityState {\n if (!content || !viewport) {\n return EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE\n }\n\n const viewportRect = viewport.getBoundingClientRect()\n // The reading line sits scrollPreviousItemPeek below scrollMargin: anchored\n // turns land there with the previous turn peeking above. A row only peeking in\n // that band has not been read down to yet, so it counts as neither visible nor\n // current.\n const lineTop = viewportRect.top + scrollMargin + scrollPreviousItemPeek\n const trackByLayout = typeof IntersectionObserver === \"undefined\"\n\n const visible: string[] = []\n let currentAnchorId: string | null = null\n\n // Walk rows in document order so visible ids come out top-to-bottom.\n for (const item of getMessageScrollerItems(content, spacer)) {\n const messageId = item.dataset.messageId\n\n if (!messageId) {\n continue\n }\n\n const isAnchor = item.dataset.scrollAnchor === \"true\"\n // Anchors need a rect to place the current line; non-anchors lean on the\n // observer set (or a rect in the no-observer fallback).\n const rect = isAnchor || trackByLayout ? item.getBoundingClientRect() : null\n\n const isVisible =\n trackByLayout && rect\n ? rect.bottom > lineTop && rect.top < viewportRect.bottom\n : visibleMessageIds.has(messageId)\n\n if (isVisible) {\n visible.push(messageId)\n }\n\n // Current is the last anchor to have reached the reading line: the turn you\n // scrolled to (placed at the line) wins over newer turns lower down, the\n // previous turn peeking above the line has been passed, and it stays current\n // even after its header scrolls above the viewport.\n if (isAnchor && rect && rect.top <= lineTop + SCROLL_POSITION_EPSILON) {\n currentAnchorId = messageId\n }\n }\n\n if (visible.length === 0 && currentAnchorId === null) {\n return EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE\n }\n\n return {\n currentAnchorId,\n visibleMessageIds: visible,\n }\n}\n\nfunction getMessageScrollerItems(\n content: HTMLElement,\n spacer: HTMLElement | null\n) {\n return Array.from(content.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement && child !== spacer\n )\n}\n\nfunction getNewScrollAnchor(items: HTMLElement[], previousItemCount: number) {\n for (let index = previousItemCount; index < items.length; index++) {\n const item = items[index]\n\n if (item?.dataset.scrollAnchor === \"true\") {\n return item\n }\n }\n\n return null\n}\n\nfunction getUnanchoredScrollAnchor(\n items: HTMLElement[],\n handledAnchors: { has(element: HTMLElement): boolean }\n) {\n for (const item of items) {\n if (item.dataset.scrollAnchor === \"true\" && !handledAnchors.has(item)) {\n return item\n }\n }\n\n return null\n}\n\nfunction hasMultipleNewScrollAnchors(\n items: HTMLElement[],\n previousItemCount: number\n) {\n let count = 0\n\n for (let index = previousItemCount; index < items.length; index++) {\n const item = items[index]\n\n if (item?.dataset.scrollAnchor !== \"true\") {\n continue\n }\n\n count += 1\n\n if (count > 1) {\n return true\n }\n }\n\n return false\n}\n\nfunction getLastScrollAnchor(items: HTMLElement[]) {\n for (let index = items.length - 1; index >= 0; index--) {\n const item = items[index]\n\n if (item?.dataset.scrollAnchor === \"true\") {\n return item\n }\n }\n\n return null\n}\n\nfunction getFirstVisibleMessageItem({\n content,\n spacer,\n viewport,\n}: {\n content: HTMLElement\n spacer: HTMLElement | null\n viewport: HTMLElement\n}) {\n const viewportRect = viewport.getBoundingClientRect()\n\n for (const item of getMessageScrollerItems(content, spacer)) {\n if (!item.dataset.messageId) {\n continue\n }\n\n const rect = item.getBoundingClientRect()\n\n if (rect.bottom > viewportRect.top && rect.top < viewportRect.bottom) {\n return item\n }\n }\n\n return null\n}\n\nfunction getElementScrollTop({\n align,\n element,\n scrollMargin,\n spacer,\n viewport,\n}: {\n align: MessageScrollerScrollAlign\n element: HTMLElement\n scrollMargin: number\n spacer: HTMLElement | null\n viewport: HTMLElement\n}) {\n const elementTop = getElementTop(element, viewport)\n const elementHeight = element.getBoundingClientRect().height\n const contentPadding = getContentBlockPadding(spacer)\n\n if (align === \"center\") {\n const insetHeight = Math.max(\n 0,\n viewport.clientHeight - contentPadding.start - contentPadding.end\n )\n\n return (\n elementTop -\n contentPadding.start -\n (insetHeight - elementHeight) / 2 -\n scrollMargin\n )\n }\n\n if (align === \"end\") {\n return (\n elementTop -\n viewport.clientHeight +\n elementHeight +\n contentPadding.end +\n scrollMargin\n )\n }\n\n if (align === \"nearest\") {\n const elementBottom = elementTop + elementHeight\n const viewportTop = viewport.scrollTop + contentPadding.start\n const viewportBottom =\n viewport.scrollTop + viewport.clientHeight - contentPadding.end\n\n if (elementTop >= viewportTop && elementBottom <= viewportBottom) {\n return viewport.scrollTop\n }\n\n if (elementTop < viewportTop) {\n return elementTop - contentPadding.start - scrollMargin\n }\n\n return (\n elementBottom - viewport.clientHeight + contentPadding.end + scrollMargin\n )\n }\n\n return elementTop - contentPadding.start - scrollMargin\n}\n\nfunction getElementTop(element: HTMLElement, viewport: HTMLElement) {\n const elementRect = element.getBoundingClientRect()\n const viewportRect = viewport.getBoundingClientRect()\n\n return elementRect.top - viewportRect.top + viewport.scrollTop\n}\n\nfunction getElementViewportTop(element: HTMLElement, viewport: HTMLElement) {\n return (\n element.getBoundingClientRect().top - viewport.getBoundingClientRect().top\n )\n}\n\nfunction getTailSpacerHeight({\n content,\n scrollTop,\n spacer,\n viewport,\n}: {\n content: HTMLElement\n scrollTop: number\n spacer: HTMLElement | null\n viewport: HTMLElement\n}) {\n const contentBottom = getContentBottom({ content, spacer, viewport })\n\n return scrollTop + viewport.clientHeight - contentBottom\n}\n\nfunction getContentBottom({\n content,\n spacer,\n viewport,\n}: {\n content: HTMLElement\n spacer: HTMLElement | null\n viewport: HTMLElement\n}) {\n const items = getMessageScrollerItems(content, spacer)\n const padding = getBlockPadding(content)\n const viewportRect = viewport.getBoundingClientRect()\n const scrollTop = viewport.scrollTop\n let contentBottom = padding.start + padding.end\n\n for (const item of items) {\n const rect = item.getBoundingClientRect()\n\n contentBottom = Math.max(\n contentBottom,\n rect.bottom - viewportRect.top + scrollTop + padding.end\n )\n }\n\n return contentBottom\n}\n\nfunction getMaxScrollTop(viewport: HTMLElement) {\n return Math.max(0, viewport.scrollHeight - viewport.clientHeight)\n}\n\nfunction getBlockPadding(element: HTMLElement) {\n const style = window.getComputedStyle(element)\n\n return {\n end: readCssPixel(style.paddingBlockEnd || style.paddingBottom),\n start: readCssPixel(style.paddingBlockStart || style.paddingTop),\n }\n}\n\nfunction getContentBlockPadding(spacer: HTMLElement | null) {\n const content = spacer?.parentElement\n\n if (!content) {\n return {\n end: 0,\n start: 0,\n }\n }\n\n return getBlockPadding(content)\n}\n\nfunction getFlexGap(element: HTMLElement | null) {\n if (!element) {\n return 0\n }\n\n const style = window.getComputedStyle(element)\n const gap = style.rowGap === \"normal\" ? style.gap : style.rowGap\n\n return readCssPixel(gap)\n}\n\nfunction readCssPixel(value: string | undefined) {\n if (!value) {\n return 0\n }\n\n const number = Number.parseFloat(value)\n\n return Number.isFinite(number) ? number : 0\n}\n\nexport {\n getContentBlockPadding,\n getContentBottom,\n getElementScrollTop,\n getElementTop,\n getElementViewportTop,\n getFirstVisibleMessageItem,\n getFlexGap,\n getLastScrollAnchor,\n getMaxScrollTop,\n getMessageScrollerItems,\n getMessageScrollerScrollable,\n getMessageScrollerVisibilityState,\n getNewScrollAnchor,\n getTailSpacerHeight,\n getUnanchoredScrollAnchor,\n hasMultipleNewScrollAnchors,\n}\n","import * as React from \"react\"\n\nimport {\n getElementScrollTop,\n getElementViewportTop,\n getMaxScrollTop,\n getTailSpacerHeight,\n} from \"./geometry\"\nimport { AUTOSCROLLING_CLEAR_DELAY, SCROLL_POSITION_EPSILON } from \"./types\"\nimport type { MessageScrollerScrollOptions } from \"./types\"\nimport {\n markDefaultScrollPositionApplied,\n type MessageScrollerRefs,\n} from \"./use-message-scroller-refs\"\n\n// Imperative scroll primitives, split from the controller so the move mechanics\n// live apart from the policy that decides when to run them. Each command resolves\n// a target scrollTop and returns false when the viewport is not mounted yet.\nfunction useMessageScrollerCommands({\n refs,\n commitScrollState,\n scheduleStateCommit,\n scheduleVisibilitySync,\n}: {\n refs: MessageScrollerRefs\n commitScrollState: () => void\n scheduleStateCommit: () => void\n scheduleVisibilitySync: () => void\n}) {\n const {\n streamingTurnRef,\n autoScrollRef,\n autoscrollingRef,\n autoscrollingTimeoutRef,\n contentRef,\n itemCountRef,\n messageElementsRef,\n modeRef,\n pendingScrollToMessageRef,\n prependRestoreRef,\n scrollMarginRef,\n scrollPreviousItemPeekRef,\n spacerGapRef,\n spacerHeightRef,\n spacerRef,\n viewportRef,\n } = refs\n\n const setAutoScrolling = React.useCallback(\n (autoscrolling: boolean) => {\n if (autoscrollingTimeoutRef.current !== null) {\n window.clearTimeout(autoscrollingTimeoutRef.current)\n autoscrollingTimeoutRef.current = null\n }\n\n if (autoscrollingRef.current !== autoscrolling) {\n autoscrollingRef.current = autoscrolling\n commitScrollState()\n }\n\n if (autoscrolling) {\n autoscrollingTimeoutRef.current = window.setTimeout(() => {\n autoscrollingTimeoutRef.current = null\n autoscrollingRef.current = false\n commitScrollState()\n }, AUTOSCROLLING_CLEAR_DELAY)\n }\n },\n [commitScrollState]\n )\n\n const setTailSpacerHeight = React.useCallback((height: number) => {\n const spacer = spacerRef.current\n\n if (!spacer) {\n return\n }\n\n const nextHeight = Math.max(0, Math.ceil(height))\n\n if (spacerHeightRef.current === nextHeight) {\n return\n }\n\n spacerHeightRef.current = nextHeight\n spacer.hidden = nextHeight === 0\n spacer.style.height = `${nextHeight}px`\n spacer.style.marginTop = nextHeight > 0 ? `${-spacerGapRef.current}px` : \"\"\n }, [])\n\n const scrollToPosition = React.useCallback(\n (\n scrollTop: number,\n {\n behavior = \"auto\",\n autoscrolling = false,\n }: {\n behavior?: ScrollBehavior\n autoscrolling?: boolean\n } = {}\n ) => {\n const viewport = viewportRef.current\n\n if (!viewport) {\n return\n }\n\n const nextScrollTop = Math.max(0, scrollTop)\n\n if (\n Math.abs(viewport.scrollTop - nextScrollTop) <= SCROLL_POSITION_EPSILON\n ) {\n viewport.scrollTop = nextScrollTop\n commitScrollState()\n return\n }\n\n if (autoscrolling) {\n setAutoScrolling(true)\n }\n\n viewport.scrollTo({\n top: nextScrollTop,\n behavior,\n })\n scheduleStateCommit()\n },\n [commitScrollState, scheduleStateCommit, setAutoScrolling]\n )\n\n const scrollToStart = React.useCallback(\n ({ behavior = \"auto\" }: MessageScrollerScrollOptions = {}) => {\n if (!viewportRef.current) {\n return false\n }\n\n setTailSpacerHeight(0)\n streamingTurnRef.current = null\n modeRef.current = \"free-scrolling\"\n scrollToPosition(0, { behavior })\n scheduleVisibilitySync()\n\n return true\n },\n [scheduleVisibilitySync, scrollToPosition, setTailSpacerHeight]\n )\n\n const scrollToEnd = React.useCallback(\n ({ behavior = \"auto\" }: MessageScrollerScrollOptions = {}) => {\n const viewport = viewportRef.current\n\n if (!viewport) {\n return false\n }\n\n setTailSpacerHeight(0)\n streamingTurnRef.current = null\n modeRef.current = autoScrollRef.current\n ? \"following-bottom\"\n : \"free-scrolling\"\n scrollToPosition(getMaxScrollTop(viewport), {\n autoscrolling: true,\n behavior,\n })\n scheduleVisibilitySync()\n\n return true\n },\n [scheduleVisibilitySync, scrollToPosition, setTailSpacerHeight]\n )\n\n const scrollToElement = React.useCallback(\n (\n element: HTMLElement,\n {\n align = \"start\",\n behavior = \"auto\",\n scrollMargin = scrollMarginRef.current,\n }: MessageScrollerScrollOptions = {},\n {\n keepPreviousPeek = false,\n }: {\n keepPreviousPeek?: boolean\n } = {}\n ) => {\n const content = contentRef.current\n const viewport = viewportRef.current\n\n if (!content || !viewport || !content.contains(element)) {\n return false\n }\n\n const scrollTop = getElementScrollTop({\n align,\n element,\n scrollMargin: keepPreviousPeek\n ? scrollMargin + scrollPreviousItemPeekRef.current\n : scrollMargin,\n spacer: spacerRef.current,\n viewport,\n })\n\n const nextSpacerHeight = getTailSpacerHeight({\n content,\n scrollTop,\n spacer: spacerRef.current,\n viewport,\n })\n\n setTailSpacerHeight(nextSpacerHeight)\n // Seed the prepend anchor with the jump target so a prepend that lands\n // before this scroll settles still preserves the jumped-to row; once it\n // settles, syncAfterScroll's capturePrependAnchor re-captures it from the\n // first visible row.\n prependRestoreRef.current = {\n element,\n viewportTop: getElementViewportTop(element, viewport),\n }\n\n modeRef.current = keepPreviousPeek\n ? \"anchored-to-message\"\n : \"settling-jump\"\n streamingTurnRef.current = keepPreviousPeek ? element : null\n\n scrollToPosition(scrollTop, { behavior })\n scheduleVisibilitySync()\n\n return true\n },\n [scheduleVisibilitySync, scrollToPosition, setTailSpacerHeight]\n )\n\n const reanchorToAnchoredMessage = React.useCallback(() => {\n const element = streamingTurnRef.current\n\n if (\n !element ||\n !element.isConnected ||\n modeRef.current !== \"anchored-to-message\"\n ) {\n return false\n }\n\n // Re-run the placement so the tail spacer is recomputed for the new content\n // height and the turn is held at the reading line.\n return scrollToElement(\n element,\n { align: \"start\" },\n { keepPreviousPeek: true }\n )\n }, [scrollToElement])\n\n // The target row may not be mounted yet (e.g. an async-loaded transcript).\n // When it is missing the request is queued in pendingScrollToMessageRef and\n // flushed later — on registerMessage for that id, or on the next content\n // change. An explicit jump also marks the mount default as applied, so\n // defaultScrollPosition does not override it.\n const scrollToMessage = React.useCallback(\n (messageId: string, options?: MessageScrollerScrollOptions) => {\n const element = messageElementsRef.current.get(messageId)\n\n if (!element) {\n if (itemCountRef.current === 0) {\n pendingScrollToMessageRef.current = {\n messageId,\n options,\n }\n markDefaultScrollPositionApplied(refs)\n\n return true\n }\n\n return false\n }\n\n markDefaultScrollPositionApplied(refs)\n\n if (scrollToElement(element, options)) {\n pendingScrollToMessageRef.current = null\n return true\n }\n\n pendingScrollToMessageRef.current = {\n messageId,\n options,\n }\n\n return true\n },\n [scrollToElement]\n )\n\n const flushPendingScrollToMessage = React.useCallback(() => {\n const pending = pendingScrollToMessageRef.current\n\n if (!pending) {\n return false\n }\n\n const element = messageElementsRef.current.get(pending.messageId)\n\n if (!element) {\n return false\n }\n\n const handled = scrollToElement(element, pending.options)\n\n if (!handled) {\n return false\n }\n\n pendingScrollToMessageRef.current = null\n markDefaultScrollPositionApplied(refs)\n\n return true\n }, [scrollToElement])\n\n return {\n flushPendingScrollToMessage,\n reanchorToAnchoredMessage,\n scrollToElement,\n scrollToEnd,\n scrollToMessage,\n scrollToStart,\n }\n}\n\nexport { useMessageScrollerCommands }\n","import * as React from \"react\"\n\nimport {\n areScrollStatesEqual,\n createMessageScrollerStore,\n createMessageScrollerVisibilityStore,\n} from \"./stores\"\nimport { EMPTY_MESSAGE_SCROLLER_SCROLLABLE } from \"./types\"\nimport type {\n MessageScrollerDefaultScrollPosition,\n MessageScrollerMode,\n MessageScrollerScrollable,\n MessageScrollerScrollOptions,\n MessageScrollerStore,\n MessageScrollerVisibilityStore,\n} from \"./types\"\n\n// Shared mutable ref bag for one MessageScroller, closed over by both the\n// controller and the commands so writes are visible across them without prop\n// threading. stateStore and visibilityStore fan out via useSyncExternalStore.\ntype MessageScrollerRefs = {\n autoScrollRef: React.RefObject<boolean>\n autoscrollingRef: React.RefObject<boolean>\n autoscrollingTimeoutRef: React.RefObject<number | null>\n streamingTurnRef: React.RefObject<HTMLElement | null>\n contentRef: React.RefObject<HTMLDivElement | null>\n defaultScrollPositionAppliedRef: React.RefObject<boolean>\n firstItemRef: React.RefObject<HTMLElement | null>\n itemCountRef: React.RefObject<number>\n lastScrollTopRef: React.RefObject<number>\n messageElementsRef: React.RefObject<Map<string, HTMLElement>>\n modeRef: React.RefObject<MessageScrollerMode>\n pendingScrollFrameRef: React.RefObject<number | null>\n pendingScrollToMessageRef: React.RefObject<{\n messageId: string\n options?: MessageScrollerScrollOptions\n } | null>\n prependRestoreRef: React.RefObject<{\n element: HTMLElement\n viewportTop: number\n } | null>\n preserveScrollOnPrependRef: React.RefObject<boolean>\n pendingDefaultScrollStore: MessageScrollerStore<boolean>\n rootRef: React.RefObject<HTMLDivElement | null>\n scrollEdgeThresholdRef: React.RefObject<number>\n scrollMarginRef: React.RefObject<number>\n scrollPreviousItemPeekRef: React.RefObject<number>\n spacerGapRef: React.RefObject<number>\n spacerHeightRef: React.RefObject<number>\n spacerRef: React.RefObject<HTMLDivElement | null>\n stateFrameRef: React.RefObject<number | null>\n stateStore: MessageScrollerStore<MessageScrollerScrollable>\n viewportRef: React.RefObject<HTMLDivElement | null>\n visibilityFrameRef: React.RefObject<number | null>\n visibilityObserverRef: React.RefObject<IntersectionObserver | null>\n visibilityStore: MessageScrollerVisibilityStore\n visibleMessageIdsRef: React.RefObject<Set<string>>\n handledScrollAnchorsRef: React.RefObject<WeakSet<HTMLElement>>\n}\n\n// Builds the per-instance ref bag: the two external stores constructed once, and\n// the latest prop values mirrored onto refs each render so callbacks stay stable.\nfunction useMessageScrollerRefs({\n autoScroll,\n defaultScrollPosition,\n scrollEdgeThreshold,\n scrollMargin,\n scrollPreviousItemPeek,\n}: {\n autoScroll: boolean\n defaultScrollPosition: MessageScrollerDefaultScrollPosition\n scrollEdgeThreshold: number\n scrollMargin: number\n scrollPreviousItemPeek: number\n}): MessageScrollerRefs {\n const autoScrollRef = React.useRef(autoScroll)\n const autoscrollingRef = React.useRef(false)\n const contentRef = React.useRef<HTMLDivElement | null>(null)\n const defaultScrollPositionAppliedRef = React.useRef(false)\n const scrollEdgeThresholdRef = React.useRef(scrollEdgeThreshold)\n const itemCountRef = React.useRef(0)\n const firstItemRef = React.useRef<HTMLElement | null>(null)\n // The scrollTop seen by the previous state commit, so follow-release can tell\n // a reader scrolling up from content growing past the live edge.\n const lastScrollTopRef = React.useRef(0)\n const modeRef = React.useRef<MessageScrollerMode>(\n autoScroll ? \"following-bottom\" : \"free-scrolling\"\n )\n const messageElementsRef = React.useRef(new Map<string, HTMLElement>())\n const pendingScrollToMessageRef = React.useRef<{\n messageId: string\n options?: MessageScrollerScrollOptions\n } | null>(null)\n // The row to hold steady on the next prepend: the first visible row, or a jump\n // target seeded by scrollToElement. restorePrependedAnchor reads only this.\n const prependRestoreRef = React.useRef<{\n element: HTMLElement\n viewportTop: number\n } | null>(null)\n // The turn held at the reading line so a reply streaming in below it can re-pin\n // it instead of letting scrollTop clamp it loose.\n const streamingTurnRef = React.useRef<HTMLElement | null>(null)\n const scrollPreviousItemPeekRef = React.useRef(scrollPreviousItemPeek)\n const preserveScrollOnPrependRef = React.useRef(true)\n const rootRef = React.useRef<HTMLDivElement | null>(null)\n const scrollMarginRef = React.useRef(scrollMargin)\n const pendingScrollFrameRef = React.useRef<number | null>(null)\n const spacerGapRef = React.useRef(0)\n const spacerHeightRef = React.useRef(0)\n const spacerRef = React.useRef<HTMLDivElement | null>(null)\n const stateFrameRef = React.useRef<number | null>(null)\n const pendingDefaultScrollStoreRef =\n React.useRef<MessageScrollerStore<boolean> | null>(null)\n const stateStoreRef =\n React.useRef<MessageScrollerStore<MessageScrollerScrollable> | null>(null)\n const autoscrollingTimeoutRef = React.useRef<number | null>(null)\n const viewportRef = React.useRef<HTMLDivElement | null>(null)\n const visibilityFrameRef = React.useRef<number | null>(null)\n const visibilityObserverRef = React.useRef<IntersectionObserver | null>(null)\n const visibilityStoreRef =\n React.useRef<MessageScrollerVisibilityStore | null>(null)\n const visibleMessageIdsRef = React.useRef(new Set<string>())\n const handledScrollAnchorsRef = React.useRef(new WeakSet<HTMLElement>())\n\n if (pendingDefaultScrollStoreRef.current === null) {\n pendingDefaultScrollStoreRef.current = createMessageScrollerStore(\n defaultScrollPosition === \"end\" ||\n defaultScrollPosition === \"last-anchor\",\n (current, next) => current === next\n )\n }\n\n if (stateStoreRef.current === null) {\n stateStoreRef.current = createMessageScrollerStore(\n EMPTY_MESSAGE_SCROLLER_SCROLLABLE,\n areScrollStatesEqual\n )\n }\n\n if (visibilityStoreRef.current === null) {\n visibilityStoreRef.current = createMessageScrollerVisibilityStore()\n }\n\n // Track the latest prop values on every render so callbacks read fresh values\n // without being recreated (the useLatest pattern).\n autoScrollRef.current = autoScroll\n scrollEdgeThresholdRef.current = scrollEdgeThreshold\n scrollMarginRef.current = scrollMargin\n scrollPreviousItemPeekRef.current = scrollPreviousItemPeek\n\n return {\n autoScrollRef,\n autoscrollingRef,\n autoscrollingTimeoutRef,\n streamingTurnRef,\n contentRef,\n defaultScrollPositionAppliedRef,\n firstItemRef,\n itemCountRef,\n lastScrollTopRef,\n messageElementsRef,\n modeRef,\n pendingScrollFrameRef,\n pendingScrollToMessageRef,\n prependRestoreRef,\n preserveScrollOnPrependRef,\n pendingDefaultScrollStore: pendingDefaultScrollStoreRef.current,\n rootRef,\n scrollEdgeThresholdRef,\n scrollMarginRef,\n scrollPreviousItemPeekRef,\n spacerGapRef,\n spacerHeightRef,\n spacerRef,\n stateFrameRef,\n stateStore: stateStoreRef.current,\n viewportRef,\n visibilityFrameRef,\n visibilityObserverRef,\n visibilityStore: visibilityStoreRef.current,\n visibleMessageIdsRef,\n handledScrollAnchorsRef,\n }\n}\n\nfunction clearPendingDefaultScroll(refs: MessageScrollerRefs) {\n refs.pendingDefaultScrollStore.setSnapshot(false)\n}\n\nfunction markDefaultScrollPositionApplied(refs: MessageScrollerRefs) {\n refs.defaultScrollPositionAppliedRef.current = true\n clearPendingDefaultScroll(refs)\n}\n\nexport {\n clearPendingDefaultScroll,\n markDefaultScrollPositionApplied,\n useMessageScrollerRefs,\n}\nexport type { MessageScrollerRefs }\n","import { EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE } from \"./types\"\nimport type {\n MessageScrollerScrollable,\n MessageScrollerStore,\n MessageScrollerVisibilityState,\n MessageScrollerVisibilityStore,\n} from \"./types\"\n\n// Generic useSyncExternalStore backing: a stable snapshot (referentially equal\n// while isEqual holds, so subscribers only re-render on real transitions) plus\n// optional reference-counting via the subscribe-time lifecycle callbacks.\nfunction createExternalStore<T>(\n initialSnapshot: T,\n isEqual: (a: T, b: T) => boolean\n) {\n let snapshot = initialSnapshot\n const listeners = new Set<() => void>()\n\n return {\n getSnapshot: () => snapshot,\n hasListeners: () => listeners.size > 0,\n setSnapshot: (nextSnapshot: T) => {\n if (isEqual(snapshot, nextSnapshot)) {\n return\n }\n\n snapshot = nextSnapshot\n listeners.forEach((listener) => listener())\n },\n subscribe: (\n listener: () => void,\n onFirstSubscribe?: () => void,\n onLastUnsubscribe?: () => void\n ) => {\n const wasEmpty = listeners.size === 0\n\n listeners.add(listener)\n\n if (wasEmpty) {\n onFirstSubscribe?.()\n }\n\n return () => {\n listeners.delete(listener)\n\n if (listeners.size === 0) {\n onLastUnsubscribe?.()\n }\n }\n },\n }\n}\n\nfunction createMessageScrollerStore<T>(\n initialSnapshot: T,\n isEqual: (a: T, b: T) => boolean\n): MessageScrollerStore<T> {\n return createExternalStore(initialSnapshot, isEqual)\n}\n\nfunction createMessageScrollerVisibilityStore(): MessageScrollerVisibilityStore {\n return createExternalStore(\n EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE,\n areVisibilityStatesEqual\n )\n}\n\nfunction areScrollStatesEqual(\n current: MessageScrollerScrollable,\n next: MessageScrollerScrollable\n) {\n return current.start === next.start && current.end === next.end\n}\n\nfunction areVisibilityStatesEqual(\n current: MessageScrollerVisibilityState,\n next: MessageScrollerVisibilityState\n) {\n if (current.currentAnchorId !== next.currentAnchorId) {\n return false\n }\n\n if (current.visibleMessageIds.length !== next.visibleMessageIds.length) {\n return false\n }\n\n return current.visibleMessageIds.every(\n (messageId, index) => messageId === next.visibleMessageIds[index]\n )\n}\n\nexport {\n areScrollStatesEqual,\n areVisibilityStatesEqual,\n createMessageScrollerStore,\n createMessageScrollerVisibilityStore,\n}\n","import * as React from \"react\"\n\nfunction useLatest<T>(value: T) {\n const ref = React.useRef(value)\n\n ref.current = value\n\n return ref\n}\n\nexport { useLatest }\n","import {\n MessageScrollerButton as Button,\n MessageScrollerContent as Content,\n MessageScrollerItem as Item,\n MessageScrollerProvider as Provider,\n MessageScroller as Root,\n MessageScrollerViewport as Viewport,\n} from \"./components\"\n\nexport const MessageScroller = {\n Provider,\n Root,\n Viewport,\n Content,\n Item,\n Button,\n}\n\nexport {\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n} from \"./components\"\n\nexport type {\n MessageScrollerDefaultScrollPosition,\n MessageScrollerScrollAlign,\n MessageScrollerScrollOptions,\n MessageScrollerScrollable,\n MessageScrollerVisibilityState,\n} from \"./types\"\n","import { Children, forwardRef, isValidElement, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Marker: an inline line in a conversation — a status (\"Explored 4 files\"), a system note, a\n * bordered row, or a labelled separator (\"Today\").\n *\n * Two ways to write one:\n * - Shorthand: `<Marker icon={<SearchIcon />}>Explored 4 files</Marker>`.\n * - Composition: `Marker` > `MarkerIcon` + `MarkerContent`.\n *\n * Presentational by default; pick the semantics from the intent:\n * - progress (\"Thinking...\", a running tool): `role=\"status\"`, a `Spinner` in the icon, and\n * `shimmer` on the content;\n * - a labelled separator needs no role (its lines are decorative and its text is read);\n * - a link or action: `asChild` onto a real `<a>` or `<button>`.\n */\n\nexport type MarkerVariant = 'default' | 'border' | 'separator';\n\nconst VARIANT: Record<MarkerVariant, string> = {\n default: '',\n border: 'border-b border-border pb-2',\n separator:\n 'before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border',\n};\n\nexport interface MarkerProps extends HTMLAttributes<HTMLDivElement> {\n variant?: MarkerVariant;\n /** Render onto the single child (a link or button). */\n asChild?: boolean;\n /** Shorthand: a `MarkerIcon`. The children become the `MarkerContent`. */\n icon?: ReactNode;\n}\n\n/** True when the children are already Marker parts, so the shorthand leaves them alone. */\nfunction isParts(children: ReactNode) {\n return Children.toArray(children).some(\n (child) => isValidElement(child) && (child.type === MarkerIcon || child.type === MarkerContent),\n );\n}\n\nexport const Marker = forwardRef<HTMLDivElement, MarkerProps>(function Marker(\n { className, variant = 'default', asChild = false, icon, children, ...props },\n ref,\n) {\n // Text children become the MarkerContent; children that are already parts stay as they are.\n const parts = (content: ReactNode) => (\n <>\n {icon != null && <MarkerIcon>{icon}</MarkerIcon>}\n {isParts(content) || content == null || content === false ? content : <MarkerContent>{content}</MarkerContent>}\n </>\n );\n\n const rootProps = {\n 'data-slot': 'marker',\n 'data-variant': variant,\n className: cn(\n \"group/marker relative flex min-h-4 w-full items-center gap-2 text-start text-sm text-muted-foreground [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground [&_svg:not([class*='size-'])]:size-4\",\n VARIANT[variant],\n className,\n ),\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot ref={ref} {...rootProps} wrapChildren={parts}>\n {isValidElement(children) ? (children as ReactElement) : null}\n </Slot>\n );\n }\n\n return (\n <div ref={ref} {...rootProps}>\n {parts(children)}\n </div>\n );\n});\n\nexport const MarkerIcon = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function MarkerIcon(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"marker-icon\"\n aria-hidden=\"true\"\n className={cn(\"size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n />\n );\n});\n\nexport const MarkerContent = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function MarkerContent(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"marker-content\"\n className={cn(\n 'min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className,\n )}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport { ChevronRightIcon } from 'lucide-react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Trace: the building block for reasoning, tool calls, sources and more. A list of lines, each\n * with an icon, a title, and an optional description and status. A line can expand to show more\n * detail, link to a page, or open a dialog or sheet.\n *\n * Trace adds no roles of its own; each line takes its semantics from the element that wraps it.\n * A `TraceLine` on its own is a `span` (read as text, not a tab stop). Wrapped in a\n * `TraceCollapsibleTrigger` it is a button with `aria-expanded`; wrapped in a link or a dialog\n * trigger it takes that element's behaviour. `TraceIcon` is hidden from assistive tech, so the\n * title is the accessible name: write it as a sentence (\"Edited trace.tsx\"), and put the status\n * in it too (\"Running pnpm build\"), because status is otherwise shown only by colour and motion.\n *\n * Two ways to write a line:\n * - Shorthand: `<TraceLine icon={<SearchIcon />} title=\"Searched the docs\" description=\"3 results\" />`.\n * - Composition: `TraceLine` > `TraceIcon` + `TraceTitle` + `TraceDescription` (+ a trailing `TraceIcon`).\n */\n\nexport const Trace = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function Trace(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"trace\"\n className={cn(\n 'flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type TraceStatus = 'running' | 'error' | 'pending';\n\nexport interface TraceLineProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'title'> {\n /** The state of the work the line reports. Leave it out for work that is done. */\n status?: TraceStatus;\n /** Shorthand: a leading `TraceIcon`. */\n icon?: ReactNode;\n /** Shorthand: the `TraceTitle`. One sentence that says what happened. */\n title?: ReactNode;\n /** Shorthand: a `TraceDescription` after the title, such as a count or a duration. */\n description?: ReactNode;\n}\n\nexport const TraceLine = forwardRef<HTMLSpanElement, TraceLineProps>(function TraceLine(\n { className, status, icon, title, description, children, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-line\"\n data-status={status}\n className={cn(\n 'flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer',\n className,\n )}\n {...props}\n >\n {icon != null && <TraceIcon>{icon}</TraceIcon>}\n {title != null && <TraceTitle>{title}</TraceTitle>}\n {description != null && <TraceDescription>{description}</TraceDescription>}\n {children}\n </span>\n );\n});\n\nexport const TraceIcon = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceIcon(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-icon\"\n aria-hidden=\"true\"\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const TraceTitle = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-title\"\n className={cn('min-w-0 truncate motion-reduce:shimmer-none', className)}\n {...props}\n />\n );\n});\n\nexport const TraceDescription = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(function TraceDescription(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"trace-description\"\n className={cn('shrink-0 text-muted-foreground/70 tabular-nums', className)}\n {...props}\n />\n );\n});\n\ntype CollapsibleRootProps = Omit<ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>, 'asChild' | 'open'>;\n\n/** `open` is controlled only together with `onOpenChange`. */\nexport type TraceCollapsibleProps = CollapsibleRootProps &\n ({ open?: undefined } | { open: boolean; onOpenChange: NonNullable<CollapsibleRootProps['onOpenChange']> });\n\nexport const TraceCollapsible = forwardRef<ElementRef<typeof CollapsiblePrimitive.Root>, TraceCollapsibleProps>(\n function TraceCollapsible({ className, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Root\n ref={ref}\n data-slot=\"trace-collapsible\"\n className={cn('flex w-full min-w-0 flex-col', className)}\n {...props}\n />\n );\n },\n);\n\nexport type TraceCollapsibleTriggerProps = Omit<\n ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>,\n 'asChild'\n>;\n\nexport const TraceCollapsibleTrigger = forwardRef<\n ElementRef<typeof CollapsiblePrimitive.Trigger>,\n TraceCollapsibleTriggerProps\n>(function TraceCollapsibleTrigger({ className, children, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Trigger\n ref={ref}\n data-slot=\"trace-collapsible-trigger\"\n className={cn(\n 'group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive',\n className,\n )}\n {...props}\n >\n {children}\n <TraceIcon className=\"transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90\">\n <ChevronRightIcon />\n </TraceIcon>\n </CollapsiblePrimitive.Trigger>\n );\n});\n\nexport type TraceCollapsibleContentProps = Omit<\n ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>,\n 'asChild'\n>;\n\nexport const TraceCollapsibleContent = forwardRef<\n ElementRef<typeof CollapsiblePrimitive.Content>,\n TraceCollapsibleContentProps\n>(function TraceCollapsibleContent({ className, children, ...props }, ref) {\n return (\n <CollapsiblePrimitive.Content\n ref={ref}\n data-slot=\"trace-collapsible-content\"\n className=\"min-w-0 overflow-hidden duration-200 [--radix-accordion-content-height:var(--radix-collapsible-content-height)] data-open:animate-accordion-down data-closed:animate-accordion-up\"\n {...props}\n >\n <div\n data-slot=\"trace-collapsible-content-inner\"\n className={cn(\n 'mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground',\n className,\n )}\n >\n {children}\n </div>\n </CollapsiblePrimitive.Content>\n );\n});\n","import { Children, forwardRef, isValidElement, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../lib/cn';\nimport { Slot } from '../../lib/slot';\n\n/**\n * Bubble: a chat message bubble.\n *\n * `variant` sets the treatment (`default` primary, `secondary`, `muted`, `tinted`, `outline`,\n * `ghost` unframed, `destructive`), `align` puts it at the start or end of the conversation.\n * A bubble sizes to its content up to 80% of the row (`ghost` spans the full row).\n *\n * Shorthand: plain children are wrapped in `BubbleContent`. Composition: `BubbleContent`\n * (`asChild` for a link or button bubble) and `BubbleReactions`; `BubbleGroup` stacks\n * consecutive bubbles from one sender.\n */\n\nexport type BubbleVariant = 'default' | 'secondary' | 'muted' | 'tinted' | 'outline' | 'ghost' | 'destructive';\n\nconst VARIANT: Record<BubbleVariant, string> = {\n default:\n '*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80',\n secondary:\n '*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]',\n muted:\n '*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]',\n tinted:\n '*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]',\n outline:\n '*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30',\n ghost:\n 'border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50',\n destructive:\n '*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30',\n};\n\nexport const BubbleGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function BubbleGroup(\n { className, ...props },\n ref,\n) {\n return <div ref={ref} data-slot=\"bubble-group\" className={cn('flex min-w-0 flex-col gap-2', className)} {...props} />;\n});\n\nexport interface BubbleProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `default`. */\n variant?: BubbleVariant;\n /** Default `start`. */\n align?: 'start' | 'end';\n}\n\nconst PARTS = new Set<unknown>();\n/** Composition when any child is a Bubble part; otherwise the children are the content. */\nconst isComposed = (children: ReactNode) =>\n Children.toArray(children).some((child) => isValidElement(child) && PARTS.has(child.type));\n\nexport const Bubble = forwardRef<HTMLDivElement, BubbleProps>(function Bubble(\n { variant = 'default', align = 'start', className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"bubble\"\n data-variant={variant}\n data-align={align}\n className={cn(\n 'group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 data-[align=end]:self-end data-[variant=ghost]:max-w-full group-data-[align=end]/message:self-end',\n VARIANT[variant],\n className,\n )}\n {...props}\n >\n {isComposed(children) ? children : <BubbleContent>{children}</BubbleContent>}\n </div>\n );\n});\n\nexport interface BubbleContentProps extends HTMLAttributes<HTMLDivElement> {\n /** Render the content as the child element, e.g. a `<button>` or `<a>`. */\n asChild?: boolean;\n}\n\nexport const BubbleContent = forwardRef<HTMLDivElement, BubbleContentProps>(function BubbleContent(\n { asChild = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n data-slot=\"bubble-content\"\n className={cn(\n 'w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end',\n '[button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30',\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface BubbleReactionsProps extends HTMLAttributes<HTMLDivElement> {\n /** Default `bottom`. */\n side?: 'top' | 'bottom';\n /** Default `end`. */\n align?: 'start' | 'end';\n}\n\nconst SIDE = { top: 'top-0 -translate-y-3/4', bottom: 'bottom-0 translate-y-3/4' } as const;\nconst ALIGN = { start: 'left-3', end: 'right-3' } as const;\n\n/** Reactions overlapping the bubble edge. Group emoji as one image with `role=\"img\"` and an `aria-label`. */\nexport const BubbleReactions = forwardRef<HTMLDivElement, BubbleReactionsProps>(function BubbleReactions(\n { side = 'bottom', align = 'end', className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"bubble-reactions\"\n data-align={align}\n data-side={side}\n className={cn(\n 'absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0',\n SIDE[side],\n ALIGN[align],\n className,\n )}\n {...props}\n />\n );\n});\n\nPARTS.add(BubbleContent);\nPARTS.add(BubbleReactions);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAC,SAAS,kBAAuC;AAoD7C,SASI,KATJ;AAfJ,IAAM,OACJ;AAEF,IAAM,cAAsD;AAAA,EAC1D,YACE;AAAA,EACF,UACE;AACJ;AAEO,IAAM,cAAc,WAA6C,SAASA,aAC/E,EAAE,cAAc,cAAc,OAAO,SAAS,MAAM,WAAW,UAAU,GAAG,MAAM,GAClF,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,aAAU;AAAA,MACV,oBAAkB;AAAA,MAClB,WAAW,GAAG,MAAM,YAAY,WAAW,GAAG,SAAS;AAAA,MACtD,GAAG;AAAA,MAEH;AAAA,eAAO,IAAI,CAAC,MAAM,UACjB,oBAAC,UAAmB,SAAkB,MAAa,GAAG,QAAzC,KAA+C,CAC7D;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEJ,CAAC;AAQM,I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AM,OAAO,EAAE,KAAK,0BAA0B,QAAQ,2BAA2B;AACjF,IAAM,QAAQ,EAAE,OAAO,UAAU,KAAK,UAAU;AAGzC,IAAM,kBAAkBE,aAAiD,SAASQ,iBACvF,EAAE,OAAO,UAAU,QAAQ,OAAO,WAAW,GAAG,MAAM,GACtD,KACA;AACA,SACE,gBAAAV;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW;AAAA,MACX,WAAW;AAAA,QACT;AAAA,QACA,KAAK,IAAI;AAAA,QACT,MAAM,KAAK;AAAA,QACX;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAEDI,OAAM,IAAI,aAAa;AACvBA,OAAM,IAAI,eAAe;","names":["ButtonGroup","ButtonGroupText","ButtonGroupSeparator","forwardRef","jsx","jsxs","forwardRef","NativeSelect","field","NativeSelectOption","NativeSelectOptGroup","forwardRef","useRef","ChevronDownIcon","ChevronDownIcon","jsx","ChevronDownIcon","jsx","jsxs","forwardRef","DatePicker","field","useRef","ChevronDownIcon","React","composeRefs","composeEventHandlers","React","React","React","composeRefs","React","composeRefs","React","answer","composeRefs","jsx","jsx","jsxs","Questionnaire","QuestionnaireProgress","QuestionnaireItem","QuestionnaireTitle","QuestionnaireDescription","QuestionnaireChoices","QuestionnaireChoice","QuestionnaireInput","QuestionnaireError","QuestionnairePrevious","QuestionnaireSkip","QuestionnaireNext","QuestionnaireSubmit","forwardRef","useId","jsx","jsxs","forwardRef","Switch","useId","createContext","forwardRef","useContext","Fragment","jsx","jsxs","createContext","forwardRef","InputOTP","field","_","InputOTPGroup","InputOTPSlot","useContext","InputOTPSeparator","forwardRef","useRef","CheckIcon","ChevronDownIcon","Fragment","jsx","jsxs","forwardRef","ComboboxTrigger","ChevronDownIcon","ComboboxClear","ComboboxInput","field","ComboboxContent","ComboboxList","ComboboxItem","CheckIcon","ComboboxGroup","ComboboxLabel","ComboboxEmpty","ComboboxSeparator","ComboboxChips","ComboboxChip","ComboboxChipsInput","useRef","createContext","forwardRef","useContext","useId","Fragment","jsx","jsxs","createContext","forwardRef","RadioGroup","useId","RadioGroupItem","useContext","field","forwardRef","useId","jsx","jsxs","forwardRef","Slider","formatValue","useId","forwardRef","Fragment","jsx","jsxs","forwardRef","TooltipTrigger","TooltipContent","createContext","forwardRef","useContext","useId","Fragment","jsx","jsxs","createContext","forwardRef","HoverCardTrigger","useContext","HoverCardContent","useId","forwardRef","Fragment","jsx","jsxs","forwardRef","ContextMenuTrigger","ContextMenuContent","forwardRef","jsx","jsxs","CONTENT_CLASSES","forwardRef","Menubar","MenubarTrigger","MenubarContent","parts","createContext","forwardRef","useContext","useEffect","useState","forwardRef","useCallback","useEffect","useRef","useState","jsx","jsxs","forwardRef","ScrollArea","useRef","useCallback","useState","useEffect","ScrollBar","jsx","jsxs","createContext","forwardRef","DrawerTrigger","DrawerClose","DrawerOverlay","DrawerContent","DrawerPanel","useState","DrawerHeader","DrawerFooter","DrawerTitle","useContext","useEffect","DrawerDescription","forwardRef","XIcon","jsx","jsxs","forwardRef","SheetTrigger","SheetClose","SheetOverlay","SheetContent","XIcon","SheetHeader","SheetFooter","SheetTitle","SheetDescription","forwardRef","useState","jsx","jsxs","forwardRef","AlertDialogTrigger","AlertDialogOverlay","AlertDialogContent","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","useState","jsx","Children","isValidElement","jsx","jsxs","Children","isValidElement","createContext","useContext","useLayoutEffect","createContext","forwardRef","useContext","ChevronDownIcon","Fragment","jsx","jsxs","createContext","forwardRef","AccordionItem","AccordionTrigger","useContext","ChevronDownIcon","AccordionContent","forwardRef","ChevronDownIcon","jsx","jsxs","forwardRef","Collapsible","ChevronDownIcon","CollapsibleTrigger","CollapsibleContent","forwardRef","jsx","AspectRatio","createContext","useCallback","useContext","useEffect","useLayoutEffect","useRef","useState","ChevronLeftIcon","ChevronRightIcon","Fragment","jsx","jsxs","createContext","useContext","useState","useCallback","useEffect","useRef","useLayoutEffect","ChevronLeftIcon","ChevronRightIcon","Fragment","Separator","jsx","jsxs","Fragment","Separator","createContext","forwardRef","isValidElement","useCallback","useContext","useEffect","useMemo","useState","Slot","ChevronRightIcon","useCallback","Fragment","jsx","jsxs","createContext","useContext","useState","useCallback","useEffect","useMemo","forwardRef","SidebarTrigger","Slot","SidebarMenuButton","SidebarMenuSubButton","DefaultLink","isValidElement","ChevronRightIcon","RowLink","forwardRef","jsx","forwardRef","Kbd","KbdGroup","Fragment","forwardRef","ChevronRightIcon","Fragment","jsx","jsxs","forwardRef","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","BreadcrumbPage","BreadcrumbSeparator","ChevronRightIcon","BreadcrumbEllipsis","forwardRef","ChevronLeftIcon","ChevronRightIcon","MoreHorizontalIcon","Fragment","jsx","jsxs","forwardRef","Pagination","PaginationContent","PaginationItem","PaginationLink","PaginationPrevious","ChevronLeftIcon","PaginationNext","ChevronRightIcon","PaginationEllipsis","MoreHorizontalIcon","forwardRef","ChevronDownIcon","Fragment","jsx","jsxs","forwardRef","NavigationMenu","NavigationMenuList","NavigationMenuItem","NavigationMenuTrigger","ChevronDownIcon","NavigationMenuContent","NavigationMenuViewport","NavigationMenuLink","NavigationMenuIndicator","forwardRef","clsx","jsx","jsxs","forwardRef","TypographyList","TypographyTable","TextLink","clsx","createContext","forwardRef","isValidElement","useContext","Fragment","jsx","jsxs","createContext","forwardRef","ItemGroup","ItemSeparator","Item","useContext","parts","isValidElement","ItemMedia","ItemContent","ItemTitle","ItemDescription","ItemActions","ItemHeader","ItemFooter","forwardRef","Fragment","jsx","jsxs","SIZE","ORIENTATION","forwardRef","Attachment","MEDIA_VARIANT","AttachmentMedia","AttachmentContent","AttachmentTitle","AttachmentDescription","AttachmentActions","AttachmentAction","AttachmentTrigger","AttachmentGroup","Children","isValidElement","CircleAlertIcon","CircleCheckIcon","InfoIcon","TriangleAlertIcon","Fragment","jsx","jsxs","VARIANT","InfoIcon","CircleAlertIcon","CircleCheckIcon","TriangleAlertIcon","PARTS","isComposed","Children","isValidElement","useEffect","useState","CircleCheckIcon","InfoIcon","TriangleAlertIcon","jsx","jsx","CircleCheckIcon","InfoIcon","TriangleAlertIcon","useState","useEffect","forwardRef","Fragment","jsx","jsxs","forwardRef","MessageGroup","Message","MessageAvatar","MessageContent","MessageHeader","MessageFooter","Children","isValidElement","React","React","React","React","React","jsx","jsxs","composeRefs","MessageScroller","Fragment","jsx","jsxs","MessageScrollerProvider","jsx","MessageScroller","Children","isValidElement","MessageScrollerViewport","jsxs","Fragment","MessageScrollerContent","MessageScrollerButton","MessageScrollerItem","Children","forwardRef","isValidElement","Fragment","jsx","jsxs","VARIANT","Children","isValidElement","forwardRef","Marker","parts","MarkerIcon","MarkerContent","forwardRef","CollapsiblePrimitive","ChevronRightIcon","jsx","jsxs","forwardRef","Trace","TraceLine","TraceIcon","TraceTitle","TraceDescription","TraceCollapsible","CollapsiblePrimitive","TraceCollapsibleTrigger","ChevronRightIcon","TraceCollapsibleContent","Children","forwardRef","isValidElement","jsx","VARIANT","forwardRef","BubbleGroup","PARTS","isComposed","Children","isValidElement","Bubble","BubbleContent","BubbleReactions"]}