florixui 1.14.1 → 1.15.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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lib/utils.ts","../src/lib/use-file-upload.ts","../src/components/ui/spinner.tsx","../src/components/ui/button.tsx","../src/components/ui/dropdown-menu.tsx","../src/components/custom/actions-menu.tsx","../src/components/ui/badge.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/field.tsx","../src/components/ui/dialog.tsx","../src/components/ui/input.tsx","../src/components/ui/textarea.tsx","../src/components/ui/input-group.tsx","../src/components/ui/command.tsx","../src/components/ui/popover.tsx","../src/components/custom/phone-countries.ts","../src/components/custom/advanced-input.tsx","../src/components/custom/alert-card.tsx","../src/components/custom/file-upload.tsx","../src/components/custom/advanced-select.tsx","../src/components/ui/checkbox.tsx","../src/components/ui/table.tsx","../src/components/custom/data-table.tsx","../src/components/custom/form-dialog.tsx","../src/components/ui/radio-group.tsx","../src/components/custom/card-radio-group.tsx","../src/components/custom/color-picker.tsx","../src/components/ui/alert-dialog.tsx","../src/components/custom/confirm-prompt.tsx","../src/components/custom/custom-tabs.tsx","../src/components/custom/data-cell.tsx","../src/components/custom/def-row.tsx","../src/components/custom/divider.tsx","../src/components/ui/empty.tsx","../src/components/custom/empty-state.tsx","../src/components/custom/faceted-filter.tsx","../src/components/custom/list-card.tsx","../src/components/custom/map-marker-pin.tsx","../src/components/custom/not-found.tsx","../src/components/custom/quick-stat.tsx","../src/components/ui/card.tsx","../src/components/custom/sensor-card.tsx","../src/components/ui/sheet.tsx","../src/components/custom/side-sheet.tsx","../src/components/custom/stat-card.tsx","../src/components/custom/status-list.tsx","../src/components/ui/select.tsx","../src/components/ui/calendar.tsx","../src/components/custom/date-time-range-picker-utils.ts","../src/components/custom/date-time-picker.tsx","../src/components/custom/date-time-range-picker.tsx","../src/components/ui/alert.tsx","../src/components/ui/button-group.tsx","../src/components/ui/chart.tsx","../src/components/ui/hover-card.tsx","../src/components/ui/item.tsx","../src/components/ui/map.tsx","../src/components/ui/progress.tsx","../src/components/ui/slider.tsx","../src/components/ui/sonner.tsx","../src/components/ui/stepper.tsx","../src/components/ui/switch.tsx","../src/components/ui/tabs.tsx","../src/components/ui/timeline.tsx","../src/components/ui/toggle.tsx","../src/components/ui/toggle-group.tsx","../src/components/ui/tooltip.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\"\n\nimport {\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n useCallback,\n useRef,\n useState,\n} from \"react\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** A file that already lives on a server (e.g. previously uploaded). */\nexport type FileMetadata = {\n name: string\n size: number\n type: string\n url: string\n id: string\n}\n\n/** An entry in the uploader: either a freshly picked `File` or remote metadata. */\nexport type FileWithPreview = {\n file: File | FileMetadata\n id: string\n preview?: string\n}\n\nexport type FileUploadOptions = {\n /** Maximum number of files allowed (multiple mode). Defaults to unlimited. */\n maxFiles?: number\n /** Maximum size per file, in bytes. Defaults to unlimited. */\n maxSize?: number\n /** `accept` attribute, e.g. `\"image/*\"` or `\".pdf,.docx\"`. Defaults to `\"*\"`. */\n accept?: string\n /** Allow selecting more than one file. */\n multiple?: boolean\n /** Files to seed the uploader with (already-uploaded items). */\n initialFiles?: FileMetadata[]\n /** Called whenever the file list changes. */\n onFilesChange?: (files: FileWithPreview[]) => void\n /** Called with only the files added in the latest action. */\n onFilesAdded?: (addedFiles: FileWithPreview[]) => void\n}\n\nexport type FileUploadState = {\n files: FileWithPreview[]\n isDragging: boolean\n errors: string[]\n}\n\nexport type FileUploadActions = {\n addFiles: (files: FileList | File[]) => void\n removeFile: (id: string) => void\n clearFiles: () => void\n clearErrors: () => void\n handleDragEnter: (e: DragEvent<HTMLElement>) => void\n handleDragLeave: (e: DragEvent<HTMLElement>) => void\n handleDragOver: (e: DragEvent<HTMLElement>) => void\n handleDrop: (e: DragEvent<HTMLElement>) => void\n handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void\n openFileDialog: () => void\n getInputProps: (\n props?: InputHTMLAttributes<HTMLInputElement>\n ) => InputHTMLAttributes<HTMLInputElement> & {\n ref: React.Ref<HTMLInputElement>\n }\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Human-readable byte size, e.g. `1.46MB`. */\nexport const formatBytes = (bytes: number, decimals = 2): string => {\n if (bytes === 0) return \"0 Bytes\"\n\n const k = 1024\n const dm = decimals < 0 ? 0 : decimals\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n\n return Number.parseFloat((bytes / k ** i).toFixed(dm)) + sizes[i]\n}\n\n// ============================================================================\n// Hook\n// ============================================================================\n\n/**\n * Headless file-upload state machine: validation, drag & drop, previews, and\n * input wiring. Pair it with your own markup (see `FileUpload` for a default UI).\n */\nexport const useFileUpload = (\n options: FileUploadOptions = {}\n): [FileUploadState, FileUploadActions] => {\n const {\n maxFiles = Number.POSITIVE_INFINITY,\n maxSize = Number.POSITIVE_INFINITY,\n accept = \"*\",\n multiple = false,\n initialFiles = [],\n onFilesChange,\n onFilesAdded,\n } = options\n\n const [state, setState] = useState<FileUploadState>({\n errors: [],\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n isDragging: false,\n })\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const validateFile = useCallback(\n (file: File | FileMetadata): string | null => {\n if (file.size > maxSize) {\n return `File \"${file.name}\" exceeds the maximum size of ${formatBytes(maxSize)}.`\n }\n\n if (accept !== \"*\") {\n const acceptedTypes = accept.split(\",\").map((type) => type.trim())\n const fileType = file instanceof File ? file.type || \"\" : file.type\n const fileExtension = `.${file.name.split(\".\").pop()}`\n\n const isAccepted = acceptedTypes.some((type) => {\n if (type.startsWith(\".\")) {\n return fileExtension.toLowerCase() === type.toLowerCase()\n }\n if (type.endsWith(\"/*\")) {\n const baseType = type.split(\"/\")[0]\n return fileType.startsWith(`${baseType}/`)\n }\n return fileType === type\n })\n\n if (!isAccepted) {\n return `File \"${file.name}\" is not an accepted file type.`\n }\n }\n\n return null\n },\n [accept, maxSize]\n )\n\n const createPreview = useCallback(\n (file: File | FileMetadata): string | undefined => {\n if (file instanceof File) {\n return URL.createObjectURL(file)\n }\n return file.url\n },\n []\n )\n\n const generateUniqueId = useCallback((file: File | FileMetadata): string => {\n if (file instanceof File) {\n return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n }\n return file.id\n }, [])\n\n const clearFiles = useCallback(() => {\n setState((prev) => {\n for (const file of prev.files ?? []) {\n if (\n file.preview &&\n file.file instanceof File &&\n file.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(file.preview)\n }\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\"\n }\n\n const newState = {\n ...prev,\n errors: [],\n files: [],\n }\n\n onFilesChange?.(newState.files)\n return newState\n })\n }, [onFilesChange])\n\n const addFiles = useCallback(\n (newFiles: FileList | File[]) => {\n if (!newFiles || newFiles.length === 0) return\n\n const newFilesArray = Array.from(newFiles)\n const errors: string[] = []\n\n setState((prev) => ({ ...prev, errors: [] }))\n\n if (!multiple) {\n clearFiles()\n }\n\n if (\n multiple &&\n maxFiles !== Number.POSITIVE_INFINITY &&\n state.files.length + newFilesArray.length > maxFiles\n ) {\n errors.push(`You can only upload a maximum of ${maxFiles} files.`)\n setState((prev) => ({ ...prev, errors }))\n return\n }\n\n const validFiles: FileWithPreview[] = []\n\n for (const file of newFilesArray) {\n if (multiple) {\n const isDuplicate = state.files.some(\n (existingFile) =>\n existingFile.file.name === file.name &&\n existingFile.file.size === file.size\n )\n\n if (isDuplicate) {\n continue\n }\n }\n\n if (file.size > maxSize) {\n errors.push(\n multiple\n ? `Some files exceed the maximum size of ${formatBytes(maxSize)}.`\n : `File exceeds the maximum size of ${formatBytes(maxSize)}.`\n )\n continue\n }\n\n const error = validateFile(file)\n\n if (error) {\n errors.push(error)\n continue\n }\n\n validFiles.push({\n file,\n id: generateUniqueId(file),\n preview: createPreview(file),\n })\n }\n\n if (validFiles.length > 0) {\n onFilesAdded?.(validFiles)\n\n setState((prev) => {\n const nextFiles = !multiple\n ? validFiles\n : [...prev.files, ...validFiles]\n onFilesChange?.(nextFiles)\n return {\n ...prev,\n errors,\n files: nextFiles,\n }\n })\n } else if (errors.length > 0) {\n setState((prev) => ({\n ...prev,\n errors,\n }))\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\"\n }\n },\n [\n state.files,\n maxFiles,\n multiple,\n maxSize,\n validateFile,\n createPreview,\n generateUniqueId,\n clearFiles,\n onFilesChange,\n onFilesAdded,\n ]\n )\n\n const removeFile = useCallback(\n (id: string) => {\n setState((prev) => {\n const fileToRemove = prev.files.find((file) => file.id === id)\n if (\n fileToRemove?.preview &&\n fileToRemove.file instanceof File &&\n fileToRemove.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(fileToRemove.preview)\n }\n\n const newFiles = prev.files.filter((file) => file.id !== id)\n onFilesChange?.(newFiles)\n\n return {\n ...prev,\n errors: [],\n files: newFiles,\n }\n })\n },\n [onFilesChange]\n )\n\n const clearErrors = useCallback(() => {\n setState((prev) => ({\n ...prev,\n errors: [],\n }))\n }, [])\n\n const handleDragEnter = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setState((prev) => ({ ...prev, isDragging: true }))\n }, [])\n\n const handleDragLeave = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n\n if (e.currentTarget.contains(e.relatedTarget as Node)) {\n return\n }\n\n setState((prev) => ({ ...prev, isDragging: false }))\n }, [])\n\n const handleDragOver = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n }, [])\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setState((prev) => ({ ...prev, isDragging: false }))\n\n if (inputRef.current?.disabled) {\n return\n }\n\n if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n if (!multiple) {\n const file = e.dataTransfer.files[0]\n addFiles([file])\n } else {\n addFiles(e.dataTransfer.files)\n }\n }\n },\n [addFiles, multiple]\n )\n\n const handleFileChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n addFiles(e.target.files)\n }\n },\n [addFiles]\n )\n\n const openFileDialog = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.click()\n }\n }, [])\n\n const getInputProps = useCallback(\n (props: InputHTMLAttributes<HTMLInputElement> = {}) => {\n return {\n ...props,\n accept: props.accept || accept,\n multiple: props.multiple !== undefined ? props.multiple : multiple,\n onChange: handleFileChange,\n ref: inputRef,\n type: \"file\" as const,\n }\n },\n [accept, multiple, handleFileChange]\n )\n\n return [\n state,\n {\n addFiles,\n clearErrors,\n clearFiles,\n getInputProps,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n handleFileChange,\n openFileDialog,\n removeFile,\n },\n ]\n}\n","import { cn } from \"@/lib/utils\"\nimport { Loader2Icon } from \"lucide-react\"\n\nfunction Spinner({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <Loader2Icon role=\"status\" aria-label=\"Loading\" className={cn(\"size-4 animate-spin\", className)} {...props} />\n )\n}\n\nexport { Spinner }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst buttonVariants = cva(\n \"group/button inline-flex shrink-0 items-center justify-center rounded-sm border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n destructive:\n \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default:\n \"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n xs: \"h-6 gap-1 rounded-sm px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-7 gap-1 rounded-sm px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n icon: \"size-8\",\n \"icon-xs\":\n \"size-6 rounded-sm [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-7 rounded-sm\",\n \"icon-lg\": \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n loading = false,\n startItem,\n endItem,\n disabled,\n children,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean\n /** Show a spinner (replacing `startItem`) and disable the button. */\n loading?: boolean\n /** Content rendered before the label (e.g. an icon). */\n startItem?: React.ReactNode\n /** Content rendered after the label (e.g. an icon or count). */\n endItem?: React.ReactNode\n }) {\n const Comp = asChild ? Slot.Root : \"button\"\n\n // With asChild the child owns its markup, so don't inject affixes/spinner —\n // just pass through (loading still disables via aria/data attributes).\n const content = asChild ? (\n children\n ) : (\n <>\n {loading ? <Spinner /> : startItem}\n {children}\n {endItem}\n </>\n )\n\n return (\n <Comp\n data-slot=\"button\"\n data-variant={variant}\n data-size={size}\n data-loading={loading || undefined}\n disabled={disabled ?? (Comp === \"button\" ? loading : undefined)}\n aria-disabled={loading || undefined}\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n >\n {content}\n </Comp>\n )\n}\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CheckIcon, ChevronRightIcon } from \"lucide-react\"\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return (\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n align = \"start\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n align={align}\n className={cn(\"z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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-[state=closed]:overflow-hidden 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\", className )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n variant?: \"default\" | \"destructive\"\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n \"relative flex cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n \"relative flex cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\"z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-sm bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-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\", className )}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n}\n","import * as React from \"react\"\nimport { MoreVertical, type LucideIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\n\nconst ICON_SIZE = 16\n\n/** A clickable action row. */\nexport interface ActionsMenuAction {\n type?: \"action\"\n label: React.ReactNode\n icon?: LucideIcon\n onSelect?: () => void\n /** Keyboard shortcut hint shown on the right (e.g. \"⌘C\"). */\n shortcut?: string\n destructive?: boolean\n disabled?: boolean\n}\n\n/** A non-clickable section heading. */\nexport interface ActionsMenuLabelItem {\n type: \"label\"\n label: React.ReactNode\n}\n\n/** A divider between groups. */\nexport interface ActionsMenuSeparator {\n type: \"separator\"\n}\n\nexport type ActionsMenuItem =\n | ActionsMenuAction\n | ActionsMenuLabelItem\n | ActionsMenuSeparator\n\nexport interface ActionsMenuProps {\n items: ActionsMenuItem[]\n /** Custom trigger element (overrides the default icon button). */\n trigger?: React.ReactNode\n /** Trigger icon for the default button. Defaults to a vertical kebab. */\n triggerIcon?: LucideIcon\n /** Visually-hidden trigger label for screen readers. */\n triggerLabel?: string\n /** Width of the dropdown content. Defaults to \"10rem\". */\n width?: string\n align?: \"start\" | \"center\" | \"end\"\n /** Class applied to the default trigger button. */\n className?: string\n /** Controlled open state. */\n open?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\nfunction isAction(item: ActionsMenuItem): item is ActionsMenuAction {\n return item.type === undefined || item.type === \"action\"\n}\n\nexport function ActionsMenu({\n items,\n trigger,\n triggerIcon: TriggerIcon = MoreVertical,\n triggerLabel = \"Open menu\",\n width = \"10rem\",\n align = \"end\",\n className,\n open,\n onOpenChange,\n}: ActionsMenuProps) {\n return (\n <DropdownMenu open={open} onOpenChange={onOpenChange}>\n <DropdownMenuTrigger asChild>\n {trigger ?? (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-8\", className)}\n aria-label={triggerLabel}\n >\n <TriggerIcon size={ICON_SIZE} />\n <span className=\"sr-only\">{triggerLabel}</span>\n </Button>\n )}\n </DropdownMenuTrigger>\n <DropdownMenuContent align={align} style={{ width }}>\n {items.map((item, idx) => {\n if (item.type === \"separator\") {\n return <DropdownMenuSeparator key={`sep-${idx}`} />\n }\n if (item.type === \"label\") {\n return (\n <DropdownMenuLabel key={`label-${idx}`}>\n {item.label}\n </DropdownMenuLabel>\n )\n }\n if (!isAction(item)) return null\n const Icon = item.icon\n return (\n <DropdownMenuItem\n key={idx}\n onSelect={item.onSelect}\n disabled={item.disabled}\n variant={item.destructive ? \"destructive\" : \"default\"}\n >\n {Icon && <Icon size={ICON_SIZE} />}\n {item.label}\n {item.shortcut && (\n <DropdownMenuShortcut>{item.shortcut}</DropdownMenuShortcut>\n )}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n \"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive:\n \"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20\",\n outline:\n \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n ghost:\n \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n // Soft-tinted color variants using the global accent tokens\n // (themes.css). The --{color} token swaps for dark mode automatically,\n // so no dark: overrides are needed.\n red: \"border-red/30 bg-red/10 text-red\",\n orange: \"border-orange/30 bg-orange/10 text-orange\",\n yellow: \"border-yellow/30 bg-yellow/10 text-yellow\",\n green: \"border-green/30 bg-green/10 text-green\",\n teal: \"border-teal/30 bg-teal/10 text-teal\",\n cyan: \"border-cyan/30 bg-cyan/10 text-cyan\",\n blue: \"border-blue/30 bg-blue/10 text-blue\",\n purple: \"border-purple/30 bg-purple/10 text-purple\",\n pink: \"border-pink/30 bg-pink/10 text-pink\",\n gray: \"border-gray/30 bg-gray/10 text-gray\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Badge({\n className,\n variant = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"span\"> &\n VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : \"span\"\n\n return (\n <Comp\n data-slot=\"badge\"\n data-variant={variant}\n className={cn(badgeVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nexport { Badge, badgeVariants }\n","import * as React from \"react\"\nimport { Label as LabelPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n \"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Label }\n","import * as React from \"react\"\nimport { Separator as SeparatorPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n decorative = true,\n ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n return (\n <SeparatorPrimitive.Root\n data-slot=\"separator\"\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Separator }\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Label } from \"@/components/ui/label\"\nimport { Separator } from \"@/components/ui/separator\"\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\",\n {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n }\n)\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({\n className,\n ...props\n}: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 font-normal text-foreground leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"last:mt-0 nth-last-2:-mt-1\",\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-sm font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { XIcon } from \"lucide-react\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate 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\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-sm bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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 {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-sm border-t bg-muted/50 p-4 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\n \"text-base leading-none font-medium\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Input({ className, type, ...props }: React.ComponentProps<\"input\">) {\n return (\n <input\n type={type}\n data-slot=\"input\"\n className={cn(\n \"h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Input }\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Textarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n \"flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Textarea }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Input } from \"@/components/ui/input\"\nimport { Textarea } from \"@/components/ui/textarea\"\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\":\n \"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]\",\n \"inline-end\":\n \"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]\",\n \"block-start\":\n \"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2\",\n \"block-end\":\n \"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n }\n)\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n \"flex items-center gap-2 text-sm shadow-none\",\n {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"\",\n \"icon-xs\":\n \"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n }\n)\n\nfunction InputGroupButton({\n className,\n type = \"button\",\n variant = \"ghost\",\n size = \"xs\",\n ...props\n}: Omit<React.ComponentProps<typeof Button>, \"size\"> &\n VariantProps<typeof inputGroupButtonVariants>) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({\n className,\n ...props\n}: React.ComponentProps<\"input\">) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({\n className,\n ...props\n}: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\nimport {\n InputGroup,\n InputGroupAddon,\n} from \"@/components/ui/input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\n \"top-1/3 translate-y-0 overflow-hidden rounded-md! p-0\",\n className\n )}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-md! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-sm! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CheckIcon className=\"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100\" />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n","import * as React from \"react\"\nimport { Popover as PopoverPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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 </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn(\"flex flex-col gap-0.5 text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<\"h2\">) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn(\"font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverDescription,\n PopoverHeader,\n PopoverTitle,\n PopoverTrigger,\n}\n","/** A country for the phone-input dial-code selector. */\nexport interface PhoneCountry {\n /** ISO 3166-1 alpha-2 code, e.g. \"US\". */\n iso: string\n /** Display name. */\n name: string\n /** Dial code without \"+\", e.g. \"1\", \"91\". */\n dial: string\n /** Flag emoji. */\n flag: string\n}\n\n/**\n * A curated, commonly-used set of countries. Not exhaustive — pass your own\n * `countries` to `PhoneInput` if you need the full list. Sorted by name.\n */\nexport const PHONE_COUNTRIES: PhoneCountry[] = [\n { iso: \"AU\", name: \"Australia\", dial: \"61\", flag: \"🇦🇺\" },\n { iso: \"AT\", name: \"Austria\", dial: \"43\", flag: \"🇦🇹\" },\n { iso: \"BE\", name: \"Belgium\", dial: \"32\", flag: \"🇧🇪\" },\n { iso: \"BR\", name: \"Brazil\", dial: \"55\", flag: \"🇧🇷\" },\n { iso: \"CA\", name: \"Canada\", dial: \"1\", flag: \"🇨🇦\" },\n { iso: \"CN\", name: \"China\", dial: \"86\", flag: \"🇨🇳\" },\n { iso: \"DK\", name: \"Denmark\", dial: \"45\", flag: \"🇩🇰\" },\n { iso: \"EG\", name: \"Egypt\", dial: \"20\", flag: \"🇪🇬\" },\n { iso: \"FI\", name: \"Finland\", dial: \"358\", flag: \"🇫🇮\" },\n { iso: \"FR\", name: \"France\", dial: \"33\", flag: \"🇫🇷\" },\n { iso: \"DE\", name: \"Germany\", dial: \"49\", flag: \"🇩🇪\" },\n { iso: \"GR\", name: \"Greece\", dial: \"30\", flag: \"🇬🇷\" },\n { iso: \"HK\", name: \"Hong Kong\", dial: \"852\", flag: \"🇭🇰\" },\n { iso: \"IN\", name: \"India\", dial: \"91\", flag: \"🇮🇳\" },\n { iso: \"ID\", name: \"Indonesia\", dial: \"62\", flag: \"🇮🇩\" },\n { iso: \"IE\", name: \"Ireland\", dial: \"353\", flag: \"🇮🇪\" },\n { iso: \"IL\", name: \"Israel\", dial: \"972\", flag: \"🇮🇱\" },\n { iso: \"IT\", name: \"Italy\", dial: \"39\", flag: \"🇮🇹\" },\n { iso: \"JP\", name: \"Japan\", dial: \"81\", flag: \"🇯🇵\" },\n { iso: \"MY\", name: \"Malaysia\", dial: \"60\", flag: \"🇲🇾\" },\n { iso: \"MX\", name: \"Mexico\", dial: \"52\", flag: \"🇲🇽\" },\n { iso: \"NL\", name: \"Netherlands\", dial: \"31\", flag: \"🇳🇱\" },\n { iso: \"NZ\", name: \"New Zealand\", dial: \"64\", flag: \"🇳🇿\" },\n { iso: \"NO\", name: \"Norway\", dial: \"47\", flag: \"🇳🇴\" },\n { iso: \"PK\", name: \"Pakistan\", dial: \"92\", flag: \"🇵🇰\" },\n { iso: \"PH\", name: \"Philippines\", dial: \"63\", flag: \"🇵🇭\" },\n { iso: \"PL\", name: \"Poland\", dial: \"48\", flag: \"🇵🇱\" },\n { iso: \"PT\", name: \"Portugal\", dial: \"351\", flag: \"🇵🇹\" },\n { iso: \"RU\", name: \"Russia\", dial: \"7\", flag: \"🇷🇺\" },\n { iso: \"SA\", name: \"Saudi Arabia\", dial: \"966\", flag: \"🇸🇦\" },\n { iso: \"SG\", name: \"Singapore\", dial: \"65\", flag: \"🇸🇬\" },\n { iso: \"ZA\", name: \"South Africa\", dial: \"27\", flag: \"🇿🇦\" },\n { iso: \"KR\", name: \"South Korea\", dial: \"82\", flag: \"🇰🇷\" },\n { iso: \"ES\", name: \"Spain\", dial: \"34\", flag: \"🇪🇸\" },\n { iso: \"SE\", name: \"Sweden\", dial: \"46\", flag: \"🇸🇪\" },\n { iso: \"CH\", name: \"Switzerland\", dial: \"41\", flag: \"🇨🇭\" },\n { iso: \"TW\", name: \"Taiwan\", dial: \"886\", flag: \"🇹🇼\" },\n { iso: \"TH\", name: \"Thailand\", dial: \"66\", flag: \"🇹🇭\" },\n { iso: \"TR\", name: \"Turkey\", dial: \"90\", flag: \"🇹🇷\" },\n { iso: \"AE\", name: \"United Arab Emirates\", dial: \"971\", flag: \"🇦🇪\" },\n { iso: \"GB\", name: \"United Kingdom\", dial: \"44\", flag: \"🇬🇧\" },\n { iso: \"US\", name: \"United States\", dial: \"1\", flag: \"🇺🇸\" },\n { iso: \"VN\", name: \"Vietnam\", dial: \"84\", flag: \"🇻🇳\" },\n]\n","import * as React from \"react\"\nimport { ChevronDown, Eye, EyeOff, Loader2, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { FieldDescription, FieldLabel } from \"@/components/ui/field\"\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@/components/ui/command\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport {\n PHONE_COUNTRIES,\n type PhoneCountry,\n} from \"./phone-countries\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype BaseProps = {\n /** Label rendered above the control. */\n label?: React.ReactNode\n /** Muted helper text rendered below the field (always visible). */\n description?: React.ReactNode\n /** Marks the field as invalid (forced true when `errorMessage` is set). */\n error?: boolean\n /** Message shown below the control when in an error state. */\n errorMessage?: string\n /** Hint shown below the control when NOT in an error state. */\n helperText?: string\n /** Adds a red asterisk after the label. */\n required?: boolean\n size?: \"sm\" | \"default\"\n /** `default` uses the input background; `alt` uses the muted background. */\n variant?: \"default\" | \"alt\"\n /** Icon rendered inside the control, on the left. */\n leftIcon?: React.ReactNode\n /** Icon rendered inside the control, on the right. */\n rightIcon?: React.ReactNode\n /** Affix rendered as an attached segment before the input (input-group). */\n startItem?: React.ReactNode\n /** Affix rendered as an attached segment after the input (input-group). */\n endItem?: React.ReactNode\n /** Replaces the left icon with a spinner while true. */\n loading?: boolean\n /** Class for the outer wrapper element. */\n wrapperClassName?: string\n}\n\ntype InputProps = BaseProps &\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> & {\n as?: \"input\"\n }\n\ntype TextareaProps = BaseProps &\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\"> & {\n as: \"textarea\"\n }\n\ntype TagsProps = BaseProps & {\n as: \"tags\"\n /** Current tags. Controlled. */\n value: string[]\n /** Called with the new tags array. */\n onChange: (tags: string[]) => void\n placeholder?: string\n disabled?: boolean\n className?: string\n id?: string\n /**\n * Where the chips render:\n * - `inside` (default): chips sit inside the field, before the cursor.\n * - `below`: the input stays single-line; chips render below it.\n */\n badgePosition?: \"inside\" | \"below\"\n /** Keys that commit the current text as a tag. Default `[\",\", \"Enter\"]`. */\n separators?: string[]\n /** Prevent duplicate tags (case-insensitive). Default `true`. */\n dedupe?: boolean\n /** Max number of tags. */\n maxTags?: number\n}\n\nexport type AdvancedInputProps = InputProps | TextareaProps | TagsProps\n\n// ============================================================================\n// Shared field-message rendering\n// ============================================================================\n\nfunction FieldMessages({\n error,\n errorMessage,\n helperText,\n errorId,\n helperId,\n}: {\n error: boolean\n errorMessage?: string\n helperText?: string\n errorId: string\n helperId: string\n}) {\n if (!errorMessage && !helperText) return null\n return (\n <div className=\"mt-1.5 min-h-5\">\n {error && errorMessage ? (\n <p id={errorId} className=\"text-xs leading-5 text-destructive\">\n {errorMessage}\n </p>\n ) : !error && helperText ? (\n <p id={helperId} className=\"text-xs leading-5 text-muted-foreground\">\n {helperText}\n </p>\n ) : null}\n </div>\n )\n}\n\n// ============================================================================\n// AdvancedInput\n// ============================================================================\n\nexport const AdvancedInput = React.forwardRef<\n HTMLInputElement | HTMLTextAreaElement,\n AdvancedInputProps\n>(function AdvancedInput(props, ref) {\n // Tags variant is self-contained (no shared hooks below).\n if (props.as === \"tags\") {\n return <TagsField {...props} />\n }\n\n const {\n className,\n wrapperClassName,\n label,\n description,\n errorMessage,\n helperText,\n required = false,\n size = \"default\",\n variant = \"default\",\n leftIcon,\n rightIcon,\n disabled,\n startItem,\n endItem,\n loading = false,\n as = \"input\",\n id: providedId,\n error: errorProp,\n ...rest\n } = props\n\n // An explicit errorMessage implies the error state.\n const error = errorProp ?? Boolean(errorMessage)\n\n const reactId = React.useId()\n const inputId = providedId || reactId\n\n // Declared before any early return so hook order stays stable.\n const [showPassword, setShowPassword] = React.useState(false)\n const errorId = `${inputId}-error`\n const helperId = `${inputId}-helper`\n const descriptionId = `${inputId}-description`\n\n const describedBy =\n [\n error && errorMessage ? errorId : null,\n !error && helperText ? helperId : null,\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n\n const bgClass =\n variant === \"alt\" ? \"bg-input-background-alt\" : \"bg-input-background\"\n\n const Asterisk = required ? (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n ) : null\n\n // ---- Textarea branch -----------------------------------------------------\n if (as === \"textarea\") {\n const textareaProps = rest as React.TextareaHTMLAttributes<HTMLTextAreaElement>\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n <textarea\n id={inputId}\n ref={ref as React.Ref<HTMLTextAreaElement>}\n disabled={disabled}\n aria-invalid={error}\n aria-describedby={describedBy}\n className={cn(\n \"flex min-h-20 w-full rounded-sm border border-border px-3 py-2 text-sm outline-none transition-[color,box-shadow] placeholder:text-foreground/50\",\n bgClass,\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n \"disabled:pointer-events-none disabled:cursor-not-allowed disabled:text-muted-foreground\",\n \"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...textareaProps}\n />\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n }\n\n // ---- Input branch --------------------------------------------------------\n const { type: rawType, onFocus, ...inputRest } =\n rest as React.InputHTMLAttributes<HTMLInputElement>\n const baseType = rawType ?? \"text\"\n\n const isPassword = baseType === \"password\"\n const type = isPassword && showPassword ? \"text\" : baseType\n\n const passwordToggle = isPassword ? (\n <button\n type=\"button\"\n onClick={() => setShowPassword((v) => !v)}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n className=\"cursor-pointer text-muted-foreground transition-colors hover:text-foreground\"\n tabIndex={-1}\n >\n {showPassword ? (\n <EyeOff className=\"size-4\" />\n ) : (\n <Eye className=\"size-4\" />\n )}\n </button>\n ) : null\n\n const effectiveLeftIcon = loading ? (\n <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />\n ) : (\n leftIcon\n )\n const effectiveRightIcon = isPassword ? passwordToggle : rightIcon\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n // Select-all on number focus so typing replaces the value.\n if (type === \"number\") e.target.select()\n onFocus?.(e)\n }\n\n const isInputGroup = Boolean(startItem || endItem)\n\n const focusRing =\n \"focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50\"\n const invalidRing =\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-3 aria-[invalid=true]:ring-destructive/20 dark:aria-[invalid=true]:ring-destructive/40\"\n\n const bareInput = (\n <input\n id={inputId}\n type={type}\n ref={ref as React.Ref<HTMLInputElement>}\n disabled={disabled}\n aria-invalid={error}\n aria-describedby={describedBy}\n onFocus={handleFocus}\n className={cn(\n \"w-full min-w-0 bg-transparent text-sm text-foreground outline-none placeholder:text-foreground/50 disabled:cursor-not-allowed disabled:text-muted-foreground\",\n // standalone vs. inside a group\n isInputGroup\n ? \"h-full border-0 py-1 focus-visible:ring-0\"\n : cn(\n // Use pl-3/pr-3 (not px-3) so the icon padding overrides cleanly —\n // tailwind-merge replaces pl-3 with pl-9 reliably (px-3 confuses it).\n // Disabled keeps its solid fill (no opacity) so the input still\n // contrasts with its container — only the text/cursor signal it.\n \"rounded-sm border border-border pl-3 pr-3 py-1 transition-[color,box-shadow]\",\n bgClass,\n size === \"default\" ? \"h-8.5\" : \"h-7\",\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:ring-destructive/40\",\n effectiveLeftIcon && \"pl-9\",\n effectiveRightIcon && \"pr-9\",\n ),\n // padding inside group — sit flush against a segment (which supplies its\n // own inset), else pad from the field edge. Matches ARGUS's pl-0/pr-0\n // next to a start/end item. Use pl-*/pr-* (not px-*) so the icon padding\n // below overrides cleanly.\n isInputGroup && (startItem ? \"pl-0\" : \"pl-3\"),\n isInputGroup && (endItem ? \"pr-0\" : \"pr-3\"),\n isInputGroup && effectiveLeftIcon && !startItem && \"pl-9\",\n isInputGroup && effectiveRightIcon && !endItem && \"pr-9\",\n isInputGroup && effectiveLeftIcon && startItem && \"pl-6\",\n isInputGroup && effectiveRightIcon && endItem && \"pr-6\",\n className,\n )}\n {...inputRest}\n />\n )\n\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n\n {isInputGroup ? (\n <div\n aria-invalid={error}\n className={cn(\n \"flex items-center overflow-hidden rounded-sm border border-border transition-[color,box-shadow]\",\n bgClass,\n size === \"default\" ? \"h-9\" : \"h-8\",\n focusRing,\n invalidRing,\n disabled && \"cursor-not-allowed\",\n )}\n >\n {startItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-3 pr-2 text-sm text-muted-foreground [&_svg]:size-4\">\n {startItem}\n </div>\n )}\n <div className=\"relative flex h-full flex-1 items-center\">\n {effectiveLeftIcon && (\n <div className=\"pointer-events-none absolute left-3 flex items-center text-muted-foreground [&_svg]:size-4\">\n {effectiveLeftIcon}\n </div>\n )}\n {bareInput}\n {effectiveRightIcon && (\n <div className=\"absolute right-3 z-10 flex items-center\">\n {effectiveRightIcon}\n </div>\n )}\n </div>\n {endItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-2 pr-3 text-sm text-foreground [&_svg]:size-4\">\n {endItem}\n </div>\n )}\n </div>\n ) : (\n <div className=\"relative\">\n {effectiveLeftIcon && (\n <div className=\"pointer-events-none absolute left-3 top-1/2 flex -translate-y-1/2 items-center text-muted-foreground [&_svg]:size-4\">\n {effectiveLeftIcon}\n </div>\n )}\n {bareInput}\n {effectiveRightIcon && (\n <div className=\"absolute right-3 top-1/2 z-10 flex -translate-y-1/2 items-center\">\n {effectiveRightIcon}\n </div>\n )}\n </div>\n )}\n\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n})\n\nAdvancedInput.displayName = \"AdvancedInput\"\n\n// ============================================================================\n// Tags field (AdvancedInput as=\"tags\")\n// ============================================================================\n\nfunction TagChip({\n children,\n onRemove,\n disabled,\n}: {\n children: React.ReactNode\n onRemove: () => void\n disabled?: boolean\n}) {\n return (\n <Badge variant=\"default\" className=\"gap-1 pr-1 font-normal\">\n <span className=\"truncate\">{children}</span>\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`Remove ${children}`}\n onClick={onRemove}\n tabIndex={-1}\n className=\"flex size-3.5 items-center justify-center rounded-sm text-primary-foreground/80 transition-colors hover:bg-primary-foreground/20 hover:text-primary-foreground\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </Badge>\n )\n}\n\nfunction TagsField({\n value,\n onChange,\n label,\n description,\n errorMessage,\n helperText,\n required = false,\n size = \"default\",\n variant = \"default\",\n disabled,\n placeholder = \"Add and press Enter…\",\n badgePosition = \"inside\",\n separators = [\",\", \"Enter\"],\n dedupe = true,\n maxTags,\n error: errorProp,\n className,\n wrapperClassName,\n id: providedId,\n}: TagsProps) {\n const [draft, setDraft] = React.useState(\"\")\n const inputRef = React.useRef<HTMLInputElement>(null)\n const reactId = React.useId()\n const inputId = providedId || reactId\n const errorId = `${inputId}-error`\n const helperId = `${inputId}-helper`\n const descriptionId = `${inputId}-description`\n\n const error = errorProp ?? Boolean(errorMessage)\n const bgClass =\n variant === \"alt\" ? \"bg-input-background-alt\" : \"bg-input-background\"\n const inside = badgePosition === \"inside\"\n\n const addTag = (raw: string) => {\n const tag = raw.trim()\n if (!tag) return\n if (dedupe && value.some((v) => v.toLowerCase() === tag.toLowerCase())) return\n if (maxTags != null && value.length >= maxTags) return\n onChange([...value, tag])\n }\n\n const commitDraft = () => {\n if (draft.trim()) {\n addTag(draft)\n setDraft(\"\")\n }\n }\n\n const removeAt = (index: number) =>\n onChange(value.filter((_, i) => i !== index))\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (separators.includes(e.key)) {\n e.preventDefault()\n commitDraft()\n } else if (e.key === \"Backspace\" && draft === \"\" && value.length > 0) {\n removeAt(value.length - 1)\n }\n }\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const text = e.target.value\n // Splitting pasted/typed text containing a comma separator into tags.\n if (separators.includes(\",\") && text.includes(\",\")) {\n const parts = text.split(\",\")\n const last = parts.pop() ?? \"\"\n parts.forEach((p) => addTag(p))\n setDraft(last)\n } else {\n setDraft(text)\n }\n }\n\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {required && (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n )}\n </FieldLabel>\n )}\n\n <div\n onClick={() => inputRef.current?.focus()}\n aria-invalid={error}\n className={cn(\n \"flex w-full cursor-text rounded-sm border border-border transition-[color,box-shadow]\",\n bgClass,\n \"focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50\",\n \"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n disabled && \"cursor-not-allowed\",\n inside\n ? \"min-h-9 flex-wrap items-center gap-1.5 px-2 py-1.5\"\n : cn(\"items-center px-3\", size === \"default\" ? \"h-9\" : \"h-8\"),\n className,\n )}\n >\n {inside &&\n value.map((tag, i) => (\n <TagChip key={`${tag}-${i}`} onRemove={() => removeAt(i)} disabled={disabled}>\n {tag}\n </TagChip>\n ))}\n <input\n id={inputId}\n ref={inputRef}\n value={draft}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onBlur={commitDraft}\n disabled={disabled}\n placeholder={value.length === 0 || !inside ? placeholder : \"\"}\n aria-invalid={error}\n aria-describedby={error && errorMessage ? errorId : undefined}\n className=\"min-w-24 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-foreground/50 disabled:cursor-not-allowed disabled:text-muted-foreground\"\n />\n </div>\n\n {/* Chips below the input */}\n {!inside && value.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {value.map((tag, i) => (\n <TagChip key={`${tag}-${i}`} onRemove={() => removeAt(i)} disabled={disabled}>\n {tag}\n </TagChip>\n ))}\n </div>\n )}\n\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n}\n\n// ============================================================================\n// Country code selector (used by PhoneInput as a startItem)\n// ============================================================================\n\nfunction CountryCodeSelect({\n country,\n countries,\n onSelect,\n disabled,\n}: {\n country: PhoneCountry\n countries: PhoneCountry[]\n onSelect: (c: PhoneCountry) => void\n disabled?: boolean\n}) {\n const [open, setOpen] = React.useState(false)\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n // Fill the startItem segment (pl-3 pr-2) flush by cancelling its inset.\n className=\"-ml-3 -mr-2 flex h-full items-center gap-1.5 pl-3 pr-2 text-sm text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted disabled:pointer-events-none\"\n >\n <span className=\"text-base leading-none\">{country.flag}</span>\n <span className=\"font-medium\">+{country.dial}</span>\n <ChevronDown className=\"size-3.5 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-64 p-0\" align=\"start\">\n <Command\n filter={(value, search) =>\n value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0\n }\n >\n <CommandInput placeholder=\"Search country…\" />\n <CommandList>\n <CommandEmpty>No country found.</CommandEmpty>\n {countries.map((c) => (\n <CommandItem\n key={c.iso}\n value={`${c.name} +${c.dial} ${c.iso}`}\n onSelect={() => {\n onSelect(c)\n setOpen(false)\n }}\n >\n <span className=\"text-base leading-none\">{c.flag}</span>\n <span className=\"flex-1 truncate\">{c.name}</span>\n <span className=\"text-muted-foreground\">+{c.dial}</span>\n </CommandItem>\n ))}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n\n// ============================================================================\n// PhoneInput — AdvancedInput with a country-code selector\n// ============================================================================\n\nexport interface PhoneInputProps\n extends Omit<\n InputProps,\n \"as\" | \"startItem\" | \"value\" | \"onChange\" | \"type\" | \"defaultValue\"\n > {\n /** Full phone value in E.164-ish form, e.g. \"+919876543210\". Controlled. */\n value?: string\n /** Called with the combined \"+{dial}{number}\" string. */\n onChange?: (value: string) => void\n /** Default selected country ISO (e.g. \"US\"). */\n defaultCountry?: string\n /** Country list. Defaults to a curated common set. */\n countries?: PhoneCountry[]\n}\n\n/**\n * A phone-number field: a searchable country dial-code selector attached to a\n * number input, built on `AdvancedInput`. Controlled via `value`/`onChange`,\n * which use the combined `+{dial}{number}` string. No external dependency — pass\n * your own `countries` for the full list.\n */\nexport const PhoneInput = React.forwardRef<HTMLInputElement, PhoneInputProps>(\n function PhoneInput(\n {\n value = \"\",\n onChange,\n defaultCountry = \"US\",\n countries = PHONE_COUNTRIES,\n placeholder = \"Phone number\",\n disabled,\n ...props\n },\n ref,\n ) {\n // Resolve the country from the value's dial prefix (longest match wins),\n // falling back to defaultCountry.\n const fallback =\n countries.find((c) => c.iso === defaultCountry) ?? countries[0]\n\n const matched = React.useMemo(() => {\n if (!value.startsWith(\"+\")) return null\n const digits = value.slice(1)\n // Prefer the longest dial code that prefixes the value.\n return (\n [...countries]\n .sort((a, b) => b.dial.length - a.dial.length)\n .find((c) => digits.startsWith(c.dial)) ?? null\n )\n }, [value, countries])\n\n const [country, setCountry] = React.useState<PhoneCountry>(\n matched ?? fallback,\n )\n\n // Displayed country: keep the user's explicit selection while its dial still\n // prefixes the value (so shared dial codes like US/CA +1 don't flip);\n // otherwise fall back to the dial-prefix match.\n const display =\n value.startsWith(\"+\") && value.slice(1).startsWith(country.dial)\n ? country\n : (matched ?? country)\n\n // The national number = value minus the \"+dial\" prefix.\n const activeDial = display.dial\n const nationalNumber =\n value.startsWith(\"+\") && value.slice(1).startsWith(activeDial)\n ? value.slice(1 + activeDial.length)\n : \"\"\n\n const emit = (dial: string, number: string) => {\n const clean = number.replace(/[^\\d]/g, \"\")\n onChange?.(`+${dial}${clean}`)\n }\n\n const handleCountry = (c: PhoneCountry) => {\n setCountry(c)\n emit(c.dial, nationalNumber)\n }\n\n return (\n <AdvancedInput\n ref={ref}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n placeholder={placeholder}\n disabled={disabled}\n value={nationalNumber}\n onChange={(e) => emit(activeDial, e.currentTarget.value)}\n startItem={\n <CountryCodeSelect\n country={display}\n countries={countries}\n onSelect={handleCountry}\n disabled={disabled}\n />\n }\n {...props}\n />\n )\n },\n)\n\nPhoneInput.displayName = \"PhoneInput\"\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n CircleCheckIcon,\n CircleXIcon,\n InfoIcon,\n TriangleAlertIcon,\n XIcon,\n type LucideIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type AlertSeverity = \"info\" | \"warning\" | \"error\" | \"success\"\nexport type AlertCardVariant = \"filled\" | \"outline\"\n\nexport interface AlertCardProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Severity — sets the accent color and default icon. */\n severity?: AlertSeverity\n /**\n * - `filled`: a soft tinted background (compact).\n * - `outline`: a bordered card with an icon box and room for actions.\n */\n variant?: AlertCardVariant\n /** Override the default severity icon. */\n icon?: React.ReactNode\n /** Heading. */\n title?: React.ReactNode\n /** Supporting text. */\n description?: React.ReactNode\n /** Small badge beside the title (outline variant). */\n badge?: React.ReactNode\n /** Action buttons rendered below the description (outline variant). */\n actions?: React.ReactNode\n /** Show a dismiss (×) button. */\n dismissible?: boolean\n /** Called when the dismiss button is clicked. */\n onDismiss?: () => void\n}\n\n// ============================================================================\n// Severity tokens (theme-aware)\n// ============================================================================\n\n// Literal class strings (not interpolated) so Tailwind can detect them.\nconst SEVERITY: Record<\n AlertSeverity,\n {\n icon: LucideIcon\n badge: \"blue\" | \"orange\" | \"red\" | \"green\"\n /** filled: tinted bg + border + text. */\n filled: string\n /** outline: the icon box. */\n iconBox: string\n /** primary action button background. */\n actionBtn: string\n }\n> = {\n info: {\n icon: InfoIcon,\n badge: \"blue\",\n filled: \"border-blue/30 bg-blue/10 text-blue\",\n iconBox: \"bg-blue/10 text-blue\",\n actionBtn: \"bg-blue text-white hover:bg-blue/90\",\n },\n warning: {\n icon: TriangleAlertIcon,\n badge: \"orange\",\n filled: \"border-orange/30 bg-orange/10 text-orange\",\n iconBox: \"bg-orange/10 text-orange\",\n actionBtn: \"bg-orange text-white hover:bg-orange/90\",\n },\n error: {\n icon: CircleXIcon,\n badge: \"red\",\n filled: \"border-red/30 bg-red/10 text-red\",\n iconBox: \"bg-red/10 text-red\",\n actionBtn: \"bg-red text-white hover:bg-red/90\",\n },\n success: {\n icon: CircleCheckIcon,\n badge: \"green\",\n filled: \"border-green/30 bg-green/10 text-green\",\n iconBox: \"bg-green/10 text-green\",\n actionBtn: \"bg-green text-white hover:bg-green/90\",\n },\n}\n\n// ============================================================================\n// Alert Card\n// ============================================================================\n\n/**\n * A higher-level alert with two looks — `filled` (soft tinted background) and\n * `outline` (bordered card with an icon box and actions) — across four\n * severities (info / warning / error / success). Theme-aware: severities map to\n * the blue / orange / red / green tokens.\n */\nexport function AlertCard({\n severity = \"info\",\n variant = \"filled\",\n icon,\n title,\n description,\n badge,\n actions,\n dismissible = false,\n onDismiss,\n className,\n ...props\n}: AlertCardProps) {\n const meta = SEVERITY[severity]\n const Sev = meta.icon\n\n const dismissBtn = dismissible && (\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n onClick={onDismiss}\n className=\"-mr-1 -mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md text-current/60 transition-colors hover:bg-current/10 hover:text-current\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n )\n\n // --- Filled: soft tinted background -------------------------------------\n if (variant === \"filled\") {\n return (\n <div\n role=\"alert\"\n data-slot=\"alert-card\"\n data-severity={severity}\n className={cn(\n \"flex items-start gap-2.5 rounded-lg border p-3\",\n meta.filled,\n className\n )}\n {...props}\n >\n <span className=\"mt-0.5 shrink-0 [&_svg]:size-4\">\n {icon ?? <Sev />}\n </span>\n <div className=\"min-w-0 flex-1\">\n {title != null && (\n <p className=\"text-sm font-medium\">{title}</p>\n )}\n {description != null && (\n <p className=\"text-sm/relaxed text-foreground/70\">{description}</p>\n )}\n </div>\n {dismissBtn}\n </div>\n )\n }\n\n // --- Outline: bordered card with icon box + actions ---------------------\n return (\n <div\n role=\"alert\"\n data-slot=\"alert-card\"\n data-severity={severity}\n className={cn(\n \"flex items-start gap-3 rounded-xl border bg-card p-3.5\",\n className\n )}\n {...props}\n >\n <span\n className={cn(\n \"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4.5\",\n meta.iconBox\n )}\n >\n {icon ?? <Sev />}\n </span>\n\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n {title != null && (\n <p className=\"text-sm font-medium text-foreground\">{title}</p>\n )}\n {badge != null && (\n <Badge variant={meta.badge} className=\"text-[10px]\">\n {badge}\n </Badge>\n )}\n </div>\n {description != null && (\n <p className=\"mt-1 text-sm/relaxed text-muted-foreground\">\n {description}\n </p>\n )}\n {actions != null && (\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">{actions}</div>\n )}\n </div>\n\n {dismissBtn}\n </div>\n )\n}\n\n/** A primary action button tinted to the alert's severity. */\nexport function AlertCardAction({\n severity = \"info\",\n className,\n ...props\n}: React.ComponentProps<typeof Button> & { severity?: AlertSeverity }) {\n return (\n <Button\n size=\"sm\"\n className={cn(SEVERITY[severity].actionBtn, className)}\n {...props}\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n AlertCircleIcon,\n FileArchiveIcon,\n FileIcon,\n FileSpreadsheetIcon,\n FileTextIcon,\n HeadphonesIcon,\n ImageIcon,\n ImageUpIcon,\n Trash2Icon,\n UploadIcon,\n VideoIcon,\n XIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n formatBytes,\n useFileUpload,\n type FileMetadata,\n type FileWithPreview,\n} from \"@/lib/use-file-upload\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type FileUploadProps = {\n /**\n * `image` renders a single-image dropzone with an inline preview overlay.\n * `files` renders a multi-file grid with per-file cards. Defaults to `image`.\n */\n variant?: \"image\" | \"files\"\n /** `accept` attribute, e.g. `\"image/*\"` or `\".pdf,.png\"`. */\n accept?: string\n /** Maximum size per file, in bytes. */\n maxSize?: number\n /** Maximum number of files (`files` variant). */\n maxFiles?: number\n /** Allow more than one file. Forced on for the `files` variant. */\n multiple?: boolean\n /** Files to seed the uploader with (already-uploaded items). */\n initialFiles?: FileMetadata[]\n /** Disables the dropzone and hides the file input. */\n disabled?: boolean\n /** Called whenever the file list changes. */\n onFilesChange?: (files: FileWithPreview[]) => void\n /** Class for the outer wrapper element. */\n className?: string\n}\n\ntype EntryFile = File | FileMetadata\n\n// ============================================================================\n// File-type helpers (files variant)\n// ============================================================================\n\nconst FILE_ICON_MATCHERS: {\n match: (type: string, name: string) => boolean\n Icon: React.ComponentType<{ className?: string }>\n}[] = [\n {\n match: (type, name) =>\n type.includes(\"zip\") ||\n type.includes(\"archive\") ||\n name.endsWith(\".zip\") ||\n name.endsWith(\".rar\"),\n Icon: FileArchiveIcon,\n },\n { match: (type) => type.includes(\"audio/\"), Icon: HeadphonesIcon },\n {\n match: (type, name) =>\n type.includes(\"excel\") ||\n name.endsWith(\".xls\") ||\n name.endsWith(\".xlsx\"),\n Icon: FileSpreadsheetIcon,\n },\n { match: (type) => type.startsWith(\"image/\"), Icon: ImageIcon },\n {\n match: (type, name) =>\n type.includes(\"pdf\") ||\n name.endsWith(\".pdf\") ||\n type.includes(\"word\") ||\n name.endsWith(\".doc\") ||\n name.endsWith(\".docx\"),\n Icon: FileTextIcon,\n },\n { match: (type) => type.includes(\"video/\"), Icon: VideoIcon },\n]\n\nfunction getFileIcon(file: EntryFile) {\n for (const { match, Icon } of FILE_ICON_MATCHERS) {\n if (match(file.type, file.name)) {\n return <Icon className=\"size-5 opacity-60\" />\n }\n }\n return <FileIcon className=\"size-5 opacity-60\" />\n}\n\nfunction FilePreview({ entry }: { entry: FileWithPreview }) {\n const { file } = entry\n const isImage = file.type.startsWith(\"image/\")\n\n return (\n <div className=\"flex aspect-square items-center justify-center overflow-hidden rounded-t-[inherit] bg-accent\">\n {isImage && entry.preview ? (\n <img\n alt={file.name}\n className=\"size-full rounded-t-[inherit] object-cover\"\n src={entry.preview}\n />\n ) : (\n getFileIcon(file)\n )}\n </div>\n )\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nfunction FileUpload({\n variant = \"image\",\n accept = \"image/*\",\n maxSize = 5 * 1024 * 1024,\n maxFiles = 6,\n multiple,\n initialFiles,\n disabled,\n onFilesChange,\n className,\n}: FileUploadProps) {\n const isMulti = variant === \"files\" ? true : (multiple ?? false)\n\n const [\n { files, isDragging, errors },\n {\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n openFileDialog,\n removeFile,\n clearFiles,\n getInputProps,\n },\n ] = useFileUpload({\n accept,\n maxSize,\n maxFiles,\n multiple: isMulti,\n initialFiles,\n onFilesChange,\n })\n\n const maxSizeLabel = formatBytes(maxSize)\n\n const errorBlock = errors.length > 0 && (\n <div\n className=\"flex items-center gap-1 text-destructive text-xs\"\n role=\"alert\"\n >\n <AlertCircleIcon className=\"size-3 shrink-0\" />\n <span>{errors[0]}</span>\n </div>\n )\n\n // --- Single image variant -------------------------------------------------\n if (variant === \"image\") {\n const previewUrl = files[0]?.preview || null\n const firstFile = files[0]\n\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div className=\"relative\">\n <div\n className=\"relative flex min-h-52 flex-col items-center justify-center overflow-hidden rounded-xl border border-input border-dashed p-4 transition-colors hover:bg-accent/50 has-disabled:pointer-events-none has-[img]:border-none has-disabled:opacity-50 has-[input:focus]:border-ring has-[input:focus]:ring-[3px] has-[input:focus]:ring-ring/50 data-[dragging=true]:bg-accent/50\"\n data-dragging={isDragging || undefined}\n onClick={disabled ? undefined : openFileDialog}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n role=\"button\"\n tabIndex={-1}\n >\n <input\n {...getInputProps({ disabled })}\n aria-label=\"Upload image file\"\n className=\"sr-only\"\n />\n {previewUrl ? (\n <div className=\"absolute inset-0 overflow-hidden rounded-xl\">\n <img\n alt={firstFile?.file?.name || \"Uploaded image\"}\n className=\"size-full rounded-xl object-cover\"\n src={previewUrl}\n />\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center px-4 py-3 text-center\">\n <div\n aria-hidden=\"true\"\n className=\"mb-2 flex size-11 shrink-0 items-center justify-center rounded-full border bg-background\"\n >\n <ImageUpIcon className=\"size-4 opacity-60\" />\n </div>\n <p className=\"mb-1.5 font-medium text-sm\">\n Drop your image here or click to browse\n </p>\n <p className=\"text-muted-foreground text-xs\">\n Max size: {maxSizeLabel}\n </p>\n </div>\n )}\n </div>\n {previewUrl && (\n <div className=\"absolute top-4 right-4\">\n <button\n aria-label=\"Remove image\"\n className=\"z-50 flex size-8 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white outline-none transition-[color,box-shadow] hover:bg-black/80 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n onClick={() => firstFile && removeFile(firstFile.id)}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </div>\n )}\n </div>\n\n {errorBlock}\n </div>\n )\n }\n\n // --- Multi-file variant ---------------------------------------------------\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div\n className=\"relative flex min-h-52 flex-col items-center not-data-files:justify-center overflow-hidden rounded-xl border border-input border-dashed p-4 transition-colors has-disabled:pointer-events-none has-disabled:opacity-50 has-[input:focus]:border-ring has-[input:focus]:ring-[3px] has-[input:focus]:ring-ring/50 data-[dragging=true]:bg-accent/50\"\n data-dragging={isDragging || undefined}\n data-files={files.length > 0 || undefined}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <input\n {...getInputProps({ disabled })}\n aria-label=\"Upload files\"\n className=\"sr-only\"\n />\n {files.length > 0 ? (\n <div className=\"flex w-full flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-2\">\n <h3 className=\"truncate font-medium text-sm\">\n Files ({files.length})\n </h3>\n <div className=\"flex gap-2\">\n <Button\n disabled={disabled}\n onClick={openFileDialog}\n size=\"sm\"\n variant=\"outline\"\n >\n <UploadIcon\n aria-hidden=\"true\"\n className=\"-ms-0.5 size-3.5 opacity-60\"\n />\n Add files\n </Button>\n <Button\n disabled={disabled}\n onClick={clearFiles}\n size=\"sm\"\n variant=\"outline\"\n >\n <Trash2Icon\n aria-hidden=\"true\"\n className=\"-ms-0.5 size-3.5 opacity-60\"\n />\n Remove all\n </Button>\n </div>\n </div>\n\n <div className=\"grid grid-cols-2 gap-4 md:grid-cols-3\">\n {files.map((entry) => (\n <div\n className=\"relative flex flex-col rounded-md border bg-background\"\n key={entry.id}\n >\n <FilePreview entry={entry} />\n <Button\n aria-label=\"Remove file\"\n className=\"-top-2 -right-2 absolute size-6 rounded-full border-2 border-background shadow-none focus-visible:border-background\"\n onClick={() => removeFile(entry.id)}\n size=\"icon\"\n >\n <XIcon className=\"size-3.5\" />\n </Button>\n <div className=\"flex min-w-0 flex-col gap-0.5 border-t p-3\">\n <p className=\"truncate font-medium text-[13px]\">\n {entry.file.name}\n </p>\n <p className=\"truncate text-muted-foreground text-xs\">\n {formatBytes(entry.file.size)}\n </p>\n </div>\n </div>\n ))}\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center px-4 py-3 text-center\">\n <div\n aria-hidden=\"true\"\n className=\"mb-2 flex size-11 shrink-0 items-center justify-center rounded-full border bg-background\"\n >\n <ImageIcon className=\"size-4 opacity-60\" />\n </div>\n <p className=\"mb-1.5 font-medium text-sm\">Drop your files here</p>\n <p className=\"text-muted-foreground text-xs\">\n Max {maxFiles} files ∙ Up to {maxSizeLabel}\n </p>\n <Button\n className=\"mt-4\"\n disabled={disabled}\n onClick={openFileDialog}\n variant=\"outline\"\n >\n <UploadIcon aria-hidden=\"true\" className=\"-ms-1 opacity-60\" />\n Select files\n </Button>\n </div>\n )}\n </div>\n\n {errorBlock}\n </div>\n )\n}\n\nexport { FileUpload }\n","import * as React from \"react\"\nimport {\n CheckIcon,\n ChevronDownIcon,\n Loader2,\n PlusIcon,\n XIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from \"@/components/ui/command\"\nimport { FieldDescription, FieldLabel } from \"@/components/ui/field\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AdvancedSelectOption {\n value: string\n label: string\n description?: string\n icon?: React.ReactNode\n image?: string\n disabled?: boolean\n badge?: string\n}\n\nexport interface AdvancedSelectGroup {\n label: string\n options: AdvancedSelectOption[]\n}\n\n// An item the consumer passes in: a plain string, a ready-made option, or an\n// arbitrary object resolved through getOptionLabel / getOptionValue.\ntype RawOption<T> = string | AdvancedSelectOption | T\n\nexport interface AdvancedSelectProps<T = AdvancedSelectOption> {\n options?: RawOption<T>[]\n groups?: AdvancedSelectGroup[]\n value?: string | string[] | T | T[]\n onValueChange?: (value: string | string[] | T | T[]) => void\n placeholder?: string\n disabled?: boolean\n error?: boolean\n errorMessage?: string\n multiple?: boolean\n className?: string\n size?: \"sm\" | \"default\"\n /** `default` uses the input background; `alt` uses the muted background. */\n variant?: \"default\" | \"alt\"\n searchable?: boolean\n clearable?: boolean\n getOptionLabel?: (option: T) => string\n getOptionValue?: (option: T) => string\n renderOptionLabel?: (option: T) => React.ReactNode\n label?: React.ReactNode\n description?: React.ReactNode\n required?: boolean\n onCreateNew?: () => void\n createNewLabel?: string\n loading?: boolean\n /** Show \"N selected\" instead of badges for multiple selections. */\n compactMultiple?: boolean\n /** Custom formatter for the compact multiple display. */\n formatCompactDisplay?: (selectedValues: T[]) => string\n /** Affix rendered before the trigger (input-group). */\n startItem?: React.ReactNode\n /** Affix rendered after the trigger (input-group). */\n endItem?: React.ReactNode\n /** Max selections allowed in multiple mode. */\n maxSelections?: number\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** Load more items for infinite scroll. */\n onLoadMore?: () => void\n hasNextPage?: boolean\n isFetchingNextPage?: boolean\n /** Allow clearing all selections in multiple mode (no minimum-1). */\n allowEmpty?: boolean\n /** Show a \"Select All\" option in multiple mode. */\n showSelectAll?: boolean\n /** Field looks normal but the dropdown won't open. */\n readOnly?: boolean\n /** Extra className for the dropdown panel. */\n popoverClassName?: string\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction isOptionObject(opt: unknown): opt is AdvancedSelectOption {\n return (\n typeof opt === \"object\" &&\n opt !== null &&\n \"value\" in opt &&\n \"label\" in opt\n )\n}\n\n// ============================================================================\n// AdvancedSelect\n// ============================================================================\n\nexport function AdvancedSelect<T = AdvancedSelectOption>({\n options = [],\n groups = [],\n value,\n onValueChange,\n placeholder = \"Select option\",\n disabled = false,\n error = false,\n errorMessage,\n multiple = false,\n className,\n size = \"default\",\n variant = \"default\",\n searchable = false,\n clearable = false,\n getOptionLabel,\n getOptionValue,\n renderOptionLabel,\n label,\n description,\n required = false,\n onCreateNew,\n createNewLabel = \"New item\",\n loading = false,\n compactMultiple = false,\n formatCompactDisplay,\n startItem,\n endItem,\n maxSelections,\n defaultOpen = false,\n onOpenChange,\n onLoadMore,\n hasNextPage = false,\n isFetchingNextPage = false,\n allowEmpty = false,\n showSelectAll = false,\n readOnly = false,\n popoverClassName,\n}: AdvancedSelectProps<T>) {\n const [open, setOpen] = React.useState(defaultOpen)\n const loadMoreCalledRef = React.useRef(false)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const selectId = React.useId()\n\n const handleOpenChange = React.useCallback(\n (newOpen: boolean) => {\n if (readOnly && newOpen) return\n setOpen(newOpen)\n onOpenChange?.(newOpen)\n if (newOpen) loadMoreCalledRef.current = false\n },\n [onOpenChange, readOnly],\n )\n\n const [selectedValues, setSelectedValues] = React.useState<T[]>(\n multiple ? (Array.isArray(value) ? (value as T[]) : value ? [value as T] : []) : [],\n )\n\n // Keep selectedValues in sync when the controlled `value` prop changes\n // (e.g. the parent resets filters). This is intentional prop->state sync.\n React.useEffect(() => {\n if (multiple) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedValues(\n Array.isArray(value) ? (value as T[]) : value ? [value as T] : [],\n )\n }\n }, [multiple, value])\n\n React.useEffect(() => {\n if (!isFetchingNextPage) loadMoreCalledRef.current = false\n }, [isFetchingNextPage])\n\n // ---- label/value resolution ---------------------------------------------\n\n const getValue = React.useCallback(\n (opt: unknown): string => {\n if (typeof opt === \"string\") return opt\n if (getOptionValue) return getOptionValue(opt as T)\n if (isOptionObject(opt)) return opt.value\n return String(opt)\n },\n [getOptionValue],\n )\n\n const getLabel = React.useCallback(\n (opt: unknown): string => {\n if (typeof opt === \"string\") {\n for (const group of groups) {\n const found = group.options.find((o) => o.value === opt)\n if (found) return found.label\n }\n for (const o of options) {\n if (typeof o === \"string\") {\n if (o === opt) return o\n } else if (isOptionObject(o) && o.value === opt) {\n return o.label\n }\n }\n return opt\n }\n if (getOptionLabel) return getOptionLabel(opt as T)\n if (isOptionObject(opt)) return opt.label\n return String(opt)\n },\n [getOptionLabel, groups, options],\n )\n\n const singleValue = React.useMemo(() => {\n if (multiple || !value) return \"\"\n if (typeof value === \"string\") return value\n if (Array.isArray(value)) return \"\"\n return getValue(value)\n }, [multiple, value, getValue])\n\n const normalizedOptions = React.useMemo<AdvancedSelectOption[]>(() => {\n return options.map((opt) => {\n if (typeof opt === \"string\") return { value: opt, label: opt }\n if (isOptionObject(opt)) return opt\n return { value: getValue(opt), label: getLabel(opt) }\n })\n }, [options, getLabel, getValue])\n\n const getOriginalOption = React.useCallback(\n (optionValue: string): T | undefined =>\n options.find((opt) => getValue(opt) === optionValue) as T | undefined,\n [options, getValue],\n )\n\n const allOptions = React.useMemo<AdvancedSelectOption[]>(() => {\n const opts = [...normalizedOptions]\n groups.forEach((group) => opts.push(...group.options))\n return opts\n }, [normalizedOptions, groups])\n\n // ---- selection handlers --------------------------------------------------\n\n const handleSelect = (optionValue: string) => {\n let original: RawOption<T> | undefined = options.find(\n (opt) => getValue(opt) === optionValue,\n )\n if (original === undefined && groups.length > 0) {\n for (const group of groups) {\n const found = group.options.find((opt) => opt.value === optionValue)\n if (found) {\n original = found as RawOption<T>\n break\n }\n }\n }\n\n if (multiple) {\n const isSelected = selectedValues.some((v) => getValue(v) === optionValue)\n // Enforce max selections silently.\n if (!isSelected && maxSelections && selectedValues.length >= maxSelections) {\n return\n }\n // Enforce minimum-1 silently (unless allowEmpty).\n if (isSelected && selectedValues.length === 1 && !allowEmpty) {\n return\n }\n const newValues = isSelected\n ? selectedValues.filter((v) => getValue(v) !== optionValue)\n : [...selectedValues, original as T]\n setSelectedValues(newValues)\n onValueChange?.(newValues)\n } else {\n onValueChange?.(original as T)\n setOpen(false)\n }\n }\n\n const isAllSelected =\n multiple &&\n allOptions.length > 0 &&\n allOptions.length === selectedValues.length\n\n const handleSelectAll = () => {\n if (!multiple) return\n if (isAllSelected) {\n if (allowEmpty) {\n setSelectedValues([])\n onValueChange?.([])\n }\n return\n }\n if (maxSelections && allOptions.length > maxSelections) return\n setSelectedValues(allOptions as unknown as T[])\n onValueChange?.(allOptions as unknown as T[])\n }\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (multiple) {\n setSelectedValues([])\n onValueChange?.([])\n } else {\n onValueChange?.(\"\")\n }\n }\n\n const handleRemoveValue = (e: React.MouseEvent, valueToRemove: T) => {\n e.stopPropagation()\n if (selectedValues.length === 1 && !allowEmpty) return\n const newValues = selectedValues.filter(\n (v) => getValue(v) !== getValue(valueToRemove),\n )\n setSelectedValues(newValues)\n onValueChange?.(newValues)\n }\n\n const handleScroll = React.useCallback(\n (e: React.UIEvent<HTMLDivElement>) => {\n const target = e.currentTarget\n const nearBottom =\n target.scrollHeight - target.scrollTop - target.clientHeight < 100\n if (\n nearBottom &&\n onLoadMore &&\n hasNextPage &&\n !isFetchingNextPage &&\n !loadMoreCalledRef.current\n ) {\n loadMoreCalledRef.current = true\n onLoadMore()\n }\n },\n [onLoadMore, hasNextPage, isFetchingNextPage],\n )\n\n const hasValue = multiple ? selectedValues.length > 0 : Boolean(singleValue)\n\n const getDisplayValue = () => {\n if (multiple) return null\n const option = allOptions.find((opt) => opt.value === singleValue)\n return option?.label || placeholder\n }\n\n const handleLabelClick = () => {\n if (!disabled && !readOnly) {\n triggerRef.current?.focus()\n setOpen(true)\n }\n }\n\n const isInputGroup = Boolean(startItem || endItem)\n // Badges wrap to multiple rows, so the trigger must grow vertically in\n // multiple (non-compact) mode; otherwise keep a fixed height.\n const canWrapBadges = multiple && !compactMultiple\n // Sizes match AdvancedInput: default h-9, small h-8.\n const fixedHeight = size === \"default\" ? \"h-9\" : \"h-8\"\n const minHeight = size === \"default\" ? \"min-h-9\" : \"min-h-8\"\n const heightClass = canWrapBadges ? minHeight : fixedHeight\n const bgClass = variant === \"alt\" ? \"bg-muted\" : \"bg-transparent dark:bg-input/30\"\n\n // ---- shared selected-display + chevron -----------------------------------\n\n const SelectedDisplay = (\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-center gap-1.5\",\n // Wrapping badges must not be clipped; keep single/compact text clipped.\n canWrapBadges ? \"py-1\" : \"overflow-hidden\",\n )}\n >\n {multiple && selectedValues.length > 0 ? (\n compactMultiple ? (\n <span className=\"min-w-0 truncate\">\n {formatCompactDisplay\n ? formatCompactDisplay(selectedValues)\n : `${selectedValues.length} selected`}\n </span>\n ) : (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {selectedValues.map((val, index) => (\n <span\n key={`${getValue(val)}-${index}`}\n className=\"inline-flex items-center gap-1 rounded-sm bg-primary px-2 py-0.5 text-xs font-normal text-primary-foreground\"\n >\n {getLabel(val)}\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`Remove ${getLabel(val)}`}\n onClick={(e) => handleRemoveValue(e, val)}\n className=\"rounded-sm transition-colors hover:bg-primary/80\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </span>\n ))}\n </div>\n )\n ) : (\n <span\n className={cn(\n \"block min-w-0 truncate\",\n !hasValue && \"text-muted-foreground/60\",\n )}\n >\n {getDisplayValue() || placeholder}\n </span>\n )}\n </div>\n )\n\n const TrailingControls = (\n <div className=\"flex shrink-0 items-center gap-1\">\n {clearable && hasValue && !disabled && (\n <span\n role=\"button\"\n tabIndex={0}\n aria-label=\"Clear\"\n onClick={handleClear}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.stopPropagation()\n handleClear(e as unknown as React.MouseEvent)\n }\n }}\n className=\"cursor-pointer rounded-sm p-0.5 transition-colors hover:bg-accent\"\n >\n <XIcon className=\"size-3.5\" />\n </span>\n )}\n <ChevronDownIcon size={16} className=\"shrink-0 opacity-60\" aria-hidden />\n </div>\n )\n\n // ---- dropdown list (shared) ----------------------------------------------\n\n const renderOption = (option: AdvancedSelectOption) => {\n const isSelected = multiple\n ? selectedValues.some((v) => getValue(v) === option.value)\n : singleValue === option.value\n const original = getOriginalOption(option.value)\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n onSelect={() => handleSelect(option.value)}\n disabled={option.disabled}\n >\n {multiple ? (\n <div\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-sm border\",\n isSelected ? \"border-primary bg-primary\" : \"border-input\",\n )}\n >\n {isSelected && <CheckIcon size={12} className=\"text-primary-foreground\" />}\n </div>\n ) : (\n <div className=\"flex size-4 shrink-0 items-center justify-center\">\n {isSelected && <CheckIcon size={16} className=\"text-primary\" />}\n </div>\n )}\n {(option.icon || option.image) && (\n <div className=\"flex size-4 shrink-0 items-center justify-center\">\n {option.image ? (\n <img\n src={option.image}\n alt={option.label}\n className=\"size-4 rounded-sm object-cover\"\n />\n ) : (\n option.icon\n )}\n </div>\n )}\n <div className=\"flex flex-1 items-center justify-between gap-2\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-normal\">\n {renderOptionLabel && original\n ? renderOptionLabel(original)\n : option.label}\n </span>\n {option.description && (\n <span className=\"text-xs leading-snug text-muted-foreground\">\n {option.description}\n </span>\n )}\n </div>\n {option.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground\">\n {option.badge}\n </span>\n )}\n </div>\n </CommandItem>\n )\n }\n\n const dropdown = (\n <PopoverContent\n className={cn(\n \"w-(--radix-popper-anchor-width) min-w-(--radix-popper-anchor-width) p-0\",\n popoverClassName,\n )}\n align=\"start\"\n onOpenAutoFocus={(e) => {\n if (!searchable) e.preventDefault()\n }}\n onWheel={(e) => e.stopPropagation()}\n >\n <Command>\n {searchable && (\n <CommandInput placeholder={`Search ${placeholder.toLowerCase()}...`} autoFocus />\n )}\n <CommandList onScroll={handleScroll}>\n {loading ? (\n <div className=\"flex items-center justify-center py-6\">\n <Loader2 className=\"size-5 animate-spin text-muted-foreground\" />\n </div>\n ) : (\n <>\n {multiple && showSelectAll && allOptions.length > 0 && (\n <>\n <CommandGroup>\n <CommandItem\n value=\"__select_all__\"\n onSelect={handleSelectAll}\n className=\"font-medium\"\n >\n <div\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-sm border\",\n isAllSelected ? \"border-primary bg-primary\" : \"border-input\",\n )}\n >\n {isAllSelected && (\n <CheckIcon size={12} className=\"text-primary-foreground\" />\n )}\n </div>\n <span>Select all</span>\n </CommandItem>\n </CommandGroup>\n <CommandSeparator />\n </>\n )}\n <CommandEmpty>No results found.</CommandEmpty>\n {groups.length > 0\n ? groups.map((group, idx) => (\n <React.Fragment key={group.label}>\n {idx > 0 && <CommandSeparator />}\n <CommandGroup heading={group.label}>\n {group.options.map(renderOption)}\n </CommandGroup>\n </React.Fragment>\n ))\n : <CommandGroup>{normalizedOptions.map(renderOption)}</CommandGroup>}\n {onCreateNew && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button\n variant=\"ghost\"\n className=\"w-full justify-start font-normal\"\n onClick={() => {\n onCreateNew()\n setOpen(false)\n }}\n >\n <PlusIcon size={16} className=\"-ms-1 opacity-60\" aria-hidden />\n {createNewLabel}\n </Button>\n </CommandGroup>\n </>\n )}\n {isFetchingNextPage && (\n <div className=\"flex items-center justify-center py-3\">\n <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />\n </div>\n )}\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n )\n\n // ---- trigger -------------------------------------------------------------\n\n const Asterisk = required ? (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n ) : null\n\n return (\n <div className=\"space-y-1.5\">\n {label && (\n <FieldLabel\n htmlFor={selectId}\n onClick={handleLabelClick}\n className={cn(\"cursor-pointer\", disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n\n {isInputGroup ? (\n <Popover open={open} onOpenChange={handleOpenChange} modal={false}>\n <PopoverTrigger asChild>\n <div\n aria-invalid={error}\n className={cn(\n \"flex rounded-md border border-input transition-colors\",\n // Wrapping badges grow the row; don't clip them.\n canWrapBadges ? \"items-stretch\" : \"items-center overflow-hidden\",\n bgClass,\n heightClass,\n open && \"border-ring ring-3 ring-ring/50\",\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-3 aria-[invalid=true]:ring-destructive/20\",\n disabled && \"pointer-events-none cursor-not-allowed opacity-50\",\n )}\n >\n {startItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center border-r border-input bg-muted/40 px-3 text-sm text-muted-foreground [&_svg]:size-4\">\n {startItem}\n </div>\n )}\n <Button\n id={selectId}\n type=\"button\"\n disabled={disabled}\n ref={triggerRef}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n onClick={(e) => {\n if (readOnly) {\n e.preventDefault()\n e.stopPropagation()\n }\n }}\n className={cn(\n \"h-full flex-1 justify-between rounded-none border-0 px-3 py-1 font-normal text-foreground shadow-none hover:bg-transparent focus-visible:ring-0\",\n canWrapBadges ? \"items-start\" : \"items-center\",\n className,\n )}\n >\n {SelectedDisplay}\n {TrailingControls}\n </Button>\n {endItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center border-l border-input bg-muted/40 px-3 text-sm text-foreground [&_svg]:size-4\">\n {endItem}\n </div>\n )}\n </div>\n </PopoverTrigger>\n {dropdown}\n </Popover>\n ) : (\n <Popover open={open} onOpenChange={handleOpenChange} modal={false}>\n <PopoverTrigger asChild>\n <Button\n id={selectId}\n type=\"button\"\n disabled={disabled}\n ref={triggerRef}\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-invalid={error}\n onClick={(e) => {\n if (readOnly) {\n e.preventDefault()\n e.stopPropagation()\n }\n }}\n className={cn(\n \"h-auto w-full justify-between px-3 py-1 font-normal text-foreground\",\n heightClass,\n // Top-align the chevron when badges wrap to multiple rows.\n canWrapBadges ? \"items-start\" : \"items-center\",\n bgClass,\n open && \"border-ring ring-3 ring-ring/50\",\n className,\n )}\n >\n {SelectedDisplay}\n {TrailingControls}\n </Button>\n </PopoverTrigger>\n {dropdown}\n </Popover>\n )}\n\n {error && errorMessage && (\n <p className=\"text-xs leading-5 text-destructive\">{errorMessage}</p>\n )}\n {description && <FieldDescription>{description}</FieldDescription>}\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CheckIcon } from \"lucide-react\"\n\nfunction Checkbox({\n className,\n ...props\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n >\n <CheckIcon\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n}\n\nexport { Checkbox }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\n return (\n <div\n data-slot=\"table-container\"\n className=\"relative w-full overflow-x-auto\"\n >\n <table\n data-slot=\"table\"\n className={cn(\"w-full caption-bottom text-sm\", className)}\n {...props}\n />\n </div>\n )\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n return (\n <thead\n data-slot=\"table-header\"\n className={cn(\"[&_tr]:border-b\", className)}\n {...props}\n />\n )\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n return (\n <tbody\n data-slot=\"table-body\"\n className={cn(\"[&_tr:last-child]:border-0\", className)}\n {...props}\n />\n )\n}\n\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n return (\n <tfoot\n data-slot=\"table-footer\"\n className={cn(\n \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\n return (\n <tr\n data-slot=\"table-row\"\n className={cn(\n \"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<\"th\">) {\n return (\n <th\n data-slot=\"table-head\"\n className={cn(\n \"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<\"td\">) {\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n \"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableCaption({\n className,\n ...props\n}: React.ComponentProps<\"caption\">) {\n return (\n <caption\n data-slot=\"table-caption\"\n className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n}\n","import * as React from \"react\";\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronsLeftIcon,\n ChevronsRightIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@/components/ui/table\";\nimport {\n ActionsMenu,\n type ActionsMenuItem,\n} from \"@/components/custom/actions-menu\";\nimport { AdvancedSelect } from \"@/components/custom/advanced-select\";\nimport { Spinner } from \"@/components/ui/spinner\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DataTableColumn<TRow> {\n /** Stable key; also used to read `row[key]` when no `cell` is given. */\n key: string;\n /** Header cell content. */\n header?: React.ReactNode;\n /** Custom cell renderer; defaults to String(row[key]). */\n cell?: (row: TRow, index: number) => React.ReactNode;\n align?: \"left\" | \"center\" | \"right\";\n /** Fixed column width, e.g. \"12rem\" or \"120px\". */\n width?: string;\n /** Extra class for this column's header + body cells. */\n className?: string;\n /** Extra class for the header cell only. */\n headerClassName?: string;\n}\n\nexport interface DataTableProps<TRow> {\n columns: DataTableColumn<TRow>[];\n data: TRow[];\n /** Unique id per row; required for selection. Defaults to the row index. */\n getRowId?: (row: TRow, index: number) => string;\n /**\n * Mark a row as disabled: it's dimmed, can't be selected (or \"select all\"-ed),\n * and ignores `onRowClick`. Row actions stay enabled.\n */\n isRowDisabled?: (row: TRow, index: number) => boolean;\n // --- selection (optional) ---\n selectable?: boolean;\n selectedIds?: string[];\n onSelectionChange?: (ids: string[]) => void;\n // --- row actions (optional) ---\n rowActions?: (row: TRow) => ActionsMenuItem[];\n // --- states ---\n loading?: boolean;\n emptyMessage?: React.ReactNode;\n // --- pagination (optional, client-side) ---\n /** Enable client-side pagination with a footer of page controls. */\n pagination?: boolean;\n /** Rows per page. Default `25`. */\n pageSize?: number;\n /** Page-size options in the footer selector. Default `[25, 50, 100, 200]`. */\n pageSizeOptions?: number[];\n // --- appearance ---\n /** Alternating row backgrounds for easier scanning. */\n striped?: boolean;\n /** Keep the header visible while the body scrolls (pair with maxHeight/fillHeight). */\n stickyHeader?: boolean;\n /** Constrains height and enables vertical scroll, e.g. \"24rem\" or 400. */\n maxHeight?: string | number;\n /**\n * Grow the table to fill its parent's height (body scrolls, footer pinned).\n * Place inside a flex column with a constrained height. Overrides `maxHeight`.\n */\n fillHeight?: boolean;\n // --- misc ---\n onRowClick?: (row: TRow) => void;\n className?: string;\n}\n\nconst alignClass = {\n left: \"text-left\",\n center: \"text-center\",\n right: \"text-right\",\n} as const;\n\n// ============================================================================\n// DataTable\n// ============================================================================\n\nexport function DataTable<TRow>({\n columns,\n data,\n getRowId = (_row, index) => String(index),\n isRowDisabled,\n selectable = false,\n selectedIds,\n onSelectionChange,\n rowActions,\n loading = false,\n emptyMessage = \"No results.\",\n pagination = false,\n pageSize: pageSizeProp = 25,\n pageSizeOptions = [25, 50, 100, 200],\n striped = true,\n stickyHeader = false,\n maxHeight,\n fillHeight = false,\n onRowClick,\n className,\n}: DataTableProps<TRow>) {\n const ids = React.useMemo(\n () => data.map((row, i) => getRowId(row, i)),\n [data, getRowId],\n );\n\n // Disabled rows are excluded from selection (\"select all\", toggle, count).\n const disabledById = React.useMemo(() => {\n const map: Record<string, boolean> = {};\n data.forEach((row, i) => {\n map[getRowId(row, i)] = isRowDisabled?.(row, i) ?? false;\n });\n return map;\n }, [data, getRowId, isRowDisabled]);\n\n // Ids eligible for selection (everything that isn't disabled).\n const selectableIds = React.useMemo(\n () => ids.filter((id) => !disabledById[id]),\n [ids, disabledById],\n );\n\n // Selection is controlled when selectedIds is provided, else internal.\n const [internalSelected, setInternalSelected] = React.useState<string[]>([]);\n const selected = selectedIds ?? internalSelected;\n\n const setSelected = (next: string[]) => {\n if (selectedIds === undefined) setInternalSelected(next);\n onSelectionChange?.(next);\n };\n\n const allSelected =\n selectableIds.length > 0 &&\n selectableIds.every((id) => selected.includes(id));\n const someSelected = selected.length > 0 && !allSelected;\n\n // Select all toggles only selectable rows; preserves any selected ids that\n // belong to disabled rows so they aren't silently dropped.\n const toggleAll = () =>\n setSelected(\n allSelected\n ? selected.filter((id) => disabledById[id])\n : [...new Set([...selected, ...selectableIds])],\n );\n const toggleRow = (id: string) => {\n if (disabledById[id]) return;\n setSelected(\n selected.includes(id)\n ? selected.filter((x) => x !== id)\n : [...selected, id],\n );\n };\n\n const totalCols =\n columns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0);\n\n // --- pagination (client-side) ---\n const [pageSize, setPageSize] = React.useState(pageSizeProp);\n const [rawPageIndex, setPageIndex] = React.useState(0);\n\n const pageCount = pagination\n ? Math.max(1, Math.ceil(data.length / pageSize))\n : 1;\n // Clamp during render (no effect): if data shrank or page size grew, the last\n // valid page is shown without an extra render pass.\n const pageIndex = Math.min(rawPageIndex, pageCount - 1);\n\n // Rows for the current page, paired with their original index so selection,\n // striping, and cell renderers keep using the row's true position.\n const pageRows = React.useMemo(() => {\n const rows = data.map((row, index) => ({ row, index }));\n if (!pagination) return rows;\n const start = pageIndex * pageSize;\n return rows.slice(start, start + pageSize);\n }, [data, pagination, pageIndex, pageSize]);\n\n // Comfier, consistent cell padding; first/last cells get extra edge inset.\n const cellPad = \"px-4 py-3 first:pl-5 last:pr-5\";\n const headPad = \"px-4 first:pl-5 last:pr-5\";\n\n // When constraining height, the scroll/max-height must live on the table's\n // own container (data-slot=table-container) so a sticky header sticks to it —\n // an outer scroll wrapper would leave the header scrolling inside the table's\n // own overflow context. We target that container via a descendant utility.\n const heightStyle =\n !fillHeight && maxHeight !== undefined\n ? typeof maxHeight === \"number\"\n ? `${maxHeight}px`\n : maxHeight\n : undefined;\n\n // Either fill the parent's height (flex) or cap it (max-height). Both put the\n // scroll on the table container so the sticky header pins to it.\n const constrained = fillHeight || maxHeight !== undefined;\n\n return (\n <div\n className={cn(\n \"overflow-hidden rounded-lg border\",\n // Square the bottom corners when a footer follows.\n pagination && \"rounded-b-none border-b-0\",\n // Make the root a flex column so the table area can grow/scroll and the\n // footer stays pinned at the bottom.\n constrained &&\n \"flex min-h-0 flex-col [&_[data-slot=table-container]]:overflow-y-auto\",\n // Fill the parent's remaining height (place inside a flex column).\n fillHeight &&\n \"min-h-0 flex-1 [&_[data-slot=table-container]]:min-h-0 [&_[data-slot=table-container]]:flex-1\",\n // Or cap at a fixed height.\n !fillHeight &&\n maxHeight !== undefined &&\n \"[&_[data-slot=table-container]]:max-h-(--dt-max-h)\",\n className,\n )}\n style={\n heightStyle\n ? ({\n \"--dt-max-h\": heightStyle,\n } as React.CSSProperties)\n : undefined\n }\n >\n <Table>\n <TableHeader\n className={cn(\n \"bg-muted/60\",\n stickyHeader &&\n cn(\n // A border on a sticky <thead>/<tr> doesn't travel with it, so\n // put the separating bottom border on the <th> cells themselves.\n \"sticky top-0 z-10 [&_th]:border-b [&_th]:bg-muted/95 [&_th]:backdrop-blur supports-backdrop-filter:[&_th]:bg-muted/80\",\n // Round the outer header cells' top corners so the header\n // background follows the container's rounded top (no square notch\n // over the border).\n \"[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg\",\n ),\n )}\n >\n <TableRow className=\"hover:bg-transparent\">\n {selectable && (\n <TableHead className={cn(\"w-10\", headPad)}>\n <Checkbox\n aria-label=\"Select all rows\"\n checked={\n allSelected ? true : someSelected ? \"indeterminate\" : false\n }\n onCheckedChange={toggleAll}\n />\n </TableHead>\n )}\n {columns.map((col) => (\n <TableHead\n key={col.key}\n style={col.width ? { width: col.width } : undefined}\n className={cn(\n \"h-11 text-xs font-semibold tracking-wide text-foreground uppercase\",\n headPad,\n col.align && alignClass[col.align],\n col.className,\n col.headerClassName,\n )}\n >\n {col.header}\n </TableHead>\n ))}\n {rowActions && <TableHead className=\"w-12\" />}\n </TableRow>\n </TableHeader>\n\n <TableBody>\n {loading ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell colSpan={totalCols} className=\"h-28 text-center\">\n <span className=\"inline-flex items-center gap-2 text-muted-foreground\">\n <Spinner className=\"size-4\" /> Loading…\n </span>\n </TableCell>\n </TableRow>\n ) : data.length === 0 ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={totalCols}\n className=\"h-28 text-center text-muted-foreground\"\n >\n {emptyMessage}\n </TableCell>\n </TableRow>\n ) : (\n pageRows.map(({ row, index }) => {\n const id = ids[index];\n const isSelected = selected.includes(id);\n const isDisabled = disabledById[id];\n return (\n <TableRow\n key={id}\n data-state={isSelected ? \"selected\" : undefined}\n data-disabled={isDisabled ? \"\" : undefined}\n aria-disabled={isDisabled || undefined}\n onClick={\n onRowClick && !isDisabled ? () => onRowClick(row) : undefined\n }\n className={cn(\n // Zebra stripe: a neutral, low-contrast tint.\n striped && !isSelected && \"odd:bg-muted/40\",\n // Selected: a distinct primary tint + left accent bar, so it\n // never reads like a stripe (overrides the stripe color).\n isSelected &&\n \"bg-primary/10 shadow-[inset_3px_0_0_0_var(--primary)] hover:bg-primary/15\",\n onRowClick && !isDisabled && \"cursor-pointer\",\n // Disabled: dimmed and not interactive (actions still work).\n isDisabled && \"opacity-50 hover:bg-transparent\",\n )}\n >\n {selectable && (\n <TableCell\n className={cn(\"w-10\", cellPad)}\n onClick={(e) => e.stopPropagation()}\n >\n <Checkbox\n aria-label=\"Select row\"\n checked={isSelected}\n disabled={isDisabled}\n onCheckedChange={() => toggleRow(id)}\n />\n </TableCell>\n )}\n {columns.map((col) => (\n <TableCell\n key={col.key}\n style={col.width ? { width: col.width } : undefined}\n className={cn(\n cellPad,\n col.align && alignClass[col.align],\n col.className,\n )}\n >\n {col.cell\n ? col.cell(row, index)\n : String(\n (row as Record<string, unknown>)[col.key] ?? \"\",\n )}\n </TableCell>\n ))}\n {rowActions && (\n <TableCell\n className=\"w-12 pr-3 text-right\"\n onClick={(e) => e.stopPropagation()}\n >\n <ActionsMenu items={rowActions(row)} />\n </TableCell>\n )}\n </TableRow>\n );\n })\n )}\n </TableBody>\n </Table>\n\n {pagination && (\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 text-sm\">\n <p className=\"text-muted-foreground\">\n Page {data.length === 0 ? 0 : pageIndex + 1} of {pageCount} (\n {data.length} total {data.length === 1 ? \"item\" : \"items\"})\n </p>\n\n <div className=\"flex items-center gap-4\">\n {pageSizeOptions && pageSizeOptions.length > 0 && (\n <div className=\"flex items-center gap-2 text-muted-foreground\">\n <span className=\"whitespace-nowrap\">Rows per page</span>\n <AdvancedSelect\n size=\"sm\"\n className=\"w-20\"\n value={String(pageSize)}\n onValueChange={(v) => {\n // Single-select emits the chosen option object; read its value.\n const raw =\n typeof v === \"object\" && v !== null && \"value\" in v\n ? (v as { value: string }).value\n : v;\n setPageSize(Number(raw));\n setPageIndex(0);\n }}\n options={pageSizeOptions.map((opt) => ({\n value: String(opt),\n label: String(opt),\n }))}\n />\n </div>\n )}\n\n <div className=\"flex items-center gap-1\">\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"First page\"\n disabled={pageIndex <= 0}\n onClick={() => setPageIndex(0)}\n >\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Previous page\"\n disabled={pageIndex <= 0}\n onClick={() => setPageIndex(Math.max(0, pageIndex - 1))}\n >\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Next page\"\n disabled={pageIndex >= pageCount - 1}\n onClick={() =>\n setPageIndex(Math.min(pageCount - 1, pageIndex + 1))\n }\n >\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Last page\"\n disabled={pageIndex >= pageCount - 1}\n onClick={() => setPageIndex(pageCount - 1)}\n >\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FormDialogProps {\n /** Body content — typically a form. Scrolls when it overflows. */\n children: React.ReactNode\n /** Heading shown in the (bordered) header. Omit to hide the header. */\n title?: React.ReactNode\n /** Whether the dialog is open. Controlled. */\n open: boolean\n /** Called when the dialog requests to close (X, overlay, or Esc). */\n onClose: () => void\n /** Optional supporting text under the title. */\n description?: React.ReactNode\n /**\n * When set, the dialog can't be dismissed by clicking the overlay or pressing\n * Escape — only the explicit close button / footer actions close it.\n */\n notDismissable?: boolean\n /** Footer content, pinned below the scrollable body with a top border. */\n footer?: React.ReactNode\n /** Class for the dialog content surface. */\n className?: string\n}\n\n// ============================================================================\n// Form Dialog\n// ============================================================================\n\n/**\n * A pre-composed modal for forms: a fixed bordered header (title, description,\n * and a close button), a scrollable body, and an optional pinned footer for\n * actions. Controlled via `open`/`onClose`. Set `notDismissable` to require an\n * explicit action to close.\n */\nfunction FormDialog({\n children,\n title,\n open,\n onClose,\n description,\n notDismissable,\n footer,\n className,\n}: FormDialogProps) {\n return (\n <Dialog\n open={open}\n onOpenChange={\n notDismissable ? undefined : (isOpen) => !isOpen && onClose()\n }\n >\n <DialogContent\n showCloseButton={false}\n className={cn(\"max-h-[75vh] gap-0 p-0 sm:max-w-2xl\", className)}\n >\n <div className=\"flex max-h-[75vh] flex-col\">\n {title && (\n <DialogHeader className=\"flex-shrink-0 border-b border-border p-6 pb-4\">\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex flex-col gap-1\">\n <DialogTitle className=\"text-left text-xl font-semibold\">\n {title}\n </DialogTitle>\n {description && (\n <DialogDescription className=\"text-left text-muted-foreground\">\n {description}\n </DialogDescription>\n )}\n </div>\n\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Close\"\n className=\"-mt-1 shrink-0\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n onClose()\n }}\n >\n <XIcon />\n </Button>\n </div>\n </DialogHeader>\n )}\n\n <div className=\"flex-1 overflow-y-auto p-6\">{children}</div>\n\n {footer && (\n <DialogFooter className=\"m-0 flex-shrink-0 rounded-none border-t border-border bg-transparent p-6 pt-4\">\n {footer}\n </DialogFooter>\n )}\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { FormDialog }\n","import * as React from \"react\"\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root\n data-slot=\"radio-group\"\n className={cn(\"grid w-full gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"flex size-4 items-center justify-center\"\n >\n <span className=\"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n}\n\nexport { RadioGroup, RadioGroupItem }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { RadioGroup, RadioGroupItem } from \"@/components/ui/radio-group\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface CardRadioItem {\n /** Unique value submitted when this card is selected. */\n value: string\n /** Primary label. */\n label: React.ReactNode\n /** Muted text shown inline after the label, e.g. \"(Sublabel)\". */\n sublabel?: React.ReactNode\n /** Supporting text shown beneath the label. */\n description?: React.ReactNode\n /** Optional leading media — an icon, logo, or small illustration. */\n icon?: React.ReactNode\n /** Disables this individual card. */\n disabled?: boolean\n}\n\nexport interface CardRadioGroupProps\n extends Omit<React.ComponentProps<typeof RadioGroup>, \"children\"> {\n /** The cards to render. */\n items: CardRadioItem[]\n /** Place the radio dot on the leading edge instead of the trailing edge. */\n indicatorPosition?: \"start\" | \"end\"\n /** Class for each card. */\n cardClassName?: string\n}\n\n// ============================================================================\n// Card Radio Group\n// ============================================================================\n\n/**\n * A radio group whose options are bordered cards, each with an optional icon,\n * a label (+ inline sublabel), and a description. The selected card highlights\n * its border. The whole card is clickable. Control selection with\n * `value`/`onValueChange` or `defaultValue`, like the base RadioGroup.\n */\nfunction CardRadioGroup({\n items,\n indicatorPosition = \"end\",\n className,\n cardClassName,\n ...props\n}: CardRadioGroupProps) {\n const reactId = React.useId()\n\n return (\n <RadioGroup className={cn(\"gap-2\", className)} {...props}>\n {items.map((item, i) => {\n const id = `${reactId}-${i}`\n const descId = item.description ? `${id}-description` : undefined\n\n return (\n // The whole card is a <label> so clicking anywhere toggles the radio\n // natively — no overlay hack needed, and the indicator dot stays\n // inside the (relative) radio item.\n <label\n key={item.value}\n htmlFor={id}\n className={cn(\n \"flex w-full items-start gap-3 rounded-md border border-input p-4 shadow-xs transition-colors\",\n \"has-data-[state=checked]:border-primary/50\",\n item.disabled\n ? \"cursor-not-allowed opacity-60\"\n : \"cursor-pointer\",\n cardClassName\n )}\n >\n <RadioGroupItem\n id={id}\n value={item.value}\n disabled={item.disabled}\n aria-describedby={descId}\n className={cn(\n \"mt-0.5\",\n indicatorPosition === \"end\" && \"order-1\"\n )}\n />\n <div className=\"flex grow items-start gap-3\">\n {item.icon && (\n <span className=\"flex shrink-0 items-center\" aria-hidden=\"true\">\n {item.icon}\n </span>\n )}\n <div className=\"grid grow gap-1.5\">\n <span className=\"text-sm font-medium leading-none\">\n {item.label}\n {item.sublabel != null && (\n <span className=\"text-xs font-normal leading-[inherit] text-muted-foreground\">\n {\" \"}\n {item.sublabel}\n </span>\n )}\n </span>\n {item.description != null && (\n <p id={descId} className=\"text-xs text-muted-foreground\">\n {item.description}\n </p>\n )}\n </div>\n </div>\n </label>\n )\n })}\n </RadioGroup>\n )\n}\n\nexport { CardRadioGroup }\n","\"use client\";\n\nimport * as React from \"react\";\nimport { CheckIcon, PaintBucketIcon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Default swatches use the theme's named accent tokens (var(--{color})), so\n * they adapt to the active theme + light/dark mode.\n */\nconst DEFAULT_SWATCHES = [\n \"var(--primary)\",\n \"var(--red)\",\n \"var(--orange)\",\n \"var(--yellow)\",\n \"var(--green)\",\n \"var(--teal)\",\n \"var(--cyan)\",\n \"var(--blue)\",\n \"var(--purple)\",\n \"var(--pink)\",\n \"var(--gray)\",\n \"var(--foreground)\",\n];\n\n/**\n * Resolve any CSS color (including `var(--token)`) to a `#rrggbb` hex string by\n * letting the browser compute it. Returns the input unchanged if unresolvable\n * (e.g. server-side) or already a plain hex.\n */\nfunction toHex(color: string): string {\n if (typeof window === \"undefined\") return color;\n if (/^#[0-9a-fA-F]{6}$/.test(color)) return color;\n const el = document.createElement(\"span\");\n el.style.color = color;\n document.body.appendChild(el);\n const rgb = getComputedStyle(el).color; // \"rgb(r, g, b)\"\n document.body.removeChild(el);\n const m = rgb.match(/\\d+/g);\n if (!m || m.length < 3) return color;\n const h = (n: number) => n.toString(16).padStart(2, \"0\");\n return `#${h(+m[0])}${h(+m[1])}${h(+m[2])}`;\n}\n\nexport interface ColorPickerProps {\n /** Current color (hex). Controlled. */\n value: string;\n /** Called with the new color. */\n onChange: (value: string) => void;\n /** Preset color swatches shown above the input. */\n swatches?: string[];\n /**\n * Trigger appearance:\n * - `swatch` (default): a rounded color box.\n * - `input`: a field showing the hex code with a leading swatch.\n */\n trigger?: \"swatch\" | \"input\";\n /** Placeholder for the `input` trigger when no value. */\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\n// ============================================================================\n// Color Picker\n// ============================================================================\n\n/**\n * A simple color picker: predefined swatches over a color-code input (with a\n * native color field). Controlled via `value`/`onChange`. Show it as a `swatch`\n * box or an `input` field via the `trigger` prop.\n */\nexport function ColorPicker({\n value,\n onChange,\n swatches = DEFAULT_SWATCHES,\n trigger = \"swatch\",\n placeholder = \"Pick a color\",\n disabled,\n className,\n}: ColorPickerProps) {\n // Local hex for the text field so the user can type freely; re-syncs to\n // `value` during render when the prop changes (no effect needed).\n const [hex, setHex] = React.useState(value);\n const [lastValue, setLastValue] = React.useState(value);\n if (value !== lastValue) {\n setLastValue(value);\n setHex(value);\n }\n\n // Pick a swatch: resolve `var(--token)` (and any CSS color) to a concrete hex\n // so the stored value + input show a real color, not the var() string.\n const pick = (swatch: string) => {\n onChange(toHex(swatch));\n };\n\n const commitHex = (next: string) => {\n setHex(next);\n if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(next)) onChange(next);\n };\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n {trigger === \"input\" ? (\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"flex h-9 w-56 items-center gap-2 rounded-md border bg-background px-2.5 text-left text-sm outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n >\n <span\n className=\"size-5 shrink-0 rounded ring-1 ring-foreground/10\"\n style={{ background: value || \"transparent\" }}\n />\n <span\n className={cn(\n \"flex-1 truncate font-mono\",\n !value && \"text-muted-foreground\",\n )}\n >\n {value || placeholder}\n </span>\n </button>\n ) : (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label=\"Pick a color\"\n className={cn(\n \"flex size-9 items-center justify-center rounded-md border ring-1 ring-foreground/10 outline-none transition-transform hover:scale-105 focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n style={{ background: value || \"transparent\" }}\n >\n {!value && (\n <PaintBucketIcon className=\"size-4 text-muted-foreground\" />\n )}\n </button>\n )}\n </PopoverTrigger>\n\n <PopoverContent className=\"w-64\" align=\"start\">\n {/* Predefined colors — a wrapping grid (swatch size stays fixed). */}\n <div className=\"grid grid-cols-6 gap-2\">\n {swatches.map((s) => {\n // Compare resolved hex so a preset stays \"active\" after its\n // var(--token) has been resolved to a concrete color in `value`.\n const active = toHex(s).toLowerCase() === value.toLowerCase();\n return (\n <button\n key={s}\n type=\"button\"\n aria-label={s}\n onClick={() => pick(s)}\n className={cn(\n \"flex aspect-square items-center justify-center rounded-md ring-1 ring-foreground/10 transition-transform hover:scale-105 active:scale-95\",\n active && \"ring-2 ring-ring ring-offset-1 ring-offset-popover\",\n )}\n style={{ background: s }}\n >\n {active && (\n <CheckIcon className=\"size-3.5 text-white mix-blend-difference\" />\n )}\n </button>\n );\n })}\n </div>\n\n {/* Color code input, with a leading swatch + native picker. */}\n <div className=\"mt-3 flex items-center gap-2 border-t pt-3\">\n <label\n className=\"relative size-7 shrink-0 overflow-hidden rounded ring-1 ring-foreground/10\"\n style={{ background: value || \"transparent\" }}\n >\n <input\n type=\"color\"\n value={/^#[0-9a-fA-F]{6}$/.test(value) ? value : \"#000000\"}\n onChange={(e) => onChange(e.target.value)}\n className=\"absolute inset-0 size-full cursor-pointer opacity-0\"\n />\n </label>\n <Input\n value={hex}\n onChange={(e) => commitHex(e.target.value)}\n placeholder=\"#000000\"\n className=\"h-8 font-mono\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n","import * as React from \"react\"\nimport { AlertDialog as AlertDialogPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\n\nfunction AlertDialog({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n )\n}\n\nfunction AlertDialogPortal({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n )\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n return (\n <AlertDialogPrimitive.Overlay\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\nfunction AlertDialogContent({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n size?: \"default\" | \"sm\"\n}) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\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-sm bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\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 has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left 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\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\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-sm border-t bg-muted/50 p-4 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\nfunction AlertDialogMedia({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n \"mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n \"text-base font-medium 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\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\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\nfunction AlertDialogAction({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Action\n data-slot=\"alert-dialog-action\"\n className={cn(className)}\n {...props}\n />\n </Button>\n )\n}\n\nfunction AlertDialogCancel({\n className,\n variant = \"outline\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Cancel\n data-slot=\"alert-dialog-cancel\"\n className={cn(className)}\n {...props}\n />\n </Button>\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { AlertTriangle, Loader2 } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n AlertDialog,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\"\nimport { Button } from \"@/components/ui/button\"\nimport { AdvancedInput } from \"@/components/custom/advanced-input\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ConfirmPromptProps {\n /** Whether the prompt is open. Controlled. */\n show: boolean\n /** Heading. Defaults to \"Are you absolutely sure?\". */\n title?: React.ReactNode\n /** Supporting copy explaining the consequence. */\n message?: React.ReactNode\n /** Runs when the user confirms. May return a promise for a loading state. */\n onConfirm: () => void | Promise<void>\n /** Runs when the user cancels / dismisses. */\n onCancel: () => void\n /** Show a spinner on the confirm button and block dismissal. */\n loading?: boolean\n /** Disable the confirm button regardless of validation. */\n disabled?: boolean\n /** Require the user to type `item` exactly before confirming. */\n validate?: boolean\n /** The string the user must type when `validate` is set. Defaults to \"CONFIRM\". */\n item?: string | null\n /** Confirm button label. Defaults to \"Confirm\". */\n confirmLabel?: string\n /** Cancel button label. Defaults to \"Cancel\". */\n cancelLabel?: string\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * A confirmation dialog for risky actions — mainly deletes. An amber warning\n * icon sits beside the title, with a red confirm button. Set `validate` to\n * require the user to type `item` exactly before confirming (the\n * \"type the name to delete\" safeguard). Controlled via `show`/`onCancel`;\n * `onConfirm` may return a promise to show a spinner.\n */\nexport function ConfirmPrompt({\n show,\n title = \"Are you absolutely sure?\",\n message = \"This action cannot be undone. This will permanently delete and remove your data from our servers.\",\n onConfirm,\n onCancel,\n loading: loadingProp,\n disabled,\n validate,\n item = \"CONFIRM\",\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n}: ConfirmPromptProps) {\n const [confirmMessage, setConfirmMessage] = React.useState(\"\")\n const [pending, setPending] = React.useState(false)\n const loading = loadingProp ?? pending\n\n const matches = !validate || confirmMessage === item\n const confirmDisabled = disabled || loading || !matches\n\n const handleCancel = () => {\n if (loading) return\n setConfirmMessage(\"\")\n onCancel()\n }\n\n const handleConfirm = async () => {\n if (confirmDisabled) return\n try {\n setPending(true)\n await onConfirm()\n setConfirmMessage(\"\")\n } finally {\n setPending(false)\n }\n }\n\n return (\n <AlertDialog\n open={Boolean(show)}\n onOpenChange={(next) => {\n if (!next) handleCancel()\n }}\n >\n <AlertDialogContent className=\"sm:max-w-lg!\">\n <AlertDialogHeader>\n <AlertDialogTitle className=\"flex items-center gap-2\">\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30\">\n <AlertTriangle className=\"size-5 text-amber-600 dark:text-amber-500\" />\n </div>\n {title}\n </AlertDialogTitle>\n {message != null && (\n <AlertDialogDescription>{message}</AlertDialogDescription>\n )}\n </AlertDialogHeader>\n\n {validate && (\n <div className=\"space-y-1\">\n <AlertDialogDescription>\n To confirm, type{\" \"}\n <span className=\"font-semibold text-foreground\">\n &ldquo;{item}&rdquo;\n </span>{\" \"}\n in the box below\n </AlertDialogDescription>\n <AdvancedInput\n value={confirmMessage}\n onChange={(e) => setConfirmMessage(e.target.value)}\n size=\"sm\"\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n disabled={loading}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") handleConfirm()\n }}\n />\n </div>\n )}\n\n <AlertDialogFooter className=\"gap-2 space-x-0!\">\n <Button variant=\"outline\" onClick={handleCancel} disabled={loading}>\n {cancelLabel}\n </Button>\n <Button\n onClick={handleConfirm}\n className={cn(\"bg-red-500 text-white hover:bg-red-600\")}\n disabled={confirmDisabled}\n >\n {loading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n confirmLabel\n )}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Tabs as TabsPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type CustomTabsType = \"underline\" | \"pill\"\n\nexport interface CustomTabItem {\n /** Unique value for the tab; also used as the trigger's `value`. */\n value: string\n /** Visible label. */\n label: React.ReactNode\n /** Optional leading icon. */\n icon?: React.ReactNode\n /** Optional numeric count rendered as a muted pill after the label. */\n count?: number\n /** Optional short badge rendered after the label, e.g. \"New\". */\n badge?: React.ReactNode\n /** Disables this individual tab. */\n disabled?: boolean\n}\n\nexport interface CustomTabsProps\n extends Omit<\n React.ComponentProps<typeof TabsPrimitive.Root>,\n \"orientation\" | \"children\"\n > {\n /** Visual style of the tab strip. Defaults to `underline`. */\n type?: CustomTabsType\n /** The tabs to render. */\n items: CustomTabItem[]\n /** Class for the tab list (the strip itself). */\n listClassName?: string\n}\n\n// ============================================================================\n// Custom Tabs\n// ============================================================================\n\n/**\n * A higher-level tab strip with two looks — `underline` and `pill` — driven by\n * a single `items` array. Each item can carry an icon, a numeric `count`, and a\n * short `badge` (e.g. \"New\"). Built on Radix Tabs, so it stays keyboard- and\n * a11y-friendly; control selection with `value`/`onValueChange` or\n * `defaultValue` just like the primitive.\n */\nfunction CustomTabs({\n type = \"underline\",\n items,\n className,\n listClassName,\n ...props\n}: CustomTabsProps) {\n return (\n <TabsPrimitive.Root\n data-slot=\"custom-tabs\"\n data-type={type}\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n >\n <TabsPrimitive.List\n data-slot=\"custom-tabs-list\"\n className={cn(\n \"inline-flex items-center text-muted-foreground\",\n type === \"underline\" &&\n \"w-full gap-6 border-b border-border\",\n type === \"pill\" && \"w-fit gap-1 rounded-lg bg-muted p-1\",\n listClassName\n )}\n >\n {items.map((item) => (\n <CustomTabsTrigger key={item.value} type={type} item={item} />\n ))}\n </TabsPrimitive.List>\n </TabsPrimitive.Root>\n )\n}\n\nfunction CustomTabsTrigger({\n type,\n item,\n}: {\n type: CustomTabsType\n item: CustomTabItem\n}) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"custom-tabs-trigger\"\n value={item.value}\n disabled={item.disabled}\n className={cn(\n \"group/trigger relative inline-flex items-center gap-2 text-sm font-medium whitespace-nowrap transition-colors outline-none\",\n \"focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:rounded-md\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n // Underline: full-height tab with an animated bottom border that picks\n // up the active theme's accent color.\n type === \"underline\" &&\n cn(\n \"-mb-px h-10 border-b-2 border-transparent px-0.5 text-foreground/60\",\n \"hover:text-foreground\",\n \"data-[state=active]:border-primary data-[state=active]:text-primary\"\n ),\n // Pill: rounded chip that fills with the accent color when active.\n type === \"pill\" &&\n cn(\n \"h-8 rounded-md px-3 text-foreground/60\",\n \"hover:text-foreground\",\n \"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm\"\n )\n )}\n >\n {item.icon}\n <span>{item.label}</span>\n {item.count != null && (\n <span\n className={cn(\n \"inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-xs font-medium tabular-nums\",\n \"bg-muted text-muted-foreground\",\n // Underline active: tab bg is transparent, so tint the count with\n // the accent. Pill active: chip is filled with the accent, so use\n // the inverse (primary-foreground) to stay legible.\n type === \"underline\" &&\n \"group-data-[state=active]/trigger:bg-primary/10 group-data-[state=active]/trigger:text-primary\",\n type === \"pill\" &&\n \"group-data-[state=active]/trigger:bg-primary-foreground/20 group-data-[state=active]/trigger:text-primary-foreground\"\n )}\n >\n {item.count}\n </span>\n )}\n {item.badge != null && (\n <Badge className=\"px-2 text-[10px]\">{item.badge}</Badge>\n )}\n </TabsPrimitive.Trigger>\n )\n}\n\nexport { CustomTabs }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DataCellProps extends React.ComponentProps<\"div\"> {\n /** Muted caption. */\n label: React.ReactNode\n /** The value. */\n value: React.ReactNode\n /**\n * Optional icon (auto-sized, muted). In `stacked` it sits beside the value;\n * in `row` it leads the label.\n */\n icon?: React.ReactNode\n /**\n * - `stacked` (default): label above value — for spec/detail grids.\n * - `row`: label on the left, value on the right — for definition lists.\n */\n layout?: \"stacked\" | \"row\"\n}\n\n// ============================================================================\n// Data Cell\n// ============================================================================\n\n/**\n * A labelled value cell. `stacked` renders the muted `label` above the bold\n * `value` (for spec/detail grids); `row` puts the label on the left and the\n * value on the right (a definition row). Lay several `stacked` cells out in a\n * grid, or several `row` cells in a `divide-y` column.\n */\nexport function DataCell({\n label,\n value,\n icon,\n layout = \"stacked\",\n className,\n ...props\n}: DataCellProps) {\n const iconNode = icon && (\n <span className=\"shrink-0 text-muted-foreground [&_svg]:size-4\">{icon}</span>\n )\n\n if (layout === \"row\") {\n // Row: icon leads the label on the left; value stays on the right.\n return (\n <div\n data-slot=\"data-cell\"\n data-layout=\"row\"\n className={cn(\n \"flex items-center justify-between gap-4 py-2\",\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1.5 text-sm text-muted-foreground\">\n {iconNode}\n {label}\n </span>\n <span className=\"text-sm font-medium\">{value}</span>\n </div>\n )\n }\n\n // Stacked: icon sits beside the value, under the label.\n return (\n <div\n data-slot=\"data-cell\"\n data-layout=\"stacked\"\n className={cn(\"flex flex-col gap-0.5\", className)}\n {...props}\n >\n <span className=\"text-xs text-muted-foreground\">{label}</span>\n <span className=\"flex items-center gap-1.5 text-sm font-medium\">\n {iconNode}\n {value}\n </span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DefRowProps extends React.ComponentProps<\"div\"> {\n /** Muted label on the left. */\n label: React.ReactNode\n /** Value on the right. */\n value: React.ReactNode\n}\n\n// ============================================================================\n// Def Row\n// ============================================================================\n\n/**\n * A definition row — a muted `label` on the left and a `value` on the right —\n * for key/value detail cards. Stack several inside a `divide-y` container.\n */\nexport function DefRow({ label, value, className, ...props }: DefRowProps) {\n return (\n <div\n data-slot=\"def-row\"\n className={cn(\"flex items-center justify-between gap-4 py-2\", className)}\n {...props}\n >\n <span className=\"text-sm text-muted-foreground\">{label}</span>\n <span className=\"text-sm font-medium\">{value}</span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Variants\n// ============================================================================\n\nconst dividerVariants = cva(\"flex items-center\", {\n variants: {\n orientation: {\n horizontal: \"w-full\",\n vertical: \"h-full flex-col\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n})\n\nconst lineVariants = cva(\"\", {\n variants: {\n color: {\n default: \"bg-border\",\n primary: \"bg-primary\",\n muted: \"bg-muted-foreground\",\n },\n thickness: {\n thin: \"\",\n medium: \"\",\n thick: \"\",\n },\n orientation: {\n horizontal: \"border-t\",\n vertical: \"w-px\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", thickness: \"thin\", class: \"border-t\" },\n { orientation: \"horizontal\", thickness: \"medium\", class: \"border-t-2\" },\n { orientation: \"horizontal\", thickness: \"thick\", class: \"border-t-4\" },\n { orientation: \"vertical\", thickness: \"thin\", class: \"w-px\" },\n { orientation: \"vertical\", thickness: \"medium\", class: \"w-0.5\" },\n { orientation: \"vertical\", thickness: \"thick\", class: \"w-1\" },\n ],\n defaultVariants: {\n color: \"default\",\n thickness: \"thin\",\n orientation: \"horizontal\",\n },\n})\n\nconst labelVariants = cva(\"font-medium whitespace-nowrap\", {\n variants: {\n color: {\n default: \"text-foreground\",\n primary: \"text-primary\",\n muted: \"text-muted-foreground\",\n },\n size: {\n sm: \"text-xs\",\n md: \"text-sm\",\n lg: \"text-base\",\n },\n },\n defaultVariants: {\n color: \"default\",\n size: \"sm\",\n },\n})\n\nconst countVariants = cva(\n \"flex items-center justify-center rounded-full text-xs font-medium\",\n {\n variants: {\n color: {\n default: \"border border-border bg-background text-foreground\",\n primary: \"border border-primary/20 bg-primary/10 text-primary\",\n muted:\n \"border border-muted-foreground/20 bg-muted text-muted-foreground\",\n },\n size: {\n sm: \"h-5 w-5 text-[10px]\",\n md: \"h-6 w-6 text-xs\",\n lg: \"h-7 w-7 text-sm\",\n },\n },\n defaultVariants: {\n color: \"default\",\n size: \"md\",\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DividerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\n /** Label text shown in the divider. */\n label?: React.ReactNode\n /** Optional count rendered as a badge after the label. */\n count?: number\n /** Tint for the line, label, and count. */\n color?: \"default\" | \"primary\" | \"muted\"\n /** Line weight. */\n thickness?: \"thin\" | \"medium\" | \"thick\"\n /** Size of the label text. */\n labelSize?: \"sm\" | \"md\" | \"lg\"\n /** Where the label sits along a horizontal divider. */\n labelPosition?: \"start\" | \"center\" | \"end\"\n /** Divider orientation. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Height for a vertical divider (e.g. \"h-11\", \"h-full\"). */\n height?: string\n /** Optional icon shown before the label (horizontal, start position). */\n icon?: React.ReactNode\n}\n\n// ============================================================================\n// Divider\n// ============================================================================\n\n/**\n * A separator that can carry a `label`, a `count` badge, and an `icon`. Supports\n * `start` / `center` / `end` label positions, `color` and `thickness` variants,\n * and a `vertical` orientation. For a plain rule with no label, use `Separator`.\n */\nfunction Divider({\n className,\n label,\n count,\n color = \"default\",\n thickness = \"thin\",\n labelSize = \"sm\",\n labelPosition = \"start\",\n orientation = \"horizontal\",\n height = \"h-full\",\n icon,\n ...props\n}: DividerProps) {\n const lineClass = cn(lineVariants({ color, thickness, orientation }))\n\n // Vertical divider — a thin rule.\n if (orientation === \"vertical\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(lineClass, \"rounded\", height, className)}\n {...props}\n />\n )\n }\n\n // Plain horizontal divider (no label/count).\n if (label == null && count === undefined) {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants({ orientation }), lineClass, className)}\n {...props}\n />\n )\n }\n\n const countBadge =\n count !== undefined ? (\n <span className={cn(countVariants({ color, size: labelSize }))}>\n {count}\n </span>\n ) : null\n\n // Label at start.\n if (labelPosition === \"start\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), \"gap-2\", className)}\n {...props}\n >\n {icon ? (\n <span className=\"shrink-0\">{icon}</span>\n ) : (\n <div className={cn(\"w-3 shrink-0\", lineClass)} />\n )}\n <span\n className={cn(labelVariants({ color, size: labelSize }), !icon && \"px-2\")}\n >\n {label}\n </span>\n {countBadge}\n <div className={cn(\"grow\", lineClass, count !== undefined && \"ml-2\")} />\n </div>\n )\n }\n\n // Label at center.\n if (labelPosition === \"center\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), className)}\n {...props}\n >\n <div className={cn(\"grow\", lineClass)} />\n <span className={cn(labelVariants({ color, size: labelSize }), \"px-3\")}>\n {label}\n </span>\n {countBadge}\n <div className={cn(\"grow\", lineClass, count !== undefined && \"ml-2\")} />\n </div>\n )\n }\n\n // Label at end.\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), className)}\n {...props}\n >\n <div className={cn(\"grow\", lineClass)} />\n {count !== undefined && (\n <span className={cn(countVariants({ color, size: labelSize }), \"mr-2\")}>\n {count}\n </span>\n )}\n <span className={cn(labelVariants({ color, size: labelSize }), \"pl-3\")}>\n {label}\n </span>\n </div>\n )\n}\n\nexport { Divider, dividerVariants }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Empty({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n \"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-header\"\n className={cn(\n \"flex max-w-sm flex-col items-center gap-2 text-center\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst emptyMediaVariants = cva(\n \"flex shrink-0 items-center justify-center mb-2 [&_svg:not([class*='size-'])]:size-6\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n icon: \"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction EmptyMedia({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof emptyMediaVariants>) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-title\"\n className={cn(\"text-lg font-medium tracking-tight\", className)}\n {...props}\n />\n )\n}\n\nfunction EmptyDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"empty-description\"\n className={cn(\n \"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn(\n \"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Empty,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n EmptyDescription,\n EmptyContent,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { InboxIcon } from \"lucide-react\"\n\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from \"@/components/ui/empty\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface EmptyStateProps\n extends Omit<React.ComponentProps<typeof Empty>, \"title\"> {\n /** Leading icon (or any node). Defaults to an inbox icon. */\n icon?: React.ReactNode\n /** Media style: `icon` wraps it in a muted square; `default` for avatars. */\n mediaVariant?: \"icon\" | \"default\"\n /** Heading. Defaults to \"No data\". */\n title?: React.ReactNode\n /** Supporting text. */\n description?: React.ReactNode\n /** Actions (buttons, links, inputs) rendered below. */\n actions?: React.ReactNode\n}\n\n// ============================================================================\n// Empty State\n// ============================================================================\n\n/**\n * A convenience wrapper over the compositional `Empty` primitive — pass\n * `icon`, `title`, `description`, and `actions` as props (with sensible\n * defaults) instead of composing the parts by hand. Drop the props you don't\n * need; use the `Empty*` parts directly when you need full control.\n */\nexport function EmptyState({\n icon = <InboxIcon />,\n mediaVariant = \"icon\",\n title = \"No data\",\n description,\n actions,\n ...props\n}: EmptyStateProps) {\n return (\n <Empty {...props}>\n <EmptyHeader>\n {icon != null && (\n <EmptyMedia variant={mediaVariant}>{icon}</EmptyMedia>\n )}\n {title != null && <EmptyTitle>{title}</EmptyTitle>}\n {description != null && (\n <EmptyDescription>{description}</EmptyDescription>\n )}\n </EmptyHeader>\n {actions != null && <EmptyContent>{actions}</EmptyContent>}\n </Empty>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { CheckIcon, PlusCircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from \"@/components/ui/command\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { Separator } from \"@/components/ui/separator\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FacetedFilterOption {\n /** Value stored in the selection. */\n value: string\n /** Visible label. */\n label: string\n /** Optional leading icon. */\n icon?: React.ReactNode\n /** Optional count shown on the right (e.g. matching rows). */\n count?: number\n}\n\ninterface BaseProps {\n /** Trigger label, e.g. \"Status\". */\n title: string\n options: FacetedFilterOption[]\n /** Placeholder for the search box. Defaults to `title`. */\n searchPlaceholder?: string\n /** Hide the search box (for short lists). */\n searchable?: boolean\n className?: string\n}\n\ninterface MultiProps extends BaseProps {\n mode?: \"multiple\"\n /** Selected values. */\n value: string[]\n onChange: (value: string[]) => void\n}\n\ninterface SingleProps extends BaseProps {\n mode: \"single\"\n /** Selected value (or null). */\n value: string | null\n onChange: (value: string | null) => void\n}\n\nexport type FacetedFilterProps = MultiProps | SingleProps\n\n// ============================================================================\n// Faceted Filter\n// ============================================================================\n\n/**\n * A controlled filter trigger + popover: a searchable list of options, each\n * selectable (multi-select checkboxes by default, or single-select with\n * `mode=\"single\"`). Shows a selected-count badge on the trigger and emits the\n * value(s) via `onChange` — use it to filter your own list or API query.\n */\nexport function FacetedFilter(props: FacetedFilterProps) {\n const {\n title,\n options,\n searchPlaceholder,\n searchable = true,\n className,\n } = props\n\n const isMultiple = props.mode !== \"single\"\n const selectedValues = React.useMemo(\n () =>\n new Set(\n isMultiple\n ? (props.value as string[])\n : props.value\n ? [props.value as string]\n : []\n ),\n [isMultiple, props.value]\n )\n\n const select = (value: string) => {\n if (isMultiple) {\n const next = new Set(selectedValues)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n ;(props.onChange as (v: string[]) => void)(Array.from(next))\n } else {\n const onChange = props.onChange as (v: string | null) => void\n // Toggle off if re-selecting the same single value.\n onChange(selectedValues.has(value) ? null : value)\n }\n }\n\n const clear = () => {\n if (isMultiple) (props.onChange as (v: string[]) => void)([])\n else (props.onChange as (v: string | null) => void)(null)\n }\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\"w-fit border-dashed\", className)}\n >\n <PlusCircleIcon />\n {title}\n {selectedValues.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"mx-0.5 h-4\" />\n {/* Only a count — never the selected labels */}\n <Badge\n variant=\"secondary\"\n className=\"rounded-sm px-1 font-normal\"\n >\n {selectedValues.size}\n </Badge>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-56 p-0\" align=\"start\">\n <Command>\n {searchable && (\n <CommandInput placeholder={searchPlaceholder ?? title} />\n )}\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value)\n return (\n <CommandItem\n key={option.value}\n onSelect={() => select(option.value)}\n >\n <div\n className={cn(\n \"flex size-4 items-center justify-center rounded-[4px] border\",\n // Square for multi (checkbox), round for single (radio).\n isMultiple ? \"rounded-[4px]\" : \"rounded-full\",\n isSelected\n ? \"border-primary bg-primary text-primary-foreground\"\n : \"border-input [&_svg]:invisible\"\n )}\n >\n <CheckIcon className=\"size-3\" />\n </div>\n {option.icon && (\n <span className=\"text-muted-foreground [&_svg]:size-4\">\n {option.icon}\n </span>\n )}\n <span>{option.label}</span>\n {option.count != null && (\n <span className=\"ml-auto flex size-4 items-center justify-center font-mono text-xs text-muted-foreground\">\n {option.count}\n </span>\n )}\n </CommandItem>\n )\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={clear}\n className=\"justify-center text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Checkbox } from \"@/components/ui/checkbox\"\nimport {\n ActionsMenu,\n type ActionsMenuItem,\n} from \"@/components/custom/actions-menu\"\n\n// ============================================================================\n// Footer building blocks (optional)\n// ============================================================================\n\n/** A small avatar (image or initials) paired with a label — for card footers. */\nexport function ListCardPerson({\n name,\n src,\n className,\n}: {\n name: string\n src?: string\n className?: string\n}) {\n const initials = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((p) => p[0]?.toUpperCase() ?? \"\")\n .join(\"\")\n return (\n <span\n className={cn(\n \"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted text-[10px] font-semibold text-foreground\">\n {src ? (\n <img src={src} alt={name} className=\"size-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n <span className=\"truncate\">{name}</span>\n </span>\n )\n}\n\n/** A bordered chip with an optional leading icon — for entity tags in footers. */\nexport function ListCardChip({\n icon,\n children,\n className,\n}: {\n icon?: React.ReactNode\n children: React.ReactNode\n className?: string\n}) {\n return (\n <span\n className={cn(\n \"inline-flex min-w-0 items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:opacity-70\",\n className\n )}\n >\n {icon}\n <span className=\"truncate\">{children}</span>\n </span>\n )\n}\n\n// ============================================================================\n// ListCard\n// ============================================================================\n\nexport interface ListCardProps\n extends Omit<React.ComponentProps<\"div\">, \"title\" | \"onSelect\"> {\n /** Primary heading. */\n title: React.ReactNode\n /** Muted secondary line below the title. */\n description?: React.ReactNode\n /** Leading visual beside the title — an image URL, or any node (icon, avatar). */\n media?: React.ReactNode | string\n /** Status badge shown in the top-left. */\n badge?: React.ReactNode\n /** Extra muted text shown in the footer, e.g. a timestamp. */\n meta?: React.ReactNode\n /** Footer content — pass `ListCardPerson`, `ListCardChip`, or any nodes. */\n footer?: React.ReactNode\n /** Kebab menu actions (top-right of the card). Pass items or a ready node. */\n actions?: ActionsMenuItem[] | React.ReactNode\n /**\n * - `stacked` (default): header row (checkbox + badge, menu on the right),\n * then media + title/description, then footer.\n * - `row`: a single line — checkbox, media, title/description, then menu.\n */\n layout?: \"stacked\" | \"row\"\n /**\n * Surface style. `default` uses the card background; `alt` uses the muted\n * background so cards stand out when nested on a card-colored surface.\n */\n variant?: \"default\" | \"alt\"\n /** Render a selection checkbox. */\n selectable?: boolean\n /** Controlled checkbox state (with `selectable`). */\n selected?: boolean\n /** Called when the checkbox toggles. */\n onSelectedChange?: (checked: boolean) => void\n /** Highlight the card with a ring (e.g. focused/open row). */\n active?: boolean\n /** Makes the whole card a button. */\n onClick?: React.MouseEventHandler<HTMLDivElement>\n}\n\n/**\n * A minimal content card for list / grid layouts: a top row (checkbox + badge,\n * with an actions menu on the right), an optional media thumbnail beside a title\n * + description, and a footer (where `meta` is shown). Every slot is optional,\n * so it renders any kind of data — alerts, tasks, contacts, files, etc.\n */\nexport function ListCard({\n title,\n description,\n media,\n badge,\n meta,\n footer,\n actions,\n layout = \"stacked\",\n variant = \"default\",\n selectable = false,\n selected,\n onSelectedChange,\n active = false,\n onClick,\n className,\n ...props\n}: ListCardProps) {\n const interactive = onClick != null\n const isRow = layout === \"row\"\n\n const checkboxNode = selectable ? (\n <Checkbox\n checked={selected}\n onCheckedChange={(c) => onSelectedChange?.(c === true)}\n onClick={(e) => e.stopPropagation()}\n aria-label=\"Select card\"\n className=\"shrink-0\"\n />\n ) : null\n\n const mediaNode =\n typeof media === \"string\" ? (\n <img\n src={media}\n alt=\"\"\n className=\"size-12 shrink-0 rounded-md object-cover\"\n />\n ) : (\n media\n )\n\n const badgeNode =\n badge == null ? null : typeof badge === \"string\" ||\n typeof badge === \"number\" ? (\n <Badge variant=\"secondary\" className=\"font-medium\">\n {badge}\n </Badge>\n ) : (\n badge\n )\n\n const actionsNode = Array.isArray(actions) ? (\n <ActionsMenu items={actions} align=\"end\" />\n ) : (\n actions\n )\n\n const rootClassName = cn(\n \"rounded-xl border p-4 text-card-foreground transition-colors\",\n variant === \"alt\" ? \"bg-muted/50\" : \"bg-card\",\n interactive &&\n \"cursor-pointer hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50\",\n active && \"ring-2 ring-ring\",\n className\n )\n\n const rootProps = {\n \"data-slot\": \"list-card\",\n \"data-active\": active || undefined,\n onClick,\n role: interactive ? \"button\" : undefined,\n tabIndex: interactive ? 0 : undefined,\n ...props,\n }\n\n // --- Single-line row layout -----------------------------------------------\n if (isRow) {\n return (\n <div className={cn(\"flex items-start gap-3\", rootClassName)} {...rootProps}>\n {checkboxNode}\n {mediaNode}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 items-start gap-2\">\n <p className=\"min-w-0 truncate font-medium text-sm\">{title}</p>\n {badgeNode}\n </div>\n {description != null && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {description}\n </p>\n )}\n {(footer != null || meta != null) && (\n <div className=\"mt-1 flex min-w-0 flex-wrap items-center gap-2\">\n {meta != null && (\n <span className=\"text-xs text-muted-foreground\">{meta}</span>\n )}\n {footer}\n </div>\n )}\n </div>\n {actionsNode != null && (\n <div className=\"shrink-0\" onClick={(e) => e.stopPropagation()}>\n {actionsNode}\n </div>\n )}\n </div>\n )\n }\n\n // --- Stacked layout -------------------------------------------------------\n return (\n <div className={cn(\"flex flex-col gap-3\", rootClassName)} {...rootProps}>\n {/* Top row: checkbox + badge on the left, actions menu on the right */}\n {(checkboxNode != null || badgeNode != null || actionsNode != null) && (\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {checkboxNode}\n {badgeNode}\n </div>\n {actionsNode != null && (\n <div\n className=\"-mt-1 -mr-1 shrink-0\"\n onClick={(e) => e.stopPropagation()}\n >\n {actionsNode}\n </div>\n )}\n </div>\n )}\n\n {/* Body: media + title/description */}\n <div className=\"flex min-w-0 items-start gap-3\">\n {mediaNode}\n <div className=\"min-w-0 flex-1\">\n <p className=\"font-medium text-sm leading-snug\">{title}</p>\n {description != null && (\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n </div>\n\n {/* Footer (meta is prepended here) */}\n {(footer != null || meta != null) && (\n <div className=\"mt-auto flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 border-t pt-3\">\n {meta != null && (\n <span className=\"text-xs text-muted-foreground\">{meta}</span>\n )}\n {footer}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================================================\n// ListCardGrid — responsive grid wrapper\n// ============================================================================\n\nexport interface ListCardGridProps extends React.ComponentProps<\"div\"> {\n /** Column count at the widest breakpoint. Defaults to 3. */\n columns?: 1 | 2 | 3 | 4\n}\n\nconst GRID_COLS: Record<NonNullable<ListCardGridProps[\"columns\"]>, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-1 sm:grid-cols-2\",\n 3: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n 4: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4\",\n}\n\n/** A responsive grid that lays out `ListCard`s. */\nexport function ListCardGrid({\n columns = 3,\n className,\n ...props\n}: ListCardGridProps) {\n return (\n <div\n data-slot=\"list-card-grid\"\n className={cn(\"grid w-full gap-4\", GRID_COLS[columns], className)}\n {...props}\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface MapMarkerPinProps extends React.ComponentProps<\"span\"> {\n /** Icon rendered inside the pin. */\n icon?: React.ReactNode\n /**\n * Background color of the pin — a Tailwind bg utility (e.g. `bg-primary`,\n * `bg-green`, `bg-red`) or a CSS color via `style`. Defaults to `bg-primary`.\n */\n color?: string\n /** Pin diameter in px. Default `28`. */\n size?: number\n /** Rotate the icon (e.g. a vehicle heading), in degrees. */\n rotate?: number\n /** Active/selected — adds a pulsing halo, scales up, and shows the label. */\n active?: boolean\n /** Optional label shown beneath the pin (always when set, or only when active). */\n label?: React.ReactNode\n /** Only show the label while `active`. Default `true`. */\n labelOnActive?: boolean\n}\n\n// ============================================================================\n// Map Marker Pin\n// ============================================================================\n\n/**\n * A reusable map-marker visual: a colored circular pin with an icon, an optional\n * pulsing halo + scale-up when `active`, and an optional `label` tooltip beneath\n * it. Drop it inside a `MapMarker` (or any positioned container). `color` is a\n * Tailwind bg utility so it tracks theme tokens.\n */\nexport function MapMarkerPin({\n icon,\n color = \"bg-primary\",\n size = 28,\n rotate,\n active = false,\n label,\n labelOnActive = true,\n className,\n ...props\n}: MapMarkerPinProps) {\n const showLabel = label != null && (!labelOnActive || active)\n\n return (\n <span\n data-slot=\"map-marker-pin\"\n data-active={active || undefined}\n className={cn(\"relative flex flex-col items-center\", className)}\n {...props}\n >\n {/* Pulsing halo when active */}\n {active && (\n <span\n aria-hidden\n className={cn(\n \"absolute top-0 animate-ping rounded-full opacity-30\",\n color\n )}\n style={{ width: size + 4, height: size + 4 }}\n />\n )}\n\n {/* Pin — icon auto-sizes to half the pin. */}\n <span\n className={cn(\n \"flex items-center justify-center rounded-full text-white shadow-md ring-2 ring-background transition-transform [&_svg]:size-1/2\",\n color,\n active && \"scale-110\"\n )}\n style={{ width: size, height: size }}\n >\n {rotate != null ? (\n <span\n className=\"flex [&_svg]:size-full\"\n style={{\n width: size / 2,\n height: size / 2,\n transform: `rotate(${rotate}deg)`,\n }}\n >\n {icon}\n </span>\n ) : (\n icon\n )}\n </span>\n\n {/* Label */}\n {showLabel && (\n <span className=\"mt-1 rounded bg-foreground px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap text-background shadow\">\n {label}\n </span>\n )}\n </span>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ArrowLeftIcon, HomeIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface NotFoundProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Big status code or glyph, e.g. \"404\". Pass an icon node for empty states. */\n code?: React.ReactNode\n /** Heading. Defaults to \"Page Not Found\". */\n title?: React.ReactNode\n /** Supporting text under the title. */\n description?: React.ReactNode\n /** Show the \"Go Back\" button (calls `onGoBack`, or history.back()). */\n showBack?: boolean\n /** Override the back-button handler. Defaults to `history.back()`. */\n onGoBack?: () => void\n /** Href for the \"Go to Home\" button. Set `null` to hide it. */\n homeHref?: string | null\n /** Label for the home button. */\n homeLabel?: React.ReactNode\n /** Extra actions rendered after the default buttons. */\n actions?: React.ReactNode\n}\n\n// ============================================================================\n// Not Found\n// ============================================================================\n\n/**\n * A centered status / not-found screen: a large `code` (e.g. \"404\"), a `title`,\n * a `description`, and action buttons (Go Back + Go to Home). Generic enough for\n * 404 / 403 / 500 and empty states — pass an icon as `code` for the latter.\n */\nexport function NotFound({\n code = \"404\",\n title = \"Page Not Found\",\n description = \"Sorry, we couldn't find the page you're looking for. The page might have been moved, deleted, or never existed.\",\n showBack = true,\n onGoBack,\n homeHref = \"/\",\n homeLabel = \"Go to Home\",\n actions,\n className,\n ...props\n}: NotFoundProps) {\n const handleBack = () => {\n if (onGoBack) onGoBack()\n else if (typeof window !== \"undefined\") window.history.back()\n }\n\n return (\n <div\n data-slot=\"not-found\"\n className={cn(\n \"flex min-h-[60svh] flex-col items-center justify-center px-6 text-center\",\n className\n )}\n {...props}\n >\n {code != null && (\n <div className=\"text-7xl font-extrabold tracking-tight text-primary tabular-nums sm:text-8xl [&_svg]:size-20\">\n {code}\n </div>\n )}\n\n {title != null && (\n <h1 className=\"mt-4 text-2xl font-bold tracking-tight sm:text-3xl\">\n {title}\n </h1>\n )}\n\n {description != null && (\n <p className=\"mt-3 max-w-md text-muted-foreground\">{description}</p>\n )}\n\n {(showBack || homeHref || actions) && (\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n {showBack && (\n <Button\n variant=\"outline\"\n onClick={handleBack}\n startItem={<ArrowLeftIcon />}\n >\n Go Back\n </Button>\n )}\n {homeHref != null && (\n <Button asChild>\n <a href={homeHref}>\n <HomeIcon />\n {homeLabel}\n </a>\n </Button>\n )}\n {actions}\n </div>\n )}\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface QuickStatProps extends React.ComponentProps<\"div\"> {\n /** Leading icon (auto-sized to 1rem). */\n icon?: React.ReactNode\n /** The figure, e.g. \"$960.99\" or 982. */\n value: React.ReactNode\n /** Muted trailing label, e.g. \"in stock\", \"sold\". */\n label?: React.ReactNode\n}\n\n// ============================================================================\n// Quick Stat\n// ============================================================================\n\n/**\n * A compact inline stat — a muted icon, a bold value, and an optional muted\n * label — for header metric rows and toolbars. Line several up with vertical\n * separators between them.\n */\nexport function QuickStat({\n icon,\n value,\n label,\n className,\n ...props\n}: QuickStatProps) {\n return (\n <div\n data-slot=\"quick-stat\"\n className={cn(\"flex items-center gap-1.5 text-sm\", className)}\n {...props}\n >\n {icon && (\n <span className=\"text-muted-foreground [&_svg]:size-4\">{icon}</span>\n )}\n <span className=\"font-medium tabular-nums\">{value}</span>\n {label != null && <span className=\"text-muted-foreground\">{label}</span>}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst cardVariants = cva(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-sm py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-sm *:[img:last-child]:rounded-b-sm\",\n {\n variants: {\n variant: {\n // Default surface.\n default: \"bg-card text-card-foreground ring-foreground/10\",\n // Muted alternate background (the repo's `alt` convention).\n alt: \"bg-muted/40 text-card-foreground ring-foreground/10\",\n // Soft, tone-tinted surfaces for status emphasis.\n primary: \"bg-primary/5 text-card-foreground ring-primary/20\",\n success: \"bg-green/5 text-card-foreground ring-green/20\",\n warning: \"bg-orange/5 text-card-foreground ring-orange/20\",\n danger: \"bg-red/5 text-card-foreground ring-red/20\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Card({\n className,\n size = \"default\",\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & {\n size?: \"default\" | \"sm\"\n} & VariantProps<typeof cardVariants>) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n data-variant={variant}\n className={cn(cardVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\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-sm px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n \"text-base leading-snug font-medium group-data-[size=sm]/card:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-sm border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n cardVariants,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { CircleDotIcon, RefreshCwIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card } from \"@/components/ui/card\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Color variant for the accent bar, mode label, icon, and value text. */\nexport type SensorCardColorVariant = \"primary\" | \"warning\" | \"danger\" | \"muted\"\n\nexport interface SensorCardProps {\n /** Leading icon. Falls back to a default based on `mode` (\"auto\" vs other). */\n icon?: React.ReactNode\n /** Mode label, e.g. \"Manual\", \"Auto\". */\n mode?: string\n /** Main description / name. */\n description?: string\n /** Value shown on the right, e.g. \"80\", \"Active\", \"OFF\". */\n value: string\n /** Show the colored accent bar before the value (active states). */\n showAccent?: boolean\n /** Color of the accent bar, mode label, and default icon. */\n colorVariant?: SensorCardColorVariant\n /** Override the accent-bar color only (falls back to `colorVariant`). */\n accentColorVariant?: SensorCardColorVariant\n /** Color the value text (defaults to the foreground color). */\n valueColorVariant?: SensorCardColorVariant\n /** Append a \"%\" to numeric values. Default `true`. */\n showPercentSign?: boolean\n /** Unit shown above the value in a stacked layout, e.g. \"°F\", \"kPa\". */\n unit?: string\n /** Icon on the left with mode/description stacked beside it. */\n stackedLayout?: boolean\n /**\n * - `default`: bare row, no Card wrapper (for nesting).\n * - `standalone`: wrapped in a Card with full styling.\n */\n variant?: \"default\" | \"standalone\"\n /** Click handler for the whole card. */\n onClick?: () => void\n /** Click handler for just the value. */\n onValueClick?: () => void\n className?: string\n}\n\n// ============================================================================\n// Color tokens\n// ============================================================================\n\nconst COLOR_CLASSES: Record<\n SensorCardColorVariant,\n { text: string; bg: string }\n> = {\n primary: { text: \"text-primary\", bg: \"bg-primary\" },\n warning: { text: \"text-orange\", bg: \"bg-orange\" },\n danger: { text: \"text-red\", bg: \"bg-red\" },\n muted: { text: \"text-muted-foreground\", bg: \"bg-muted-foreground\" },\n}\n\n// ============================================================================\n// Sensor Card\n// ============================================================================\n\n/**\n * A compact info/action card: a left side with an icon, mode label, and\n * description, and a right side with an accent bar and a value. Use\n * `colorVariant` to tint the bar, mode label, and default icon (primary /\n * warning / danger / muted), `variant=\"standalone\"` to wrap it in a Card, and\n * `onClick` / `onValueClick` for actions.\n */\nexport function SensorCard({\n icon,\n mode,\n description,\n value,\n showAccent = false,\n colorVariant = \"primary\",\n accentColorVariant,\n valueColorVariant,\n showPercentSign = true,\n unit,\n stackedLayout = false,\n variant = \"default\",\n onClick,\n onValueClick,\n className,\n}: SensorCardProps) {\n const colors = COLOR_CLASSES[colorVariant]\n const accentColors = COLOR_CLASSES[accentColorVariant ?? colorVariant]\n const valueTextColorClass = valueColorVariant\n ? COLOR_CLASSES[valueColorVariant].text\n : \"text-foreground\"\n\n // Default icon, tinted with the card's color variant.\n const iconSize = stackedLayout ? \"size-10\" : \"size-5\"\n const resolvedIcon =\n icon ??\n (mode?.toLowerCase() === \"auto\" ? (\n <RefreshCwIcon className={cn(iconSize, colors.text)} />\n ) : (\n <CircleDotIcon className={cn(iconSize, colors.text)} />\n ))\n\n const left = stackedLayout ? (\n <div className=\"flex items-center gap-3\">\n {resolvedIcon}\n <div className=\"flex flex-col\">\n {mode && (\n <span className={cn(\"text-sm font-medium\", colors.text)}>{mode}</span>\n )}\n <span className=\"text-sm font-medium text-foreground\">\n {description}\n </span>\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n {resolvedIcon}\n {mode && (\n <span className={cn(\"text-sm font-medium\", colors.text)}>{mode}</span>\n )}\n </div>\n <span className=\"text-sm font-medium text-foreground\">{description}</span>\n </div>\n )\n\n const content = (\n <>\n {left}\n\n {/* Right side - accent bar + value */}\n <div className=\"flex items-center gap-3\">\n <div\n className={cn(\n \"h-9 w-0.5 rounded-full\",\n showAccent ? accentColors.bg : \"bg-border\"\n )}\n />\n {unit ? (\n <div\n className={cn(\n \"flex min-w-16 flex-col items-center text-center\",\n onValueClick &&\n \"cursor-pointer transition-colors hover:text-primary\"\n )}\n onClick={onValueClick}\n >\n <span className=\"text-xs font-medium text-muted-foreground\">\n {unit}\n </span>\n <span className={cn(\"text-sm font-medium\", valueTextColorClass)}>\n {value}\n </span>\n </div>\n ) : (\n <span\n className={cn(\n \"min-w-16 text-center text-sm font-medium whitespace-nowrap\",\n valueTextColorClass,\n onValueClick &&\n \"cursor-pointer transition-colors hover:text-primary\"\n )}\n onClick={onValueClick}\n >\n {showPercentSign && value !== \"\" && !isNaN(Number(value))\n ? `${value}%`\n : value}\n </span>\n )}\n </div>\n </>\n )\n\n const baseClasses = cn(\n \"flex w-full flex-row items-center justify-between gap-3\",\n stackedLayout ? \"py-3 pr-3 pl-3\" : \"py-3.5 pr-3 pl-4\",\n onClick && \"cursor-pointer hover:bg-accent\",\n className\n )\n\n if (variant === \"standalone\") {\n return (\n <Card className=\"p-0\" onClick={onClick}>\n <div className={baseClasses}>{content}</div>\n </Card>\n )\n }\n\n return (\n <div className={baseClasses} onClick={onClick}>\n {content}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Dialog as SheetPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { XIcon } from \"lucide-react\"\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\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\nfunction SheetContent({\n className,\n children,\n side = \"right\",\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n showCloseButton?: boolean\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\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 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm 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 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\n variant=\"ghost\"\n className=\"absolute top-3 right-3\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn(\"flex flex-col gap-0.5 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn(\n \"text-base font-medium text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeftIcon, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n} from \"@/components/ui/sheet\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SideSheetProps {\n /** Body content — typically a form. Scrolls between the pinned header/footer. */\n children: React.ReactNode\n /** Heading shown in the pinned header. */\n title?: React.ReactNode\n /** Whether the sheet is open. Controlled. */\n open: boolean\n /** Called when the sheet requests to close (back/close, overlay, or Esc). */\n onClose: () => void\n /** Optional supporting text under the title. */\n description?: React.ReactNode\n /** Which edge the sheet slides in from. Defaults to `right`. */\n side?: \"left\" | \"right\"\n /**\n * Detach the panel from the screen edge — inset with a margin, fully rounded\n * corners, and a shadow, so it reads as a floating card.\n */\n floating?: boolean\n /**\n * Show a back chevron before the title. Defaults to a close (X) button.\n * When set, the chevron calls `onBack` (falls back to `onClose`).\n */\n onBack?: () => void\n /**\n * When set, the sheet can't be dismissed by clicking the overlay or pressing\n * Escape — only the header control / footer actions close it.\n */\n notDismissable?: boolean\n /** Footer content, pinned to the bottom with a top border. Always visible. */\n footer?: React.ReactNode\n /** Class for the sheet content surface (e.g. width overrides). */\n className?: string\n}\n\n// ============================================================================\n// Side Sheet\n// ============================================================================\n\n/**\n * A slide-in panel with a pinned header and a **sticky footer**: the header\n * (title, description, and a back/close control) and the footer (actions) stay\n * fixed while the body scrolls between them. Controlled via `open`/`onClose`.\n * Set `notDismissable` to require an explicit action to close, pass `onBack` to\n * swap the close button for a back chevron, or `floating` to detach the panel\n * from the screen edge as a rounded, shadowed card.\n */\nfunction SideSheet({\n children,\n title,\n open,\n onClose,\n description,\n side = \"right\",\n floating,\n onBack,\n notDismissable,\n footer,\n className,\n}: SideSheetProps) {\n const showBack = onBack !== undefined\n\n return (\n <Sheet\n open={open}\n onOpenChange={\n notDismissable ? undefined : (isOpen) => !isOpen && onClose()\n }\n >\n <SheetContent\n side={side}\n showCloseButton={false}\n className={cn(\n \"flex w-full flex-col gap-0 overflow-hidden p-0\",\n // Override the base SheetContent's `data-[side]:sm:max-w-sm` cap.\n // tailwind-merge keeps both since they differ by variant, so we match\n // the same variant to win and widen the panel toward the reference.\n \"data-[side=left]:sm:max-w-[570px] data-[side=right]:sm:max-w-[570px]\",\n // Floating: detach from the edge with a margin, round all corners, and\n // cast a shadow. We re-target the base's `data-[side]` positioning so\n // tailwind-merge lets these win.\n floating &&\n cn(\n \"rounded-xl shadow-xl ring-1 ring-foreground/10\",\n \"data-[side=right]:inset-y-3 data-[side=right]:right-3 data-[side=right]:h-auto\",\n \"data-[side=left]:inset-y-3 data-[side=left]:left-3 data-[side=left]:h-auto\"\n ),\n className\n )}\n >\n {/* Pinned header */}\n <SheetHeader className=\"shrink-0 flex-row items-center gap-2 border-b border-border px-4 py-3\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={showBack ? \"Back\" : \"Close\"}\n className=\"-ml-1 shrink-0 text-muted-foreground\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n ;(showBack ? onBack! : onClose)()\n }}\n >\n {showBack ? <ChevronLeftIcon /> : <XIcon />}\n </Button>\n <div className=\"flex min-w-0 flex-col\">\n <SheetTitle className=\"truncate text-left text-lg font-semibold\">\n {title}\n </SheetTitle>\n {description && (\n <SheetDescription className=\"text-left\">\n {description}\n </SheetDescription>\n )}\n </div>\n </SheetHeader>\n\n {/* Scrollable body */}\n <div className=\"min-h-0 flex-1 space-y-4 overflow-y-auto p-4\">\n {children}\n </div>\n\n {/* Sticky footer */}\n {footer && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 border-t border-border px-4 py-4\">\n {footer}\n </div>\n )}\n </SheetContent>\n </Sheet>\n )\n}\n\n// ============================================================================\n// Side Sheet Section\n// ============================================================================\n\nexport interface SideSheetSectionProps extends React.ComponentProps<\"div\"> {\n /** Optional label rendered above the grouped panel, with a divider rule. */\n label?: React.ReactNode\n /** Optional trailing control beside the label (e.g. an expand button). */\n action?: React.ReactNode\n}\n\n/**\n * A labelled, grouped block for the sheet body — a divider-titled `bg-secondary`\n * panel, matching the \"Trigger Settings\" / \"Spray Stages\" grouping pattern.\n * Drop form rows in as children.\n */\nfunction SideSheetSection({\n label,\n action,\n className,\n children,\n ...props\n}: SideSheetSectionProps) {\n return (\n <div data-slot=\"side-sheet-section\" {...props}>\n {label && (\n <div className=\"mb-3 flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n <span className=\"h-px flex-1 bg-border\" />\n {action}\n </div>\n )}\n <div className={cn(\"space-y-4 rounded-lg bg-secondary p-4\", className)}>\n {children}\n </div>\n </div>\n )\n}\n\nexport { SideSheet, SideSheetSection }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Area, AreaChart, ResponsiveContainer } from \"recharts\"\nimport { TrendingDownIcon, TrendingUpIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card, CardContent, CardHeader } from \"@/components/ui/card\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type StatCardColor =\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\"\n\nexport interface StatCardTrend {\n /** Delta text, e.g. \"+20.1%\". */\n value: string\n /** Direction — sets the arrow icon and default color. */\n direction?: \"up\" | \"down\"\n /** Trailing context, e.g. \"from last month\". */\n label?: React.ReactNode\n}\n\nexport interface StatCardProgress {\n /** Completion percentage, 0–100. */\n value: number\n /** Caption under the bar, left-aligned. */\n caption?: React.ReactNode\n /** Caption under the bar, right-aligned (e.g. \"Target: $10,000\"). */\n target?: React.ReactNode\n}\n\nexport interface StatCardRing {\n /** Filled percentage, 0–100. */\n value: number\n /** Label inside the ring (defaults to `value%`). */\n label?: React.ReactNode\n /** Caption beside the ring (e.g. \"of 100 GB\"). */\n caption?: React.ReactNode\n}\n\nexport interface StatCardProps {\n /** Small muted heading. */\n title: React.ReactNode\n /** The headline figure, e.g. \"$45,231\". */\n value: React.ReactNode\n /** Muted supporting line under the value. */\n description?: React.ReactNode\n /** Icon shown in a tinted box at the top-right. */\n icon?: React.ReactNode\n /** Accent color for the icon box, trend, progress bar, and ring. */\n color?: StatCardColor\n /** A colored delta with a trend arrow, shown in place of `description`. */\n trend?: StatCardTrend\n /** A linear progress bar with optional captions, shown under the value. */\n progress?: StatCardProgress\n /** A small filled area chart (series of numbers), shown under the value. */\n sparkline?: number[]\n /** A radial progress ring shown beside the value. */\n ring?: StatCardRing\n className?: string\n}\n\n// ============================================================================\n// Color tokens\n// ============================================================================\n\nconst COLOR: Record<StatCardColor, { text: string; bg: string; soft: string }> =\n {\n primary: { text: \"text-primary\", bg: \"bg-primary\", soft: \"bg-primary/10\" },\n success: { text: \"text-green\", bg: \"bg-green\", soft: \"bg-green/10\" },\n warning: { text: \"text-orange\", bg: \"bg-orange\", soft: \"bg-orange/10\" },\n danger: { text: \"text-red\", bg: \"bg-red\", soft: \"bg-red/10\" },\n muted: {\n text: \"text-muted-foreground\",\n bg: \"bg-muted-foreground\",\n soft: \"bg-muted\",\n },\n }\n\n// ============================================================================\n// Accessories\n// ============================================================================\n\nfunction Sparkline({\n data,\n colorVar,\n}: {\n data: number[]\n colorVar: string\n}) {\n const id = React.useId().replace(/:/g, \"\")\n const series = data.map((y, x) => ({ x, y }))\n return (\n <div className=\"mt-3 h-16 w-full\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={series} margin={{ top: 4, right: 0, bottom: 0, left: 0 }}>\n <defs>\n <linearGradient id={`spark-${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colorVar} stopOpacity={0.25} />\n <stop offset=\"100%\" stopColor={colorVar} stopOpacity={0} />\n </linearGradient>\n </defs>\n <Area\n dataKey=\"y\"\n type=\"natural\"\n stroke={colorVar}\n strokeWidth={2}\n fill={`url(#spark-${id})`}\n fillOpacity={1}\n isAnimationActive={false}\n dot={false}\n />\n </AreaChart>\n </ResponsiveContainer>\n </div>\n )\n}\n\n// ============================================================================\n// Stat Card\n// ============================================================================\n\n/**\n * A dashboard stat card: a muted `title`, a bold `value`, and an optional\n * accessory — a tinted `icon` box, a colored `trend` delta, a linear\n * `progress` bar, a `sparkline` area chart, or a radial `ring`. Tint accessories\n * with `color`.\n */\nexport function StatCard({\n title,\n value,\n description,\n icon,\n color = \"primary\",\n trend,\n progress,\n sparkline,\n ring,\n className,\n}: StatCardProps) {\n const colors = COLOR[color]\n // Resolve the accent to a CSS variable recharts can read.\n const colorVar =\n color === \"muted\" ? \"var(--muted-foreground)\" : `var(--${cssVar(color)})`\n\n return (\n <Card className={cn(\"gap-3\", className)}>\n <CardHeader className=\"flex flex-row items-start justify-between gap-2 pb-0\">\n <span className=\"text-sm font-medium text-muted-foreground\">\n {title}\n </span>\n {icon && (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center rounded-md\",\n colors.soft,\n colors.text,\n \"[&_svg]:size-4\"\n )}\n >\n {icon}\n </span>\n )}\n </CardHeader>\n\n <CardContent>\n {ring ? (\n <div className=\"mt-1 flex items-center gap-4\">\n <RingOnly ring={ring} colors={colors} />\n <div className=\"flex flex-col\">\n <span className=\"text-2xl font-bold tracking-tight tabular-nums\">\n {value}\n </span>\n {ring.caption && (\n <span className=\"text-sm text-muted-foreground\">\n {ring.caption}\n </span>\n )}\n </div>\n </div>\n ) : (\n <span className=\"text-2xl font-bold tracking-tight tabular-nums\">\n {value}\n </span>\n )}\n\n {/* Trend / description line */}\n {trend ? (\n <p className=\"mt-1 flex items-center gap-1 text-sm text-muted-foreground\">\n <span\n className={cn(\n \"flex items-center gap-1 font-medium\",\n trend.direction === \"down\" ? \"text-red\" : \"text-green\"\n )}\n >\n {trend.direction === \"down\" ? (\n <TrendingDownIcon className=\"size-4\" />\n ) : (\n <TrendingUpIcon className=\"size-4\" />\n )}\n {trend.value}\n </span>\n {trend.label}\n </p>\n ) : description && !ring ? (\n <p className=\"mt-1 text-sm text-muted-foreground\">{description}</p>\n ) : null}\n\n {/* Progress */}\n {progress && (\n <div className=\"mt-3 flex flex-col gap-2\">\n <div className=\"h-2 w-full overflow-hidden rounded-full bg-muted\">\n <div\n className={cn(\"h-full rounded-full transition-all\", colors.bg)}\n style={{\n width: `${Math.max(0, Math.min(100, progress.value))}%`,\n }}\n />\n </div>\n {(progress.caption || progress.target) && (\n <div className=\"flex items-center justify-between text-sm text-muted-foreground\">\n <span>{progress.caption}</span>\n <span>{progress.target}</span>\n </div>\n )}\n </div>\n )}\n\n {/* Sparkline */}\n {sparkline && sparkline.length > 1 && (\n <Sparkline data={sparkline} colorVar={colorVar} />\n )}\n </CardContent>\n </Card>\n )\n}\n\n/** Maps a color name to its CSS custom-property name. */\nfunction cssVar(color: StatCardColor): string {\n switch (color) {\n case \"primary\":\n return \"primary\"\n case \"success\":\n return \"green\"\n case \"warning\":\n return \"orange\"\n case \"danger\":\n return \"red\"\n default:\n return \"muted-foreground\"\n }\n}\n\n/** Just the radial ring + centered label (value is rendered by the caller). */\nfunction RingOnly({\n ring,\n colors,\n}: {\n ring: StatCardRing\n colors: (typeof COLOR)[StatCardColor]\n}) {\n const pct = Math.max(0, Math.min(100, ring.value))\n const r = 34\n const c = 2 * Math.PI * r\n return (\n <div className=\"relative size-20 shrink-0\">\n <svg className=\"size-full -rotate-90\" viewBox=\"0 0 80 80\">\n <circle\n cx=\"40\"\n cy=\"40\"\n r={r}\n fill=\"none\"\n strokeWidth={8}\n className=\"stroke-muted\"\n />\n <circle\n cx=\"40\"\n cy=\"40\"\n r={r}\n fill=\"none\"\n strokeWidth={8}\n strokeLinecap=\"round\"\n strokeDasharray={c}\n strokeDashoffset={c - (pct / 100) * c}\n stroke=\"currentColor\"\n className={cn(\"transition-all\", colors.text)}\n />\n </svg>\n <span className=\"absolute inset-0 flex items-center justify-center text-sm font-semibold\">\n {ring.label ?? `${pct}%`}\n </span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type StatusListTone =\n | \"neutral\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n\n/** How the right-side status renders. */\nexport type StatusVariant = \"pill\" | \"outline\" | \"text\"\n\n// ============================================================================\n// Tone tokens\n// ============================================================================\n\nconst TONE = {\n neutral: {\n text: \"text-muted-foreground\",\n pill: \"border-transparent bg-muted text-muted-foreground\",\n outline: \"border-border text-foreground\",\n softBox: \"bg-muted text-muted-foreground\",\n activeBg: \"bg-muted/50 ring-border\",\n avatar: \"bg-muted text-foreground\",\n },\n primary: {\n text: \"text-primary\",\n pill: \"border-transparent bg-primary/10 text-primary\",\n outline: \"border-primary/30 text-primary\",\n softBox: \"bg-primary/10 text-primary\",\n activeBg: \"bg-primary/5 ring-primary/30\",\n avatar: \"bg-primary/15 text-primary\",\n },\n success: {\n text: \"text-green\",\n pill: \"border-transparent bg-green/10 text-green\",\n outline: \"border-green/30 text-green\",\n softBox: \"bg-green/10 text-green\",\n activeBg: \"bg-green/5 ring-green/30\",\n avatar: \"bg-green/15 text-green\",\n },\n warning: {\n text: \"text-orange\",\n pill: \"border-transparent bg-orange/10 text-orange\",\n outline: \"border-orange/30 text-orange\",\n softBox: \"bg-orange/10 text-orange\",\n activeBg: \"bg-orange/5 ring-orange/30\",\n avatar: \"bg-orange/15 text-orange\",\n },\n danger: {\n text: \"text-red\",\n pill: \"border-transparent bg-red/10 text-red\",\n outline: \"border-red/30 text-red\",\n softBox: \"bg-red/10 text-red\",\n activeBg: \"bg-red/5 ring-red/30\",\n avatar: \"bg-red/15 text-red\",\n },\n} satisfies Record<StatusListTone, Record<string, string>>\n\n// ============================================================================\n// Leading-visual helpers\n// ============================================================================\n\n/** A soft, tone-tinted rounded-square icon box (the gateway-row style). */\nexport function StatusIcon({\n tone = \"neutral\",\n className,\n children,\n}: {\n tone?: StatusListTone\n className?: string\n children: React.ReactNode\n}) {\n return (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-5\",\n TONE[tone].softBox,\n className\n )}\n >\n {children}\n </span>\n )\n}\n\n/** A circular avatar — an image, or tone-tinted initials fallback. */\nexport function StatusAvatar({\n src,\n name,\n tone = \"primary\",\n className,\n}: {\n src?: string\n name: string\n tone?: StatusListTone\n className?: string\n}) {\n const initials = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((p) => p[0]?.toUpperCase() ?? \"\")\n .join(\"\")\n return (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full text-xs font-semibold\",\n TONE[tone].avatar,\n className\n )}\n >\n {src ? (\n <img src={src} alt={name} className=\"size-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n )\n}\n\n// ============================================================================\n// Status List\n// ============================================================================\n\nexport function StatusList({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"status-list\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n )\n}\n\n/** An uppercase group header with an optional count, e.g. \"WORKERS (2)\". */\nexport function StatusListGroup({\n label,\n count,\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n label: React.ReactNode\n count?: number\n}) {\n return (\n <div data-slot=\"status-list-group\" className={className} {...props}>\n <p className=\"mb-2 px-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {label}\n {count != null && (\n <span className=\"ml-1 text-muted-foreground/70\">({count})</span>\n )}\n </p>\n <div className=\"flex flex-col gap-2\">{children}</div>\n </div>\n )\n}\n\nexport interface StatusListItemProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Leading visual — pass a `StatusIcon`, `StatusAvatar`, or any node. */\n media?: React.ReactNode\n /** Primary label. */\n title: React.ReactNode\n /** Muted secondary line. */\n description?: React.ReactNode\n /** Status text shown on the right. */\n status?: React.ReactNode\n /** How the status renders: filled pill, outline pill, or plain text. */\n statusVariant?: StatusVariant\n /** Extra muted text before the status (e.g. \"3 min open\"). */\n hint?: React.ReactNode\n /** Tone — tints the status, hint, and (when `active`) the row background. */\n tone?: StatusListTone\n /** Highlight the row with a soft tinted background + ring. */\n active?: boolean\n}\n\n/**\n * A single status row: a leading visual (`media`), a title + description, and a\n * right-side status (`pill`, `outline`, or `text`). Set `active` to highlight\n * the row, and `tone` to color the status/hint/highlight.\n */\nexport function StatusListItem({\n media,\n title,\n description,\n status,\n statusVariant = \"pill\",\n hint,\n tone = \"neutral\",\n active = false,\n className,\n ...props\n}: StatusListItemProps) {\n const t = TONE[tone]\n\n return (\n <div\n data-slot=\"status-list-item\"\n className={cn(\n \"flex items-center gap-3 rounded-lg border p-3\",\n active ? cn(\"border-transparent ring-1\", t.activeBg) : \"bg-card\",\n className\n )}\n {...props}\n >\n {media}\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium\">{title}</p>\n {description != null && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {hint != null && (\n <span className={cn(\"text-xs font-medium\", t.text)}>{hint}</span>\n )}\n {status != null &&\n (statusVariant === \"text\" ? (\n <span className={cn(\"text-sm font-medium\", t.text)}>{status}</span>\n ) : (\n <Badge\n variant=\"outline\"\n className={cn(\n \"font-medium\",\n statusVariant === \"outline\" ? t.outline : t.pill\n )}\n >\n {status}\n </Badge>\n ))}\n </div>\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Select as SelectPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { ChevronDownIcon, CheckIcon, ChevronUpIcon } from \"lucide-react\"\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn(\"scroll-my-1 p-1\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = \"default\",\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: \"sm\" | \"default\"\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n \"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-sm *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n position = \"item-aligned\",\n align = \"center\",\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n data-align-trigger={position === \"item-aligned\"}\n className={cn(\"relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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\", position ===\"popper\"&&\"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\", className )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n data-position={position}\n className={cn(\n \"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)\",\n position === \"popper\" && \"\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn(\"px-1.5 py-1 text-xs text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"pointer-events-none\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\"pointer-events-none -mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n \"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <ChevronUpIcon\n />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n \"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <ChevronDownIcon\n />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type Locale,\n} from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button, buttonVariants } from \"@/components/ui/button\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\"\nimport { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from \"lucide-react\"\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"]\n}) {\n const defaultClassNames = getDefaultClassNames()\n\n return (\n <DayPicker\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) =>\n date.toLocaleString(locale?.code, { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n // The nav overlays the caption row; make it click-through so the\n // dropdowns underneath stay interactive (only the arrows are clickable).\n nav: cn(\n \"pointer-events-none absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"pointer-events-auto 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 \"pointer-events-auto 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 // The native-select overlay styles (absolute/opacity-0) are dropped — we\n // render our own Select via the Dropdown component override.\n dropdown_root: \"relative\",\n dropdown: \"\",\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n table: \"w-full border-collapse\",\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(\n \"w-(--cell-size) select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\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-r-(--cell-radius)\",\n props.showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-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-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-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(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\n \"text-muted-foreground opacity-50\",\n defaultClassNames.disabled\n ),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n )\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n if (orientation === \"right\") {\n return (\n <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n return (\n <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n )\n },\n // Replace react-day-picker's native <select> month/year dropdowns with\n // our themed Select.\n Dropdown: ({ value, onChange, options = [], \"aria-label\": ariaLabel }) => {\n const selected = options.find((o) => o.value === Number(value))\n return (\n <Select\n value={value != null ? String(value) : undefined}\n onValueChange={(v) => {\n // RDP's onChange expects a change-like event with target.value.\n onChange?.({\n target: { value: v },\n } as React.ChangeEvent<HTMLSelectElement>)\n }}\n >\n <SelectTrigger\n size=\"sm\"\n aria-label={ariaLabel}\n className=\"h-7 gap-1 border-none px-2 font-medium shadow-none focus-visible:ring-0 [&_svg]:opacity-60\"\n >\n <SelectValue>{selected?.label}</SelectValue>\n </SelectTrigger>\n <SelectContent className=\"max-h-60\">\n {options.map((o) => (\n <SelectItem\n key={o.value}\n value={String(o.value)}\n disabled={o.disabled}\n >\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n },\n DayButton: ({ ...props }) => (\n <CalendarDayButton locale={locale} {...props} />\n ),\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n {children}\n </div>\n </td>\n )\n },\n ...components,\n }}\n {...props}\n />\n )\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames()\n\n const ref = React.useRef<HTMLButtonElement>(null)\n React.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={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\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-r-(--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-l-(--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\nexport { Calendar, CalendarDayButton }\n","// Pure helpers for DateTimeRangePicker — kept separate from the component file\n// so it can fast-refresh cleanly (a component module should only export\n// components).\n\nexport type TimePreset = \"hour\" | \"day\" | \"week\" | \"month\"\n\nexport interface TimeRange {\n preset: TimePreset | null\n /** ISO datetime: YYYY-MM-DDTHH:mm:ssZ */\n from: string\n /** ISO datetime: YYYY-MM-DDTHH:mm:ssZ */\n to: string\n}\n\nexport function toISOWithTime(date: Date): string {\n const y = date.getUTCFullYear()\n const mo = String(date.getUTCMonth() + 1).padStart(2, \"0\")\n const d = String(date.getUTCDate()).padStart(2, \"0\")\n const h = String(date.getUTCHours()).padStart(2, \"0\")\n const m = String(date.getUTCMinutes()).padStart(2, \"0\")\n const s = String(date.getUTCSeconds()).padStart(2, \"0\")\n return `${y}-${mo}-${d}T${h}:${m}:${s}Z`\n}\n\n/** Parse an ISO string into timezone-local parts. */\nexport function isoToTzParts(iso: string, timezone: string) {\n if (!iso) return null\n const date = new Date(iso)\n if (isNaN(date.getTime())) return null\n\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZone: timezone,\n }).formatToParts(date)\n\n const get = (type: string) =>\n parts.find((p) => p.type === type)?.value || \"0\"\n return {\n year: parseInt(get(\"year\"), 10),\n month: parseInt(get(\"month\"), 10) - 1, // 0-indexed\n day: parseInt(get(\"day\"), 10),\n h: get(\"hour\").padStart(2, \"0\"),\n m: get(\"minute\").padStart(2, \"0\"),\n s: get(\"second\").padStart(2, \"0\"),\n }\n}\n\n/** Build a UTC ISO string from timezone-local date/time parts. */\nexport function buildISOFromTz(\n year: number,\n month: number,\n day: number,\n h: string,\n m: string,\n s: string,\n timezone: string,\n): string {\n const localMs = Date.UTC(\n year,\n month,\n day,\n parseInt(h),\n parseInt(m),\n parseInt(s),\n )\n const utcDate = new Date(localMs)\n\n const tzParts = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZone: timezone,\n }).formatToParts(utcDate)\n\n const get = (type: string) =>\n parseInt(tzParts.find((p) => p.type === type)?.value || \"0\", 10)\n const tzMs = Date.UTC(\n get(\"year\"),\n get(\"month\") - 1,\n get(\"day\"),\n get(\"hour\"),\n get(\"minute\"),\n get(\"second\"),\n )\n\n const offsetMs = tzMs - localMs\n return toISOWithTime(new Date(localMs - offsetMs))\n}\n\nexport const DEFAULT_PRESETS: { value: TimePreset; label: string }[] = [\n { value: \"hour\", label: \"Hour\" },\n { value: \"day\", label: \"Day\" },\n { value: \"week\", label: \"Week\" },\n { value: \"month\", label: \"Month\" },\n]\n\n/** Convert a relative preset to a concrete { from, to } ISO range ending now. */\nexport function presetToRange(preset: TimePreset): {\n from: string\n to: string\n} {\n const now = new Date()\n const to = toISOWithTime(now)\n const d = new Date(now)\n switch (preset) {\n case \"hour\":\n d.setUTCHours(d.getUTCHours() - 1)\n break\n case \"day\":\n d.setUTCHours(d.getUTCHours() - 24)\n break\n case \"week\":\n d.setUTCDate(d.getUTCDate() - 7)\n break\n case \"month\":\n d.setUTCDate(d.getUTCDate() - 30)\n break\n }\n return { from: toISOWithTime(d), to }\n}\n\n/** Shift a range backward/forward by its own duration. */\nexport function navigateRange(\n range: TimeRange,\n direction: \"prev\" | \"next\",\n): TimeRange {\n const fromMs = new Date(range.from).getTime()\n const toMs = new Date(range.to).getTime()\n const durationMs = toMs - fromMs\n const shift = direction === \"prev\" ? -durationMs : durationMs\n return {\n preset: range.preset,\n from: toISOWithTime(new Date(fromMs + shift)),\n to: toISOWithTime(new Date(toMs + shift)),\n }\n}\n\nexport function formatDisplayRange(\n range: TimeRange,\n timezone?: string,\n): string {\n if (range.preset) {\n return (\n DEFAULT_PRESETS.find((p) => p.value === range.preset)?.label ??\n range.preset\n )\n }\n if (range.from && range.to) {\n const fmt = (iso: string) =>\n new Date(iso).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n timeZone: timezone || \"UTC\",\n })\n return `${fmt(range.from)} – ${fmt(range.to)}`\n }\n return \"Select range\"\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Calendar as CalendarIcon, Clock } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Calendar } from \"@/components/ui/calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { buildISOFromTz, isoToTzParts } from \"./date-time-range-picker-utils\"\n\n// ============================================================================\n// TimeInput — a single padded H/M/S number field with arrow stepping\n// ============================================================================\n\nfunction TimeInput({\n value,\n max,\n onChange,\n}: {\n value: string\n max: number\n onChange: (v: string) => void\n}) {\n const [local, setLocal] = React.useState(value)\n\n React.useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setLocal(value)\n }, [value])\n\n const commit = (raw: string) => {\n const n = Math.min(Math.max(0, parseInt(raw || \"0\", 10)), max)\n const padded = isNaN(n) ? \"00\" : String(n).padStart(2, \"0\")\n setLocal(padded)\n onChange(padded)\n }\n\n const step = (delta: number) => {\n const n = Math.min(Math.max(parseInt(local || \"0\", 10) + delta, 0), max)\n const padded = String(n).padStart(2, \"0\")\n setLocal(padded)\n onChange(padded)\n }\n\n return (\n <input\n type=\"number\"\n min={0}\n max={max}\n value={local}\n onChange={(e) => setLocal(e.target.value)}\n onBlur={(e) => commit(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") commit((e.target as HTMLInputElement).value)\n if (e.key === \"ArrowUp\") {\n e.preventDefault()\n step(1)\n }\n if (e.key === \"ArrowDown\") {\n e.preventDefault()\n step(-1)\n }\n }}\n className={cn(\n \"h-8 w-12 rounded-md border border-input bg-transparent text-center text-sm font-medium dark:bg-input/30\",\n \"focus:border-ring focus:ring-3 focus:ring-ring/50 focus:outline-none\",\n \"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\",\n )}\n />\n )\n}\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DateTimePickerProps {\n /** Selected value as an ISO 8601 string (empty for none). Controlled. */\n value: string\n /** Called with the new ISO string when the date or time changes. */\n onChange: (iso: string) => void\n /** Optional label rendered above the trigger. */\n label?: React.ReactNode\n /** Trigger text when no value is selected. */\n placeholder?: string\n /** Hide the time row to pick a date only. */\n showTime?: boolean\n /** IANA timezone for display + emitted ISO. Defaults to `UTC`. */\n timezone?: string\n /** Disable days before this date (ISO/date string). */\n minDate?: string\n /** Disable days after this date (ISO/date string). */\n maxDate?: string\n /**\n * Caption style: `dropdown` (default) shows month + year dropdowns for quick\n * year jumps; `label` shows the month name with prev/next arrows only.\n */\n captionLayout?: \"dropdown\" | \"dropdown-months\" | \"dropdown-years\" | \"label\"\n /**\n * Selectable year span for the dropdown, `[from, to]`. Defaults to 100 years\n * back and 5 years ahead of the current year (clamped by min/maxDate).\n */\n yearRange?: [number, number]\n /** Disable the field. */\n disabled?: boolean\n /** Class for the wrapper. */\n className?: string\n}\n\n// ============================================================================\n// DateTimePicker — a single date (+ optional time) selector\n// ============================================================================\n\n/**\n * A single date-and-time selector: a trigger that opens a calendar with an\n * H:M:S time row in a popover. Controlled via `value` (ISO string) /`onChange`.\n * Set `showTime={false}` for date-only. This is the same field the\n * `DateTimeRangePicker` uses for its custom from/to inputs.\n */\nexport function DateTimePicker({\n value,\n onChange,\n label,\n placeholder = \"Select date & time\",\n showTime = true,\n timezone,\n minDate,\n maxDate,\n captionLayout = \"dropdown\",\n yearRange,\n disabled,\n className,\n}: DateTimePickerProps) {\n const [open, setOpen] = React.useState(false)\n const tz = timezone || \"UTC\"\n const parsed = isoToTzParts(value, tz)\n\n const [timeH, setTimeH] = React.useState(parsed?.h ?? \"00\")\n const [timeM, setTimeM] = React.useState(parsed?.m ?? \"00\")\n const [timeS, setTimeS] = React.useState(parsed?.s ?? \"00\")\n\n // Sync time inputs when the external value changes (intentional prop->state).\n React.useEffect(() => {\n const p = isoToTzParts(value, tz)\n /* eslint-disable react-hooks/set-state-in-effect */\n setTimeH(p?.h ?? \"00\")\n setTimeM(p?.m ?? \"00\")\n setTimeS(p?.s ?? \"00\")\n /* eslint-enable react-hooks/set-state-in-effect */\n }, [value, tz])\n\n const selectedDate = parsed\n ? new Date(parsed.year, parsed.month, parsed.day)\n : undefined\n\n const emit = (\n year: number,\n month: number,\n day: number,\n h: string,\n m: string,\n s: string,\n ) => onChange(buildISOFromTz(year, month, day, h, m, s, tz))\n\n const handleSelectDate = (date: Date | undefined) => {\n if (!date) return\n emit(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n showTime ? timeH : \"00\",\n showTime ? timeM : \"00\",\n showTime ? timeS : \"00\",\n )\n if (!showTime) setOpen(false)\n }\n\n const handleTime = (which: \"h\" | \"m\" | \"s\", v: string) => {\n const h = which === \"h\" ? v : timeH\n const m = which === \"m\" ? v : timeM\n const s = which === \"s\" ? v : timeS\n if (which === \"h\") setTimeH(v)\n if (which === \"m\") setTimeM(v)\n if (which === \"s\") setTimeS(v)\n if (parsed) emit(parsed.year, parsed.month, parsed.day, h, m, s)\n }\n\n const disabledMatcher = (date: Date) => {\n if (minDate) {\n const min = new Date(minDate)\n min.setHours(0, 0, 0, 0)\n if (date < min) return true\n }\n if (maxDate) {\n const max = new Date(maxDate)\n max.setHours(23, 59, 59, 999)\n if (date > max) return true\n }\n return false\n }\n\n // Bound the year dropdown. Default to 100 years back / 5 ahead, then clamp to\n // any min/maxDate so the dropdown only offers selectable years.\n const thisYear = new Date().getFullYear()\n const [fromYear, toYear] = yearRange ?? [thisYear - 100, thisYear + 5]\n const startYear = minDate\n ? Math.max(fromYear, new Date(minDate).getFullYear())\n : fromYear\n const endYear = maxDate\n ? Math.min(toYear, new Date(maxDate).getFullYear())\n : toYear\n const startMonth = new Date(startYear, 0, 1)\n const endMonth = new Date(endYear, 11, 31)\n\n const displayValue = parsed\n ? new Date(value).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n ...(showTime\n ? {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n }\n : {}),\n timeZone: tz,\n })\n : placeholder\n\n return (\n <div className={cn(\"flex flex-col gap-1\", className)}>\n {label != null && (\n <label className=\"px-0.5 text-xs text-muted-foreground\">{label}</label>\n )}\n <Popover open={open} onOpenChange={setOpen} modal={false}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"flex h-8 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-1 text-sm transition-colors outline-none dark:bg-input/30\",\n // Hover/focus like a standard Input: no background fill, just the\n // focus ring.\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n open && \"border-ring ring-3 ring-ring/50\",\n !parsed && \"text-muted-foreground\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n <span className=\"truncate\">{displayValue}</span>\n <CalendarIcon className=\"size-3.5 shrink-0 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\" sideOffset={4}>\n <Calendar\n mode=\"single\"\n selected={selectedDate}\n onSelect={handleSelectDate}\n disabled={disabledMatcher}\n defaultMonth={selectedDate}\n captionLayout={captionLayout}\n startMonth={startMonth}\n endMonth={endMonth}\n autoFocus\n />\n {showTime && (\n <div className=\"flex items-center gap-2 border-t px-3 py-2.5\">\n <Clock className=\"size-4 shrink-0 text-muted-foreground\" />\n <TimeInput value={timeH} max={23} onChange={(v) => handleTime(\"h\", v)} />\n <span className=\"text-sm font-medium text-muted-foreground\">:</span>\n <TimeInput value={timeM} max={59} onChange={(v) => handleTime(\"m\", v)} />\n <span className=\"text-sm font-medium text-muted-foreground\">:</span>\n <TimeInput value={timeS} max={59} onChange={(v) => handleTime(\"s\", v)} />\n </div>\n )}\n </PopoverContent>\n </Popover>\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Calendar as CalendarIcon, ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { DateTimePicker } from \"./date-time-picker\"\nimport {\n DEFAULT_PRESETS,\n formatDisplayRange,\n presetToRange,\n type TimePreset,\n type TimeRange,\n} from \"./date-time-range-picker-utils\"\n\n// Re-export the public types (type-only keeps this a component-only module;\n// the value helpers presetToRange/navigateRange are exported from the barrel).\nexport type {\n TimePreset,\n TimeRange,\n} from \"./date-time-range-picker-utils\"\n\nexport interface DateTimeRangePickerProps {\n value: TimeRange\n onChange: (range: TimeRange) => void\n className?: string\n timezone?: string\n presets?: { value: TimePreset; label: string }[]\n maxRangeDays?: number\n}\n\n// ============================================================================\n// DateTimeRangePicker\n// ============================================================================\n\nexport const DateTimeRangePicker = React.forwardRef<\n HTMLButtonElement,\n DateTimeRangePickerProps\n>(function DateTimeRangePicker(\n { value, onChange, className, timezone, presets: customPresets, maxRangeDays },\n ref,\n) {\n const activePresets = customPresets ?? DEFAULT_PRESETS\n const [open, setOpen] = React.useState(false)\n const [customFrom, setCustomFrom] = React.useState(value.from)\n const [customTo, setCustomTo] = React.useState(value.to)\n\n React.useEffect(() => {\n /* eslint-disable react-hooks/set-state-in-effect */\n setCustomFrom(value.from)\n setCustomTo(value.to)\n /* eslint-enable react-hooks/set-state-in-effect */\n }, [value])\n\n const handleCustomFromChange = (iso: string) => {\n setCustomFrom(iso)\n if (maxRangeDays && iso) {\n const maxTo = new Date(\n new Date(iso).getTime() + maxRangeDays * 86_400_000,\n )\n if (new Date(customTo) > maxTo) setCustomTo(maxTo.toISOString())\n }\n }\n\n const handlePreset = (preset: TimePreset) => {\n onChange({ preset, ...presetToRange(preset) })\n setOpen(false)\n }\n\n const handleCustomApply = () => {\n if (!customFrom || !customTo) return\n const from = customFrom <= customTo ? customFrom : customTo\n const to = customFrom <= customTo ? customTo : customFrom\n onChange({ preset: null, from, to })\n setOpen(false)\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"flex h-9 items-center justify-between gap-1.5 rounded-md border border-input bg-transparent px-3 py-1 text-sm transition-colors outline-none dark:bg-input/30\",\n // Hover/focus like a standard Input: no background fill, just the ring.\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n open && \"border-ring ring-3 ring-ring/50\",\n className,\n )}\n >\n <CalendarIcon className=\"size-3.5 shrink-0 opacity-60\" />\n <span className=\"truncate\">{formatDisplayRange(value, timezone)}</span>\n <ChevronDown\n className={cn(\n \"size-3.5 shrink-0 opacity-60 transition-transform\",\n open && \"rotate-180\",\n )}\n />\n </button>\n </PopoverTrigger>\n\n <PopoverContent align=\"end\" sideOffset={4} className=\"w-auto p-0\">\n <div className=\"flex min-w-60 flex-col\">\n {/* Presets */}\n <div className=\"border-b p-2\">\n <p className=\"mb-2 px-0.5 text-sm text-muted-foreground\">Presets</p>\n <div\n className=\"grid gap-1\"\n style={{\n gridTemplateColumns: `repeat(${activePresets.length}, minmax(0, 1fr))`,\n }}\n >\n {activePresets.map((preset) => (\n <button\n key={preset.value}\n type=\"button\"\n onClick={() => handlePreset(preset.value)}\n className={cn(\n \"rounded-md px-2 py-1.5 text-center text-xs font-medium transition-colors\",\n value.preset === preset.value\n ? \"bg-primary text-primary-foreground\"\n : \"bg-accent/50 text-foreground hover:bg-accent\",\n )}\n >\n {preset.label}\n </button>\n ))}\n </div>\n </div>\n\n {/* Custom range */}\n <div className=\"flex flex-col gap-3 p-2\">\n <p className=\"px-0.5 text-sm text-muted-foreground\">Custom range</p>\n <DateTimePicker\n value={customFrom}\n onChange={handleCustomFromChange}\n label=\"From\"\n placeholder=\"Start date & time\"\n timezone={timezone}\n maxDate={new Date().toISOString()}\n />\n <DateTimePicker\n value={customTo}\n onChange={setCustomTo}\n label=\"To\"\n placeholder=\"End date & time\"\n timezone={timezone}\n minDate={customFrom || undefined}\n maxDate={(() => {\n const now = new Date().toISOString()\n if (maxRangeDays && customFrom) {\n const fromPlusMax = new Date(\n new Date(customFrom).getTime() + maxRangeDays * 86_400_000,\n ).toISOString()\n return fromPlusMax < now ? fromPlusMax : now\n }\n return now\n })()}\n />\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"w-full\"\n disabled={!customFrom || !customTo}\n onClick={handleCustomApply}\n >\n Apply\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n})\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n \"group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 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 {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n destructive:\n \"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof alertVariants>) {\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<\"div\">) {\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 {...props}\n />\n )\n}\n\nfunction AlertDescription({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-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 [&_p:not(:last-child)]:mb-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-action\"\n className={cn(\"absolute top-2 right-2\", className)}\n {...props}\n />\n )\n}\n\nexport { Alert, AlertTitle, AlertDescription, AlertAction }\n","import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nconst buttonGroupVariants = cva(\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-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-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 },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean\n}) {\n const Comp = asChild ? Slot.Root : \"div\"\n\n return (\n <Comp\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\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n","import * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\nimport type { TooltipValueType } from \"recharts\"\n\nimport { cn } from \"@/lib/utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const\ntype TooltipNameType = number | string\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n>\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error(\"useChart must be used within a <ChartContainer />\")\n }\n\n return context\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<\"div\"> & {\n config: ChartConfig\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >[\"children\"]\n initialDimension?: {\n width: number\n height: number\n }\n}) {\n const uniqueId = React.useId()\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer\n initialDimension={initialDimension}\n >\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme ?? config.color\n )\n\n if (!colorConfig.length) {\n return null\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join(\"\\n\")}\n}\n`\n )\n .join(\"\\n\"),\n }}\n />\n )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = \"dot\",\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<\"div\"> & {\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n nameKey?: string\n labelKey?: string\n } & Omit<\n RechartsPrimitive.DefaultTooltipContentProps<\n TooltipValueType,\n TooltipNameType\n >,\n \"accessibilityLayer\"\n >) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === \"string\"\n ? (config[label]?.label ?? label)\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn(\"font-medium\", labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n <div\n className={cn(\n \"grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl\",\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color ?? item.payload?.fill ?? item.color\n\n return (\n <div\n key={index}\n className={cn(\n \"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n \"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)\",\n {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"w-1\": indicator === \"line\",\n \"w-0 border-[1.5px] border-dashed bg-transparent\":\n indicator === \"dashed\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n }\n )}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n \"flex flex-1 justify-between leading-none\",\n nestLabel ? \"items-end\" : \"items-center\"\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">\n {itemConfig?.label ?? item.name}\n </span>\n </div>\n {item.value != null && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {typeof item.value === \"number\"\n ? item.value.toLocaleString()\n : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = \"bottom\",\n nameKey,\n}: React.ComponentProps<\"div\"> & {\n hideIcon?: boolean\n nameKey?: string\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n \"flex items-center justify-center gap-4\",\n verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n className\n )}\n >\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={index}\n className={cn(\n \"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground\"\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== \"object\" || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n \"payload\" in payload &&\n typeof payload.payload === \"object\" &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === \"string\"\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key]\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { HoverCard as HoverCardPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction HoverCard({\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {\n return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />\n}\n\nfunction HoverCardTrigger({\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {\n return (\n <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />\n )\n}\n\nfunction HoverCardContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n <HoverCardPrimitive.Content\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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 </HoverCardPrimitive.Portal>\n )\n}\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nfunction ItemGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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 )\n}\n\nfunction ItemSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"item-separator\"\n orientation=\"horizontal\"\n className={cn(\"my-2\", className)}\n {...props}\n />\n )\n}\n\nconst itemVariants = cva(\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 {\n variants: {\n variant: {\n default: \"border-transparent\",\n outline: \"border-border\",\n muted: \"border-transparent bg-muted/50\",\n },\n size: {\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 },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Item({\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof itemVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : \"div\"\n return (\n <Comp\n data-slot=\"item\"\n data-variant={variant}\n data-size={size}\n className={cn(itemVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nconst itemMediaVariants = cva(\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 {\n variants: {\n variant: {\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 },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction ItemMedia({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof itemMediaVariants>) {\n return (\n <div\n data-slot=\"item-media\"\n data-variant={variant}\n className={cn(itemMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction ItemContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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\nfunction ItemTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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\nfunction ItemDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"item-description\"\n className={cn(\n \"line-clamp-2 text-left 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\nfunction ItemActions({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-actions\"\n className={cn(\"flex items-center gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction ItemHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-header\"\n className={cn(\n \"flex basis-full items-center justify-between gap-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ItemFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-footer\"\n className={cn(\n \"flex basis-full items-center justify-between gap-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Item,\n ItemMedia,\n ItemContent,\n ItemActions,\n ItemGroup,\n ItemSeparator,\n ItemTitle,\n ItemDescription,\n ItemHeader,\n ItemFooter,\n}\n","\"use client\";\n\nimport MapLibreGL, { type PopupOptions, type MarkerOptions } from \"maplibre-gl\";\n// MapLibre's stylesheet is bundled via src/styles.css (not imported here) so the\n// published JS bundle stays a pure ESM module with no CSS side-effect imports —\n// a bare CSS import inside node_modules ESM breaks consumers' Vite/esbuild\n// dependency pre-bundling. Consumers already import florixui/dist/styles.css once.\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n X,\n Minus,\n Plus,\n Locate,\n Maximize,\n Loader2,\n Layers,\n Check,\n} from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst defaultStyles = {\n dark: \"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json\",\n light: \"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json\",\n};\n\n/** Selectable basemap tiles. The first is the default; the second is Voyager. */\nexport type MapTile = { label: string; url: string };\nconst defaultTiles: MapTile[] = [\n { label: \"Light\", url: \"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json\" },\n { label: \"Voyager\", url: \"https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json\" },\n { label: \"Dark\", url: \"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json\" },\n];\n\n// Maps default to the light basemap. A theme can still be forced per-map via\n// the `theme` prop; they do not auto-follow the app's light/dark mode.\ntype Theme = \"light\" | \"dark\";\n\ntype MapContextValue = {\n map: MapLibreGL.Map | null;\n isLoaded: boolean;\n};\n\nconst MapContext = createContext<MapContextValue | null>(null);\n\nfunction useMap() {\n const context = useContext(MapContext);\n if (!context) {\n throw new Error(\"useMap must be used within a Map component\");\n }\n return context;\n}\n\n/** Map viewport state */\ntype MapViewport = {\n /** Center coordinates [longitude, latitude] */\n center: [number, number];\n /** Zoom level */\n zoom: number;\n /** Bearing (rotation) in degrees */\n bearing: number;\n /** Pitch (tilt) in degrees */\n pitch: number;\n};\n\ntype MapStyleOption = string | MapLibreGL.StyleSpecification;\n\ntype MapRef = MapLibreGL.Map;\n\ntype MapProps = {\n children?: ReactNode;\n /** Additional CSS classes for the map container */\n className?: string;\n /**\n * Theme for the map. If not provided, automatically detects system preference.\n * Pass your theme value here.\n */\n theme?: Theme;\n /** Custom map styles for light and dark themes. Overrides the default Carto styles. */\n styles?: {\n light?: MapStyleOption;\n dark?: MapStyleOption;\n };\n /** Map projection type. Use `{ type: \"globe\" }` for 3D globe view. */\n projection?: MapLibreGL.ProjectionSpecification;\n /**\n * Controlled viewport. When provided with onViewportChange,\n * the map becomes controlled and viewport is driven by this prop.\n */\n viewport?: Partial<MapViewport>;\n /**\n * Callback fired continuously as the viewport changes (pan, zoom, rotate, pitch).\n * Can be used standalone to observe changes, or with `viewport` prop\n * to enable controlled mode where the map viewport is driven by your state.\n */\n onViewportChange?: (viewport: MapViewport) => void;\n /** Show a loading indicator on the map */\n loading?: boolean;\n /**\n * Render default zoom controls (bottom-right). Defaults to true.\n * Set to false to omit them or to supply your own <MapControls />.\n */\n controls?: boolean;\n /**\n * Selectable basemap tiles, shown as a picker (top-left). Defaults to\n * Light / Voyager / Dark. Set to false to hide the tile picker.\n */\n tiles?: MapTile[] | false;\n} & Omit<MapLibreGL.MapOptions, \"container\" | \"style\">;\n\nfunction DefaultLoader() {\n return (\n <div className=\"bg-background/50 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-xs\">\n <div className=\"flex gap-1\">\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full\" />\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full [animation-delay:150ms]\" />\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full [animation-delay:300ms]\" />\n </div>\n </div>\n );\n}\n\nfunction getViewport(map: MapLibreGL.Map): MapViewport {\n const center = map.getCenter();\n return {\n center: [center.lng, center.lat],\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n };\n}\n\nconst Map = forwardRef<MapRef, MapProps>(function Map(\n {\n children,\n className,\n theme: themeProp,\n styles,\n projection,\n viewport,\n onViewportChange,\n loading = false,\n controls = true,\n tiles = defaultTiles,\n ...props\n },\n ref,\n) {\n const tileList = tiles === false ? [] : tiles;\n const containerRef = useRef<HTMLDivElement>(null);\n const [mapInstance, setMapInstance] = useState<MapLibreGL.Map | null>(null);\n const [isLoaded, setIsLoaded] = useState(false);\n const [isStyleLoaded, setIsStyleLoaded] = useState(false);\n // Index of the selected basemap tile (when the tile picker is enabled).\n const [tileIndex, setTileIndex] = useState(0);\n const currentStyleRef = useRef<MapStyleOption | null>(null);\n const styleTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const internalUpdateRef = useRef(false);\n const isControlled = viewport !== undefined && onViewportChange !== undefined;\n\n const onViewportChangeRef = useRef(onViewportChange);\n onViewportChangeRef.current = onViewportChange;\n\n const mapStyles = useMemo(\n () => ({\n dark: styles?.dark ?? defaultStyles.dark,\n light: styles?.light ?? defaultStyles.light,\n }),\n [styles],\n );\n\n // Expose the map instance to the parent component\n useImperativeHandle(ref, () => mapInstance as MapLibreGL.Map, [mapInstance]);\n\n const clearStyleTimeout = useCallback(() => {\n if (styleTimeoutRef.current) {\n clearTimeout(styleTimeoutRef.current);\n styleTimeoutRef.current = null;\n }\n }, []);\n\n // Initialize the map\n useEffect(() => {\n if (!containerRef.current) return;\n\n // Use the selected tile if a picker is enabled, else the light basemap.\n const initialStyle = tileList[0]?.url ?? mapStyles.light;\n currentStyleRef.current = initialStyle;\n\n const map = new MapLibreGL.Map({\n container: containerRef.current,\n style: initialStyle,\n renderWorldCopies: false,\n attributionControl: false,\n ...props,\n ...viewport,\n });\n\n const styleDataHandler = () => {\n clearStyleTimeout();\n // Delay to ensure style is fully processed before allowing layer operations\n // This is a workaround to avoid race conditions with the style loading\n // else we have to force update every layer on setStyle change\n styleTimeoutRef.current = setTimeout(() => {\n setIsStyleLoaded(true);\n if (projection) {\n map.setProjection(projection);\n }\n }, 100);\n };\n const loadHandler = () => setIsLoaded(true);\n\n // Viewport change handler - skip if triggered by internal update\n const handleMove = () => {\n if (internalUpdateRef.current) return;\n onViewportChangeRef.current?.(getViewport(map));\n };\n\n map.on(\"load\", loadHandler);\n map.on(\"styledata\", styleDataHandler);\n map.on(\"move\", handleMove);\n setMapInstance(map);\n\n return () => {\n clearStyleTimeout();\n map.off(\"load\", loadHandler);\n map.off(\"styledata\", styleDataHandler);\n map.off(\"move\", handleMove);\n map.remove();\n setIsLoaded(false);\n setIsStyleLoaded(false);\n setMapInstance(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Sync controlled viewport to map\n useEffect(() => {\n if (!mapInstance || !isControlled || !viewport) return;\n if (mapInstance.isMoving()) return;\n\n const current = getViewport(mapInstance);\n const next = {\n center: viewport.center ?? current.center,\n zoom: viewport.zoom ?? current.zoom,\n bearing: viewport.bearing ?? current.bearing,\n pitch: viewport.pitch ?? current.pitch,\n };\n\n if (\n next.center[0] === current.center[0] &&\n next.center[1] === current.center[1] &&\n next.zoom === current.zoom &&\n next.bearing === current.bearing &&\n next.pitch === current.pitch\n ) {\n return;\n }\n\n internalUpdateRef.current = true;\n mapInstance.jumpTo(next);\n internalUpdateRef.current = false;\n }, [mapInstance, isControlled, viewport]);\n\n // Handle style change. When a tile picker is enabled, the selected tile wins;\n // otherwise fall back to the explicit `theme` prop (default light).\n useEffect(() => {\n if (!mapInstance) return;\n\n const newStyle =\n tileList[tileIndex]?.url ??\n (themeProp === \"dark\" ? mapStyles.dark : mapStyles.light);\n\n if (currentStyleRef.current === newStyle) return;\n\n clearStyleTimeout();\n currentStyleRef.current = newStyle;\n setIsStyleLoaded(false);\n\n mapInstance.setStyle(newStyle, { diff: true });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [mapInstance, tileIndex, themeProp, mapStyles, clearStyleTimeout]);\n\n const contextValue = useMemo(\n () => ({\n map: mapInstance,\n isLoaded: isLoaded && isStyleLoaded,\n }),\n [mapInstance, isLoaded, isStyleLoaded],\n );\n\n return (\n <MapContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n className={cn(\"relative h-full w-full\", className)}\n >\n {(!isLoaded || loading) && <DefaultLoader />}\n {/* SSR-safe: children render only when map is loaded on client */}\n {mapInstance && (\n <>\n {controls && (\n <MapControls\n position=\"top-right\"\n tiles={tileList}\n tileIndex={tileIndex}\n onTileChange={setTileIndex}\n />\n )}\n {children}\n </>\n )}\n </div>\n </MapContext.Provider>\n );\n});\n\ntype MarkerContextValue = {\n marker: MapLibreGL.Marker;\n map: MapLibreGL.Map | null;\n};\n\nconst MarkerContext = createContext<MarkerContextValue | null>(null);\n\nfunction useMarkerContext() {\n const context = useContext(MarkerContext);\n if (!context) {\n throw new Error(\"Marker components must be used within MapMarker\");\n }\n return context;\n}\n\ntype MapMarkerProps = {\n /** Longitude coordinate for marker position */\n longitude: number;\n /** Latitude coordinate for marker position */\n latitude: number;\n /** Marker subcomponents (MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel) */\n children: ReactNode;\n /** Callback when marker is clicked */\n onClick?: (e: MouseEvent) => void;\n /** Callback when mouse enters marker */\n onMouseEnter?: (e: MouseEvent) => void;\n /** Callback when mouse leaves marker */\n onMouseLeave?: (e: MouseEvent) => void;\n /** Callback when marker drag starts (requires draggable: true) */\n onDragStart?: (lngLat: { lng: number; lat: number }) => void;\n /** Callback during marker drag (requires draggable: true) */\n onDrag?: (lngLat: { lng: number; lat: number }) => void;\n /** Callback when marker drag ends (requires draggable: true) */\n onDragEnd?: (lngLat: { lng: number; lat: number }) => void;\n} & Omit<MarkerOptions, \"element\">;\n\nfunction MapMarker({\n longitude,\n latitude,\n children,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n draggable = false,\n ...markerOptions\n}: MapMarkerProps) {\n const { map } = useMap();\n\n const callbacksRef = useRef({\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n });\n callbacksRef.current = {\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n const marker = useMemo(() => {\n const markerInstance = new MapLibreGL.Marker({\n ...markerOptions,\n element: document.createElement(\"div\"),\n draggable,\n }).setLngLat([longitude, latitude]);\n\n const handleClick = (e: MouseEvent) => callbacksRef.current.onClick?.(e);\n const handleMouseEnter = (e: MouseEvent) =>\n callbacksRef.current.onMouseEnter?.(e);\n const handleMouseLeave = (e: MouseEvent) =>\n callbacksRef.current.onMouseLeave?.(e);\n\n markerInstance.getElement()?.addEventListener(\"click\", handleClick);\n markerInstance\n .getElement()\n ?.addEventListener(\"mouseenter\", handleMouseEnter);\n markerInstance\n .getElement()\n ?.addEventListener(\"mouseleave\", handleMouseLeave);\n\n const handleDragStart = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDragStart?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n const handleDrag = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDrag?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n const handleDragEnd = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDragEnd?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n\n markerInstance.on(\"dragstart\", handleDragStart);\n markerInstance.on(\"drag\", handleDrag);\n markerInstance.on(\"dragend\", handleDragEnd);\n\n return markerInstance;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n marker.addTo(map);\n\n return () => {\n marker.remove();\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (\n marker.getLngLat().lng !== longitude ||\n marker.getLngLat().lat !== latitude\n ) {\n marker.setLngLat([longitude, latitude]);\n }\n if (marker.isDraggable() !== draggable) {\n marker.setDraggable(draggable);\n }\n\n const currentOffset = marker.getOffset();\n const newOffset = markerOptions.offset ?? [0, 0];\n const [newOffsetX, newOffsetY] = Array.isArray(newOffset)\n ? newOffset\n : [newOffset.x, newOffset.y];\n if (currentOffset.x !== newOffsetX || currentOffset.y !== newOffsetY) {\n marker.setOffset(newOffset);\n }\n\n if (marker.getRotation() !== markerOptions.rotation) {\n marker.setRotation(markerOptions.rotation ?? 0);\n }\n if (marker.getRotationAlignment() !== markerOptions.rotationAlignment) {\n marker.setRotationAlignment(markerOptions.rotationAlignment ?? \"auto\");\n }\n if (marker.getPitchAlignment() !== markerOptions.pitchAlignment) {\n marker.setPitchAlignment(markerOptions.pitchAlignment ?? \"auto\");\n }\n\n return (\n <MarkerContext.Provider value={{ marker, map }}>\n {children}\n </MarkerContext.Provider>\n );\n}\n\ntype MarkerContentProps = {\n /** Custom marker content. Defaults to a blue dot if not provided */\n children?: ReactNode;\n /** Additional CSS classes for the marker container */\n className?: string;\n};\n\nfunction MarkerContent({ children, className }: MarkerContentProps) {\n const { marker } = useMarkerContext();\n\n return createPortal(\n <div className={cn(\"relative cursor-pointer\", className)}>\n {children || <DefaultMarkerIcon />}\n </div>,\n marker.getElement(),\n );\n}\n\nfunction DefaultMarkerIcon() {\n return (\n <div className=\"relative h-4 w-4 rounded-full border-2 border-white bg-blue-500 shadow-lg\" />\n );\n}\n\nfunction PopupCloseButton({ onClick }: { onClick: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label=\"Close popup\"\n className=\"focus-visible:ring-ring hover:bg-muted text-foreground absolute top-0.5 right-0.5 z-10 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm transition-colors focus:outline-none focus-visible:ring-2\"\n >\n <X className=\"size-3.5\" />\n </button>\n );\n}\n\ntype MarkerPopupProps = {\n /** Popup content */\n children: ReactNode;\n /** Additional CSS classes for the popup container */\n className?: string;\n /** Show a close button in the popup (default: false) */\n closeButton?: boolean;\n} & Omit<PopupOptions, \"className\" | \"closeButton\">;\n\nfunction MarkerPopup({\n children,\n className,\n closeButton = false,\n ...popupOptions\n}: MarkerPopupProps) {\n const { marker, map } = useMarkerContext();\n const container = useMemo(() => document.createElement(\"div\"), []);\n const prevPopupOptions = useRef(popupOptions);\n\n const popup = useMemo(() => {\n const popupInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeButton: false,\n })\n .setMaxWidth(\"none\")\n .setDOMContent(container);\n\n return popupInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n popup.setDOMContent(container);\n marker.setPopup(popup);\n\n return () => {\n marker.setPopup(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (popup.isOpen()) {\n const prev = prevPopupOptions.current;\n\n if (prev.offset !== popupOptions.offset) {\n popup.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n popup.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n\n prevPopupOptions.current = popupOptions;\n }\n\n const handleClose = () => popup.remove();\n\n return createPortal(\n <div\n className={cn(\n \"bg-popover text-popover-foreground relative max-w-62 rounded-md border p-3 shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {closeButton && <PopupCloseButton onClick={handleClose} />}\n {children}\n </div>,\n container,\n );\n}\n\ntype MarkerTooltipProps = {\n /** Tooltip content */\n children: ReactNode;\n /** Additional CSS classes for the tooltip container */\n className?: string;\n} & Omit<PopupOptions, \"className\" | \"closeButton\" | \"closeOnClick\">;\n\nfunction MarkerTooltip({\n children,\n className,\n ...popupOptions\n}: MarkerTooltipProps) {\n const { marker, map } = useMarkerContext();\n const container = useMemo(() => document.createElement(\"div\"), []);\n const prevTooltipOptions = useRef(popupOptions);\n\n const tooltip = useMemo(() => {\n const tooltipInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeOnClick: true,\n closeButton: false,\n }).setMaxWidth(\"none\");\n\n return tooltipInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n tooltip.setDOMContent(container);\n\n const handleMouseEnter = () => {\n tooltip.setLngLat(marker.getLngLat()).addTo(map);\n };\n const handleMouseLeave = () => tooltip.remove();\n\n marker.getElement()?.addEventListener(\"mouseenter\", handleMouseEnter);\n marker.getElement()?.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n marker.getElement()?.removeEventListener(\"mouseenter\", handleMouseEnter);\n marker.getElement()?.removeEventListener(\"mouseleave\", handleMouseLeave);\n tooltip.remove();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (tooltip.isOpen()) {\n const prev = prevTooltipOptions.current;\n\n if (prev.offset !== popupOptions.offset) {\n tooltip.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n tooltip.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n\n prevTooltipOptions.current = popupOptions;\n }\n\n return createPortal(\n <div\n className={cn(\n \"bg-foreground text-background pointer-events-none rounded-md px-2 py-1 text-xs text-balance shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {children}\n </div>,\n container,\n );\n}\n\ntype MarkerLabelProps = {\n /** Label text content */\n children: ReactNode;\n /** Additional CSS classes for the label */\n className?: string;\n /** Position of the label relative to the marker (default: \"top\") */\n position?: \"top\" | \"bottom\";\n};\n\nfunction MarkerLabel({\n children,\n className,\n position = \"top\",\n}: MarkerLabelProps) {\n const positionClasses = {\n top: \"bottom-full mb-1\",\n bottom: \"top-full mt-1\",\n };\n\n return (\n <div\n className={cn(\n \"absolute left-1/2 -translate-x-1/2 whitespace-nowrap\",\n \"text-foreground text-[10px] font-medium\",\n positionClasses[position],\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\ntype MapControlsProps = {\n /** Position of the controls on the map (default: \"bottom-right\") */\n position?: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n /** Show zoom in/out buttons (default: true) */\n showZoom?: boolean;\n /** Show compass button to reset bearing (default: false) */\n showCompass?: boolean;\n /** Show locate button to find user's location (default: false) */\n showLocate?: boolean;\n /** Show fullscreen toggle button (default: false) */\n showFullscreen?: boolean;\n /** Additional CSS classes for the controls container */\n className?: string;\n /** Callback with user coordinates when located */\n onLocate?: (coords: { longitude: number; latitude: number }) => void;\n /** Basemap tiles for the tile-cycle button. Hidden when fewer than 2. */\n tiles?: MapTile[];\n /** Index of the active tile. */\n tileIndex?: number;\n /** Called with the next tile index when the tile button is clicked. */\n onTileChange?: (index: number) => void;\n};\n\nconst positionClasses = {\n \"top-left\": \"top-2 left-2\",\n \"top-right\": \"top-2 right-2\",\n \"bottom-left\": \"bottom-2 left-2\",\n \"bottom-right\": \"bottom-10 right-2\",\n};\n\nfunction ControlGroup({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"border-border bg-background [&>button:not(:last-child)]:border-border flex flex-col overflow-hidden rounded-md border shadow-sm [&>button:not(:last-child)]:border-b\">\n {children}\n </div>\n );\n}\n\nfunction ControlButton({\n onClick,\n label,\n children,\n disabled = false,\n}: {\n onClick: () => void;\n label: string;\n children: React.ReactNode;\n disabled?: boolean;\n}) {\n return (\n <button\n onClick={onClick}\n aria-label={label}\n type=\"button\"\n className={cn(\n \"flex size-8 items-center justify-center transition-all\",\n \"first:rounded-t-md last:rounded-b-md\",\n \"hover:bg-accent dark:hover:bg-accent/40\",\n \"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n disabled={disabled}\n >\n {children}\n </button>\n );\n}\n\nfunction TileSelectorButton({\n tiles,\n tileIndex,\n onTileChange,\n openLeft,\n}: {\n tiles: MapTile[];\n tileIndex: number;\n onTileChange?: (index: number) => void;\n openLeft: boolean;\n}) {\n const [open, setOpen] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (e: PointerEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n document.addEventListener(\"pointerdown\", onPointerDown);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"pointerdown\", onPointerDown);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [open]);\n\n return (\n <div ref={ref} className=\"relative\">\n <ControlGroup>\n <ControlButton\n onClick={() => setOpen((v) => !v)}\n label={`Basemap: ${tiles[tileIndex]?.label ?? \"\"}`}\n >\n <Layers className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n {open && (\n <div\n role=\"listbox\"\n aria-label=\"Basemap\"\n className={cn(\n \"border-border bg-background absolute top-0 z-20 min-w-32 overflow-hidden rounded-md border p-1 shadow-md\",\n openLeft ? \"right-9\" : \"left-9\",\n )}\n >\n {tiles.map((t, i) => (\n <button\n key={t.label}\n type=\"button\"\n role=\"option\"\n aria-selected={i === tileIndex}\n onClick={() => {\n onTileChange?.(i);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center justify-between gap-3 rounded-sm px-2 py-1.5 text-left text-xs font-medium transition-colors\",\n i === tileIndex\n ? \"bg-accent text-accent-foreground\"\n : \"hover:bg-accent/50\",\n )}\n >\n {t.label}\n {i === tileIndex && <Check className=\"size-3.5 shrink-0\" />}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction MapControls({\n position = \"bottom-right\",\n showZoom = true,\n showCompass = false,\n showLocate = false,\n showFullscreen = false,\n className,\n onLocate,\n tiles = [],\n tileIndex = 0,\n onTileChange,\n}: MapControlsProps) {\n const { map } = useMap();\n const [waitingForLocation, setWaitingForLocation] = useState(false);\n\n const handleZoomIn = useCallback(() => {\n map?.zoomTo(map.getZoom() + 1, { duration: 300 });\n }, [map]);\n\n const handleZoomOut = useCallback(() => {\n map?.zoomTo(map.getZoom() - 1, { duration: 300 });\n }, [map]);\n\n const handleResetBearing = useCallback(() => {\n map?.resetNorthPitch({ duration: 300 });\n }, [map]);\n\n const handleLocate = useCallback(() => {\n setWaitingForLocation(true);\n if (\"geolocation\" in navigator) {\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n const coords = {\n longitude: pos.coords.longitude,\n latitude: pos.coords.latitude,\n };\n map?.flyTo({\n center: [coords.longitude, coords.latitude],\n zoom: 14,\n duration: 1500,\n });\n onLocate?.(coords);\n setWaitingForLocation(false);\n },\n (error) => {\n console.error(\"Error getting location:\", error);\n setWaitingForLocation(false);\n },\n );\n }\n }, [map, onLocate]);\n\n const handleFullscreen = useCallback(() => {\n const container = map?.getContainer();\n if (!container) return;\n if (document.fullscreenElement) {\n document.exitFullscreen();\n } else {\n container.requestFullscreen();\n }\n }, [map]);\n\n return (\n <div\n className={cn(\n \"absolute z-10 flex flex-col gap-1.5\",\n positionClasses[position],\n className,\n )}\n >\n {showZoom && (\n <ControlGroup>\n <ControlButton onClick={handleZoomIn} label=\"Zoom in\">\n <Plus className=\"size-4\" />\n </ControlButton>\n <ControlButton onClick={handleZoomOut} label=\"Zoom out\">\n <Minus className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n )}\n {tiles.length > 1 && (\n <TileSelectorButton\n tiles={tiles}\n tileIndex={tileIndex}\n onTileChange={onTileChange}\n openLeft={position.endsWith(\"right\")}\n />\n )}\n {showCompass && (\n <ControlGroup>\n <CompassButton onClick={handleResetBearing} />\n </ControlGroup>\n )}\n {showLocate && (\n <ControlGroup>\n <ControlButton\n onClick={handleLocate}\n label=\"Find my location\"\n disabled={waitingForLocation}\n >\n {waitingForLocation ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Locate className=\"size-4\" />\n )}\n </ControlButton>\n </ControlGroup>\n )}\n {showFullscreen && (\n <ControlGroup>\n <ControlButton onClick={handleFullscreen} label=\"Toggle fullscreen\">\n <Maximize className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n )}\n </div>\n );\n}\n\nfunction CompassButton({ onClick }: { onClick: () => void }) {\n const { map } = useMap();\n const compassRef = useRef<SVGSVGElement>(null);\n\n useEffect(() => {\n if (!map || !compassRef.current) return;\n\n const compass = compassRef.current;\n\n const updateRotation = () => {\n const bearing = map.getBearing();\n const pitch = map.getPitch();\n compass.style.transform = `rotateX(${pitch}deg) rotateZ(${-bearing}deg)`;\n };\n\n map.on(\"rotate\", updateRotation);\n map.on(\"pitch\", updateRotation);\n updateRotation();\n\n return () => {\n map.off(\"rotate\", updateRotation);\n map.off(\"pitch\", updateRotation);\n };\n }, [map]);\n\n return (\n <ControlButton onClick={onClick} label=\"Reset bearing to north\">\n <svg\n ref={compassRef}\n viewBox=\"0 0 24 24\"\n className=\"size-5 transition-transform duration-200\"\n style={{ transformStyle: \"preserve-3d\" }}\n >\n <path d=\"M12 2L16 12H12V2Z\" className=\"fill-red-500\" />\n <path d=\"M12 2L8 12H12V2Z\" className=\"fill-red-300\" />\n <path d=\"M12 22L16 12H12V22Z\" className=\"fill-muted-foreground/60\" />\n <path d=\"M12 22L8 12H12V22Z\" className=\"fill-muted-foreground/30\" />\n </svg>\n </ControlButton>\n );\n}\n\ntype MapPopupProps = {\n /** Longitude coordinate for popup position */\n longitude: number;\n /** Latitude coordinate for popup position */\n latitude: number;\n /** Callback when popup is closed */\n onClose?: () => void;\n /** Popup content */\n children: ReactNode;\n /** Additional CSS classes for the popup container */\n className?: string;\n /** Show a close button in the popup (default: false) */\n closeButton?: boolean;\n} & Omit<PopupOptions, \"className\" | \"closeButton\">;\n\nfunction MapPopup({\n longitude,\n latitude,\n onClose,\n children,\n className,\n closeButton = false,\n ...popupOptions\n}: MapPopupProps) {\n const { map } = useMap();\n const popupOptionsRef = useRef(popupOptions);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const container = useMemo(() => document.createElement(\"div\"), []);\n\n const popup = useMemo(() => {\n const popupInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeButton: false,\n })\n .setMaxWidth(\"none\")\n .setLngLat([longitude, latitude]);\n\n return popupInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n const onCloseProp = () => onCloseRef.current?.();\n\n popup.on(\"close\", onCloseProp);\n\n popup.setDOMContent(container);\n popup.addTo(map);\n\n return () => {\n popup.off(\"close\", onCloseProp);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (popup.isOpen()) {\n const prev = popupOptionsRef.current;\n\n if (\n popup.getLngLat().lng !== longitude ||\n popup.getLngLat().lat !== latitude\n ) {\n popup.setLngLat([longitude, latitude]);\n }\n\n if (prev.offset !== popupOptions.offset) {\n popup.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n popup.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n popupOptionsRef.current = popupOptions;\n }\n\n const handleClose = () => {\n popup.remove();\n };\n\n return createPortal(\n <div\n className={cn(\n \"bg-popover text-popover-foreground relative max-w-62 rounded-md border p-3 shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {closeButton && <PopupCloseButton onClick={handleClose} />}\n {children}\n </div>,\n container,\n );\n}\n\ntype MapRouteProps = {\n /** Optional unique identifier for the route layer */\n id?: string;\n /** Array of [longitude, latitude] coordinate pairs defining the route */\n coordinates: [number, number][];\n /** Line color as CSS color value (default: \"#4285F4\") */\n color?: string;\n /** Line width in pixels (default: 3) */\n width?: number;\n /** Line opacity from 0 to 1 (default: 0.8) */\n opacity?: number;\n /** Dash pattern [dash length, gap length] for dashed lines */\n dashArray?: [number, number];\n /** Callback when the route line is clicked */\n onClick?: () => void;\n /** Callback when mouse enters the route line */\n onMouseEnter?: () => void;\n /** Callback when mouse leaves the route line */\n onMouseLeave?: () => void;\n /** Whether the route is interactive - shows pointer cursor on hover (default: true) */\n interactive?: boolean;\n};\n\nfunction MapRoute({\n id: propId,\n coordinates,\n color = \"#4285F4\",\n width = 3,\n opacity = 0.8,\n dashArray,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive = true,\n}: MapRouteProps) {\n const { map, isLoaded } = useMap();\n const autoId = useId();\n const id = propId ?? autoId;\n const sourceId = `route-source-${id}`;\n const layerId = `route-layer-${id}`;\n\n // Add source and layer on mount\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n map.addSource(sourceId, {\n type: \"geojson\",\n data: {\n type: \"Feature\",\n properties: {},\n geometry: { type: \"LineString\", coordinates: [] },\n },\n });\n\n map.addLayer({\n id: layerId,\n type: \"line\",\n source: sourceId,\n layout: { \"line-join\": \"round\", \"line-cap\": \"round\" },\n paint: {\n \"line-color\": color,\n \"line-width\": width,\n \"line-opacity\": opacity,\n ...(dashArray && { \"line-dasharray\": dashArray }),\n },\n });\n\n return () => {\n try {\n if (map.getLayer(layerId)) map.removeLayer(layerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map]);\n\n // When coordinates change, update the source data\n useEffect(() => {\n if (!isLoaded || !map || coordinates.length < 2) return;\n\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n if (source) {\n source.setData({\n type: \"Feature\",\n properties: {},\n geometry: { type: \"LineString\", coordinates },\n });\n }\n }, [isLoaded, map, coordinates, sourceId]);\n\n useEffect(() => {\n if (!isLoaded || !map || !map.getLayer(layerId)) return;\n\n map.setPaintProperty(layerId, \"line-color\", color);\n map.setPaintProperty(layerId, \"line-width\", width);\n map.setPaintProperty(layerId, \"line-opacity\", opacity);\n if (dashArray) {\n map.setPaintProperty(layerId, \"line-dasharray\", dashArray);\n }\n }, [isLoaded, map, layerId, color, width, opacity, dashArray]);\n\n // Handle click and hover events\n useEffect(() => {\n if (!isLoaded || !map || !interactive) return;\n\n const handleClick = () => {\n onClick?.();\n };\n const handleMouseEnter = () => {\n map.getCanvas().style.cursor = \"pointer\";\n onMouseEnter?.();\n };\n const handleMouseLeave = () => {\n map.getCanvas().style.cursor = \"\";\n onMouseLeave?.();\n };\n\n map.on(\"click\", layerId, handleClick);\n map.on(\"mouseenter\", layerId, handleMouseEnter);\n map.on(\"mouseleave\", layerId, handleMouseLeave);\n\n return () => {\n map.off(\"click\", layerId, handleClick);\n map.off(\"mouseenter\", layerId, handleMouseEnter);\n map.off(\"mouseleave\", layerId, handleMouseLeave);\n };\n }, [\n isLoaded,\n map,\n layerId,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive,\n ]);\n\n return null;\n}\n\n/** A single arc to render inside <MapArc data={...}>. */\ntype MapArcDatum = {\n /** Unique identifier for this arc. Required for hover state tracking and event payloads. */\n id: string | number;\n /** Start coordinate as [longitude, latitude]. */\n from: [number, number];\n /** End coordinate as [longitude, latitude]. */\n to: [number, number];\n};\n\n/** Event payload passed to MapArc interaction callbacks. */\ntype MapArcEvent<T extends MapArcDatum = MapArcDatum> = {\n /** The arc datum that was hovered or clicked. */\n arc: T;\n /** Longitude of the cursor at the time of the event. */\n longitude: number;\n /** Latitude of the cursor at the time of the event. */\n latitude: number;\n /** The underlying MapLibre mouse event for advanced use cases. */\n originalEvent: MapLibreGL.MapMouseEvent;\n};\n\ntype MapArcLinePaint = NonNullable<MapLibreGL.LineLayerSpecification[\"paint\"]>;\ntype MapArcLineLayout = NonNullable<\n MapLibreGL.LineLayerSpecification[\"layout\"]\n>;\n\ntype MapArcProps<T extends MapArcDatum = MapArcDatum> = {\n /** Array of arcs to render. Each arc must have a unique `id`. */\n data: T[];\n /** Optional unique identifier prefix for the arc source/layers. Auto-generated if not provided. */\n id?: string;\n /**\n * How far each arc bows away from a straight line. `0` renders straight\n * lines; higher values bend further. Negative values bend to the opposite\n * side. Arcs are computed as a quadratic Bézier in lng/lat space and do not\n * account for the antimeridian. (default: 0.2)\n */\n curvature?: number;\n /** Number of samples used to render each curve. Higher = smoother. (default: 64) */\n samples?: number;\n /**\n * MapLibre paint properties for the arc layer. Merged on top of sensible\n * defaults (`line-color: #4285F4`, `line-width: 2`, `line-opacity: 0.85`).\n * Any value can be a MapLibre expression for per-feature styling, every\n * field on each arc datum (besides `from`/`to`) is exposed via `[\"get\", ...]`.\n */\n paint?: MapArcLinePaint;\n /** MapLibre layout properties for the arc layer. Defaults to rounded joins/caps. */\n layout?: MapArcLineLayout;\n /**\n * Paint properties applied to the arc currently under the cursor. Each key\n * is merged into `paint` as a `case` expression keyed on per-feature hover\n * state, so only the hovered arc changes appearance.\n */\n hoverPaint?: MapArcLinePaint;\n /** Callback when an arc is clicked. */\n onClick?: (e: MapArcEvent<T>) => void;\n /**\n * Callback fired when the hovered arc changes. Receives the cursor's\n * lng/lat at the moment of entry, and `null` when the cursor leaves the\n * last hovered arc.\n */\n onHover?: (e: MapArcEvent<T> | null) => void;\n /** Whether arcs respond to mouse events (default: true). */\n interactive?: boolean;\n /** Optional MapLibre layer id to insert the arc layers before (z-order control). */\n beforeId?: string;\n};\n\nconst DEFAULT_ARC_CURVATURE = 0.2;\nconst DEFAULT_ARC_SAMPLES = 64;\nconst ARC_HIT_MIN_WIDTH = 12;\nconst ARC_HIT_PADDING = 6;\n\nconst DEFAULT_ARC_PAINT: MapArcLinePaint = {\n \"line-color\": \"#4285F4\",\n \"line-width\": 2,\n \"line-opacity\": 0.85,\n};\n\nconst DEFAULT_ARC_LAYOUT: MapArcLineLayout = {\n \"line-join\": \"round\",\n \"line-cap\": \"round\",\n};\n\nfunction mergeArcPaint(\n paint: MapArcLinePaint,\n hoverPaint: MapArcLinePaint | undefined,\n): MapArcLinePaint {\n if (!hoverPaint) return paint;\n const merged: Record<string, unknown> = { ...paint };\n for (const [key, hoverValue] of Object.entries(hoverPaint)) {\n if (hoverValue === undefined) continue;\n const baseValue = merged[key];\n merged[key] =\n baseValue === undefined\n ? hoverValue\n : [\n \"case\",\n [\"boolean\", [\"feature-state\", \"hover\"], false],\n hoverValue,\n baseValue,\n ];\n }\n return merged as MapArcLinePaint;\n}\n\nfunction buildArcCoordinates(\n from: [number, number],\n to: [number, number],\n curvature: number,\n samples: number,\n): [number, number][] {\n const [x0, y0] = from;\n const [x2, y2] = to;\n const dx = x2 - x0;\n const dy = y2 - y0;\n const distance = Math.hypot(dx, dy);\n\n if (distance === 0 || curvature === 0) return [from, to];\n\n const mx = (x0 + x2) / 2;\n const my = (y0 + y2) / 2;\n const nx = -dy / distance;\n const ny = dx / distance;\n const offset = distance * curvature;\n const cx = mx + nx * offset;\n const cy = my + ny * offset;\n\n const points: [number, number][] = [];\n const segments = Math.max(2, Math.floor(samples));\n for (let i = 0; i <= segments; i += 1) {\n const t = i / segments;\n const inv = 1 - t;\n const x = inv * inv * x0 + 2 * inv * t * cx + t * t * x2;\n const y = inv * inv * y0 + 2 * inv * t * cy + t * t * y2;\n points.push([x, y]);\n }\n return points;\n}\n\nfunction MapArc<T extends MapArcDatum = MapArcDatum>({\n data,\n id: propId,\n curvature = DEFAULT_ARC_CURVATURE,\n samples = DEFAULT_ARC_SAMPLES,\n paint,\n layout,\n hoverPaint,\n onClick,\n onHover,\n interactive = true,\n beforeId,\n}: MapArcProps<T>) {\n const { map, isLoaded } = useMap();\n const autoId = useId();\n const id = propId ?? autoId;\n const sourceId = `arc-source-${id}`;\n const layerId = `arc-layer-${id}`;\n const hitLayerId = `arc-hit-layer-${id}`;\n\n const mergedPaint = useMemo(\n () => mergeArcPaint({ ...DEFAULT_ARC_PAINT, ...paint }, hoverPaint),\n [paint, hoverPaint],\n );\n const mergedLayout = useMemo(\n () => ({ ...DEFAULT_ARC_LAYOUT, ...layout }),\n [layout],\n );\n\n const hitWidth = useMemo(() => {\n const w = paint?.[\"line-width\"] ?? DEFAULT_ARC_PAINT[\"line-width\"];\n const base = typeof w === \"number\" ? w : ARC_HIT_MIN_WIDTH;\n return Math.max(base + ARC_HIT_PADDING, ARC_HIT_MIN_WIDTH);\n }, [paint]);\n\n const geoJSON = useMemo<GeoJSON.FeatureCollection<GeoJSON.LineString>>(\n () => ({\n type: \"FeatureCollection\",\n features: data.map((arc) => {\n const { from, to, ...properties } = arc;\n return {\n type: \"Feature\",\n properties,\n geometry: {\n type: \"LineString\",\n coordinates: buildArcCoordinates(from, to, curvature, samples),\n },\n };\n }),\n }),\n [data, curvature, samples],\n );\n\n const latestRef = useRef({ data, onClick, onHover });\n latestRef.current = { data, onClick, onHover };\n\n // Add source and layers on mount.\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n map.addSource(sourceId, {\n type: \"geojson\",\n data: geoJSON,\n promoteId: \"id\",\n });\n\n map.addLayer(\n {\n id: hitLayerId,\n type: \"line\",\n source: sourceId,\n layout: DEFAULT_ARC_LAYOUT,\n paint: {\n \"line-color\": \"rgba(0, 0, 0, 0)\",\n \"line-width\": hitWidth,\n \"line-opacity\": 1,\n },\n },\n beforeId,\n );\n\n map.addLayer(\n {\n id: layerId,\n type: \"line\",\n source: sourceId,\n layout: mergedLayout,\n paint: mergedPaint,\n },\n beforeId,\n );\n\n return () => {\n try {\n if (map.getLayer(layerId)) map.removeLayer(layerId);\n if (map.getLayer(hitLayerId)) map.removeLayer(hitLayerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map]);\n\n // Sync features when data / curvature / samples change.\n useEffect(() => {\n if (!isLoaded || !map) return;\n const source = map.getSource(sourceId) as\n | MapLibreGL.GeoJSONSource\n | undefined;\n source?.setData(geoJSON);\n }, [isLoaded, map, geoJSON, sourceId]);\n\n // Sync paint/layout when they change.\n useEffect(() => {\n if (!isLoaded || !map || !map.getLayer(layerId)) return;\n for (const [key, value] of Object.entries(mergedPaint)) {\n map.setPaintProperty(\n layerId,\n key as keyof MapArcLinePaint,\n value as never,\n );\n }\n for (const [key, value] of Object.entries(mergedLayout)) {\n map.setLayoutProperty(\n layerId,\n key as keyof MapArcLineLayout,\n value as never,\n );\n }\n if (map.getLayer(hitLayerId)) {\n map.setPaintProperty(hitLayerId, \"line-width\", hitWidth);\n }\n }, [isLoaded, map, layerId, hitLayerId, mergedPaint, mergedLayout, hitWidth]);\n\n // Interaction handlers\n useEffect(() => {\n if (!isLoaded || !map || !interactive) return;\n\n let hoveredId: string | number | null = null;\n\n const setHover = (next: string | number | null) => {\n if (next === hoveredId) return;\n const sourceExists = !!map.getSource(sourceId);\n if (hoveredId != null && sourceExists) {\n map.setFeatureState(\n { source: sourceId, id: hoveredId },\n { hover: false },\n );\n }\n hoveredId = next;\n if (next != null && sourceExists) {\n map.setFeatureState({ source: sourceId, id: next }, { hover: true });\n }\n };\n\n const findArc = (featureId: string | number | undefined) =>\n featureId == null\n ? undefined\n : latestRef.current.data.find(\n (arc) => String(arc.id) === String(featureId),\n );\n\n const handleMouseMove = (e: MapLibreGL.MapLayerMouseEvent) => {\n const featureId = e.features?.[0]?.id as string | number | undefined;\n if (featureId == null || featureId === hoveredId) return;\n\n setHover(featureId);\n map.getCanvas().style.cursor = \"pointer\";\n\n const arc = findArc(featureId);\n if (arc) {\n latestRef.current.onHover?.({\n arc: arc as T,\n longitude: e.lngLat.lng,\n latitude: e.lngLat.lat,\n originalEvent: e,\n });\n }\n };\n\n const handleMouseLeave = () => {\n setHover(null);\n map.getCanvas().style.cursor = \"\";\n latestRef.current.onHover?.(null);\n };\n\n const handleClick = (e: MapLibreGL.MapLayerMouseEvent) => {\n const arc = findArc(e.features?.[0]?.id as string | number | undefined);\n if (!arc) return;\n latestRef.current.onClick?.({\n arc: arc as T,\n longitude: e.lngLat.lng,\n latitude: e.lngLat.lat,\n originalEvent: e,\n });\n };\n\n map.on(\"mousemove\", hitLayerId, handleMouseMove);\n map.on(\"mouseleave\", hitLayerId, handleMouseLeave);\n map.on(\"click\", hitLayerId, handleClick);\n\n return () => {\n map.off(\"mousemove\", hitLayerId, handleMouseMove);\n map.off(\"mouseleave\", hitLayerId, handleMouseLeave);\n map.off(\"click\", hitLayerId, handleClick);\n setHover(null);\n map.getCanvas().style.cursor = \"\";\n };\n }, [isLoaded, map, hitLayerId, sourceId, interactive]);\n\n return null;\n}\n\ntype MapClusterLayerProps<\n P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties,\n> = {\n /** GeoJSON FeatureCollection data or URL to fetch GeoJSON from */\n data: string | GeoJSON.FeatureCollection<GeoJSON.Point, P>;\n /** Maximum zoom level to cluster points on (default: 14) */\n clusterMaxZoom?: number;\n /** Radius of each cluster when clustering points in pixels (default: 50) */\n clusterRadius?: number;\n /** Colors for cluster circles: [small, medium, large] based on point count (default: [\"#22c55e\", \"#eab308\", \"#ef4444\"]) */\n clusterColors?: [string, string, string];\n /** Point count thresholds for color/size steps: [medium, large] (default: [100, 750]) */\n clusterThresholds?: [number, number];\n /** Color for unclustered individual points (default: \"#3b82f6\") */\n pointColor?: string;\n /** Callback when an unclustered point is clicked */\n onPointClick?: (\n feature: GeoJSON.Feature<GeoJSON.Point, P>,\n coordinates: [number, number],\n ) => void;\n /** Callback when a cluster is clicked. If not provided, zooms into the cluster */\n onClusterClick?: (\n clusterId: number,\n coordinates: [number, number],\n pointCount: number,\n ) => void;\n};\n\nfunction MapClusterLayer<\n P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties,\n>({\n data,\n clusterMaxZoom = 14,\n clusterRadius = 50,\n clusterColors = [\"#22c55e\", \"#eab308\", \"#ef4444\"],\n clusterThresholds = [100, 750],\n pointColor = \"#3b82f6\",\n onPointClick,\n onClusterClick,\n}: MapClusterLayerProps<P>) {\n const { map, isLoaded } = useMap();\n const id = useId();\n const sourceId = `cluster-source-${id}`;\n const clusterLayerId = `clusters-${id}`;\n const clusterCountLayerId = `cluster-count-${id}`;\n const unclusteredLayerId = `unclustered-point-${id}`;\n\n const stylePropsRef = useRef({\n clusterColors,\n clusterThresholds,\n pointColor,\n });\n\n // Add source and layers on mount\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n // Add clustered GeoJSON source\n map.addSource(sourceId, {\n type: \"geojson\",\n data,\n cluster: true,\n clusterMaxZoom,\n clusterRadius,\n });\n\n // Add cluster circles layer\n map.addLayer({\n id: clusterLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"has\", \"point_count\"],\n paint: {\n \"circle-color\": [\n \"step\",\n [\"get\", \"point_count\"],\n clusterColors[0],\n clusterThresholds[0],\n clusterColors[1],\n clusterThresholds[1],\n clusterColors[2],\n ],\n \"circle-radius\": [\n \"step\",\n [\"get\", \"point_count\"],\n 20,\n clusterThresholds[0],\n 30,\n clusterThresholds[1],\n 40,\n ],\n \"circle-stroke-width\": 1,\n \"circle-stroke-color\": \"#fff\",\n \"circle-opacity\": 0.85,\n },\n });\n\n // Add cluster count text layer\n map.addLayer({\n id: clusterCountLayerId,\n type: \"symbol\",\n source: sourceId,\n filter: [\"has\", \"point_count\"],\n layout: {\n \"text-field\": \"{point_count_abbreviated}\",\n \"text-font\": [\"Open Sans\"],\n \"text-size\": 12,\n },\n paint: {\n \"text-color\": \"#fff\",\n },\n });\n\n // Add unclustered point layer\n map.addLayer({\n id: unclusteredLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"!\", [\"has\", \"point_count\"]],\n paint: {\n \"circle-color\": pointColor,\n \"circle-radius\": 5,\n \"circle-stroke-width\": 2,\n \"circle-stroke-color\": \"#fff\",\n },\n });\n\n return () => {\n try {\n if (map.getLayer(clusterCountLayerId))\n map.removeLayer(clusterCountLayerId);\n if (map.getLayer(unclusteredLayerId))\n map.removeLayer(unclusteredLayerId);\n if (map.getLayer(clusterLayerId)) map.removeLayer(clusterLayerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map, sourceId]);\n\n // Update source data when data prop changes (only for non-URL data)\n useEffect(() => {\n if (!isLoaded || !map || typeof data === \"string\") return;\n\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n if (source) {\n source.setData(data);\n }\n }, [isLoaded, map, data, sourceId]);\n\n // Update layer styles when props change\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n const prev = stylePropsRef.current;\n const colorsChanged =\n prev.clusterColors !== clusterColors ||\n prev.clusterThresholds !== clusterThresholds;\n\n // Update cluster layer colors and sizes\n if (map.getLayer(clusterLayerId) && colorsChanged) {\n map.setPaintProperty(clusterLayerId, \"circle-color\", [\n \"step\",\n [\"get\", \"point_count\"],\n clusterColors[0],\n clusterThresholds[0],\n clusterColors[1],\n clusterThresholds[1],\n clusterColors[2],\n ]);\n map.setPaintProperty(clusterLayerId, \"circle-radius\", [\n \"step\",\n [\"get\", \"point_count\"],\n 20,\n clusterThresholds[0],\n 30,\n clusterThresholds[1],\n 40,\n ]);\n }\n\n // Update unclustered point layer color\n if (map.getLayer(unclusteredLayerId) && prev.pointColor !== pointColor) {\n map.setPaintProperty(unclusteredLayerId, \"circle-color\", pointColor);\n }\n\n stylePropsRef.current = { clusterColors, clusterThresholds, pointColor };\n }, [\n isLoaded,\n map,\n clusterLayerId,\n unclusteredLayerId,\n clusterColors,\n clusterThresholds,\n pointColor,\n ]);\n\n // Handle click events\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n // Cluster click handler - zoom into cluster\n const handleClusterClick = async (\n e: MapLibreGL.MapMouseEvent & {\n features?: MapLibreGL.MapGeoJSONFeature[];\n },\n ) => {\n const features = map.queryRenderedFeatures(e.point, {\n layers: [clusterLayerId],\n });\n if (!features.length) return;\n\n const feature = features[0];\n const clusterId = feature.properties?.cluster_id as number;\n const pointCount = feature.properties?.point_count as number;\n const coordinates = (feature.geometry as GeoJSON.Point).coordinates as [\n number,\n number,\n ];\n\n if (onClusterClick) {\n onClusterClick(clusterId, coordinates, pointCount);\n } else {\n // Default behavior: zoom to cluster expansion zoom\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n const zoom = await source.getClusterExpansionZoom(clusterId);\n map.easeTo({\n center: coordinates,\n zoom,\n });\n }\n };\n\n // Unclustered point click handler\n const handlePointClick = (\n e: MapLibreGL.MapMouseEvent & {\n features?: MapLibreGL.MapGeoJSONFeature[];\n },\n ) => {\n if (!onPointClick || !e.features?.length) return;\n\n const feature = e.features[0];\n const coordinates = (\n feature.geometry as GeoJSON.Point\n ).coordinates.slice() as [number, number];\n\n // Handle world copies\n while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {\n coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;\n }\n\n onPointClick(\n feature as unknown as GeoJSON.Feature<GeoJSON.Point, P>,\n coordinates,\n );\n };\n\n // Cursor style handlers\n const handleMouseEnterCluster = () => {\n map.getCanvas().style.cursor = \"pointer\";\n };\n const handleMouseLeaveCluster = () => {\n map.getCanvas().style.cursor = \"\";\n };\n const handleMouseEnterPoint = () => {\n if (onPointClick) {\n map.getCanvas().style.cursor = \"pointer\";\n }\n };\n const handleMouseLeavePoint = () => {\n map.getCanvas().style.cursor = \"\";\n };\n\n map.on(\"click\", clusterLayerId, handleClusterClick);\n map.on(\"click\", unclusteredLayerId, handlePointClick);\n map.on(\"mouseenter\", clusterLayerId, handleMouseEnterCluster);\n map.on(\"mouseleave\", clusterLayerId, handleMouseLeaveCluster);\n map.on(\"mouseenter\", unclusteredLayerId, handleMouseEnterPoint);\n map.on(\"mouseleave\", unclusteredLayerId, handleMouseLeavePoint);\n\n return () => {\n map.off(\"click\", clusterLayerId, handleClusterClick);\n map.off(\"click\", unclusteredLayerId, handlePointClick);\n map.off(\"mouseenter\", clusterLayerId, handleMouseEnterCluster);\n map.off(\"mouseleave\", clusterLayerId, handleMouseLeaveCluster);\n map.off(\"mouseenter\", unclusteredLayerId, handleMouseEnterPoint);\n map.off(\"mouseleave\", unclusteredLayerId, handleMouseLeavePoint);\n };\n }, [\n isLoaded,\n map,\n clusterLayerId,\n unclusteredLayerId,\n sourceId,\n onClusterClick,\n onPointClick,\n ]);\n\n return null;\n}\n\nexport {\n Map,\n useMap,\n MapMarker,\n MarkerContent,\n MarkerPopup,\n MarkerTooltip,\n MarkerLabel,\n MapPopup,\n MapControls,\n MapRoute,\n MapArc,\n MapClusterLayer,\n};\n\nexport type { MapRef, MapViewport, MapArcDatum, MapArcEvent };\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Progress as ProgressPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Progress({\n className,\n value,\n ...props\n}: React.ComponentProps<typeof ProgressPrimitive.Root>) {\n return (\n <ProgressPrimitive.Root\n data-slot=\"progress\"\n className={cn(\n \"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted\",\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className=\"size-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n )\n}\n\nexport { Progress }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Slider as SliderPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Slider({\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n ...props\n}: React.ComponentProps<typeof SliderPrimitive.Root>) {\n const _values = React.useMemo(\n () =>\n Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min, max],\n [value, defaultValue, min, max]\n )\n\n return (\n <SliderPrimitive.Root\n data-slot=\"slider\"\n defaultValue={defaultValue}\n value={value}\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 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 {Array.from({ length: _values.length }, (_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={index}\n className=\"relative block size-3 shrink-0 rounded-full border border-ring bg-white 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\nexport { Slider }\n","import { useTheme } from \"next-themes\"\nimport { Toaster as Sonner, type ToasterProps } from \"sonner\"\nimport { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from \"lucide-react\"\n\nconst Toaster = ({ ...props }: ToasterProps) => {\n const { theme = \"system\" } = useTheme()\n\n return (\n <Sonner\n theme={theme as ToasterProps[\"theme\"]}\n className=\"toaster group\"\n icons={{\n success: (\n <CircleCheckIcon className=\"size-4\" />\n ),\n info: (\n <InfoIcon className=\"size-4\" />\n ),\n warning: (\n <TriangleAlertIcon className=\"size-4\" />\n ),\n error: (\n <OctagonXIcon className=\"size-4\" />\n ),\n loading: (\n <Loader2Icon className=\"size-4 animate-spin\" />\n ),\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 } as React.CSSProperties\n }\n toastOptions={{\n classNames: {\n toast: \"cn-toast\",\n },\n }}\n {...props}\n />\n )\n}\n\nexport { Toaster }\n","\"use client\";\n\nimport { CheckIcon, LoaderCircleIcon } from \"lucide-react\";\nimport { Slot } from \"radix-ui\";\nimport * as React from \"react\";\nimport { createContext, useContext } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n// Types\ntype StepperContextValue = {\n activeStep: number;\n setActiveStep: (step: number) => void;\n orientation: \"horizontal\" | \"vertical\";\n};\n\ntype StepItemContextValue = {\n step: number;\n state: StepState;\n isDisabled: boolean;\n isLoading: boolean;\n};\n\ntype StepState = \"active\" | \"completed\" | \"inactive\" | \"loading\";\n\n// Contexts\nconst StepperContext = createContext<StepperContextValue | undefined>(\n undefined,\n);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(\n undefined,\n);\n\nconst useStepper = () => {\n const context = useContext(StepperContext);\n if (!context) {\n throw new Error(\"useStepper must be used within a Stepper\");\n }\n return context;\n};\n\nconst useStepItem = () => {\n const context = useContext(StepItemContext);\n if (!context) {\n throw new Error(\"useStepItem must be used within a StepperItem\");\n }\n return context;\n};\n\n// Components\ninterface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n defaultValue?: number;\n value?: number;\n onValueChange?: (value: number) => void;\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nfunction Stepper({\n defaultValue = 0,\n value,\n onValueChange,\n orientation = \"horizontal\",\n className,\n ...props\n}: StepperProps) {\n const [activeStep, setInternalStep] = React.useState(defaultValue);\n\n const setActiveStep = React.useCallback(\n (step: number) => {\n if (value === undefined) {\n setInternalStep(step);\n }\n onValueChange?.(step);\n },\n [value, onValueChange],\n );\n\n const currentStep = value ?? activeStep;\n\n return (\n <StepperContext.Provider\n value={{\n activeStep: currentStep,\n orientation,\n setActiveStep,\n }}\n >\n <div\n className={cn(\n \"group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col\",\n className,\n )}\n data-orientation={orientation}\n data-slot=\"stepper\"\n {...props}\n />\n </StepperContext.Provider>\n );\n}\n\n// StepperItem\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n step: number;\n completed?: boolean;\n disabled?: boolean;\n loading?: boolean;\n}\n\nfunction StepperItem({\n step,\n completed = false,\n disabled = false,\n loading = false,\n className,\n children,\n ...props\n}: StepperItemProps) {\n const { activeStep } = useStepper();\n\n const state: StepState =\n completed || step < activeStep\n ? \"completed\"\n : activeStep === step\n ? \"active\"\n : \"inactive\";\n\n const isLoading = loading && step === activeStep;\n\n return (\n <StepItemContext.Provider\n value={{ isDisabled: disabled, isLoading, state, step }}\n >\n <div\n className={cn(\n \"group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=vertical]/stepper:flex-col\",\n className,\n )}\n data-slot=\"stepper-item\"\n data-state={state}\n {...(isLoading ? { \"data-loading\": true } : {})}\n {...props}\n >\n {children}\n </div>\n </StepItemContext.Provider>\n );\n}\n\n// StepperTrigger\ninterface StepperTriggerProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\nfunction StepperTrigger({\n asChild = false,\n className,\n children,\n ...props\n}: StepperTriggerProps) {\n const { setActiveStep } = useStepper();\n const { step, isDisabled } = useStepItem();\n\n if (asChild) {\n const Comp = asChild ? Slot.Root : \"span\";\n return (\n <Comp className={className} data-slot=\"stepper-trigger\">\n {children}\n </Comp>\n );\n }\n\n return (\n <button\n className={cn(\n \"inline-flex items-center gap-3 rounded-full outline-none focus-visible:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n data-slot=\"stepper-trigger\"\n disabled={isDisabled}\n onClick={() => setActiveStep(step)}\n type=\"button\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\n// StepperIndicator\ninterface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nfunction StepperIndicator({\n asChild = false,\n className,\n children,\n ...props\n}: StepperIndicatorProps) {\n const { state, step, isLoading } = useStepItem();\n\n return (\n <span\n className={cn(\n \"relative flex size-6 shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs data-[state=active]:bg-primary data-[state=completed]:bg-primary data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground\",\n className,\n )}\n data-slot=\"stepper-indicator\"\n data-state={state}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n <span className=\"transition-all group-data-[state=completed]/step:scale-0 group-data-loading/step:scale-0 group-data-[state=completed]/step:opacity-0 group-data-loading/step:opacity-0 group-data-loading/step:transition-none\">\n {step}\n </span>\n <CheckIcon\n aria-hidden=\"true\"\n className=\"absolute scale-0 opacity-0 transition-all group-data-[state=completed]/step:scale-100 group-data-[state=completed]/step:opacity-100\"\n size={16}\n />\n {isLoading && (\n <span className=\"absolute transition-all\">\n <LoaderCircleIcon\n aria-hidden=\"true\"\n className=\"animate-spin\"\n size={14}\n />\n </span>\n )}\n </>\n )}\n </span>\n );\n}\n\n// StepperTitle\nfunction StepperTitle({\n className,\n ...props\n}: React.HTMLAttributes<HTMLHeadingElement>) {\n return (\n <h3\n className={cn(\"font-medium text-sm\", className)}\n data-slot=\"stepper-title\"\n {...props}\n />\n );\n}\n\n// StepperDescription\nfunction StepperDescription({\n className,\n ...props\n}: React.HTMLAttributes<HTMLParagraphElement>) {\n return (\n <p\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"stepper-description\"\n {...props}\n />\n );\n}\n\n// StepperSeparator\nfunction StepperSeparator({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\n \"m-0.5 bg-muted group-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=vertical]/stepper:h-12 group-data-[orientation=horizontal]/stepper:w-full group-data-[orientation=vertical]/stepper:w-0.5 group-data-[orientation=horizontal]/stepper:flex-1 group-data-[state=completed]/step:bg-primary\",\n className,\n )}\n data-slot=\"stepper-separator\"\n {...props}\n />\n );\n}\n\nexport {\n Stepper,\n StepperDescription,\n StepperIndicator,\n StepperItem,\n StepperSeparator,\n StepperTitle,\n StepperTrigger,\n};\n","import * as React from \"react\"\nimport { Switch as SwitchPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Switch({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof SwitchPrimitive.Root> & {\n size?: \"sm\" | \"default\"\n}) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className=\"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground\"\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Tabs as TabsPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Tabs({\n className,\n orientation = \"horizontal\",\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Root>) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n data-orientation={orientation}\n className={cn(\n \"group/tabs flex gap-2 data-horizontal:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva(\n \"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none\",\n {\n variants: {\n variant: {\n default: \"bg-muted\",\n line: \"gap-1 bg-transparent\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction TabsList({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.List> &\n VariantProps<typeof tabsListVariants>) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"tabs-trigger\"\n className={cn(\n \"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n \"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent\",\n \"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground\",\n \"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TabsContent({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Content>) {\n return (\n <TabsPrimitive.Content\n data-slot=\"tabs-content\"\n className={cn(\"flex-1 text-sm outline-none\", className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }\n","\"use client\";\n\nimport { Slot } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n// Types\ntype TimelineContextValue = {\n activeStep: number;\n setActiveStep: (step: number) => void;\n};\n\n// Context\nconst TimelineContext = React.createContext<TimelineContextValue | undefined>(\n undefined,\n);\n\nconst useTimeline = () => {\n const context = React.useContext(TimelineContext);\n if (!context) {\n throw new Error(\"useTimeline must be used within a Timeline\");\n }\n return context;\n};\n\n// Components\ninterface TimelineProps extends React.HTMLAttributes<HTMLDivElement> {\n defaultValue?: number;\n value?: number;\n onValueChange?: (value: number) => void;\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nfunction Timeline({\n defaultValue = 1,\n value,\n onValueChange,\n orientation = \"vertical\",\n className,\n ...props\n}: TimelineProps) {\n const [activeStep, setInternalStep] = React.useState(defaultValue);\n\n const setActiveStep = React.useCallback(\n (step: number) => {\n if (value === undefined) {\n setInternalStep(step);\n }\n onValueChange?.(step);\n },\n [value, onValueChange],\n );\n\n const currentStep = value ?? activeStep;\n\n return (\n <TimelineContext.Provider\n value={{ activeStep: currentStep, setActiveStep }}\n >\n <div\n className={cn(\n \"group/timeline flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col\",\n className,\n )}\n data-orientation={orientation}\n data-slot=\"timeline\"\n {...props}\n />\n </TimelineContext.Provider>\n );\n}\n\n// TimelineContent\nfunction TimelineContent({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"timeline-content\"\n {...props}\n />\n );\n}\n\n// TimelineDate\ninterface TimelineDateProps extends React.HTMLAttributes<HTMLTimeElement> {\n asChild?: boolean;\n}\n\nfunction TimelineDate({\n asChild = false,\n className,\n ...props\n}: TimelineDateProps) {\n const Comp = asChild ? Slot.Root : \"time\";\n\n return (\n <Comp\n className={cn(\n \"mb-1 block font-medium text-muted-foreground text-xs group-data-[orientation=vertical]/timeline:max-sm:h-4\",\n className,\n )}\n data-slot=\"timeline-date\"\n {...props}\n />\n );\n}\n\n// TimelineHeader\nfunction TimelineHeader({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div className={cn(className)} data-slot=\"timeline-header\" {...props} />\n );\n}\n\n// TimelineIndicator\ninterface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nfunction TimelineIndicator({\n className,\n children,\n ...props\n}: TimelineIndicatorProps) {\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute size-4 rounded-full border-2 border-primary/20 group-data-[orientation=vertical]/timeline:top-0 group-data-[orientation=horizontal]/timeline:left-0 group-data-completed/timeline-item:border-primary\",\n className,\n )}\n data-slot=\"timeline-indicator\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n// TimelineItem\ninterface TimelineItemProps extends React.HTMLAttributes<HTMLDivElement> {\n step: number;\n}\n\nfunction TimelineItem({ step, className, ...props }: TimelineItemProps) {\n const { activeStep } = useTimeline();\n\n return (\n <div\n className={cn(\n \"group/timeline-item relative flex flex-1 flex-col gap-0.5 group-data-[orientation=vertical]/timeline:ms-8 group-data-[orientation=horizontal]/timeline:mt-8 group-data-[orientation=horizontal]/timeline:not-last:pe-8 group-data-[orientation=vertical]/timeline:not-last:pb-12 has-[+[data-completed]]:[&_[data-slot=timeline-separator]]:bg-primary\",\n className,\n )}\n data-completed={step <= activeStep || undefined}\n data-slot=\"timeline-item\"\n {...props}\n />\n );\n}\n\n// TimelineSeparator\nfunction TimelineSeparator({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute self-start bg-primary/10 group-last/timeline-item:hidden group-data-[orientation=horizontal]/timeline:h-0.5 group-data-[orientation=vertical]/timeline:h-[calc(100%-1rem-0.25rem)] group-data-[orientation=horizontal]/timeline:w-[calc(100%-1rem-0.25rem)] group-data-[orientation=vertical]/timeline:w-0.5 group-data-[orientation=horizontal]/timeline:translate-x-4.5 group-data-[orientation=vertical]/timeline:translate-y-4.5\",\n className,\n )}\n data-slot=\"timeline-separator\"\n {...props}\n />\n );\n}\n\n// TimelineTitle\nfunction TimelineTitle({\n className,\n ...props\n}: React.HTMLAttributes<HTMLHeadingElement>) {\n return (\n <h3\n className={cn(\"font-medium text-sm\", className)}\n data-slot=\"timeline-title\"\n {...props}\n />\n );\n}\n\nexport {\n Timeline,\n TimelineContent,\n TimelineDate,\n TimelineHeader,\n TimelineIndicator,\n TimelineItem,\n TimelineSeparator,\n TimelineTitle,\n};\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline: \"border border-input bg-transparent hover:bg-muted\",\n },\n size: {\n default:\n \"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n sm: \"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Toggle({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>) {\n return (\n <TogglePrimitive.Root\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Toggle, toggleVariants }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { type VariantProps } from \"class-variance-authority\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { toggleVariants } from \"@/components/ui/toggle\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 2,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 2,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants>) {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t\",\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n","import * as React from \"react\"\nimport { Tooltip as TooltipPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n )\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-50 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 has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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 {children}\n <TooltipPrimitive.Arrow className=\"z-50 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\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,CAAM,CAAC;AAC7B;;;ACwEA,IAAa,MAAe,GAAe,IAAW,MAAc;CAClE,IAAI,MAAU,GAAG,OAAO;CAExB,IAAM,IAAI,MACJ,IAAK,IAAW,IAAI,IAAI,GACxB,IAAQ;EAAC;EAAS;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI,GAEhE,IAAI,KAAK,MAAM,KAAK,IAAI,CAAK,IAAI,KAAK,IAAI,CAAC,CAAC;CAElD,OAAO,OAAO,YAAY,IAAQ,KAAK,GAAG,QAAQ,CAAE,CAAC,IAAI,EAAM;AACjE,GAUa,MACX,IAA6B,CAAC,MACW;CACzC,IAAM,EACJ,cAAW,UACX,aAAU,UACV,YAAS,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CACzD,OACE,kBAAC,GAAiB,UAAlB;EACE,aAAU;EACK;EACf,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,GAAQ,EACf,GAAG,KACkD;CACrD,OAAO,kBAAC,GAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,GAAe,EACtB,GAAG,KACqD;CACxD,OAAO,kBAAC,GAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,GAAe,EACtB,cACA,gBAAa,GACb,aACA,GAAG,KACqD;CACxD,OACE,kBAAC,GAAiB,QAAlB,EAAA,UACE,kBAAC,GAAiB,SAAlB;EACE,aAAU;EACE;EACZ,WAAW,EACT,8rBACA,CACF;EACA,GAAI;YAPN,CASG,GACD,kBAAC,GAAiB,OAAlB,EAAwB,WAAU,qGAAsG,CAAA,CAChH;IACH,CAAA;AAE7B"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/utils.ts","../src/lib/use-file-upload.ts","../src/components/ui/spinner.tsx","../src/components/ui/button.tsx","../src/components/ui/dropdown-menu.tsx","../src/components/custom/actions-menu.tsx","../src/components/ui/badge.tsx","../src/components/ui/label.tsx","../src/components/ui/separator.tsx","../src/components/ui/field.tsx","../src/components/ui/dialog.tsx","../src/components/ui/input.tsx","../src/components/ui/textarea.tsx","../src/components/ui/input-group.tsx","../src/components/ui/command.tsx","../src/components/ui/popover.tsx","../src/components/custom/phone-countries.ts","../src/components/custom/advanced-input.tsx","../src/components/custom/alert-card.tsx","../src/components/custom/file-upload.tsx","../src/components/custom/advanced-select.tsx","../src/components/ui/checkbox.tsx","../src/components/ui/table.tsx","../src/components/custom/data-table.tsx","../src/components/custom/form-dialog.tsx","../src/components/ui/radio-group.tsx","../src/components/custom/card-radio-group.tsx","../src/components/custom/color-picker.tsx","../src/components/ui/alert-dialog.tsx","../src/components/custom/confirm-prompt.tsx","../src/components/custom/custom-tabs.tsx","../src/components/custom/data-cell.tsx","../src/components/custom/def-row.tsx","../src/components/custom/divider.tsx","../src/components/ui/empty.tsx","../src/components/custom/empty-state.tsx","../src/components/custom/faceted-filter.tsx","../src/components/custom/list-card.tsx","../src/components/custom/map-marker-pin.tsx","../src/components/custom/not-found.tsx","../src/components/custom/quick-stat.tsx","../src/components/ui/card.tsx","../src/components/custom/sensor-card.tsx","../src/components/ui/sheet.tsx","../src/components/custom/side-sheet.tsx","../src/components/custom/stat-card.tsx","../src/components/custom/status-list.tsx","../src/components/ui/select.tsx","../src/components/ui/calendar.tsx","../src/components/custom/date-time-range-picker-utils.ts","../src/components/custom/date-time-picker.tsx","../src/components/custom/date-time-range-picker.tsx","../src/components/ui/alert.tsx","../src/components/ui/button-group.tsx","../src/components/ui/chart.tsx","../src/components/ui/hover-card.tsx","../src/components/ui/item.tsx","../src/components/ui/map.tsx","../src/components/ui/progress.tsx","../src/components/ui/slider.tsx","../src/components/ui/sonner.tsx","../src/components/ui/stepper.tsx","../src/components/ui/switch.tsx","../src/components/ui/tabs.tsx","../src/components/ui/timeline.tsx","../src/components/ui/toggle.tsx","../src/components/ui/toggle-group.tsx","../src/components/ui/tooltip.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\"\n\nimport {\n type ChangeEvent,\n type DragEvent,\n type InputHTMLAttributes,\n useCallback,\n useRef,\n useState,\n} from \"react\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** A file that already lives on a server (e.g. previously uploaded). */\nexport type FileMetadata = {\n name: string\n size: number\n type: string\n url: string\n id: string\n}\n\n/** An entry in the uploader: either a freshly picked `File` or remote metadata. */\nexport type FileWithPreview = {\n file: File | FileMetadata\n id: string\n preview?: string\n}\n\nexport type FileUploadOptions = {\n /** Maximum number of files allowed (multiple mode). Defaults to unlimited. */\n maxFiles?: number\n /** Maximum size per file, in bytes. Defaults to unlimited. */\n maxSize?: number\n /** `accept` attribute, e.g. `\"image/*\"` or `\".pdf,.docx\"`. Defaults to `\"*\"`. */\n accept?: string\n /** Allow selecting more than one file. */\n multiple?: boolean\n /** Files to seed the uploader with (already-uploaded items). */\n initialFiles?: FileMetadata[]\n /** Called whenever the file list changes. */\n onFilesChange?: (files: FileWithPreview[]) => void\n /** Called with only the files added in the latest action. */\n onFilesAdded?: (addedFiles: FileWithPreview[]) => void\n}\n\nexport type FileUploadState = {\n files: FileWithPreview[]\n isDragging: boolean\n errors: string[]\n}\n\nexport type FileUploadActions = {\n addFiles: (files: FileList | File[]) => void\n removeFile: (id: string) => void\n clearFiles: () => void\n clearErrors: () => void\n handleDragEnter: (e: DragEvent<HTMLElement>) => void\n handleDragLeave: (e: DragEvent<HTMLElement>) => void\n handleDragOver: (e: DragEvent<HTMLElement>) => void\n handleDrop: (e: DragEvent<HTMLElement>) => void\n handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void\n openFileDialog: () => void\n getInputProps: (\n props?: InputHTMLAttributes<HTMLInputElement>\n ) => InputHTMLAttributes<HTMLInputElement> & {\n ref: React.Ref<HTMLInputElement>\n }\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Human-readable byte size, e.g. `1.46MB`. */\nexport const formatBytes = (bytes: number, decimals = 2): string => {\n if (bytes === 0) return \"0 Bytes\"\n\n const k = 1024\n const dm = decimals < 0 ? 0 : decimals\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n\n return Number.parseFloat((bytes / k ** i).toFixed(dm)) + sizes[i]\n}\n\n// ============================================================================\n// Hook\n// ============================================================================\n\n/**\n * Headless file-upload state machine: validation, drag & drop, previews, and\n * input wiring. Pair it with your own markup (see `FileUpload` for a default UI).\n */\nexport const useFileUpload = (\n options: FileUploadOptions = {}\n): [FileUploadState, FileUploadActions] => {\n const {\n maxFiles = Number.POSITIVE_INFINITY,\n maxSize = Number.POSITIVE_INFINITY,\n accept = \"*\",\n multiple = false,\n initialFiles = [],\n onFilesChange,\n onFilesAdded,\n } = options\n\n const [state, setState] = useState<FileUploadState>({\n errors: [],\n files: initialFiles.map((file) => ({\n file,\n id: file.id,\n preview: file.url,\n })),\n isDragging: false,\n })\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const validateFile = useCallback(\n (file: File | FileMetadata): string | null => {\n if (file.size > maxSize) {\n return `File \"${file.name}\" exceeds the maximum size of ${formatBytes(maxSize)}.`\n }\n\n if (accept !== \"*\") {\n const acceptedTypes = accept.split(\",\").map((type) => type.trim())\n const fileType = file instanceof File ? file.type || \"\" : file.type\n const fileExtension = `.${file.name.split(\".\").pop()}`\n\n const isAccepted = acceptedTypes.some((type) => {\n if (type.startsWith(\".\")) {\n return fileExtension.toLowerCase() === type.toLowerCase()\n }\n if (type.endsWith(\"/*\")) {\n const baseType = type.split(\"/\")[0]\n return fileType.startsWith(`${baseType}/`)\n }\n return fileType === type\n })\n\n if (!isAccepted) {\n return `File \"${file.name}\" is not an accepted file type.`\n }\n }\n\n return null\n },\n [accept, maxSize]\n )\n\n const createPreview = useCallback(\n (file: File | FileMetadata): string | undefined => {\n if (file instanceof File) {\n return URL.createObjectURL(file)\n }\n return file.url\n },\n []\n )\n\n const generateUniqueId = useCallback((file: File | FileMetadata): string => {\n if (file instanceof File) {\n return `${file.name}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n }\n return file.id\n }, [])\n\n const clearFiles = useCallback(() => {\n setState((prev) => {\n for (const file of prev.files ?? []) {\n if (\n file.preview &&\n file.file instanceof File &&\n file.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(file.preview)\n }\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\"\n }\n\n const newState = {\n ...prev,\n errors: [],\n files: [],\n }\n\n onFilesChange?.(newState.files)\n return newState\n })\n }, [onFilesChange])\n\n const addFiles = useCallback(\n (newFiles: FileList | File[]) => {\n if (!newFiles || newFiles.length === 0) return\n\n const newFilesArray = Array.from(newFiles)\n const errors: string[] = []\n\n setState((prev) => ({ ...prev, errors: [] }))\n\n if (!multiple) {\n clearFiles()\n }\n\n if (\n multiple &&\n maxFiles !== Number.POSITIVE_INFINITY &&\n state.files.length + newFilesArray.length > maxFiles\n ) {\n errors.push(`You can only upload a maximum of ${maxFiles} files.`)\n setState((prev) => ({ ...prev, errors }))\n return\n }\n\n const validFiles: FileWithPreview[] = []\n\n for (const file of newFilesArray) {\n if (multiple) {\n const isDuplicate = state.files.some(\n (existingFile) =>\n existingFile.file.name === file.name &&\n existingFile.file.size === file.size\n )\n\n if (isDuplicate) {\n continue\n }\n }\n\n if (file.size > maxSize) {\n errors.push(\n multiple\n ? `Some files exceed the maximum size of ${formatBytes(maxSize)}.`\n : `File exceeds the maximum size of ${formatBytes(maxSize)}.`\n )\n continue\n }\n\n const error = validateFile(file)\n\n if (error) {\n errors.push(error)\n continue\n }\n\n validFiles.push({\n file,\n id: generateUniqueId(file),\n preview: createPreview(file),\n })\n }\n\n if (validFiles.length > 0) {\n onFilesAdded?.(validFiles)\n\n setState((prev) => {\n const nextFiles = !multiple\n ? validFiles\n : [...prev.files, ...validFiles]\n onFilesChange?.(nextFiles)\n return {\n ...prev,\n errors,\n files: nextFiles,\n }\n })\n } else if (errors.length > 0) {\n setState((prev) => ({\n ...prev,\n errors,\n }))\n }\n\n if (inputRef.current) {\n inputRef.current.value = \"\"\n }\n },\n [\n state.files,\n maxFiles,\n multiple,\n maxSize,\n validateFile,\n createPreview,\n generateUniqueId,\n clearFiles,\n onFilesChange,\n onFilesAdded,\n ]\n )\n\n const removeFile = useCallback(\n (id: string) => {\n setState((prev) => {\n const fileToRemove = prev.files.find((file) => file.id === id)\n if (\n fileToRemove?.preview &&\n fileToRemove.file instanceof File &&\n fileToRemove.file.type.startsWith(\"image/\")\n ) {\n URL.revokeObjectURL(fileToRemove.preview)\n }\n\n const newFiles = prev.files.filter((file) => file.id !== id)\n onFilesChange?.(newFiles)\n\n return {\n ...prev,\n errors: [],\n files: newFiles,\n }\n })\n },\n [onFilesChange]\n )\n\n const clearErrors = useCallback(() => {\n setState((prev) => ({\n ...prev,\n errors: [],\n }))\n }, [])\n\n const handleDragEnter = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setState((prev) => ({ ...prev, isDragging: true }))\n }, [])\n\n const handleDragLeave = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n\n if (e.currentTarget.contains(e.relatedTarget as Node)) {\n return\n }\n\n setState((prev) => ({ ...prev, isDragging: false }))\n }, [])\n\n const handleDragOver = useCallback((e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n }, [])\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setState((prev) => ({ ...prev, isDragging: false }))\n\n if (inputRef.current?.disabled) {\n return\n }\n\n if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {\n if (!multiple) {\n const file = e.dataTransfer.files[0]\n addFiles([file])\n } else {\n addFiles(e.dataTransfer.files)\n }\n }\n },\n [addFiles, multiple]\n )\n\n const handleFileChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n addFiles(e.target.files)\n }\n },\n [addFiles]\n )\n\n const openFileDialog = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.click()\n }\n }, [])\n\n const getInputProps = useCallback(\n (props: InputHTMLAttributes<HTMLInputElement> = {}) => {\n return {\n ...props,\n accept: props.accept || accept,\n multiple: props.multiple !== undefined ? props.multiple : multiple,\n onChange: handleFileChange,\n ref: inputRef,\n type: \"file\" as const,\n }\n },\n [accept, multiple, handleFileChange]\n )\n\n return [\n state,\n {\n addFiles,\n clearErrors,\n clearFiles,\n getInputProps,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n handleFileChange,\n openFileDialog,\n removeFile,\n },\n ]\n}\n","import { cn } from \"@/lib/utils\"\nimport { Loader2Icon } from \"lucide-react\"\n\nfunction Spinner({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <Loader2Icon role=\"status\" aria-label=\"Loading\" className={cn(\"size-4 animate-spin\", className)} {...props} />\n )\n}\n\nexport { Spinner }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Spinner } from \"@/components/ui/spinner\"\n\nconst buttonVariants = cva(\n \"group/button inline-flex shrink-0 items-center justify-center rounded-sm border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n destructive:\n \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default:\n \"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n xs: \"h-6 gap-1 rounded-sm px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-7 gap-1 rounded-sm px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n icon: \"size-8\",\n \"icon-xs\":\n \"size-6 rounded-sm [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-7 rounded-sm\",\n \"icon-lg\": \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n loading = false,\n startItem,\n endItem,\n disabled,\n children,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean\n /** Show a spinner (replacing `startItem`) and disable the button. */\n loading?: boolean\n /** Content rendered before the label (e.g. an icon). */\n startItem?: React.ReactNode\n /** Content rendered after the label (e.g. an icon or count). */\n endItem?: React.ReactNode\n }) {\n const Comp = asChild ? Slot.Root : \"button\"\n\n // With asChild the child owns its markup, so don't inject affixes/spinner —\n // just pass through (loading still disables via aria/data attributes).\n const content = asChild ? (\n children\n ) : (\n <>\n {loading ? <Spinner /> : startItem}\n {children}\n {endItem}\n </>\n )\n\n return (\n <Comp\n data-slot=\"button\"\n data-variant={variant}\n data-size={size}\n data-loading={loading || undefined}\n disabled={disabled ?? (Comp === \"button\" ? loading : undefined)}\n aria-disabled={loading || undefined}\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n >\n {content}\n </Comp>\n )\n}\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CheckIcon, ChevronRightIcon } from \"lucide-react\"\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return (\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuContent({\n className,\n align = \"start\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n align={align}\n className={cn(\"z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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-[state=closed]:overflow-hidden 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\", className )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n )\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n variant?: \"default\" | \"destructive\"\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n \"relative flex cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n \"relative flex cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon\n />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n )\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n )\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\"z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-sm bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-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\", className )}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n}\n","import * as React from \"react\"\nimport { MoreVertical, type LucideIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\n\nconst ICON_SIZE = 16\n\n/** A clickable action row. */\nexport interface ActionsMenuAction {\n type?: \"action\"\n label: React.ReactNode\n icon?: LucideIcon\n onSelect?: () => void\n /** Keyboard shortcut hint shown on the right (e.g. \"⌘C\"). */\n shortcut?: string\n destructive?: boolean\n disabled?: boolean\n}\n\n/** A non-clickable section heading. */\nexport interface ActionsMenuLabelItem {\n type: \"label\"\n label: React.ReactNode\n}\n\n/** A divider between groups. */\nexport interface ActionsMenuSeparator {\n type: \"separator\"\n}\n\nexport type ActionsMenuItem =\n | ActionsMenuAction\n | ActionsMenuLabelItem\n | ActionsMenuSeparator\n\nexport interface ActionsMenuProps {\n items: ActionsMenuItem[]\n /** Custom trigger element (overrides the default icon button). */\n trigger?: React.ReactNode\n /** Trigger icon for the default button. Defaults to a vertical kebab. */\n triggerIcon?: LucideIcon\n /** Visually-hidden trigger label for screen readers. */\n triggerLabel?: string\n /** Width of the dropdown content. Defaults to \"10rem\". */\n width?: string\n align?: \"start\" | \"center\" | \"end\"\n /** Class applied to the default trigger button. */\n className?: string\n /** Controlled open state. */\n open?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\nfunction isAction(item: ActionsMenuItem): item is ActionsMenuAction {\n return item.type === undefined || item.type === \"action\"\n}\n\nexport function ActionsMenu({\n items,\n trigger,\n triggerIcon: TriggerIcon = MoreVertical,\n triggerLabel = \"Open menu\",\n width = \"10rem\",\n align = \"end\",\n className,\n open,\n onOpenChange,\n}: ActionsMenuProps) {\n return (\n <DropdownMenu open={open} onOpenChange={onOpenChange}>\n <DropdownMenuTrigger asChild>\n {trigger ?? (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-8\", className)}\n aria-label={triggerLabel}\n >\n <TriggerIcon size={ICON_SIZE} />\n <span className=\"sr-only\">{triggerLabel}</span>\n </Button>\n )}\n </DropdownMenuTrigger>\n <DropdownMenuContent align={align} style={{ width }}>\n {items.map((item, idx) => {\n if (item.type === \"separator\") {\n return <DropdownMenuSeparator key={`sep-${idx}`} />\n }\n if (item.type === \"label\") {\n return (\n <DropdownMenuLabel key={`label-${idx}`}>\n {item.label}\n </DropdownMenuLabel>\n )\n }\n if (!isAction(item)) return null\n const Icon = item.icon\n return (\n <DropdownMenuItem\n key={idx}\n onSelect={item.onSelect}\n disabled={item.disabled}\n variant={item.destructive ? \"destructive\" : \"default\"}\n >\n {Icon && <Icon size={ICON_SIZE} />}\n {item.label}\n {item.shortcut && (\n <DropdownMenuShortcut>{item.shortcut}</DropdownMenuShortcut>\n )}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n \"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n destructive:\n \"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20\",\n outline:\n \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n ghost:\n \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n // Soft-tinted color variants using the global accent tokens\n // (themes.css). The --{color} token swaps for dark mode automatically,\n // so no dark: overrides are needed.\n red: \"border-red/30 bg-red/10 text-red\",\n orange: \"border-orange/30 bg-orange/10 text-orange\",\n yellow: \"border-yellow/30 bg-yellow/10 text-yellow\",\n green: \"border-green/30 bg-green/10 text-green\",\n teal: \"border-teal/30 bg-teal/10 text-teal\",\n cyan: \"border-cyan/30 bg-cyan/10 text-cyan\",\n blue: \"border-blue/30 bg-blue/10 text-blue\",\n purple: \"border-purple/30 bg-purple/10 text-purple\",\n pink: \"border-pink/30 bg-pink/10 text-pink\",\n gray: \"border-gray/30 bg-gray/10 text-gray\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Badge({\n className,\n variant = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"span\"> &\n VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : \"span\"\n\n return (\n <Comp\n data-slot=\"badge\"\n data-variant={variant}\n className={cn(badgeVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nexport { Badge, badgeVariants }\n","import * as React from \"react\"\nimport { Label as LabelPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n \"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Label }\n","import * as React from \"react\"\nimport { Separator as SeparatorPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n decorative = true,\n ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n return (\n <SeparatorPrimitive.Root\n data-slot=\"separator\"\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Separator }\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Label } from \"@/components/ui/label\"\nimport { Separator } from \"@/components/ui/separator\"\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-destructive\",\n {\n variants: {\n orientation: {\n vertical: \"flex-col *:w-full [&>.sr-only]:w-auto\",\n horizontal:\n \"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n responsive:\n \"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n }\n)\n\nfunction Field({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-0.5 leading-snug\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLabel({\n className,\n ...props\n}: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 font-normal text-foreground leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5\",\n \"last:mt-0 nth-last-2:-mt-1\",\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const content = useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-sm font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { XIcon } from \"lucide-react\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate 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\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-sm bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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 {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-sm border-t bg-muted/50 p-4 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\n \"text-base leading-none font-medium\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Input({ className, type, ...props }: React.ComponentProps<\"input\">) {\n return (\n <input\n type={type}\n data-slot=\"input\"\n className={cn(\n \"h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Input }\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Textarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n \"flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Textarea }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Input } from \"@/components/ui/input\"\nimport { Textarea } from \"@/components/ui/textarea\"\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\":\n \"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]\",\n \"inline-end\":\n \"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]\",\n \"block-start\":\n \"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2\",\n \"block-end\":\n \"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n }\n)\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n \"flex items-center gap-2 text-sm shadow-none\",\n {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"\",\n \"icon-xs\":\n \"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n }\n)\n\nfunction InputGroupButton({\n className,\n type = \"button\",\n variant = \"ghost\",\n size = \"xs\",\n ...props\n}: Omit<React.ComponentProps<typeof Button>, \"size\"> &\n VariantProps<typeof inputGroupButtonVariants>) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({\n className,\n ...props\n}: React.ComponentProps<\"input\">) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({\n className,\n ...props\n}: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\nimport {\n InputGroup,\n InputGroupAddon,\n} from \"@/components/ui/input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\n \"top-1/3 translate-y-0 overflow-hidden rounded-md! p-0\",\n className\n )}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-md! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-sm! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CheckIcon className=\"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100\" />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n","import * as React from \"react\"\nimport { Popover as PopoverPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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 </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn(\"flex flex-col gap-0.5 text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<\"h2\">) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn(\"font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverDescription,\n PopoverHeader,\n PopoverTitle,\n PopoverTrigger,\n}\n","/** A country for the phone-input dial-code selector. */\nexport interface PhoneCountry {\n /** ISO 3166-1 alpha-2 code, e.g. \"US\". */\n iso: string\n /** Display name. */\n name: string\n /** Dial code without \"+\", e.g. \"1\", \"91\". */\n dial: string\n /** Flag emoji. */\n flag: string\n}\n\n/**\n * A curated, commonly-used set of countries. Not exhaustive — pass your own\n * `countries` to `PhoneInput` if you need the full list. Sorted by name.\n */\nexport const PHONE_COUNTRIES: PhoneCountry[] = [\n { iso: \"AU\", name: \"Australia\", dial: \"61\", flag: \"🇦🇺\" },\n { iso: \"AT\", name: \"Austria\", dial: \"43\", flag: \"🇦🇹\" },\n { iso: \"BE\", name: \"Belgium\", dial: \"32\", flag: \"🇧🇪\" },\n { iso: \"BR\", name: \"Brazil\", dial: \"55\", flag: \"🇧🇷\" },\n { iso: \"CA\", name: \"Canada\", dial: \"1\", flag: \"🇨🇦\" },\n { iso: \"CN\", name: \"China\", dial: \"86\", flag: \"🇨🇳\" },\n { iso: \"DK\", name: \"Denmark\", dial: \"45\", flag: \"🇩🇰\" },\n { iso: \"EG\", name: \"Egypt\", dial: \"20\", flag: \"🇪🇬\" },\n { iso: \"FI\", name: \"Finland\", dial: \"358\", flag: \"🇫🇮\" },\n { iso: \"FR\", name: \"France\", dial: \"33\", flag: \"🇫🇷\" },\n { iso: \"DE\", name: \"Germany\", dial: \"49\", flag: \"🇩🇪\" },\n { iso: \"GR\", name: \"Greece\", dial: \"30\", flag: \"🇬🇷\" },\n { iso: \"HK\", name: \"Hong Kong\", dial: \"852\", flag: \"🇭🇰\" },\n { iso: \"IN\", name: \"India\", dial: \"91\", flag: \"🇮🇳\" },\n { iso: \"ID\", name: \"Indonesia\", dial: \"62\", flag: \"🇮🇩\" },\n { iso: \"IE\", name: \"Ireland\", dial: \"353\", flag: \"🇮🇪\" },\n { iso: \"IL\", name: \"Israel\", dial: \"972\", flag: \"🇮🇱\" },\n { iso: \"IT\", name: \"Italy\", dial: \"39\", flag: \"🇮🇹\" },\n { iso: \"JP\", name: \"Japan\", dial: \"81\", flag: \"🇯🇵\" },\n { iso: \"MY\", name: \"Malaysia\", dial: \"60\", flag: \"🇲🇾\" },\n { iso: \"MX\", name: \"Mexico\", dial: \"52\", flag: \"🇲🇽\" },\n { iso: \"NL\", name: \"Netherlands\", dial: \"31\", flag: \"🇳🇱\" },\n { iso: \"NZ\", name: \"New Zealand\", dial: \"64\", flag: \"🇳🇿\" },\n { iso: \"NO\", name: \"Norway\", dial: \"47\", flag: \"🇳🇴\" },\n { iso: \"PK\", name: \"Pakistan\", dial: \"92\", flag: \"🇵🇰\" },\n { iso: \"PH\", name: \"Philippines\", dial: \"63\", flag: \"🇵🇭\" },\n { iso: \"PL\", name: \"Poland\", dial: \"48\", flag: \"🇵🇱\" },\n { iso: \"PT\", name: \"Portugal\", dial: \"351\", flag: \"🇵🇹\" },\n { iso: \"RU\", name: \"Russia\", dial: \"7\", flag: \"🇷🇺\" },\n { iso: \"SA\", name: \"Saudi Arabia\", dial: \"966\", flag: \"🇸🇦\" },\n { iso: \"SG\", name: \"Singapore\", dial: \"65\", flag: \"🇸🇬\" },\n { iso: \"ZA\", name: \"South Africa\", dial: \"27\", flag: \"🇿🇦\" },\n { iso: \"KR\", name: \"South Korea\", dial: \"82\", flag: \"🇰🇷\" },\n { iso: \"ES\", name: \"Spain\", dial: \"34\", flag: \"🇪🇸\" },\n { iso: \"SE\", name: \"Sweden\", dial: \"46\", flag: \"🇸🇪\" },\n { iso: \"CH\", name: \"Switzerland\", dial: \"41\", flag: \"🇨🇭\" },\n { iso: \"TW\", name: \"Taiwan\", dial: \"886\", flag: \"🇹🇼\" },\n { iso: \"TH\", name: \"Thailand\", dial: \"66\", flag: \"🇹🇭\" },\n { iso: \"TR\", name: \"Turkey\", dial: \"90\", flag: \"🇹🇷\" },\n { iso: \"AE\", name: \"United Arab Emirates\", dial: \"971\", flag: \"🇦🇪\" },\n { iso: \"GB\", name: \"United Kingdom\", dial: \"44\", flag: \"🇬🇧\" },\n { iso: \"US\", name: \"United States\", dial: \"1\", flag: \"🇺🇸\" },\n { iso: \"VN\", name: \"Vietnam\", dial: \"84\", flag: \"🇻🇳\" },\n]\n","import * as React from \"react\"\nimport { ChevronDown, Eye, EyeOff, Loader2, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { FieldDescription, FieldLabel } from \"@/components/ui/field\"\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@/components/ui/command\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport {\n PHONE_COUNTRIES,\n type PhoneCountry,\n} from \"./phone-countries\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype BaseProps = {\n /** Label rendered above the control. */\n label?: React.ReactNode\n /** Muted helper text rendered below the field (always visible). */\n description?: React.ReactNode\n /** Marks the field as invalid (forced true when `errorMessage` is set). */\n error?: boolean\n /** Message shown below the control when in an error state. */\n errorMessage?: string\n /** Hint shown below the control when NOT in an error state. */\n helperText?: string\n /** Adds a red asterisk after the label. */\n required?: boolean\n size?: \"sm\" | \"default\"\n /** `default` uses the input background; `alt` uses the muted background. */\n variant?: \"default\" | \"alt\"\n /** Icon rendered inside the control, on the left. */\n leftIcon?: React.ReactNode\n /** Icon rendered inside the control, on the right. */\n rightIcon?: React.ReactNode\n /** Affix rendered as an attached segment before the input (input-group). */\n startItem?: React.ReactNode\n /** Affix rendered as an attached segment after the input (input-group). */\n endItem?: React.ReactNode\n /** Replaces the left icon with a spinner while true. */\n loading?: boolean\n /** Class for the outer wrapper element. */\n wrapperClassName?: string\n}\n\ntype InputProps = BaseProps &\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> & {\n as?: \"input\"\n }\n\ntype TextareaProps = BaseProps &\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\"> & {\n as: \"textarea\"\n }\n\ntype TagsProps = BaseProps & {\n as: \"tags\"\n /** Current tags. Controlled. */\n value: string[]\n /** Called with the new tags array. */\n onChange: (tags: string[]) => void\n placeholder?: string\n disabled?: boolean\n className?: string\n id?: string\n /**\n * Where the chips render:\n * - `inside` (default): chips sit inside the field, before the cursor.\n * - `below`: the input stays single-line; chips render below it.\n */\n badgePosition?: \"inside\" | \"below\"\n /** Keys that commit the current text as a tag. Default `[\",\", \"Enter\"]`. */\n separators?: string[]\n /** Prevent duplicate tags (case-insensitive). Default `true`. */\n dedupe?: boolean\n /** Max number of tags. */\n maxTags?: number\n}\n\nexport type AdvancedInputProps = InputProps | TextareaProps | TagsProps\n\n// ============================================================================\n// Shared field-message rendering\n// ============================================================================\n\nfunction FieldMessages({\n error,\n errorMessage,\n helperText,\n errorId,\n helperId,\n}: {\n error: boolean\n errorMessage?: string\n helperText?: string\n errorId: string\n helperId: string\n}) {\n if (!errorMessage && !helperText) return null\n return (\n <div className=\"mt-1.5 min-h-5\">\n {error && errorMessage ? (\n <p id={errorId} className=\"text-xs leading-5 text-destructive\">\n {errorMessage}\n </p>\n ) : !error && helperText ? (\n <p id={helperId} className=\"text-xs leading-5 text-muted-foreground\">\n {helperText}\n </p>\n ) : null}\n </div>\n )\n}\n\n// ============================================================================\n// AdvancedInput\n// ============================================================================\n\nexport const AdvancedInput = React.forwardRef<\n HTMLInputElement | HTMLTextAreaElement,\n AdvancedInputProps\n>(function AdvancedInput(props, ref) {\n // Tags variant is self-contained (no shared hooks below).\n if (props.as === \"tags\") {\n return <TagsField {...props} />\n }\n\n const {\n className,\n wrapperClassName,\n label,\n description,\n errorMessage,\n helperText,\n required = false,\n size = \"default\",\n variant = \"default\",\n leftIcon,\n rightIcon,\n disabled,\n startItem,\n endItem,\n loading = false,\n as = \"input\",\n id: providedId,\n error: errorProp,\n ...rest\n } = props\n\n // An explicit errorMessage implies the error state.\n const error = errorProp ?? Boolean(errorMessage)\n\n const reactId = React.useId()\n const inputId = providedId || reactId\n\n // Declared before any early return so hook order stays stable.\n const [showPassword, setShowPassword] = React.useState(false)\n const errorId = `${inputId}-error`\n const helperId = `${inputId}-helper`\n const descriptionId = `${inputId}-description`\n\n const describedBy =\n [\n error && errorMessage ? errorId : null,\n !error && helperText ? helperId : null,\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n\n const bgClass =\n variant === \"alt\" ? \"bg-input-background-alt\" : \"bg-input-background\"\n\n const Asterisk = required ? (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n ) : null\n\n // ---- Textarea branch -----------------------------------------------------\n if (as === \"textarea\") {\n const textareaProps = rest as React.TextareaHTMLAttributes<HTMLTextAreaElement>\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n <textarea\n id={inputId}\n ref={ref as React.Ref<HTMLTextAreaElement>}\n disabled={disabled}\n aria-invalid={error}\n aria-describedby={describedBy}\n className={cn(\n \"flex min-h-20 w-full rounded-sm border border-border px-3 py-2 text-sm outline-none transition-[color,box-shadow] placeholder:text-foreground/50\",\n bgClass,\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n \"disabled:pointer-events-none disabled:cursor-not-allowed disabled:text-muted-foreground\",\n \"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...textareaProps}\n />\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n }\n\n // ---- Input branch --------------------------------------------------------\n const { type: rawType, onFocus, ...inputRest } =\n rest as React.InputHTMLAttributes<HTMLInputElement>\n const baseType = rawType ?? \"text\"\n\n const isPassword = baseType === \"password\"\n const type = isPassword && showPassword ? \"text\" : baseType\n\n const passwordToggle = isPassword ? (\n <button\n type=\"button\"\n onClick={() => setShowPassword((v) => !v)}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n className=\"cursor-pointer text-muted-foreground transition-colors hover:text-foreground\"\n tabIndex={-1}\n >\n {showPassword ? (\n <EyeOff className=\"size-4\" />\n ) : (\n <Eye className=\"size-4\" />\n )}\n </button>\n ) : null\n\n const effectiveLeftIcon = loading ? (\n <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />\n ) : (\n leftIcon\n )\n const effectiveRightIcon = isPassword ? passwordToggle : rightIcon\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n // Select-all on number focus so typing replaces the value.\n if (type === \"number\") e.target.select()\n onFocus?.(e)\n }\n\n const isInputGroup = Boolean(startItem || endItem)\n\n const focusRing =\n \"focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50\"\n const invalidRing =\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-3 aria-[invalid=true]:ring-destructive/20 dark:aria-[invalid=true]:ring-destructive/40\"\n\n const bareInput = (\n <input\n id={inputId}\n type={type}\n ref={ref as React.Ref<HTMLInputElement>}\n disabled={disabled}\n aria-invalid={error}\n aria-describedby={describedBy}\n onFocus={handleFocus}\n className={cn(\n \"w-full min-w-0 bg-transparent text-sm text-foreground outline-none placeholder:text-foreground/50 disabled:cursor-not-allowed disabled:text-muted-foreground\",\n // standalone vs. inside a group\n isInputGroup\n ? \"h-full border-0 py-1 focus-visible:ring-0\"\n : cn(\n // Use pl-3/pr-3 (not px-3) so the icon padding overrides cleanly —\n // tailwind-merge replaces pl-3 with pl-9 reliably (px-3 confuses it).\n // Disabled keeps its solid fill (no opacity) so the input still\n // contrasts with its container — only the text/cursor signal it.\n \"rounded-sm border border-border pl-3 pr-3 py-1 transition-[color,box-shadow]\",\n bgClass,\n size === \"default\" ? \"h-8.5\" : \"h-7\",\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:ring-destructive/40\",\n effectiveLeftIcon && \"pl-9\",\n effectiveRightIcon && \"pr-9\",\n ),\n // padding inside group — sit flush against a segment (which supplies its\n // own inset), else pad from the field edge. Matches ARGUS's pl-0/pr-0\n // next to a start/end item. Use pl-*/pr-* (not px-*) so the icon padding\n // below overrides cleanly.\n isInputGroup && (startItem ? \"pl-0\" : \"pl-3\"),\n isInputGroup && (endItem ? \"pr-0\" : \"pr-3\"),\n isInputGroup && effectiveLeftIcon && !startItem && \"pl-9\",\n isInputGroup && effectiveRightIcon && !endItem && \"pr-9\",\n isInputGroup && effectiveLeftIcon && startItem && \"pl-6\",\n isInputGroup && effectiveRightIcon && endItem && \"pr-6\",\n className,\n )}\n {...inputRest}\n />\n )\n\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n\n {isInputGroup ? (\n <div\n aria-invalid={error}\n className={cn(\n \"flex items-center overflow-hidden rounded-sm border border-border transition-[color,box-shadow]\",\n bgClass,\n size === \"default\" ? \"h-9\" : \"h-8\",\n focusRing,\n invalidRing,\n disabled && \"cursor-not-allowed\",\n )}\n >\n {startItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-3 pr-2 text-sm text-muted-foreground [&_svg]:size-4\">\n {startItem}\n </div>\n )}\n <div className=\"relative flex h-full flex-1 items-center\">\n {effectiveLeftIcon && (\n <div className=\"pointer-events-none absolute left-3 flex items-center text-muted-foreground [&_svg]:size-4\">\n {effectiveLeftIcon}\n </div>\n )}\n {bareInput}\n {effectiveRightIcon && (\n <div className=\"absolute right-3 z-10 flex items-center\">\n {effectiveRightIcon}\n </div>\n )}\n </div>\n {endItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-2 pr-3 text-sm text-foreground [&_svg]:size-4\">\n {endItem}\n </div>\n )}\n </div>\n ) : (\n <div className=\"relative\">\n {effectiveLeftIcon && (\n <div className=\"pointer-events-none absolute left-3 top-1/2 flex -translate-y-1/2 items-center text-muted-foreground [&_svg]:size-4\">\n {effectiveLeftIcon}\n </div>\n )}\n {bareInput}\n {effectiveRightIcon && (\n <div className=\"absolute right-3 top-1/2 z-10 flex -translate-y-1/2 items-center\">\n {effectiveRightIcon}\n </div>\n )}\n </div>\n )}\n\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n})\n\nAdvancedInput.displayName = \"AdvancedInput\"\n\n// ============================================================================\n// Tags field (AdvancedInput as=\"tags\")\n// ============================================================================\n\nfunction TagChip({\n children,\n onRemove,\n disabled,\n}: {\n children: React.ReactNode\n onRemove: () => void\n disabled?: boolean\n}) {\n return (\n <Badge variant=\"default\" className=\"gap-1 pr-1 font-normal\">\n <span className=\"truncate\">{children}</span>\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`Remove ${children}`}\n onClick={onRemove}\n tabIndex={-1}\n className=\"flex size-3.5 items-center justify-center rounded-sm text-primary-foreground/80 transition-colors hover:bg-primary-foreground/20 hover:text-primary-foreground\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </Badge>\n )\n}\n\nfunction TagsField({\n value,\n onChange,\n label,\n description,\n errorMessage,\n helperText,\n required = false,\n size = \"default\",\n variant = \"default\",\n disabled,\n placeholder = \"Add and press Enter…\",\n badgePosition = \"inside\",\n separators = [\",\", \"Enter\"],\n dedupe = true,\n maxTags,\n error: errorProp,\n className,\n wrapperClassName,\n id: providedId,\n}: TagsProps) {\n const [draft, setDraft] = React.useState(\"\")\n const inputRef = React.useRef<HTMLInputElement>(null)\n const reactId = React.useId()\n const inputId = providedId || reactId\n const errorId = `${inputId}-error`\n const helperId = `${inputId}-helper`\n const descriptionId = `${inputId}-description`\n\n const error = errorProp ?? Boolean(errorMessage)\n const bgClass =\n variant === \"alt\" ? \"bg-input-background-alt\" : \"bg-input-background\"\n const inside = badgePosition === \"inside\"\n\n const addTag = (raw: string) => {\n const tag = raw.trim()\n if (!tag) return\n if (dedupe && value.some((v) => v.toLowerCase() === tag.toLowerCase())) return\n if (maxTags != null && value.length >= maxTags) return\n onChange([...value, tag])\n }\n\n const commitDraft = () => {\n if (draft.trim()) {\n addTag(draft)\n setDraft(\"\")\n }\n }\n\n const removeAt = (index: number) =>\n onChange(value.filter((_, i) => i !== index))\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (separators.includes(e.key)) {\n e.preventDefault()\n commitDraft()\n } else if (e.key === \"Backspace\" && draft === \"\" && value.length > 0) {\n removeAt(value.length - 1)\n }\n }\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const text = e.target.value\n // Splitting pasted/typed text containing a comma separator into tags.\n if (separators.includes(\",\") && text.includes(\",\")) {\n const parts = text.split(\",\")\n const last = parts.pop() ?? \"\"\n parts.forEach((p) => addTag(p))\n setDraft(last)\n } else {\n setDraft(text)\n }\n }\n\n return (\n <div className={cn(\"space-y-1.5\", wrapperClassName)}>\n {label && (\n <FieldLabel\n htmlFor={inputId}\n className={cn(disabled && \"text-muted-foreground\")}\n >\n {label}\n {required && (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n )}\n </FieldLabel>\n )}\n\n <div\n onClick={() => inputRef.current?.focus()}\n aria-invalid={error}\n className={cn(\n \"flex w-full cursor-text rounded-sm border border-border transition-[color,box-shadow]\",\n bgClass,\n \"focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50\",\n \"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n disabled && \"cursor-not-allowed\",\n inside\n ? \"min-h-9 flex-wrap items-center gap-1.5 px-2 py-1.5\"\n : cn(\"items-center px-3\", size === \"default\" ? \"h-9\" : \"h-8\"),\n className,\n )}\n >\n {inside &&\n value.map((tag, i) => (\n <TagChip key={`${tag}-${i}`} onRemove={() => removeAt(i)} disabled={disabled}>\n {tag}\n </TagChip>\n ))}\n <input\n id={inputId}\n ref={inputRef}\n value={draft}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onBlur={commitDraft}\n disabled={disabled}\n placeholder={value.length === 0 || !inside ? placeholder : \"\"}\n aria-invalid={error}\n aria-describedby={error && errorMessage ? errorId : undefined}\n className=\"min-w-24 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-foreground/50 disabled:cursor-not-allowed disabled:text-muted-foreground\"\n />\n </div>\n\n {/* Chips below the input */}\n {!inside && value.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {value.map((tag, i) => (\n <TagChip key={`${tag}-${i}`} onRemove={() => removeAt(i)} disabled={disabled}>\n {tag}\n </TagChip>\n ))}\n </div>\n )}\n\n <FieldMessages\n error={error}\n errorMessage={errorMessage}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n {description && (\n <FieldDescription id={descriptionId}>{description}</FieldDescription>\n )}\n </div>\n )\n}\n\n// ============================================================================\n// Country code selector (used by PhoneInput as a startItem)\n// ============================================================================\n\nfunction CountryCodeSelect({\n country,\n countries,\n onSelect,\n disabled,\n}: {\n country: PhoneCountry\n countries: PhoneCountry[]\n onSelect: (c: PhoneCountry) => void\n disabled?: boolean\n}) {\n const [open, setOpen] = React.useState(false)\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n // Fill the startItem segment (pl-3 pr-2) flush by cancelling its inset.\n className=\"-ml-3 -mr-2 flex h-full items-center gap-1.5 pl-3 pr-2 text-sm text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted disabled:pointer-events-none\"\n >\n <span className=\"text-base leading-none\">{country.flag}</span>\n <span className=\"font-medium\">+{country.dial}</span>\n <ChevronDown className=\"size-3.5 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-64 p-0\" align=\"start\">\n <Command\n filter={(value, search) =>\n value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0\n }\n >\n <CommandInput placeholder=\"Search country…\" />\n <CommandList>\n <CommandEmpty>No country found.</CommandEmpty>\n {countries.map((c) => (\n <CommandItem\n key={c.iso}\n value={`${c.name} +${c.dial} ${c.iso}`}\n onSelect={() => {\n onSelect(c)\n setOpen(false)\n }}\n >\n <span className=\"text-base leading-none\">{c.flag}</span>\n <span className=\"flex-1 truncate\">{c.name}</span>\n <span className=\"text-muted-foreground\">+{c.dial}</span>\n </CommandItem>\n ))}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n\n// ============================================================================\n// PhoneInput — AdvancedInput with a country-code selector\n// ============================================================================\n\nexport interface PhoneInputProps\n extends Omit<\n InputProps,\n \"as\" | \"startItem\" | \"value\" | \"onChange\" | \"type\" | \"defaultValue\"\n > {\n /** Full phone value in E.164-ish form, e.g. \"+919876543210\". Controlled. */\n value?: string\n /** Called with the combined \"+{dial}{number}\" string. */\n onChange?: (value: string) => void\n /** Default selected country ISO (e.g. \"US\"). */\n defaultCountry?: string\n /** Country list. Defaults to a curated common set. */\n countries?: PhoneCountry[]\n}\n\n/**\n * A phone-number field: a searchable country dial-code selector attached to a\n * number input, built on `AdvancedInput`. Controlled via `value`/`onChange`,\n * which use the combined `+{dial}{number}` string. No external dependency — pass\n * your own `countries` for the full list.\n */\nexport const PhoneInput = React.forwardRef<HTMLInputElement, PhoneInputProps>(\n function PhoneInput(\n {\n value = \"\",\n onChange,\n defaultCountry = \"US\",\n countries = PHONE_COUNTRIES,\n placeholder = \"Phone number\",\n disabled,\n ...props\n },\n ref,\n ) {\n // Resolve the country from the value's dial prefix (longest match wins),\n // falling back to defaultCountry.\n const fallback =\n countries.find((c) => c.iso === defaultCountry) ?? countries[0]\n\n const matched = React.useMemo(() => {\n if (!value.startsWith(\"+\")) return null\n const digits = value.slice(1)\n // Prefer the longest dial code that prefixes the value.\n return (\n [...countries]\n .sort((a, b) => b.dial.length - a.dial.length)\n .find((c) => digits.startsWith(c.dial)) ?? null\n )\n }, [value, countries])\n\n const [country, setCountry] = React.useState<PhoneCountry>(\n matched ?? fallback,\n )\n\n // Displayed country: keep the user's explicit selection while its dial still\n // prefixes the value (so shared dial codes like US/CA +1 don't flip);\n // otherwise fall back to the dial-prefix match.\n const display =\n value.startsWith(\"+\") && value.slice(1).startsWith(country.dial)\n ? country\n : (matched ?? country)\n\n // The national number = value minus the \"+dial\" prefix.\n const activeDial = display.dial\n const nationalNumber =\n value.startsWith(\"+\") && value.slice(1).startsWith(activeDial)\n ? value.slice(1 + activeDial.length)\n : \"\"\n\n const emit = (dial: string, number: string) => {\n const clean = number.replace(/[^\\d]/g, \"\")\n onChange?.(`+${dial}${clean}`)\n }\n\n const handleCountry = (c: PhoneCountry) => {\n setCountry(c)\n emit(c.dial, nationalNumber)\n }\n\n return (\n <AdvancedInput\n ref={ref}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n placeholder={placeholder}\n disabled={disabled}\n value={nationalNumber}\n onChange={(e) => emit(activeDial, e.currentTarget.value)}\n startItem={\n <CountryCodeSelect\n country={display}\n countries={countries}\n onSelect={handleCountry}\n disabled={disabled}\n />\n }\n {...props}\n />\n )\n },\n)\n\nPhoneInput.displayName = \"PhoneInput\"\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n CircleCheckIcon,\n CircleXIcon,\n InfoIcon,\n TriangleAlertIcon,\n XIcon,\n type LucideIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type AlertSeverity = \"info\" | \"warning\" | \"error\" | \"success\"\nexport type AlertCardVariant = \"filled\" | \"outline\"\n\nexport interface AlertCardProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Severity — sets the accent color and default icon. */\n severity?: AlertSeverity\n /**\n * - `filled`: a soft tinted background (compact).\n * - `outline`: a bordered card with an icon box and room for actions.\n */\n variant?: AlertCardVariant\n /** Override the default severity icon. */\n icon?: React.ReactNode\n /** Heading. */\n title?: React.ReactNode\n /** Supporting text. */\n description?: React.ReactNode\n /** Small badge beside the title (outline variant). */\n badge?: React.ReactNode\n /** Action buttons rendered below the description (outline variant). */\n actions?: React.ReactNode\n /** Show a dismiss (×) button. */\n dismissible?: boolean\n /** Called when the dismiss button is clicked. */\n onDismiss?: () => void\n}\n\n// ============================================================================\n// Severity tokens (theme-aware)\n// ============================================================================\n\n// Literal class strings (not interpolated) so Tailwind can detect them.\nconst SEVERITY: Record<\n AlertSeverity,\n {\n icon: LucideIcon\n badge: \"blue\" | \"orange\" | \"red\" | \"green\"\n /** filled: tinted bg + border + text. */\n filled: string\n /** outline: the icon box. */\n iconBox: string\n /** primary action button background. */\n actionBtn: string\n }\n> = {\n info: {\n icon: InfoIcon,\n badge: \"blue\",\n filled: \"border-blue/30 bg-blue/10 text-blue\",\n iconBox: \"bg-blue/10 text-blue\",\n actionBtn: \"bg-blue text-white hover:bg-blue/90\",\n },\n warning: {\n icon: TriangleAlertIcon,\n badge: \"orange\",\n filled: \"border-orange/30 bg-orange/10 text-orange\",\n iconBox: \"bg-orange/10 text-orange\",\n actionBtn: \"bg-orange text-white hover:bg-orange/90\",\n },\n error: {\n icon: CircleXIcon,\n badge: \"red\",\n filled: \"border-red/30 bg-red/10 text-red\",\n iconBox: \"bg-red/10 text-red\",\n actionBtn: \"bg-red text-white hover:bg-red/90\",\n },\n success: {\n icon: CircleCheckIcon,\n badge: \"green\",\n filled: \"border-green/30 bg-green/10 text-green\",\n iconBox: \"bg-green/10 text-green\",\n actionBtn: \"bg-green text-white hover:bg-green/90\",\n },\n}\n\n// ============================================================================\n// Alert Card\n// ============================================================================\n\n/**\n * A higher-level alert with two looks — `filled` (soft tinted background) and\n * `outline` (bordered card with an icon box and actions) — across four\n * severities (info / warning / error / success). Theme-aware: severities map to\n * the blue / orange / red / green tokens.\n */\nexport function AlertCard({\n severity = \"info\",\n variant = \"filled\",\n icon,\n title,\n description,\n badge,\n actions,\n dismissible = false,\n onDismiss,\n className,\n ...props\n}: AlertCardProps) {\n const meta = SEVERITY[severity]\n const Sev = meta.icon\n\n const dismissBtn = dismissible && (\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n onClick={onDismiss}\n className=\"-mr-1 -mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md text-current/60 transition-colors hover:bg-current/10 hover:text-current\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n )\n\n // --- Filled: soft tinted background -------------------------------------\n if (variant === \"filled\") {\n return (\n <div\n role=\"alert\"\n data-slot=\"alert-card\"\n data-severity={severity}\n className={cn(\n \"flex items-start gap-2.5 rounded-lg border p-3\",\n meta.filled,\n className\n )}\n {...props}\n >\n <span className=\"mt-0.5 shrink-0 [&_svg]:size-4\">\n {icon ?? <Sev />}\n </span>\n <div className=\"min-w-0 flex-1\">\n {title != null && (\n <p className=\"text-sm font-medium\">{title}</p>\n )}\n {description != null && (\n <p className=\"text-sm/relaxed text-foreground/70\">{description}</p>\n )}\n </div>\n {dismissBtn}\n </div>\n )\n }\n\n // --- Outline: bordered card with icon box + actions ---------------------\n return (\n <div\n role=\"alert\"\n data-slot=\"alert-card\"\n data-severity={severity}\n className={cn(\n \"flex items-start gap-3 rounded-xl border bg-card p-3.5\",\n className\n )}\n {...props}\n >\n <span\n className={cn(\n \"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4.5\",\n meta.iconBox\n )}\n >\n {icon ?? <Sev />}\n </span>\n\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n {title != null && (\n <p className=\"text-sm font-medium text-foreground\">{title}</p>\n )}\n {badge != null && (\n <Badge variant={meta.badge} className=\"text-[10px]\">\n {badge}\n </Badge>\n )}\n </div>\n {description != null && (\n <p className=\"mt-1 text-sm/relaxed text-muted-foreground\">\n {description}\n </p>\n )}\n {actions != null && (\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">{actions}</div>\n )}\n </div>\n\n {dismissBtn}\n </div>\n )\n}\n\n/** A primary action button tinted to the alert's severity. */\nexport function AlertCardAction({\n severity = \"info\",\n className,\n ...props\n}: React.ComponentProps<typeof Button> & { severity?: AlertSeverity }) {\n return (\n <Button\n size=\"sm\"\n className={cn(SEVERITY[severity].actionBtn, className)}\n {...props}\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n AlertCircleIcon,\n FileArchiveIcon,\n FileIcon,\n FileSpreadsheetIcon,\n FileTextIcon,\n HeadphonesIcon,\n ImageIcon,\n ImageUpIcon,\n Trash2Icon,\n UploadIcon,\n VideoIcon,\n XIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n formatBytes,\n useFileUpload,\n type FileMetadata,\n type FileWithPreview,\n} from \"@/lib/use-file-upload\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type FileUploadProps = {\n /**\n * `image` renders a single-image dropzone with an inline preview overlay.\n * `files` renders a multi-file grid with per-file cards. Defaults to `image`.\n */\n variant?: \"image\" | \"files\"\n /** `accept` attribute, e.g. `\"image/*\"` or `\".pdf,.png\"`. */\n accept?: string\n /** Maximum size per file, in bytes. */\n maxSize?: number\n /** Maximum number of files (`files` variant). */\n maxFiles?: number\n /** Allow more than one file. Forced on for the `files` variant. */\n multiple?: boolean\n /** Files to seed the uploader with (already-uploaded items). */\n initialFiles?: FileMetadata[]\n /** Disables the dropzone and hides the file input. */\n disabled?: boolean\n /** Called whenever the file list changes. */\n onFilesChange?: (files: FileWithPreview[]) => void\n /** Class for the outer wrapper element. */\n className?: string\n}\n\ntype EntryFile = File | FileMetadata\n\n// ============================================================================\n// File-type helpers (files variant)\n// ============================================================================\n\nconst FILE_ICON_MATCHERS: {\n match: (type: string, name: string) => boolean\n Icon: React.ComponentType<{ className?: string }>\n}[] = [\n {\n match: (type, name) =>\n type.includes(\"zip\") ||\n type.includes(\"archive\") ||\n name.endsWith(\".zip\") ||\n name.endsWith(\".rar\"),\n Icon: FileArchiveIcon,\n },\n { match: (type) => type.includes(\"audio/\"), Icon: HeadphonesIcon },\n {\n match: (type, name) =>\n type.includes(\"excel\") ||\n name.endsWith(\".xls\") ||\n name.endsWith(\".xlsx\"),\n Icon: FileSpreadsheetIcon,\n },\n { match: (type) => type.startsWith(\"image/\"), Icon: ImageIcon },\n {\n match: (type, name) =>\n type.includes(\"pdf\") ||\n name.endsWith(\".pdf\") ||\n type.includes(\"word\") ||\n name.endsWith(\".doc\") ||\n name.endsWith(\".docx\"),\n Icon: FileTextIcon,\n },\n { match: (type) => type.includes(\"video/\"), Icon: VideoIcon },\n]\n\nfunction getFileIcon(file: EntryFile) {\n for (const { match, Icon } of FILE_ICON_MATCHERS) {\n if (match(file.type, file.name)) {\n return <Icon className=\"size-5 opacity-60\" />\n }\n }\n return <FileIcon className=\"size-5 opacity-60\" />\n}\n\nfunction FilePreview({ entry }: { entry: FileWithPreview }) {\n const { file } = entry\n const isImage = file.type.startsWith(\"image/\")\n\n return (\n <div className=\"flex aspect-square items-center justify-center overflow-hidden rounded-t-[inherit] bg-accent\">\n {isImage && entry.preview ? (\n <img\n alt={file.name}\n className=\"size-full rounded-t-[inherit] object-cover\"\n src={entry.preview}\n />\n ) : (\n getFileIcon(file)\n )}\n </div>\n )\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nfunction FileUpload({\n variant = \"image\",\n accept = \"image/*\",\n maxSize = 5 * 1024 * 1024,\n maxFiles = 6,\n multiple,\n initialFiles,\n disabled,\n onFilesChange,\n className,\n}: FileUploadProps) {\n const isMulti = variant === \"files\" ? true : (multiple ?? false)\n\n const [\n { files, isDragging, errors },\n {\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n openFileDialog,\n removeFile,\n clearFiles,\n getInputProps,\n },\n ] = useFileUpload({\n accept,\n maxSize,\n maxFiles,\n multiple: isMulti,\n initialFiles,\n onFilesChange,\n })\n\n const maxSizeLabel = formatBytes(maxSize)\n\n const errorBlock = errors.length > 0 && (\n <div\n className=\"flex items-center gap-1 text-destructive text-xs\"\n role=\"alert\"\n >\n <AlertCircleIcon className=\"size-3 shrink-0\" />\n <span>{errors[0]}</span>\n </div>\n )\n\n // --- Single image variant -------------------------------------------------\n if (variant === \"image\") {\n const previewUrl = files[0]?.preview || null\n const firstFile = files[0]\n\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div className=\"relative\">\n <div\n className=\"relative flex min-h-52 flex-col items-center justify-center overflow-hidden rounded-xl border border-input border-dashed p-4 transition-colors hover:bg-accent/50 has-disabled:pointer-events-none has-[img]:border-none has-disabled:opacity-50 has-[input:focus]:border-ring has-[input:focus]:ring-[3px] has-[input:focus]:ring-ring/50 data-[dragging=true]:bg-accent/50\"\n data-dragging={isDragging || undefined}\n onClick={disabled ? undefined : openFileDialog}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n role=\"button\"\n tabIndex={-1}\n >\n <input\n {...getInputProps({ disabled })}\n aria-label=\"Upload image file\"\n className=\"sr-only\"\n />\n {previewUrl ? (\n <div className=\"absolute inset-0 overflow-hidden rounded-xl\">\n <img\n alt={firstFile?.file?.name || \"Uploaded image\"}\n className=\"size-full rounded-xl object-cover\"\n src={previewUrl}\n />\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center px-4 py-3 text-center\">\n <div\n aria-hidden=\"true\"\n className=\"mb-2 flex size-11 shrink-0 items-center justify-center rounded-full border bg-background\"\n >\n <ImageUpIcon className=\"size-4 opacity-60\" />\n </div>\n <p className=\"mb-1.5 font-medium text-sm\">\n Drop your image here or click to browse\n </p>\n <p className=\"text-muted-foreground text-xs\">\n Max size: {maxSizeLabel}\n </p>\n </div>\n )}\n </div>\n {previewUrl && (\n <div className=\"absolute top-4 right-4\">\n <button\n aria-label=\"Remove image\"\n className=\"z-50 flex size-8 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white outline-none transition-[color,box-shadow] hover:bg-black/80 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n onClick={() => firstFile && removeFile(firstFile.id)}\n type=\"button\"\n >\n <XIcon aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </div>\n )}\n </div>\n\n {errorBlock}\n </div>\n )\n }\n\n // --- Multi-file variant ---------------------------------------------------\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div\n className=\"relative flex min-h-52 flex-col items-center not-data-files:justify-center overflow-hidden rounded-xl border border-input border-dashed p-4 transition-colors has-disabled:pointer-events-none has-disabled:opacity-50 has-[input:focus]:border-ring has-[input:focus]:ring-[3px] has-[input:focus]:ring-ring/50 data-[dragging=true]:bg-accent/50\"\n data-dragging={isDragging || undefined}\n data-files={files.length > 0 || undefined}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n >\n <input\n {...getInputProps({ disabled })}\n aria-label=\"Upload files\"\n className=\"sr-only\"\n />\n {files.length > 0 ? (\n <div className=\"flex w-full flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-2\">\n <h3 className=\"truncate font-medium text-sm\">\n Files ({files.length})\n </h3>\n <div className=\"flex gap-2\">\n <Button\n disabled={disabled}\n onClick={openFileDialog}\n size=\"sm\"\n variant=\"outline\"\n >\n <UploadIcon\n aria-hidden=\"true\"\n className=\"-ms-0.5 size-3.5 opacity-60\"\n />\n Add files\n </Button>\n <Button\n disabled={disabled}\n onClick={clearFiles}\n size=\"sm\"\n variant=\"outline\"\n >\n <Trash2Icon\n aria-hidden=\"true\"\n className=\"-ms-0.5 size-3.5 opacity-60\"\n />\n Remove all\n </Button>\n </div>\n </div>\n\n <div className=\"grid grid-cols-2 gap-4 md:grid-cols-3\">\n {files.map((entry) => (\n <div\n className=\"relative flex flex-col rounded-md border bg-background\"\n key={entry.id}\n >\n <FilePreview entry={entry} />\n <Button\n aria-label=\"Remove file\"\n className=\"-top-2 -right-2 absolute size-6 rounded-full border-2 border-background shadow-none focus-visible:border-background\"\n onClick={() => removeFile(entry.id)}\n size=\"icon\"\n >\n <XIcon className=\"size-3.5\" />\n </Button>\n <div className=\"flex min-w-0 flex-col gap-0.5 border-t p-3\">\n <p className=\"truncate font-medium text-[13px]\">\n {entry.file.name}\n </p>\n <p className=\"truncate text-muted-foreground text-xs\">\n {formatBytes(entry.file.size)}\n </p>\n </div>\n </div>\n ))}\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center px-4 py-3 text-center\">\n <div\n aria-hidden=\"true\"\n className=\"mb-2 flex size-11 shrink-0 items-center justify-center rounded-full border bg-background\"\n >\n <ImageIcon className=\"size-4 opacity-60\" />\n </div>\n <p className=\"mb-1.5 font-medium text-sm\">Drop your files here</p>\n <p className=\"text-muted-foreground text-xs\">\n Max {maxFiles} files ∙ Up to {maxSizeLabel}\n </p>\n <Button\n className=\"mt-4\"\n disabled={disabled}\n onClick={openFileDialog}\n variant=\"outline\"\n >\n <UploadIcon aria-hidden=\"true\" className=\"-ms-1 opacity-60\" />\n Select files\n </Button>\n </div>\n )}\n </div>\n\n {errorBlock}\n </div>\n )\n}\n\nexport { FileUpload }\n","import * as React from \"react\"\nimport {\n CheckIcon,\n ChevronDownIcon,\n Loader2,\n PlusIcon,\n XIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from \"@/components/ui/command\"\nimport { FieldDescription, FieldLabel } from \"@/components/ui/field\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AdvancedSelectOption {\n value: string\n label: string\n description?: string\n icon?: React.ReactNode\n image?: string\n disabled?: boolean\n badge?: string\n}\n\nexport interface AdvancedSelectGroup {\n label: string\n options: AdvancedSelectOption[]\n}\n\n// An item the consumer passes in: a plain string, a ready-made option, or an\n// arbitrary object resolved through getOptionLabel / getOptionValue.\ntype RawOption<T> = string | AdvancedSelectOption | T\n\nexport interface AdvancedSelectProps<T = AdvancedSelectOption> {\n options?: RawOption<T>[]\n groups?: AdvancedSelectGroup[]\n value?: string | string[] | T | T[]\n onValueChange?: (value: string | string[] | T | T[]) => void\n placeholder?: string\n disabled?: boolean\n error?: boolean\n errorMessage?: string\n multiple?: boolean\n className?: string\n size?: \"sm\" | \"default\"\n /** `default` uses the input background; `alt` uses the muted background. */\n variant?: \"default\" | \"alt\"\n searchable?: boolean\n clearable?: boolean\n getOptionLabel?: (option: T) => string\n getOptionValue?: (option: T) => string\n renderOptionLabel?: (option: T) => React.ReactNode\n label?: React.ReactNode\n description?: React.ReactNode\n required?: boolean\n onCreateNew?: () => void\n createNewLabel?: string\n loading?: boolean\n /** Show \"N selected\" instead of badges for multiple selections. */\n compactMultiple?: boolean\n /** Custom formatter for the compact multiple display. */\n formatCompactDisplay?: (selectedValues: T[]) => string\n /** Affix rendered before the trigger (input-group). */\n startItem?: React.ReactNode\n /** Affix rendered after the trigger (input-group). */\n endItem?: React.ReactNode\n /** Max selections allowed in multiple mode. */\n maxSelections?: number\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** Load more items for infinite scroll. */\n onLoadMore?: () => void\n hasNextPage?: boolean\n isFetchingNextPage?: boolean\n /** Allow clearing all selections in multiple mode (no minimum-1). */\n allowEmpty?: boolean\n /** Show a \"Select All\" option in multiple mode. */\n showSelectAll?: boolean\n /** Field looks normal but the dropdown won't open. */\n readOnly?: boolean\n /** Extra className for the dropdown panel. */\n popoverClassName?: string\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction isOptionObject(opt: unknown): opt is AdvancedSelectOption {\n return (\n typeof opt === \"object\" &&\n opt !== null &&\n \"value\" in opt &&\n \"label\" in opt\n )\n}\n\n// ============================================================================\n// AdvancedSelect\n// ============================================================================\n\nexport function AdvancedSelect<T = AdvancedSelectOption>({\n options = [],\n groups = [],\n value,\n onValueChange,\n placeholder = \"Select option\",\n disabled = false,\n error = false,\n errorMessage,\n multiple = false,\n className,\n size = \"default\",\n variant = \"default\",\n searchable = false,\n clearable = false,\n getOptionLabel,\n getOptionValue,\n renderOptionLabel,\n label,\n description,\n required = false,\n onCreateNew,\n createNewLabel = \"New item\",\n loading = false,\n compactMultiple = false,\n formatCompactDisplay,\n startItem,\n endItem,\n maxSelections,\n defaultOpen = false,\n onOpenChange,\n onLoadMore,\n hasNextPage = false,\n isFetchingNextPage = false,\n allowEmpty = false,\n showSelectAll = false,\n readOnly = false,\n popoverClassName,\n}: AdvancedSelectProps<T>) {\n const [open, setOpen] = React.useState(defaultOpen)\n const loadMoreCalledRef = React.useRef(false)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const selectId = React.useId()\n\n const handleOpenChange = React.useCallback(\n (newOpen: boolean) => {\n if (readOnly && newOpen) return\n setOpen(newOpen)\n onOpenChange?.(newOpen)\n if (newOpen) loadMoreCalledRef.current = false\n },\n [onOpenChange, readOnly],\n )\n\n const [selectedValues, setSelectedValues] = React.useState<T[]>(\n multiple ? (Array.isArray(value) ? (value as T[]) : value ? [value as T] : []) : [],\n )\n\n // Keep selectedValues in sync when the controlled `value` prop changes\n // (e.g. the parent resets filters). This is intentional prop->state sync.\n React.useEffect(() => {\n if (multiple) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSelectedValues(\n Array.isArray(value) ? (value as T[]) : value ? [value as T] : [],\n )\n }\n }, [multiple, value])\n\n React.useEffect(() => {\n if (!isFetchingNextPage) loadMoreCalledRef.current = false\n }, [isFetchingNextPage])\n\n // ---- label/value resolution ---------------------------------------------\n\n const getValue = React.useCallback(\n (opt: unknown): string => {\n if (typeof opt === \"string\") return opt\n if (getOptionValue) return getOptionValue(opt as T)\n if (isOptionObject(opt)) return opt.value\n return String(opt)\n },\n [getOptionValue],\n )\n\n const getLabel = React.useCallback(\n (opt: unknown): string => {\n if (typeof opt === \"string\") {\n for (const group of groups) {\n const found = group.options.find((o) => o.value === opt)\n if (found) return found.label\n }\n for (const o of options) {\n if (typeof o === \"string\") {\n if (o === opt) return o\n } else if (isOptionObject(o) && o.value === opt) {\n return o.label\n }\n }\n return opt\n }\n if (getOptionLabel) return getOptionLabel(opt as T)\n if (isOptionObject(opt)) return opt.label\n return String(opt)\n },\n [getOptionLabel, groups, options],\n )\n\n const singleValue = React.useMemo(() => {\n if (multiple || !value) return \"\"\n if (typeof value === \"string\") return value\n if (Array.isArray(value)) return \"\"\n return getValue(value)\n }, [multiple, value, getValue])\n\n const normalizedOptions = React.useMemo<AdvancedSelectOption[]>(() => {\n return options.map((opt) => {\n if (typeof opt === \"string\") return { value: opt, label: opt }\n if (isOptionObject(opt)) return opt\n return { value: getValue(opt), label: getLabel(opt) }\n })\n }, [options, getLabel, getValue])\n\n const getOriginalOption = React.useCallback(\n (optionValue: string): T | undefined =>\n options.find((opt) => getValue(opt) === optionValue) as T | undefined,\n [options, getValue],\n )\n\n const allOptions = React.useMemo<AdvancedSelectOption[]>(() => {\n const opts = [...normalizedOptions]\n groups.forEach((group) => opts.push(...group.options))\n return opts\n }, [normalizedOptions, groups])\n\n // ---- selection handlers --------------------------------------------------\n\n const handleSelect = (optionValue: string) => {\n let original: RawOption<T> | undefined = options.find(\n (opt) => getValue(opt) === optionValue,\n )\n if (original === undefined && groups.length > 0) {\n for (const group of groups) {\n const found = group.options.find((opt) => opt.value === optionValue)\n if (found) {\n original = found as RawOption<T>\n break\n }\n }\n }\n\n if (multiple) {\n const isSelected = selectedValues.some((v) => getValue(v) === optionValue)\n // Enforce max selections silently.\n if (!isSelected && maxSelections && selectedValues.length >= maxSelections) {\n return\n }\n // Enforce minimum-1 silently (unless allowEmpty).\n if (isSelected && selectedValues.length === 1 && !allowEmpty) {\n return\n }\n const newValues = isSelected\n ? selectedValues.filter((v) => getValue(v) !== optionValue)\n : [...selectedValues, original as T]\n setSelectedValues(newValues)\n onValueChange?.(newValues)\n } else {\n onValueChange?.(original as T)\n setOpen(false)\n }\n }\n\n const isAllSelected =\n multiple &&\n allOptions.length > 0 &&\n allOptions.length === selectedValues.length\n\n const handleSelectAll = () => {\n if (!multiple) return\n if (isAllSelected) {\n if (allowEmpty) {\n setSelectedValues([])\n onValueChange?.([])\n }\n return\n }\n if (maxSelections && allOptions.length > maxSelections) return\n setSelectedValues(allOptions as unknown as T[])\n onValueChange?.(allOptions as unknown as T[])\n }\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (multiple) {\n setSelectedValues([])\n onValueChange?.([])\n } else {\n onValueChange?.(\"\")\n }\n }\n\n const handleRemoveValue = (e: React.MouseEvent, valueToRemove: T) => {\n e.stopPropagation()\n if (selectedValues.length === 1 && !allowEmpty) return\n const newValues = selectedValues.filter(\n (v) => getValue(v) !== getValue(valueToRemove),\n )\n setSelectedValues(newValues)\n onValueChange?.(newValues)\n }\n\n const handleScroll = React.useCallback(\n (e: React.UIEvent<HTMLDivElement>) => {\n const target = e.currentTarget\n const nearBottom =\n target.scrollHeight - target.scrollTop - target.clientHeight < 100\n if (\n nearBottom &&\n onLoadMore &&\n hasNextPage &&\n !isFetchingNextPage &&\n !loadMoreCalledRef.current\n ) {\n loadMoreCalledRef.current = true\n onLoadMore()\n }\n },\n [onLoadMore, hasNextPage, isFetchingNextPage],\n )\n\n const hasValue = multiple ? selectedValues.length > 0 : Boolean(singleValue)\n\n const getDisplayValue = () => {\n if (multiple) return null\n const option = allOptions.find((opt) => opt.value === singleValue)\n return option?.label || placeholder\n }\n\n const handleLabelClick = () => {\n if (!disabled && !readOnly) {\n triggerRef.current?.focus()\n setOpen(true)\n }\n }\n\n const isInputGroup = Boolean(startItem || endItem)\n // Badges wrap to multiple rows, so the trigger must grow vertically in\n // multiple (non-compact) mode; otherwise keep a fixed height.\n const canWrapBadges = multiple && !compactMultiple\n // Sizes match AdvancedInput: default h-8.5, small h-7.\n const fixedHeight = size === \"default\" ? \"h-8.5\" : \"h-7\"\n const minHeight = size === \"default\" ? \"min-h-8.5\" : \"min-h-7\"\n const heightClass = canWrapBadges ? minHeight : fixedHeight\n // Mirror AdvancedInput exactly so the two controls share one fill scheme.\n const bgClass =\n variant === \"alt\" ? \"bg-input-background-alt\" : \"bg-input-background\"\n\n // ---- shared selected-display + chevron -----------------------------------\n\n const SelectedDisplay = (\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-center gap-1.5\",\n // Wrapping badges must not be clipped; keep single/compact text clipped.\n canWrapBadges ? \"py-1\" : \"overflow-hidden\",\n )}\n >\n {multiple && selectedValues.length > 0 ? (\n compactMultiple ? (\n <span className=\"min-w-0 truncate\">\n {formatCompactDisplay\n ? formatCompactDisplay(selectedValues)\n : `${selectedValues.length} selected`}\n </span>\n ) : (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {selectedValues.map((val, index) => (\n <span\n key={`${getValue(val)}-${index}`}\n className=\"inline-flex items-center gap-1 rounded-sm bg-primary px-2 py-0.5 text-xs font-normal text-primary-foreground\"\n >\n {getLabel(val)}\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`Remove ${getLabel(val)}`}\n onClick={(e) => handleRemoveValue(e, val)}\n className=\"rounded-sm transition-colors hover:bg-primary/80\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </span>\n ))}\n </div>\n )\n ) : (\n <span\n className={cn(\n \"block min-w-0 truncate\",\n !hasValue && \"text-muted-foreground/60\",\n )}\n >\n {getDisplayValue() || placeholder}\n </span>\n )}\n </div>\n )\n\n const TrailingControls = (\n <div className=\"flex shrink-0 items-center gap-1\">\n {clearable && hasValue && !disabled && (\n <span\n role=\"button\"\n tabIndex={0}\n aria-label=\"Clear\"\n onClick={handleClear}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.stopPropagation()\n handleClear(e as unknown as React.MouseEvent)\n }\n }}\n className=\"cursor-pointer rounded-sm p-0.5 transition-colors hover:bg-accent\"\n >\n <XIcon className=\"size-3.5\" />\n </span>\n )}\n <ChevronDownIcon size={16} className=\"shrink-0 opacity-60\" aria-hidden />\n </div>\n )\n\n // ---- dropdown list (shared) ----------------------------------------------\n\n const renderOption = (option: AdvancedSelectOption) => {\n const isSelected = multiple\n ? selectedValues.some((v) => getValue(v) === option.value)\n : singleValue === option.value\n const original = getOriginalOption(option.value)\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n onSelect={() => handleSelect(option.value)}\n disabled={option.disabled}\n >\n {multiple ? (\n <div\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-sm border\",\n isSelected ? \"border-primary bg-primary\" : \"border-input\",\n )}\n >\n {isSelected && <CheckIcon size={12} className=\"text-primary-foreground\" />}\n </div>\n ) : (\n <div className=\"flex size-4 shrink-0 items-center justify-center\">\n {isSelected && <CheckIcon size={16} className=\"text-primary\" />}\n </div>\n )}\n {(option.icon || option.image) && (\n <div className=\"flex size-4 shrink-0 items-center justify-center\">\n {option.image ? (\n <img\n src={option.image}\n alt={option.label}\n className=\"size-4 rounded-sm object-cover\"\n />\n ) : (\n option.icon\n )}\n </div>\n )}\n <div className=\"flex flex-1 items-center justify-between gap-2\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-normal\">\n {renderOptionLabel && original\n ? renderOptionLabel(original)\n : option.label}\n </span>\n {option.description && (\n <span className=\"text-xs leading-snug text-muted-foreground\">\n {option.description}\n </span>\n )}\n </div>\n {option.badge && (\n <span className=\"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground\">\n {option.badge}\n </span>\n )}\n </div>\n </CommandItem>\n )\n }\n\n const dropdown = (\n <PopoverContent\n className={cn(\n \"w-(--radix-popper-anchor-width) min-w-(--radix-popper-anchor-width) p-0\",\n popoverClassName,\n )}\n align=\"start\"\n onOpenAutoFocus={(e) => {\n if (!searchable) e.preventDefault()\n }}\n onWheel={(e) => e.stopPropagation()}\n >\n <Command>\n {searchable && (\n <CommandInput placeholder={`Search ${placeholder.toLowerCase()}...`} autoFocus />\n )}\n <CommandList onScroll={handleScroll}>\n {loading ? (\n <div className=\"flex items-center justify-center py-6\">\n <Loader2 className=\"size-5 animate-spin text-muted-foreground\" />\n </div>\n ) : (\n <>\n {multiple && showSelectAll && allOptions.length > 0 && (\n <>\n <CommandGroup>\n <CommandItem\n value=\"__select_all__\"\n onSelect={handleSelectAll}\n className=\"font-medium\"\n >\n <div\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-sm border\",\n isAllSelected ? \"border-primary bg-primary\" : \"border-input\",\n )}\n >\n {isAllSelected && (\n <CheckIcon size={12} className=\"text-primary-foreground\" />\n )}\n </div>\n <span>Select all</span>\n </CommandItem>\n </CommandGroup>\n <CommandSeparator />\n </>\n )}\n <CommandEmpty>No results found.</CommandEmpty>\n {groups.length > 0\n ? groups.map((group, idx) => (\n <React.Fragment key={group.label}>\n {idx > 0 && <CommandSeparator />}\n <CommandGroup heading={group.label}>\n {group.options.map(renderOption)}\n </CommandGroup>\n </React.Fragment>\n ))\n : <CommandGroup>{normalizedOptions.map(renderOption)}</CommandGroup>}\n {onCreateNew && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <Button\n variant=\"ghost\"\n className=\"w-full justify-start font-normal\"\n onClick={() => {\n onCreateNew()\n setOpen(false)\n }}\n >\n <PlusIcon size={16} className=\"-ms-1 opacity-60\" aria-hidden />\n {createNewLabel}\n </Button>\n </CommandGroup>\n </>\n )}\n {isFetchingNextPage && (\n <div className=\"flex items-center justify-center py-3\">\n <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />\n </div>\n )}\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n )\n\n // ---- trigger -------------------------------------------------------------\n\n const Asterisk = required ? (\n <span aria-hidden className=\"ml-0.5 text-destructive\">\n *\n </span>\n ) : null\n\n return (\n <div className=\"space-y-1.5\">\n {label && (\n <FieldLabel\n htmlFor={selectId}\n onClick={handleLabelClick}\n className={cn(\"cursor-pointer\", disabled && \"text-muted-foreground\")}\n >\n {label}\n {Asterisk}\n </FieldLabel>\n )}\n\n {isInputGroup ? (\n <Popover open={open} onOpenChange={handleOpenChange} modal={false}>\n <PopoverTrigger asChild>\n <div\n aria-invalid={error}\n className={cn(\n \"flex rounded-sm border border-border transition-[color,box-shadow]\",\n // Wrapping badges grow the row; don't clip them.\n canWrapBadges ? \"items-stretch\" : \"items-center overflow-hidden\",\n bgClass,\n heightClass,\n open && \"border-ring ring-3 ring-ring/50\",\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-3 aria-[invalid=true]:ring-destructive/20\",\n disabled && \"pointer-events-none cursor-not-allowed opacity-50\",\n )}\n >\n {startItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-3 pr-2 text-sm text-muted-foreground [&_svg]:size-4\">\n {startItem}\n </div>\n )}\n <Button\n id={selectId}\n type=\"button\"\n disabled={disabled}\n ref={triggerRef}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n onClick={(e) => {\n if (readOnly) {\n e.preventDefault()\n e.stopPropagation()\n }\n }}\n className={cn(\n \"h-full flex-1 justify-between rounded-none border-0 px-3 py-1 font-normal text-foreground shadow-none hover:bg-transparent focus-visible:ring-0\",\n canWrapBadges ? \"items-start\" : \"items-center\",\n className,\n )}\n >\n {SelectedDisplay}\n {TrailingControls}\n </Button>\n {endItem && (\n <div className=\"flex h-full shrink-0 items-center justify-center pl-2 pr-3 text-sm text-foreground [&_svg]:size-4\">\n {endItem}\n </div>\n )}\n </div>\n </PopoverTrigger>\n {dropdown}\n </Popover>\n ) : (\n <Popover open={open} onOpenChange={handleOpenChange} modal={false}>\n <PopoverTrigger asChild>\n <Button\n id={selectId}\n type=\"button\"\n disabled={disabled}\n ref={triggerRef}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n aria-invalid={error}\n onClick={(e) => {\n if (readOnly) {\n e.preventDefault()\n e.stopPropagation()\n }\n }}\n className={cn(\n // ghost (not outline) so the button carries no bg/hover of its\n // own — bgClass + border below fully control the fill, matching\n // AdvancedInput exactly.\n \"h-auto w-full justify-between rounded-sm border border-border px-3 py-1 font-normal text-foreground transition-[color,box-shadow] hover:bg-transparent\",\n heightClass,\n // Top-align the chevron when badges wrap to multiple rows.\n canWrapBadges ? \"items-start\" : \"items-center\",\n bgClass,\n \"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n open && \"border-ring ring-3 ring-ring/50\",\n className,\n )}\n >\n {SelectedDisplay}\n {TrailingControls}\n </Button>\n </PopoverTrigger>\n {dropdown}\n </Popover>\n )}\n\n {error && errorMessage && (\n <p className=\"text-xs leading-5 text-destructive\">{errorMessage}</p>\n )}\n {description && <FieldDescription>{description}</FieldDescription>}\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CheckIcon } from \"lucide-react\"\n\nfunction Checkbox({\n className,\n ...props\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n >\n <CheckIcon\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n}\n\nexport { Checkbox }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\n return (\n <div\n data-slot=\"table-container\"\n className=\"relative w-full overflow-x-auto\"\n >\n <table\n data-slot=\"table\"\n className={cn(\"w-full caption-bottom text-sm\", className)}\n {...props}\n />\n </div>\n )\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n return (\n <thead\n data-slot=\"table-header\"\n className={cn(\"[&_tr]:border-b\", className)}\n {...props}\n />\n )\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n return (\n <tbody\n data-slot=\"table-body\"\n className={cn(\"[&_tr:last-child]:border-0\", className)}\n {...props}\n />\n )\n}\n\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n return (\n <tfoot\n data-slot=\"table-footer\"\n className={cn(\n \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\n return (\n <tr\n data-slot=\"table-row\"\n className={cn(\n \"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<\"th\">) {\n return (\n <th\n data-slot=\"table-head\"\n className={cn(\n \"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<\"td\">) {\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n \"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TableCaption({\n className,\n ...props\n}: React.ComponentProps<\"caption\">) {\n return (\n <caption\n data-slot=\"table-caption\"\n className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n}\n","import * as React from \"react\";\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronsLeftIcon,\n ChevronsRightIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@/components/ui/table\";\nimport {\n ActionsMenu,\n type ActionsMenuItem,\n} from \"@/components/custom/actions-menu\";\nimport { AdvancedSelect } from \"@/components/custom/advanced-select\";\nimport { Spinner } from \"@/components/ui/spinner\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DataTableColumn<TRow> {\n /** Stable key; also used to read `row[key]` when no `cell` is given. */\n key: string;\n /** Header cell content. */\n header?: React.ReactNode;\n /** Custom cell renderer; defaults to String(row[key]). */\n cell?: (row: TRow, index: number) => React.ReactNode;\n align?: \"left\" | \"center\" | \"right\";\n /** Fixed column width, e.g. \"12rem\" or \"120px\". */\n width?: string;\n /** Extra class for this column's header + body cells. */\n className?: string;\n /** Extra class for the header cell only. */\n headerClassName?: string;\n}\n\nexport interface DataTableProps<TRow> {\n columns: DataTableColumn<TRow>[];\n data: TRow[];\n /** Unique id per row; required for selection. Defaults to the row index. */\n getRowId?: (row: TRow, index: number) => string;\n /**\n * Mark a row as disabled: it's dimmed, can't be selected (or \"select all\"-ed),\n * and ignores `onRowClick`. Row actions stay enabled.\n */\n isRowDisabled?: (row: TRow, index: number) => boolean;\n // --- selection (optional) ---\n selectable?: boolean;\n selectedIds?: string[];\n onSelectionChange?: (ids: string[]) => void;\n // --- row actions (optional) ---\n rowActions?: (row: TRow) => ActionsMenuItem[];\n // --- states ---\n loading?: boolean;\n emptyMessage?: React.ReactNode;\n // --- pagination (optional, client-side) ---\n /** Enable client-side pagination with a footer of page controls. */\n pagination?: boolean;\n /** Rows per page. Default `25`. */\n pageSize?: number;\n /** Page-size options in the footer selector. Default `[25, 50, 100, 200]`. */\n pageSizeOptions?: number[];\n // --- appearance ---\n /** Alternating row backgrounds for easier scanning. */\n striped?: boolean;\n /** Keep the header visible while the body scrolls (pair with maxHeight/fillHeight). */\n stickyHeader?: boolean;\n /** Constrains height and enables vertical scroll, e.g. \"24rem\" or 400. */\n maxHeight?: string | number;\n /**\n * Grow the table to fill its parent's height (body scrolls, footer pinned).\n * Place inside a flex column with a constrained height. Overrides `maxHeight`.\n */\n fillHeight?: boolean;\n // --- misc ---\n onRowClick?: (row: TRow) => void;\n className?: string;\n}\n\nconst alignClass = {\n left: \"text-left\",\n center: \"text-center\",\n right: \"text-right\",\n} as const;\n\n// ============================================================================\n// DataTable\n// ============================================================================\n\nexport function DataTable<TRow>({\n columns,\n data,\n getRowId = (_row, index) => String(index),\n isRowDisabled,\n selectable = false,\n selectedIds,\n onSelectionChange,\n rowActions,\n loading = false,\n emptyMessage = \"No results.\",\n pagination = false,\n pageSize: pageSizeProp = 25,\n pageSizeOptions = [25, 50, 100, 200],\n striped = true,\n stickyHeader = false,\n maxHeight,\n fillHeight = false,\n onRowClick,\n className,\n}: DataTableProps<TRow>) {\n const ids = React.useMemo(\n () => data.map((row, i) => getRowId(row, i)),\n [data, getRowId],\n );\n\n // Disabled rows are excluded from selection (\"select all\", toggle, count).\n const disabledById = React.useMemo(() => {\n const map: Record<string, boolean> = {};\n data.forEach((row, i) => {\n map[getRowId(row, i)] = isRowDisabled?.(row, i) ?? false;\n });\n return map;\n }, [data, getRowId, isRowDisabled]);\n\n // Ids eligible for selection (everything that isn't disabled).\n const selectableIds = React.useMemo(\n () => ids.filter((id) => !disabledById[id]),\n [ids, disabledById],\n );\n\n // Selection is controlled when selectedIds is provided, else internal.\n const [internalSelected, setInternalSelected] = React.useState<string[]>([]);\n const selected = selectedIds ?? internalSelected;\n\n const setSelected = (next: string[]) => {\n if (selectedIds === undefined) setInternalSelected(next);\n onSelectionChange?.(next);\n };\n\n const allSelected =\n selectableIds.length > 0 &&\n selectableIds.every((id) => selected.includes(id));\n const someSelected = selected.length > 0 && !allSelected;\n\n // Select all toggles only selectable rows; preserves any selected ids that\n // belong to disabled rows so they aren't silently dropped.\n const toggleAll = () =>\n setSelected(\n allSelected\n ? selected.filter((id) => disabledById[id])\n : [...new Set([...selected, ...selectableIds])],\n );\n const toggleRow = (id: string) => {\n if (disabledById[id]) return;\n setSelected(\n selected.includes(id)\n ? selected.filter((x) => x !== id)\n : [...selected, id],\n );\n };\n\n const totalCols =\n columns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0);\n\n // --- pagination (client-side) ---\n const [pageSize, setPageSize] = React.useState(pageSizeProp);\n const [rawPageIndex, setPageIndex] = React.useState(0);\n\n const pageCount = pagination\n ? Math.max(1, Math.ceil(data.length / pageSize))\n : 1;\n // Clamp during render (no effect): if data shrank or page size grew, the last\n // valid page is shown without an extra render pass.\n const pageIndex = Math.min(rawPageIndex, pageCount - 1);\n\n // Rows for the current page, paired with their original index so selection,\n // striping, and cell renderers keep using the row's true position.\n const pageRows = React.useMemo(() => {\n const rows = data.map((row, index) => ({ row, index }));\n if (!pagination) return rows;\n const start = pageIndex * pageSize;\n return rows.slice(start, start + pageSize);\n }, [data, pagination, pageIndex, pageSize]);\n\n // Comfier, consistent cell padding; first/last cells get extra edge inset.\n const cellPad = \"px-4 py-3 first:pl-5 last:pr-5\";\n const headPad = \"px-4 first:pl-5 last:pr-5\";\n\n // When constraining height, the scroll/max-height must live on the table's\n // own container (data-slot=table-container) so a sticky header sticks to it —\n // an outer scroll wrapper would leave the header scrolling inside the table's\n // own overflow context. We target that container via a descendant utility.\n const heightStyle =\n !fillHeight && maxHeight !== undefined\n ? typeof maxHeight === \"number\"\n ? `${maxHeight}px`\n : maxHeight\n : undefined;\n\n // Either fill the parent's height (flex) or cap it (max-height). Both put the\n // scroll on the table container so the sticky header pins to it.\n const constrained = fillHeight || maxHeight !== undefined;\n\n return (\n <div\n className={cn(\n \"overflow-hidden rounded-lg border\",\n // Square the bottom corners when a footer follows.\n pagination && \"rounded-b-none border-b-0\",\n // Make the root a flex column so the table area can grow/scroll and the\n // footer stays pinned at the bottom.\n constrained &&\n \"flex min-h-0 flex-col [&_[data-slot=table-container]]:overflow-y-auto\",\n // Fill the parent's remaining height (place inside a flex column).\n fillHeight &&\n \"min-h-0 flex-1 [&_[data-slot=table-container]]:min-h-0 [&_[data-slot=table-container]]:flex-1\",\n // Or cap at a fixed height.\n !fillHeight &&\n maxHeight !== undefined &&\n \"[&_[data-slot=table-container]]:max-h-(--dt-max-h)\",\n className,\n )}\n style={\n heightStyle\n ? ({\n \"--dt-max-h\": heightStyle,\n } as React.CSSProperties)\n : undefined\n }\n >\n <Table>\n <TableHeader\n className={cn(\n \"bg-muted/60\",\n stickyHeader &&\n cn(\n // A border on a sticky <thead>/<tr> doesn't travel with it, so\n // put the separating bottom border on the <th> cells themselves.\n \"sticky top-0 z-10 [&_th]:border-b [&_th]:bg-muted/95 [&_th]:backdrop-blur supports-backdrop-filter:[&_th]:bg-muted/80\",\n // Round the outer header cells' top corners so the header\n // background follows the container's rounded top (no square notch\n // over the border).\n \"[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg\",\n ),\n )}\n >\n <TableRow className=\"hover:bg-transparent\">\n {selectable && (\n <TableHead className={cn(\"w-10\", headPad)}>\n <Checkbox\n aria-label=\"Select all rows\"\n checked={\n allSelected ? true : someSelected ? \"indeterminate\" : false\n }\n onCheckedChange={toggleAll}\n />\n </TableHead>\n )}\n {columns.map((col) => (\n <TableHead\n key={col.key}\n style={col.width ? { width: col.width } : undefined}\n className={cn(\n \"h-11 text-xs font-semibold tracking-wide text-foreground uppercase\",\n headPad,\n col.align && alignClass[col.align],\n col.className,\n col.headerClassName,\n )}\n >\n {col.header}\n </TableHead>\n ))}\n {rowActions && <TableHead className=\"w-12\" />}\n </TableRow>\n </TableHeader>\n\n <TableBody>\n {loading ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell colSpan={totalCols} className=\"h-28 text-center\">\n <span className=\"inline-flex items-center gap-2 text-muted-foreground\">\n <Spinner className=\"size-4\" /> Loading…\n </span>\n </TableCell>\n </TableRow>\n ) : data.length === 0 ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={totalCols}\n className=\"h-28 text-center text-muted-foreground\"\n >\n {emptyMessage}\n </TableCell>\n </TableRow>\n ) : (\n pageRows.map(({ row, index }) => {\n const id = ids[index];\n const isSelected = selected.includes(id);\n const isDisabled = disabledById[id];\n return (\n <TableRow\n key={id}\n data-state={isSelected ? \"selected\" : undefined}\n data-disabled={isDisabled ? \"\" : undefined}\n aria-disabled={isDisabled || undefined}\n onClick={\n onRowClick && !isDisabled ? () => onRowClick(row) : undefined\n }\n className={cn(\n // Zebra stripe: a neutral, low-contrast tint.\n striped && !isSelected && \"odd:bg-muted/40\",\n // Selected: a distinct primary tint + left accent bar, so it\n // never reads like a stripe (overrides the stripe color).\n isSelected &&\n \"bg-primary/10 shadow-[inset_3px_0_0_0_var(--primary)] hover:bg-primary/15\",\n onRowClick && !isDisabled && \"cursor-pointer\",\n // Disabled: dimmed and not interactive (actions still work).\n isDisabled && \"opacity-50 hover:bg-transparent\",\n )}\n >\n {selectable && (\n <TableCell\n className={cn(\"w-10\", cellPad)}\n onClick={(e) => e.stopPropagation()}\n >\n <Checkbox\n aria-label=\"Select row\"\n checked={isSelected}\n disabled={isDisabled}\n onCheckedChange={() => toggleRow(id)}\n />\n </TableCell>\n )}\n {columns.map((col) => (\n <TableCell\n key={col.key}\n style={col.width ? { width: col.width } : undefined}\n className={cn(\n cellPad,\n col.align && alignClass[col.align],\n col.className,\n )}\n >\n {col.cell\n ? col.cell(row, index)\n : String(\n (row as Record<string, unknown>)[col.key] ?? \"\",\n )}\n </TableCell>\n ))}\n {rowActions && (\n <TableCell\n className=\"w-12 pr-3 text-right\"\n onClick={(e) => e.stopPropagation()}\n >\n <ActionsMenu items={rowActions(row)} />\n </TableCell>\n )}\n </TableRow>\n );\n })\n )}\n </TableBody>\n </Table>\n\n {pagination && (\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 text-sm\">\n <p className=\"text-muted-foreground\">\n Page {data.length === 0 ? 0 : pageIndex + 1} of {pageCount} (\n {data.length} total {data.length === 1 ? \"item\" : \"items\"})\n </p>\n\n <div className=\"flex items-center gap-4\">\n {pageSizeOptions && pageSizeOptions.length > 0 && (\n <div className=\"flex items-center gap-2 text-muted-foreground\">\n <span className=\"whitespace-nowrap\">Rows per page</span>\n <AdvancedSelect\n size=\"sm\"\n className=\"w-20\"\n value={String(pageSize)}\n onValueChange={(v) => {\n // Single-select emits the chosen option object; read its value.\n const raw =\n typeof v === \"object\" && v !== null && \"value\" in v\n ? (v as { value: string }).value\n : v;\n setPageSize(Number(raw));\n setPageIndex(0);\n }}\n options={pageSizeOptions.map((opt) => ({\n value: String(opt),\n label: String(opt),\n }))}\n />\n </div>\n )}\n\n <div className=\"flex items-center gap-1\">\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"First page\"\n disabled={pageIndex <= 0}\n onClick={() => setPageIndex(0)}\n >\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Previous page\"\n disabled={pageIndex <= 0}\n onClick={() => setPageIndex(Math.max(0, pageIndex - 1))}\n >\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Next page\"\n disabled={pageIndex >= pageCount - 1}\n onClick={() =>\n setPageIndex(Math.min(pageCount - 1, pageIndex + 1))\n }\n >\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Last page\"\n disabled={pageIndex >= pageCount - 1}\n onClick={() => setPageIndex(pageCount - 1)}\n >\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FormDialogProps {\n /** Body content — typically a form. Scrolls when it overflows. */\n children: React.ReactNode\n /** Heading shown in the (bordered) header. Omit to hide the header. */\n title?: React.ReactNode\n /** Whether the dialog is open. Controlled. */\n open: boolean\n /** Called when the dialog requests to close (X, overlay, or Esc). */\n onClose: () => void\n /** Optional supporting text under the title. */\n description?: React.ReactNode\n /**\n * When set, the dialog can't be dismissed by clicking the overlay or pressing\n * Escape — only the explicit close button / footer actions close it.\n */\n notDismissable?: boolean\n /** Footer content, pinned below the scrollable body with a top border. */\n footer?: React.ReactNode\n /** Class for the dialog content surface. */\n className?: string\n}\n\n// ============================================================================\n// Form Dialog\n// ============================================================================\n\n/**\n * A pre-composed modal for forms: a fixed bordered header (title, description,\n * and a close button), a scrollable body, and an optional pinned footer for\n * actions. Controlled via `open`/`onClose`. Set `notDismissable` to require an\n * explicit action to close.\n */\nfunction FormDialog({\n children,\n title,\n open,\n onClose,\n description,\n notDismissable,\n footer,\n className,\n}: FormDialogProps) {\n return (\n <Dialog\n open={open}\n onOpenChange={\n notDismissable ? undefined : (isOpen) => !isOpen && onClose()\n }\n >\n <DialogContent\n showCloseButton={false}\n className={cn(\"max-h-[75vh] gap-0 p-0 sm:max-w-2xl\", className)}\n >\n <div className=\"flex max-h-[75vh] flex-col\">\n {title && (\n <DialogHeader className=\"flex-shrink-0 border-b border-border p-6 pb-4\">\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex flex-col gap-1\">\n <DialogTitle className=\"text-left text-xl font-semibold\">\n {title}\n </DialogTitle>\n {description && (\n <DialogDescription className=\"text-left text-muted-foreground\">\n {description}\n </DialogDescription>\n )}\n </div>\n\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label=\"Close\"\n className=\"-mt-1 shrink-0\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n onClose()\n }}\n >\n <XIcon />\n </Button>\n </div>\n </DialogHeader>\n )}\n\n <div className=\"flex-1 overflow-y-auto p-6\">{children}</div>\n\n {footer && (\n <DialogFooter className=\"m-0 flex-shrink-0 rounded-none border-t border-border bg-transparent p-6 pt-4\">\n {footer}\n </DialogFooter>\n )}\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { FormDialog }\n","import * as React from \"react\"\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root\n data-slot=\"radio-group\"\n className={cn(\"grid w-full gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"flex size-4 items-center justify-center\"\n >\n <span className=\"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n}\n\nexport { RadioGroup, RadioGroupItem }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { RadioGroup, RadioGroupItem } from \"@/components/ui/radio-group\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface CardRadioItem {\n /** Unique value submitted when this card is selected. */\n value: string\n /** Primary label. */\n label: React.ReactNode\n /** Muted text shown inline after the label, e.g. \"(Sublabel)\". */\n sublabel?: React.ReactNode\n /** Supporting text shown beneath the label. */\n description?: React.ReactNode\n /** Optional leading media — an icon, logo, or small illustration. */\n icon?: React.ReactNode\n /** Disables this individual card. */\n disabled?: boolean\n}\n\nexport interface CardRadioGroupProps\n extends Omit<React.ComponentProps<typeof RadioGroup>, \"children\"> {\n /** The cards to render. */\n items: CardRadioItem[]\n /** Place the radio dot on the leading edge instead of the trailing edge. */\n indicatorPosition?: \"start\" | \"end\"\n /** Class for each card. */\n cardClassName?: string\n}\n\n// ============================================================================\n// Card Radio Group\n// ============================================================================\n\n/**\n * A radio group whose options are bordered cards, each with an optional icon,\n * a label (+ inline sublabel), and a description. The selected card highlights\n * its border. The whole card is clickable. Control selection with\n * `value`/`onValueChange` or `defaultValue`, like the base RadioGroup.\n */\nfunction CardRadioGroup({\n items,\n indicatorPosition = \"end\",\n className,\n cardClassName,\n ...props\n}: CardRadioGroupProps) {\n const reactId = React.useId()\n\n return (\n <RadioGroup className={cn(\"gap-2\", className)} {...props}>\n {items.map((item, i) => {\n const id = `${reactId}-${i}`\n const descId = item.description ? `${id}-description` : undefined\n\n return (\n // The whole card is a <label> so clicking anywhere toggles the radio\n // natively — no overlay hack needed, and the indicator dot stays\n // inside the (relative) radio item.\n <label\n key={item.value}\n htmlFor={id}\n className={cn(\n \"flex w-full items-start gap-3 rounded-md border border-input p-4 shadow-xs transition-colors\",\n \"has-data-[state=checked]:border-primary/50\",\n item.disabled\n ? \"cursor-not-allowed opacity-60\"\n : \"cursor-pointer\",\n cardClassName\n )}\n >\n <RadioGroupItem\n id={id}\n value={item.value}\n disabled={item.disabled}\n aria-describedby={descId}\n className={cn(\n \"mt-0.5\",\n indicatorPosition === \"end\" && \"order-1\"\n )}\n />\n <div className=\"flex grow items-start gap-3\">\n {item.icon && (\n <span className=\"flex shrink-0 items-center\" aria-hidden=\"true\">\n {item.icon}\n </span>\n )}\n <div className=\"grid grow gap-1.5\">\n <span className=\"text-sm font-medium leading-none\">\n {item.label}\n {item.sublabel != null && (\n <span className=\"text-xs font-normal leading-[inherit] text-muted-foreground\">\n {\" \"}\n {item.sublabel}\n </span>\n )}\n </span>\n {item.description != null && (\n <p id={descId} className=\"text-xs text-muted-foreground\">\n {item.description}\n </p>\n )}\n </div>\n </div>\n </label>\n )\n })}\n </RadioGroup>\n )\n}\n\nexport { CardRadioGroup }\n","\"use client\";\n\nimport * as React from \"react\";\nimport { CheckIcon, PaintBucketIcon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Default swatches use the theme's named accent tokens (var(--{color})), so\n * they adapt to the active theme + light/dark mode.\n */\nconst DEFAULT_SWATCHES = [\n \"var(--primary)\",\n \"var(--red)\",\n \"var(--orange)\",\n \"var(--yellow)\",\n \"var(--green)\",\n \"var(--teal)\",\n \"var(--cyan)\",\n \"var(--blue)\",\n \"var(--purple)\",\n \"var(--pink)\",\n \"var(--gray)\",\n \"var(--foreground)\",\n];\n\n/**\n * Resolve any CSS color (including `var(--token)`) to a `#rrggbb` hex string by\n * letting the browser compute it. Returns the input unchanged if unresolvable\n * (e.g. server-side) or already a plain hex.\n */\nfunction toHex(color: string): string {\n if (typeof window === \"undefined\") return color;\n if (/^#[0-9a-fA-F]{6}$/.test(color)) return color;\n const el = document.createElement(\"span\");\n el.style.color = color;\n document.body.appendChild(el);\n const rgb = getComputedStyle(el).color; // \"rgb(r, g, b)\"\n document.body.removeChild(el);\n const m = rgb.match(/\\d+/g);\n if (!m || m.length < 3) return color;\n const h = (n: number) => n.toString(16).padStart(2, \"0\");\n return `#${h(+m[0])}${h(+m[1])}${h(+m[2])}`;\n}\n\nexport interface ColorPickerProps {\n /** Current color (hex). Controlled. */\n value: string;\n /** Called with the new color. */\n onChange: (value: string) => void;\n /** Preset color swatches shown above the input. */\n swatches?: string[];\n /**\n * Trigger appearance:\n * - `swatch` (default): a rounded color box.\n * - `input`: a field showing the hex code with a leading swatch.\n */\n trigger?: \"swatch\" | \"input\";\n /** Placeholder for the `input` trigger when no value. */\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\n// ============================================================================\n// Color Picker\n// ============================================================================\n\n/**\n * A simple color picker: predefined swatches over a color-code input (with a\n * native color field). Controlled via `value`/`onChange`. Show it as a `swatch`\n * box or an `input` field via the `trigger` prop.\n */\nexport function ColorPicker({\n value,\n onChange,\n swatches = DEFAULT_SWATCHES,\n trigger = \"swatch\",\n placeholder = \"Pick a color\",\n disabled,\n className,\n}: ColorPickerProps) {\n // Local hex for the text field so the user can type freely; re-syncs to\n // `value` during render when the prop changes (no effect needed).\n const [hex, setHex] = React.useState(value);\n const [lastValue, setLastValue] = React.useState(value);\n if (value !== lastValue) {\n setLastValue(value);\n setHex(value);\n }\n\n // Pick a swatch: resolve `var(--token)` (and any CSS color) to a concrete hex\n // so the stored value + input show a real color, not the var() string.\n const pick = (swatch: string) => {\n onChange(toHex(swatch));\n };\n\n const commitHex = (next: string) => {\n setHex(next);\n if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(next)) onChange(next);\n };\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n {trigger === \"input\" ? (\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"flex h-9 w-56 items-center gap-2 rounded-md border bg-background px-2.5 text-left text-sm outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n >\n <span\n className=\"size-5 shrink-0 rounded ring-1 ring-foreground/10\"\n style={{ background: value || \"transparent\" }}\n />\n <span\n className={cn(\n \"flex-1 truncate font-mono\",\n !value && \"text-muted-foreground\",\n )}\n >\n {value || placeholder}\n </span>\n </button>\n ) : (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label=\"Pick a color\"\n className={cn(\n \"flex size-9 items-center justify-center rounded-md border ring-1 ring-foreground/10 outline-none transition-transform hover:scale-105 focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n style={{ background: value || \"transparent\" }}\n >\n {!value && (\n <PaintBucketIcon className=\"size-4 text-muted-foreground\" />\n )}\n </button>\n )}\n </PopoverTrigger>\n\n <PopoverContent className=\"w-64\" align=\"start\">\n {/* Predefined colors — a wrapping grid (swatch size stays fixed). */}\n <div className=\"grid grid-cols-6 gap-2\">\n {swatches.map((s) => {\n // Compare resolved hex so a preset stays \"active\" after its\n // var(--token) has been resolved to a concrete color in `value`.\n const active = toHex(s).toLowerCase() === value.toLowerCase();\n return (\n <button\n key={s}\n type=\"button\"\n aria-label={s}\n onClick={() => pick(s)}\n className={cn(\n \"flex aspect-square items-center justify-center rounded-md ring-1 ring-foreground/10 transition-transform hover:scale-105 active:scale-95\",\n active && \"ring-2 ring-ring ring-offset-1 ring-offset-popover\",\n )}\n style={{ background: s }}\n >\n {active && (\n <CheckIcon className=\"size-3.5 text-white mix-blend-difference\" />\n )}\n </button>\n );\n })}\n </div>\n\n {/* Color code input, with a leading swatch + native picker. */}\n <div className=\"mt-3 flex items-center gap-2 border-t pt-3\">\n <label\n className=\"relative size-7 shrink-0 overflow-hidden rounded ring-1 ring-foreground/10\"\n style={{ background: value || \"transparent\" }}\n >\n <input\n type=\"color\"\n value={/^#[0-9a-fA-F]{6}$/.test(value) ? value : \"#000000\"}\n onChange={(e) => onChange(e.target.value)}\n className=\"absolute inset-0 size-full cursor-pointer opacity-0\"\n />\n </label>\n <Input\n value={hex}\n onChange={(e) => commitHex(e.target.value)}\n placeholder=\"#000000\"\n className=\"h-8 font-mono\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n","import * as React from \"react\"\nimport { AlertDialog as AlertDialogPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\n\nfunction AlertDialog({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n )\n}\n\nfunction AlertDialogPortal({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n )\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n return (\n <AlertDialogPrimitive.Overlay\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\nfunction AlertDialogContent({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n size?: \"default\" | \"sm\"\n}) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\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-sm bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\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 has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left 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\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\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-sm border-t bg-muted/50 p-4 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\nfunction AlertDialogMedia({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n \"mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n \"text-base font-medium 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\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\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\nfunction AlertDialogAction({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Action\n data-slot=\"alert-dialog-action\"\n className={cn(className)}\n {...props}\n />\n </Button>\n )\n}\n\nfunction AlertDialogCancel({\n className,\n variant = \"outline\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n return (\n <Button variant={variant} size={size} asChild>\n <AlertDialogPrimitive.Cancel\n data-slot=\"alert-dialog-cancel\"\n className={cn(className)}\n {...props}\n />\n </Button>\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { AlertTriangle, Loader2 } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n AlertDialog,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\"\nimport { Button } from \"@/components/ui/button\"\nimport { AdvancedInput } from \"@/components/custom/advanced-input\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ConfirmPromptProps {\n /** Whether the prompt is open. Controlled. */\n show: boolean\n /** Heading. Defaults to \"Are you absolutely sure?\". */\n title?: React.ReactNode\n /** Supporting copy explaining the consequence. */\n message?: React.ReactNode\n /** Runs when the user confirms. May return a promise for a loading state. */\n onConfirm: () => void | Promise<void>\n /** Runs when the user cancels / dismisses. */\n onCancel: () => void\n /** Show a spinner on the confirm button and block dismissal. */\n loading?: boolean\n /** Disable the confirm button regardless of validation. */\n disabled?: boolean\n /** Require the user to type `item` exactly before confirming. */\n validate?: boolean\n /** The string the user must type when `validate` is set. Defaults to \"CONFIRM\". */\n item?: string | null\n /** Confirm button label. Defaults to \"Confirm\". */\n confirmLabel?: string\n /** Cancel button label. Defaults to \"Cancel\". */\n cancelLabel?: string\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * A confirmation dialog for risky actions — mainly deletes. An amber warning\n * icon sits beside the title, with a red confirm button. Set `validate` to\n * require the user to type `item` exactly before confirming (the\n * \"type the name to delete\" safeguard). Controlled via `show`/`onCancel`;\n * `onConfirm` may return a promise to show a spinner.\n */\nexport function ConfirmPrompt({\n show,\n title = \"Are you absolutely sure?\",\n message = \"This action cannot be undone. This will permanently delete and remove your data from our servers.\",\n onConfirm,\n onCancel,\n loading: loadingProp,\n disabled,\n validate,\n item = \"CONFIRM\",\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n}: ConfirmPromptProps) {\n const [confirmMessage, setConfirmMessage] = React.useState(\"\")\n const [pending, setPending] = React.useState(false)\n const loading = loadingProp ?? pending\n\n const matches = !validate || confirmMessage === item\n const confirmDisabled = disabled || loading || !matches\n\n const handleCancel = () => {\n if (loading) return\n setConfirmMessage(\"\")\n onCancel()\n }\n\n const handleConfirm = async () => {\n if (confirmDisabled) return\n try {\n setPending(true)\n await onConfirm()\n setConfirmMessage(\"\")\n } finally {\n setPending(false)\n }\n }\n\n return (\n <AlertDialog\n open={Boolean(show)}\n onOpenChange={(next) => {\n if (!next) handleCancel()\n }}\n >\n <AlertDialogContent className=\"sm:max-w-lg!\">\n <AlertDialogHeader>\n <AlertDialogTitle className=\"flex items-center gap-2\">\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30\">\n <AlertTriangle className=\"size-5 text-amber-600 dark:text-amber-500\" />\n </div>\n {title}\n </AlertDialogTitle>\n {message != null && (\n <AlertDialogDescription>{message}</AlertDialogDescription>\n )}\n </AlertDialogHeader>\n\n {validate && (\n <div className=\"space-y-1\">\n <AlertDialogDescription>\n To confirm, type{\" \"}\n <span className=\"font-semibold text-foreground\">\n &ldquo;{item}&rdquo;\n </span>{\" \"}\n in the box below\n </AlertDialogDescription>\n <AdvancedInput\n value={confirmMessage}\n onChange={(e) => setConfirmMessage(e.target.value)}\n size=\"sm\"\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n disabled={loading}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") handleConfirm()\n }}\n />\n </div>\n )}\n\n <AlertDialogFooter className=\"gap-2 space-x-0!\">\n <Button variant=\"outline\" onClick={handleCancel} disabled={loading}>\n {cancelLabel}\n </Button>\n <Button\n onClick={handleConfirm}\n className={cn(\"bg-red-500 text-white hover:bg-red-600\")}\n disabled={confirmDisabled}\n >\n {loading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n confirmLabel\n )}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Tabs as TabsPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type CustomTabsType = \"underline\" | \"pill\"\n\nexport interface CustomTabItem {\n /** Unique value for the tab; also used as the trigger's `value`. */\n value: string\n /** Visible label. */\n label: React.ReactNode\n /** Optional leading icon. */\n icon?: React.ReactNode\n /** Optional numeric count rendered as a muted pill after the label. */\n count?: number\n /** Optional short badge rendered after the label, e.g. \"New\". */\n badge?: React.ReactNode\n /** Disables this individual tab. */\n disabled?: boolean\n}\n\nexport interface CustomTabsProps\n extends Omit<\n React.ComponentProps<typeof TabsPrimitive.Root>,\n \"orientation\" | \"children\"\n > {\n /** Visual style of the tab strip. Defaults to `underline`. */\n type?: CustomTabsType\n /** The tabs to render. */\n items: CustomTabItem[]\n /** Class for the tab list (the strip itself). */\n listClassName?: string\n}\n\n// ============================================================================\n// Custom Tabs\n// ============================================================================\n\n/**\n * A higher-level tab strip with two looks — `underline` and `pill` — driven by\n * a single `items` array. Each item can carry an icon, a numeric `count`, and a\n * short `badge` (e.g. \"New\"). Built on Radix Tabs, so it stays keyboard- and\n * a11y-friendly; control selection with `value`/`onValueChange` or\n * `defaultValue` just like the primitive.\n */\nfunction CustomTabs({\n type = \"underline\",\n items,\n className,\n listClassName,\n ...props\n}: CustomTabsProps) {\n return (\n <TabsPrimitive.Root\n data-slot=\"custom-tabs\"\n data-type={type}\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n >\n <TabsPrimitive.List\n data-slot=\"custom-tabs-list\"\n className={cn(\n \"inline-flex items-center text-muted-foreground\",\n type === \"underline\" &&\n \"w-full gap-6 border-b border-border\",\n type === \"pill\" && \"w-fit gap-1 rounded-lg bg-muted p-1\",\n listClassName\n )}\n >\n {items.map((item) => (\n <CustomTabsTrigger key={item.value} type={type} item={item} />\n ))}\n </TabsPrimitive.List>\n </TabsPrimitive.Root>\n )\n}\n\nfunction CustomTabsTrigger({\n type,\n item,\n}: {\n type: CustomTabsType\n item: CustomTabItem\n}) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"custom-tabs-trigger\"\n value={item.value}\n disabled={item.disabled}\n className={cn(\n \"group/trigger relative inline-flex items-center gap-2 text-sm font-medium whitespace-nowrap transition-colors outline-none\",\n \"focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:rounded-md\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n // Underline: full-height tab with an animated bottom border that picks\n // up the active theme's accent color.\n type === \"underline\" &&\n cn(\n \"-mb-px h-10 border-b-2 border-transparent px-0.5 text-foreground/60\",\n \"hover:text-foreground\",\n \"data-[state=active]:border-primary data-[state=active]:text-primary\"\n ),\n // Pill: rounded chip that fills with the accent color when active.\n type === \"pill\" &&\n cn(\n \"h-8 rounded-md px-3 text-foreground/60\",\n \"hover:text-foreground\",\n \"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm\"\n )\n )}\n >\n {item.icon}\n <span>{item.label}</span>\n {item.count != null && (\n <span\n className={cn(\n \"inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-xs font-medium tabular-nums\",\n \"bg-muted text-muted-foreground\",\n // Underline active: tab bg is transparent, so tint the count with\n // the accent. Pill active: chip is filled with the accent, so use\n // the inverse (primary-foreground) to stay legible.\n type === \"underline\" &&\n \"group-data-[state=active]/trigger:bg-primary/10 group-data-[state=active]/trigger:text-primary\",\n type === \"pill\" &&\n \"group-data-[state=active]/trigger:bg-primary-foreground/20 group-data-[state=active]/trigger:text-primary-foreground\"\n )}\n >\n {item.count}\n </span>\n )}\n {item.badge != null && (\n <Badge className=\"px-2 text-[10px]\">{item.badge}</Badge>\n )}\n </TabsPrimitive.Trigger>\n )\n}\n\nexport { CustomTabs }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DataCellProps extends React.ComponentProps<\"div\"> {\n /** Muted caption. */\n label: React.ReactNode\n /** The value. */\n value: React.ReactNode\n /**\n * Optional icon (auto-sized, muted). In `stacked` it sits beside the value;\n * in `row` it leads the label.\n */\n icon?: React.ReactNode\n /**\n * - `stacked` (default): label above value — for spec/detail grids.\n * - `row`: label on the left, value on the right — for definition lists.\n */\n layout?: \"stacked\" | \"row\"\n}\n\n// ============================================================================\n// Data Cell\n// ============================================================================\n\n/**\n * A labelled value cell. `stacked` renders the muted `label` above the bold\n * `value` (for spec/detail grids); `row` puts the label on the left and the\n * value on the right (a definition row). Lay several `stacked` cells out in a\n * grid, or several `row` cells in a `divide-y` column.\n */\nexport function DataCell({\n label,\n value,\n icon,\n layout = \"stacked\",\n className,\n ...props\n}: DataCellProps) {\n const iconNode = icon && (\n <span className=\"shrink-0 text-muted-foreground [&_svg]:size-4\">{icon}</span>\n )\n\n if (layout === \"row\") {\n // Row: icon leads the label on the left; value stays on the right.\n return (\n <div\n data-slot=\"data-cell\"\n data-layout=\"row\"\n className={cn(\n \"flex items-center justify-between gap-4 py-2\",\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1.5 text-sm text-muted-foreground\">\n {iconNode}\n {label}\n </span>\n <span className=\"text-sm font-medium\">{value}</span>\n </div>\n )\n }\n\n // Stacked: icon sits beside the value, under the label.\n return (\n <div\n data-slot=\"data-cell\"\n data-layout=\"stacked\"\n className={cn(\"flex flex-col gap-0.5\", className)}\n {...props}\n >\n <span className=\"text-xs text-muted-foreground\">{label}</span>\n <span className=\"flex items-center gap-1.5 text-sm font-medium\">\n {iconNode}\n {value}\n </span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DefRowProps extends React.ComponentProps<\"div\"> {\n /** Muted label on the left. */\n label: React.ReactNode\n /** Value on the right. */\n value: React.ReactNode\n}\n\n// ============================================================================\n// Def Row\n// ============================================================================\n\n/**\n * A definition row — a muted `label` on the left and a `value` on the right —\n * for key/value detail cards. Stack several inside a `divide-y` container.\n */\nexport function DefRow({ label, value, className, ...props }: DefRowProps) {\n return (\n <div\n data-slot=\"def-row\"\n className={cn(\"flex items-center justify-between gap-4 py-2\", className)}\n {...props}\n >\n <span className=\"text-sm text-muted-foreground\">{label}</span>\n <span className=\"text-sm font-medium\">{value}</span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Variants\n// ============================================================================\n\nconst dividerVariants = cva(\"flex items-center\", {\n variants: {\n orientation: {\n horizontal: \"w-full\",\n vertical: \"h-full flex-col\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n})\n\nconst lineVariants = cva(\"\", {\n variants: {\n color: {\n default: \"bg-border\",\n primary: \"bg-primary\",\n muted: \"bg-muted-foreground\",\n },\n thickness: {\n thin: \"\",\n medium: \"\",\n thick: \"\",\n },\n orientation: {\n horizontal: \"border-t\",\n vertical: \"w-px\",\n },\n },\n compoundVariants: [\n { orientation: \"horizontal\", thickness: \"thin\", class: \"border-t\" },\n { orientation: \"horizontal\", thickness: \"medium\", class: \"border-t-2\" },\n { orientation: \"horizontal\", thickness: \"thick\", class: \"border-t-4\" },\n { orientation: \"vertical\", thickness: \"thin\", class: \"w-px\" },\n { orientation: \"vertical\", thickness: \"medium\", class: \"w-0.5\" },\n { orientation: \"vertical\", thickness: \"thick\", class: \"w-1\" },\n ],\n defaultVariants: {\n color: \"default\",\n thickness: \"thin\",\n orientation: \"horizontal\",\n },\n})\n\nconst labelVariants = cva(\"font-medium whitespace-nowrap\", {\n variants: {\n color: {\n default: \"text-foreground\",\n primary: \"text-primary\",\n muted: \"text-muted-foreground\",\n },\n size: {\n sm: \"text-xs\",\n md: \"text-sm\",\n lg: \"text-base\",\n },\n },\n defaultVariants: {\n color: \"default\",\n size: \"sm\",\n },\n})\n\nconst countVariants = cva(\n \"flex items-center justify-center rounded-full text-xs font-medium\",\n {\n variants: {\n color: {\n default: \"border border-border bg-background text-foreground\",\n primary: \"border border-primary/20 bg-primary/10 text-primary\",\n muted:\n \"border border-muted-foreground/20 bg-muted text-muted-foreground\",\n },\n size: {\n sm: \"h-5 w-5 text-[10px]\",\n md: \"h-6 w-6 text-xs\",\n lg: \"h-7 w-7 text-sm\",\n },\n },\n defaultVariants: {\n color: \"default\",\n size: \"md\",\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DividerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\n /** Label text shown in the divider. */\n label?: React.ReactNode\n /** Optional count rendered as a badge after the label. */\n count?: number\n /** Tint for the line, label, and count. */\n color?: \"default\" | \"primary\" | \"muted\"\n /** Line weight. */\n thickness?: \"thin\" | \"medium\" | \"thick\"\n /** Size of the label text. */\n labelSize?: \"sm\" | \"md\" | \"lg\"\n /** Where the label sits along a horizontal divider. */\n labelPosition?: \"start\" | \"center\" | \"end\"\n /** Divider orientation. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Height for a vertical divider (e.g. \"h-11\", \"h-full\"). */\n height?: string\n /** Optional icon shown before the label (horizontal, start position). */\n icon?: React.ReactNode\n}\n\n// ============================================================================\n// Divider\n// ============================================================================\n\n/**\n * A separator that can carry a `label`, a `count` badge, and an `icon`. Supports\n * `start` / `center` / `end` label positions, `color` and `thickness` variants,\n * and a `vertical` orientation. For a plain rule with no label, use `Separator`.\n */\nfunction Divider({\n className,\n label,\n count,\n color = \"default\",\n thickness = \"thin\",\n labelSize = \"sm\",\n labelPosition = \"start\",\n orientation = \"horizontal\",\n height = \"h-full\",\n icon,\n ...props\n}: DividerProps) {\n const lineClass = cn(lineVariants({ color, thickness, orientation }))\n\n // Vertical divider — a thin rule.\n if (orientation === \"vertical\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(lineClass, \"rounded\", height, className)}\n {...props}\n />\n )\n }\n\n // Plain horizontal divider (no label/count).\n if (label == null && count === undefined) {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants({ orientation }), lineClass, className)}\n {...props}\n />\n )\n }\n\n const countBadge =\n count !== undefined ? (\n <span className={cn(countVariants({ color, size: labelSize }))}>\n {count}\n </span>\n ) : null\n\n // Label at start.\n if (labelPosition === \"start\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), \"gap-2\", className)}\n {...props}\n >\n {icon ? (\n <span className=\"shrink-0\">{icon}</span>\n ) : (\n <div className={cn(\"w-3 shrink-0\", lineClass)} />\n )}\n <span\n className={cn(labelVariants({ color, size: labelSize }), !icon && \"px-2\")}\n >\n {label}\n </span>\n {countBadge}\n <div className={cn(\"grow\", lineClass, count !== undefined && \"ml-2\")} />\n </div>\n )\n }\n\n // Label at center.\n if (labelPosition === \"center\") {\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), className)}\n {...props}\n >\n <div className={cn(\"grow\", lineClass)} />\n <span className={cn(labelVariants({ color, size: labelSize }), \"px-3\")}>\n {label}\n </span>\n {countBadge}\n <div className={cn(\"grow\", lineClass, count !== undefined && \"ml-2\")} />\n </div>\n )\n }\n\n // Label at end.\n return (\n <div\n data-slot=\"divider\"\n role=\"separator\"\n className={cn(dividerVariants(), className)}\n {...props}\n >\n <div className={cn(\"grow\", lineClass)} />\n {count !== undefined && (\n <span className={cn(countVariants({ color, size: labelSize }), \"mr-2\")}>\n {count}\n </span>\n )}\n <span className={cn(labelVariants({ color, size: labelSize }), \"pl-3\")}>\n {label}\n </span>\n </div>\n )\n}\n\nexport { Divider, dividerVariants }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Empty({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty\"\n className={cn(\n \"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-header\"\n className={cn(\n \"flex max-w-sm flex-col items-center gap-2 text-center\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst emptyMediaVariants = cva(\n \"flex shrink-0 items-center justify-center mb-2 [&_svg:not([class*='size-'])]:size-6\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n icon: \"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction EmptyMedia({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof emptyMediaVariants>) {\n return (\n <div\n data-slot=\"empty-icon\"\n data-variant={variant}\n className={cn(emptyMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction EmptyTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-title\"\n className={cn(\"text-lg font-medium tracking-tight\", className)}\n {...props}\n />\n )\n}\n\nfunction EmptyDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"empty-description\"\n className={cn(\n \"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"empty-content\"\n className={cn(\n \"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Empty,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n EmptyDescription,\n EmptyContent,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { InboxIcon } from \"lucide-react\"\n\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from \"@/components/ui/empty\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface EmptyStateProps\n extends Omit<React.ComponentProps<typeof Empty>, \"title\"> {\n /** Leading icon (or any node). Defaults to an inbox icon. */\n icon?: React.ReactNode\n /** Media style: `icon` wraps it in a muted square; `default` for avatars. */\n mediaVariant?: \"icon\" | \"default\"\n /** Heading. Defaults to \"No data\". */\n title?: React.ReactNode\n /** Supporting text. */\n description?: React.ReactNode\n /** Actions (buttons, links, inputs) rendered below. */\n actions?: React.ReactNode\n}\n\n// ============================================================================\n// Empty State\n// ============================================================================\n\n/**\n * A convenience wrapper over the compositional `Empty` primitive — pass\n * `icon`, `title`, `description`, and `actions` as props (with sensible\n * defaults) instead of composing the parts by hand. Drop the props you don't\n * need; use the `Empty*` parts directly when you need full control.\n */\nexport function EmptyState({\n icon = <InboxIcon />,\n mediaVariant = \"icon\",\n title = \"No data\",\n description,\n actions,\n ...props\n}: EmptyStateProps) {\n return (\n <Empty {...props}>\n <EmptyHeader>\n {icon != null && (\n <EmptyMedia variant={mediaVariant}>{icon}</EmptyMedia>\n )}\n {title != null && <EmptyTitle>{title}</EmptyTitle>}\n {description != null && (\n <EmptyDescription>{description}</EmptyDescription>\n )}\n </EmptyHeader>\n {actions != null && <EmptyContent>{actions}</EmptyContent>}\n </Empty>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { CheckIcon, PlusCircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from \"@/components/ui/command\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { Separator } from \"@/components/ui/separator\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FacetedFilterOption {\n /** Value stored in the selection. */\n value: string\n /** Visible label. */\n label: string\n /** Optional leading icon. */\n icon?: React.ReactNode\n /** Optional count shown on the right (e.g. matching rows). */\n count?: number\n}\n\ninterface BaseProps {\n /** Trigger label, e.g. \"Status\". */\n title: string\n options: FacetedFilterOption[]\n /** Placeholder for the search box. Defaults to `title`. */\n searchPlaceholder?: string\n /** Hide the search box (for short lists). */\n searchable?: boolean\n className?: string\n}\n\ninterface MultiProps extends BaseProps {\n mode?: \"multiple\"\n /** Selected values. */\n value: string[]\n onChange: (value: string[]) => void\n}\n\ninterface SingleProps extends BaseProps {\n mode: \"single\"\n /** Selected value (or null). */\n value: string | null\n onChange: (value: string | null) => void\n}\n\nexport type FacetedFilterProps = MultiProps | SingleProps\n\n// ============================================================================\n// Faceted Filter\n// ============================================================================\n\n/**\n * A controlled filter trigger + popover: a searchable list of options, each\n * selectable (multi-select checkboxes by default, or single-select with\n * `mode=\"single\"`). Shows a selected-count badge on the trigger and emits the\n * value(s) via `onChange` — use it to filter your own list or API query.\n */\nexport function FacetedFilter(props: FacetedFilterProps) {\n const {\n title,\n options,\n searchPlaceholder,\n searchable = true,\n className,\n } = props\n\n const isMultiple = props.mode !== \"single\"\n const selectedValues = React.useMemo(\n () =>\n new Set(\n isMultiple\n ? (props.value as string[])\n : props.value\n ? [props.value as string]\n : []\n ),\n [isMultiple, props.value]\n )\n\n const select = (value: string) => {\n if (isMultiple) {\n const next = new Set(selectedValues)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n ;(props.onChange as (v: string[]) => void)(Array.from(next))\n } else {\n const onChange = props.onChange as (v: string | null) => void\n // Toggle off if re-selecting the same single value.\n onChange(selectedValues.has(value) ? null : value)\n }\n }\n\n const clear = () => {\n if (isMultiple) (props.onChange as (v: string[]) => void)([])\n else (props.onChange as (v: string | null) => void)(null)\n }\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\"w-fit border-dashed\", className)}\n >\n <PlusCircleIcon />\n {title}\n {selectedValues.size > 0 && (\n <>\n <Separator orientation=\"vertical\" className=\"mx-0.5 h-4\" />\n {/* Only a count — never the selected labels */}\n <Badge\n variant=\"secondary\"\n className=\"rounded-sm px-1 font-normal\"\n >\n {selectedValues.size}\n </Badge>\n </>\n )}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-56 p-0\" align=\"start\">\n <Command>\n {searchable && (\n <CommandInput placeholder={searchPlaceholder ?? title} />\n )}\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n <CommandGroup>\n {options.map((option) => {\n const isSelected = selectedValues.has(option.value)\n return (\n <CommandItem\n key={option.value}\n onSelect={() => select(option.value)}\n >\n <div\n className={cn(\n \"flex size-4 items-center justify-center rounded-[4px] border\",\n // Square for multi (checkbox), round for single (radio).\n isMultiple ? \"rounded-[4px]\" : \"rounded-full\",\n isSelected\n ? \"border-primary bg-primary text-primary-foreground\"\n : \"border-input [&_svg]:invisible\"\n )}\n >\n <CheckIcon className=\"size-3\" />\n </div>\n {option.icon && (\n <span className=\"text-muted-foreground [&_svg]:size-4\">\n {option.icon}\n </span>\n )}\n <span>{option.label}</span>\n {option.count != null && (\n <span className=\"ml-auto flex size-4 items-center justify-center font-mono text-xs text-muted-foreground\">\n {option.count}\n </span>\n )}\n </CommandItem>\n )\n })}\n </CommandGroup>\n {selectedValues.size > 0 && (\n <>\n <CommandSeparator />\n <CommandGroup>\n <CommandItem\n onSelect={clear}\n className=\"justify-center text-center\"\n >\n Clear filters\n </CommandItem>\n </CommandGroup>\n </>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Checkbox } from \"@/components/ui/checkbox\"\nimport {\n ActionsMenu,\n type ActionsMenuItem,\n} from \"@/components/custom/actions-menu\"\n\n// ============================================================================\n// Footer building blocks (optional)\n// ============================================================================\n\n/** A small avatar (image or initials) paired with a label — for card footers. */\nexport function ListCardPerson({\n name,\n src,\n className,\n}: {\n name: string\n src?: string\n className?: string\n}) {\n const initials = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((p) => p[0]?.toUpperCase() ?? \"\")\n .join(\"\")\n return (\n <span\n className={cn(\n \"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted text-[10px] font-semibold text-foreground\">\n {src ? (\n <img src={src} alt={name} className=\"size-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n <span className=\"truncate\">{name}</span>\n </span>\n )\n}\n\n/** A bordered chip with an optional leading icon — for entity tags in footers. */\nexport function ListCardChip({\n icon,\n children,\n className,\n}: {\n icon?: React.ReactNode\n children: React.ReactNode\n className?: string\n}) {\n return (\n <span\n className={cn(\n \"inline-flex min-w-0 items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:opacity-70\",\n className\n )}\n >\n {icon}\n <span className=\"truncate\">{children}</span>\n </span>\n )\n}\n\n// ============================================================================\n// ListCard\n// ============================================================================\n\nexport interface ListCardProps\n extends Omit<React.ComponentProps<\"div\">, \"title\" | \"onSelect\"> {\n /** Primary heading. */\n title: React.ReactNode\n /** Muted secondary line below the title. */\n description?: React.ReactNode\n /** Leading visual beside the title — an image URL, or any node (icon, avatar). */\n media?: React.ReactNode | string\n /** Status badge shown in the top-left. */\n badge?: React.ReactNode\n /** Extra muted text shown in the footer, e.g. a timestamp. */\n meta?: React.ReactNode\n /** Footer content — pass `ListCardPerson`, `ListCardChip`, or any nodes. */\n footer?: React.ReactNode\n /** Kebab menu actions (top-right of the card). Pass items or a ready node. */\n actions?: ActionsMenuItem[] | React.ReactNode\n /**\n * - `stacked` (default): header row (checkbox + badge, menu on the right),\n * then media + title/description, then footer.\n * - `row`: a single line — checkbox, media, title/description, then menu.\n */\n layout?: \"stacked\" | \"row\"\n /**\n * Surface style. `default` uses the card background; `alt` uses the muted\n * background so cards stand out when nested on a card-colored surface.\n */\n variant?: \"default\" | \"alt\"\n /** Render a selection checkbox. */\n selectable?: boolean\n /** Controlled checkbox state (with `selectable`). */\n selected?: boolean\n /** Called when the checkbox toggles. */\n onSelectedChange?: (checked: boolean) => void\n /** Highlight the card with a ring (e.g. focused/open row). */\n active?: boolean\n /** Makes the whole card a button. */\n onClick?: React.MouseEventHandler<HTMLDivElement>\n}\n\n/**\n * A minimal content card for list / grid layouts: a top row (checkbox + badge,\n * with an actions menu on the right), an optional media thumbnail beside a title\n * + description, and a footer (where `meta` is shown). Every slot is optional,\n * so it renders any kind of data — alerts, tasks, contacts, files, etc.\n */\nexport function ListCard({\n title,\n description,\n media,\n badge,\n meta,\n footer,\n actions,\n layout = \"stacked\",\n variant = \"default\",\n selectable = false,\n selected,\n onSelectedChange,\n active = false,\n onClick,\n className,\n ...props\n}: ListCardProps) {\n const interactive = onClick != null\n const isRow = layout === \"row\"\n\n const checkboxNode = selectable ? (\n <Checkbox\n checked={selected}\n onCheckedChange={(c) => onSelectedChange?.(c === true)}\n onClick={(e) => e.stopPropagation()}\n aria-label=\"Select card\"\n className=\"shrink-0\"\n />\n ) : null\n\n const mediaNode =\n typeof media === \"string\" ? (\n <img\n src={media}\n alt=\"\"\n className=\"size-12 shrink-0 rounded-md object-cover\"\n />\n ) : (\n media\n )\n\n const badgeNode =\n badge == null ? null : typeof badge === \"string\" ||\n typeof badge === \"number\" ? (\n <Badge variant=\"secondary\" className=\"font-medium\">\n {badge}\n </Badge>\n ) : (\n badge\n )\n\n const actionsNode = Array.isArray(actions) ? (\n <ActionsMenu items={actions} align=\"end\" />\n ) : (\n actions\n )\n\n const rootClassName = cn(\n \"rounded-xl border p-4 text-card-foreground transition-colors\",\n variant === \"alt\" ? \"bg-muted/50\" : \"bg-card\",\n interactive &&\n \"cursor-pointer hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50\",\n active && \"ring-2 ring-ring\",\n className\n )\n\n const rootProps = {\n \"data-slot\": \"list-card\",\n \"data-active\": active || undefined,\n onClick,\n role: interactive ? \"button\" : undefined,\n tabIndex: interactive ? 0 : undefined,\n ...props,\n }\n\n // --- Single-line row layout -----------------------------------------------\n if (isRow) {\n return (\n <div className={cn(\"flex items-start gap-3\", rootClassName)} {...rootProps}>\n {checkboxNode}\n {mediaNode}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex min-w-0 items-start gap-2\">\n <p className=\"min-w-0 truncate font-medium text-sm\">{title}</p>\n {badgeNode}\n </div>\n {description != null && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {description}\n </p>\n )}\n {(footer != null || meta != null) && (\n <div className=\"mt-1 flex min-w-0 flex-wrap items-center gap-2\">\n {meta != null && (\n <span className=\"text-xs text-muted-foreground\">{meta}</span>\n )}\n {footer}\n </div>\n )}\n </div>\n {actionsNode != null && (\n <div className=\"shrink-0\" onClick={(e) => e.stopPropagation()}>\n {actionsNode}\n </div>\n )}\n </div>\n )\n }\n\n // --- Stacked layout -------------------------------------------------------\n return (\n <div className={cn(\"flex flex-col gap-3\", rootClassName)} {...rootProps}>\n {/* Top row: checkbox + badge on the left, actions menu on the right */}\n {(checkboxNode != null || badgeNode != null || actionsNode != null) && (\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {checkboxNode}\n {badgeNode}\n </div>\n {actionsNode != null && (\n <div\n className=\"-mt-1 -mr-1 shrink-0\"\n onClick={(e) => e.stopPropagation()}\n >\n {actionsNode}\n </div>\n )}\n </div>\n )}\n\n {/* Body: media + title/description */}\n <div className=\"flex min-w-0 items-start gap-3\">\n {mediaNode}\n <div className=\"min-w-0 flex-1\">\n <p className=\"font-medium text-sm leading-snug\">{title}</p>\n {description != null && (\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n </div>\n\n {/* Footer (meta is prepended here) */}\n {(footer != null || meta != null) && (\n <div className=\"mt-auto flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 border-t pt-3\">\n {meta != null && (\n <span className=\"text-xs text-muted-foreground\">{meta}</span>\n )}\n {footer}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================================================\n// ListCardGrid — responsive grid wrapper\n// ============================================================================\n\nexport interface ListCardGridProps extends React.ComponentProps<\"div\"> {\n /** Column count at the widest breakpoint. Defaults to 3. */\n columns?: 1 | 2 | 3 | 4\n}\n\nconst GRID_COLS: Record<NonNullable<ListCardGridProps[\"columns\"]>, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-1 sm:grid-cols-2\",\n 3: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n 4: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4\",\n}\n\n/** A responsive grid that lays out `ListCard`s. */\nexport function ListCardGrid({\n columns = 3,\n className,\n ...props\n}: ListCardGridProps) {\n return (\n <div\n data-slot=\"list-card-grid\"\n className={cn(\"grid w-full gap-4\", GRID_COLS[columns], className)}\n {...props}\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface MapMarkerPinProps extends React.ComponentProps<\"span\"> {\n /** Icon rendered inside the pin. */\n icon?: React.ReactNode\n /**\n * Background color of the pin — a Tailwind bg utility (e.g. `bg-primary`,\n * `bg-green`, `bg-red`) or a CSS color via `style`. Defaults to `bg-primary`.\n */\n color?: string\n /** Pin diameter in px. Default `28`. */\n size?: number\n /** Rotate the icon (e.g. a vehicle heading), in degrees. */\n rotate?: number\n /** Active/selected — adds a pulsing halo, scales up, and shows the label. */\n active?: boolean\n /** Optional label shown beneath the pin (always when set, or only when active). */\n label?: React.ReactNode\n /** Only show the label while `active`. Default `true`. */\n labelOnActive?: boolean\n}\n\n// ============================================================================\n// Map Marker Pin\n// ============================================================================\n\n/**\n * A reusable map-marker visual: a colored circular pin with an icon, an optional\n * pulsing halo + scale-up when `active`, and an optional `label` tooltip beneath\n * it. Drop it inside a `MapMarker` (or any positioned container). `color` is a\n * Tailwind bg utility so it tracks theme tokens.\n */\nexport function MapMarkerPin({\n icon,\n color = \"bg-primary\",\n size = 28,\n rotate,\n active = false,\n label,\n labelOnActive = true,\n className,\n ...props\n}: MapMarkerPinProps) {\n const showLabel = label != null && (!labelOnActive || active)\n\n return (\n <span\n data-slot=\"map-marker-pin\"\n data-active={active || undefined}\n className={cn(\"relative flex flex-col items-center\", className)}\n {...props}\n >\n {/* Pulsing halo when active */}\n {active && (\n <span\n aria-hidden\n className={cn(\n \"absolute top-0 animate-ping rounded-full opacity-30\",\n color\n )}\n style={{ width: size + 4, height: size + 4 }}\n />\n )}\n\n {/* Pin — icon auto-sizes to half the pin. */}\n <span\n className={cn(\n \"flex items-center justify-center rounded-full text-white shadow-md ring-2 ring-background transition-transform [&_svg]:size-1/2\",\n color,\n active && \"scale-110\"\n )}\n style={{ width: size, height: size }}\n >\n {rotate != null ? (\n <span\n className=\"flex [&_svg]:size-full\"\n style={{\n width: size / 2,\n height: size / 2,\n transform: `rotate(${rotate}deg)`,\n }}\n >\n {icon}\n </span>\n ) : (\n icon\n )}\n </span>\n\n {/* Label */}\n {showLabel && (\n <span className=\"mt-1 rounded bg-foreground px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap text-background shadow\">\n {label}\n </span>\n )}\n </span>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ArrowLeftIcon, HomeIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface NotFoundProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Big status code or glyph, e.g. \"404\". Pass an icon node for empty states. */\n code?: React.ReactNode\n /** Heading. Defaults to \"Page Not Found\". */\n title?: React.ReactNode\n /** Supporting text under the title. */\n description?: React.ReactNode\n /** Show the \"Go Back\" button (calls `onGoBack`, or history.back()). */\n showBack?: boolean\n /** Override the back-button handler. Defaults to `history.back()`. */\n onGoBack?: () => void\n /** Href for the \"Go to Home\" button. Set `null` to hide it. */\n homeHref?: string | null\n /** Label for the home button. */\n homeLabel?: React.ReactNode\n /** Extra actions rendered after the default buttons. */\n actions?: React.ReactNode\n}\n\n// ============================================================================\n// Not Found\n// ============================================================================\n\n/**\n * A centered status / not-found screen: a large `code` (e.g. \"404\"), a `title`,\n * a `description`, and action buttons (Go Back + Go to Home). Generic enough for\n * 404 / 403 / 500 and empty states — pass an icon as `code` for the latter.\n */\nexport function NotFound({\n code = \"404\",\n title = \"Page Not Found\",\n description = \"Sorry, we couldn't find the page you're looking for. The page might have been moved, deleted, or never existed.\",\n showBack = true,\n onGoBack,\n homeHref = \"/\",\n homeLabel = \"Go to Home\",\n actions,\n className,\n ...props\n}: NotFoundProps) {\n const handleBack = () => {\n if (onGoBack) onGoBack()\n else if (typeof window !== \"undefined\") window.history.back()\n }\n\n return (\n <div\n data-slot=\"not-found\"\n className={cn(\n \"flex min-h-[60svh] flex-col items-center justify-center px-6 text-center\",\n className\n )}\n {...props}\n >\n {code != null && (\n <div className=\"text-7xl font-extrabold tracking-tight text-primary tabular-nums sm:text-8xl [&_svg]:size-20\">\n {code}\n </div>\n )}\n\n {title != null && (\n <h1 className=\"mt-4 text-2xl font-bold tracking-tight sm:text-3xl\">\n {title}\n </h1>\n )}\n\n {description != null && (\n <p className=\"mt-3 max-w-md text-muted-foreground\">{description}</p>\n )}\n\n {(showBack || homeHref || actions) && (\n <div className=\"mt-8 flex flex-wrap items-center justify-center gap-3\">\n {showBack && (\n <Button\n variant=\"outline\"\n onClick={handleBack}\n startItem={<ArrowLeftIcon />}\n >\n Go Back\n </Button>\n )}\n {homeHref != null && (\n <Button asChild>\n <a href={homeHref}>\n <HomeIcon />\n {homeLabel}\n </a>\n </Button>\n )}\n {actions}\n </div>\n )}\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface QuickStatProps extends React.ComponentProps<\"div\"> {\n /** Leading icon (auto-sized to 1rem). */\n icon?: React.ReactNode\n /** The figure, e.g. \"$960.99\" or 982. */\n value: React.ReactNode\n /** Muted trailing label, e.g. \"in stock\", \"sold\". */\n label?: React.ReactNode\n}\n\n// ============================================================================\n// Quick Stat\n// ============================================================================\n\n/**\n * A compact inline stat — a muted icon, a bold value, and an optional muted\n * label — for header metric rows and toolbars. Line several up with vertical\n * separators between them.\n */\nexport function QuickStat({\n icon,\n value,\n label,\n className,\n ...props\n}: QuickStatProps) {\n return (\n <div\n data-slot=\"quick-stat\"\n className={cn(\"flex items-center gap-1.5 text-sm\", className)}\n {...props}\n >\n {icon && (\n <span className=\"text-muted-foreground [&_svg]:size-4\">{icon}</span>\n )}\n <span className=\"font-medium tabular-nums\">{value}</span>\n {label != null && <span className=\"text-muted-foreground\">{label}</span>}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst cardVariants = cva(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-sm py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-sm *:[img:last-child]:rounded-b-sm\",\n {\n variants: {\n variant: {\n // Default surface.\n default: \"bg-card text-card-foreground ring-foreground/10\",\n // Muted alternate background (the repo's `alt` convention).\n alt: \"bg-muted/40 text-card-foreground ring-foreground/10\",\n // Soft, tone-tinted surfaces for status emphasis.\n primary: \"bg-primary/5 text-card-foreground ring-primary/20\",\n success: \"bg-green/5 text-card-foreground ring-green/20\",\n warning: \"bg-orange/5 text-card-foreground ring-orange/20\",\n danger: \"bg-red/5 text-card-foreground ring-red/20\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Card({\n className,\n size = \"default\",\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & {\n size?: \"default\" | \"sm\"\n} & VariantProps<typeof cardVariants>) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n data-variant={variant}\n className={cn(cardVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\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-sm px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n \"text-base leading-snug font-medium group-data-[size=sm]/card:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-sm border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n cardVariants,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { CircleDotIcon, RefreshCwIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card } from \"@/components/ui/card\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Color variant for the accent bar, mode label, icon, and value text. */\nexport type SensorCardColorVariant = \"primary\" | \"warning\" | \"danger\" | \"muted\"\n\nexport interface SensorCardProps {\n /** Leading icon. Falls back to a default based on `mode` (\"auto\" vs other). */\n icon?: React.ReactNode\n /** Mode label, e.g. \"Manual\", \"Auto\". */\n mode?: string\n /** Main description / name. */\n description?: string\n /** Value shown on the right, e.g. \"80\", \"Active\", \"OFF\". */\n value: string\n /** Show the colored accent bar before the value (active states). */\n showAccent?: boolean\n /** Color of the accent bar, mode label, and default icon. */\n colorVariant?: SensorCardColorVariant\n /** Override the accent-bar color only (falls back to `colorVariant`). */\n accentColorVariant?: SensorCardColorVariant\n /** Color the value text (defaults to the foreground color). */\n valueColorVariant?: SensorCardColorVariant\n /** Append a \"%\" to numeric values. Default `true`. */\n showPercentSign?: boolean\n /** Unit shown above the value in a stacked layout, e.g. \"°F\", \"kPa\". */\n unit?: string\n /** Icon on the left with mode/description stacked beside it. */\n stackedLayout?: boolean\n /**\n * - `default`: bare row, no Card wrapper (for nesting).\n * - `standalone`: wrapped in a Card with full styling.\n */\n variant?: \"default\" | \"standalone\"\n /** Click handler for the whole card. */\n onClick?: () => void\n /** Click handler for just the value. */\n onValueClick?: () => void\n className?: string\n}\n\n// ============================================================================\n// Color tokens\n// ============================================================================\n\nconst COLOR_CLASSES: Record<\n SensorCardColorVariant,\n { text: string; bg: string }\n> = {\n primary: { text: \"text-primary\", bg: \"bg-primary\" },\n warning: { text: \"text-orange\", bg: \"bg-orange\" },\n danger: { text: \"text-red\", bg: \"bg-red\" },\n muted: { text: \"text-muted-foreground\", bg: \"bg-muted-foreground\" },\n}\n\n// ============================================================================\n// Sensor Card\n// ============================================================================\n\n/**\n * A compact info/action card: a left side with an icon, mode label, and\n * description, and a right side with an accent bar and a value. Use\n * `colorVariant` to tint the bar, mode label, and default icon (primary /\n * warning / danger / muted), `variant=\"standalone\"` to wrap it in a Card, and\n * `onClick` / `onValueClick` for actions.\n */\nexport function SensorCard({\n icon,\n mode,\n description,\n value,\n showAccent = false,\n colorVariant = \"primary\",\n accentColorVariant,\n valueColorVariant,\n showPercentSign = true,\n unit,\n stackedLayout = false,\n variant = \"default\",\n onClick,\n onValueClick,\n className,\n}: SensorCardProps) {\n const colors = COLOR_CLASSES[colorVariant]\n const accentColors = COLOR_CLASSES[accentColorVariant ?? colorVariant]\n const valueTextColorClass = valueColorVariant\n ? COLOR_CLASSES[valueColorVariant].text\n : \"text-foreground\"\n\n // Default icon, tinted with the card's color variant.\n const iconSize = stackedLayout ? \"size-10\" : \"size-5\"\n const resolvedIcon =\n icon ??\n (mode?.toLowerCase() === \"auto\" ? (\n <RefreshCwIcon className={cn(iconSize, colors.text)} />\n ) : (\n <CircleDotIcon className={cn(iconSize, colors.text)} />\n ))\n\n const left = stackedLayout ? (\n <div className=\"flex items-center gap-3\">\n {resolvedIcon}\n <div className=\"flex flex-col\">\n {mode && (\n <span className={cn(\"text-sm font-medium\", colors.text)}>{mode}</span>\n )}\n <span className=\"text-sm font-medium text-foreground\">\n {description}\n </span>\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n {resolvedIcon}\n {mode && (\n <span className={cn(\"text-sm font-medium\", colors.text)}>{mode}</span>\n )}\n </div>\n <span className=\"text-sm font-medium text-foreground\">{description}</span>\n </div>\n )\n\n const content = (\n <>\n {left}\n\n {/* Right side - accent bar + value */}\n <div className=\"flex items-center gap-3\">\n <div\n className={cn(\n \"h-9 w-0.5 rounded-full\",\n showAccent ? accentColors.bg : \"bg-border\"\n )}\n />\n {unit ? (\n <div\n className={cn(\n \"flex min-w-16 flex-col items-center text-center\",\n onValueClick &&\n \"cursor-pointer transition-colors hover:text-primary\"\n )}\n onClick={onValueClick}\n >\n <span className=\"text-xs font-medium text-muted-foreground\">\n {unit}\n </span>\n <span className={cn(\"text-sm font-medium\", valueTextColorClass)}>\n {value}\n </span>\n </div>\n ) : (\n <span\n className={cn(\n \"min-w-16 text-center text-sm font-medium whitespace-nowrap\",\n valueTextColorClass,\n onValueClick &&\n \"cursor-pointer transition-colors hover:text-primary\"\n )}\n onClick={onValueClick}\n >\n {showPercentSign && value !== \"\" && !isNaN(Number(value))\n ? `${value}%`\n : value}\n </span>\n )}\n </div>\n </>\n )\n\n const baseClasses = cn(\n \"flex w-full flex-row items-center justify-between gap-3\",\n stackedLayout ? \"py-3 pr-3 pl-3\" : \"py-3.5 pr-3 pl-4\",\n onClick && \"cursor-pointer hover:bg-accent\",\n className\n )\n\n if (variant === \"standalone\") {\n return (\n <Card className=\"p-0\" onClick={onClick}>\n <div className={baseClasses}>{content}</div>\n </Card>\n )\n }\n\n return (\n <div className={baseClasses} onClick={onClick}>\n {content}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Dialog as SheetPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { XIcon } from \"lucide-react\"\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\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\nfunction SheetContent({\n className,\n children,\n side = \"right\",\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n showCloseButton?: boolean\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\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 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm 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 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\n variant=\"ghost\"\n className=\"absolute top-3 right-3\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn(\"flex flex-col gap-0.5 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn(\n \"text-base font-medium text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeftIcon, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetTitle,\n} from \"@/components/ui/sheet\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SideSheetProps {\n /** Body content — typically a form. Scrolls between the pinned header/footer. */\n children: React.ReactNode\n /** Heading shown in the pinned header. */\n title?: React.ReactNode\n /** Whether the sheet is open. Controlled. */\n open: boolean\n /** Called when the sheet requests to close (back/close, overlay, or Esc). */\n onClose: () => void\n /** Optional supporting text under the title. */\n description?: React.ReactNode\n /** Which edge the sheet slides in from. Defaults to `right`. */\n side?: \"left\" | \"right\"\n /**\n * Detach the panel from the screen edge — inset with a margin, fully rounded\n * corners, and a shadow, so it reads as a floating card.\n */\n floating?: boolean\n /**\n * Show a back chevron before the title. Defaults to a close (X) button.\n * When set, the chevron calls `onBack` (falls back to `onClose`).\n */\n onBack?: () => void\n /**\n * When set, the sheet can't be dismissed by clicking the overlay or pressing\n * Escape — only the header control / footer actions close it.\n */\n notDismissable?: boolean\n /** Footer content, pinned to the bottom with a top border. Always visible. */\n footer?: React.ReactNode\n /** Class for the sheet content surface (e.g. width overrides). */\n className?: string\n}\n\n// ============================================================================\n// Side Sheet\n// ============================================================================\n\n/**\n * A slide-in panel with a pinned header and a **sticky footer**: the header\n * (title, description, and a back/close control) and the footer (actions) stay\n * fixed while the body scrolls between them. Controlled via `open`/`onClose`.\n * Set `notDismissable` to require an explicit action to close, pass `onBack` to\n * swap the close button for a back chevron, or `floating` to detach the panel\n * from the screen edge as a rounded, shadowed card.\n */\nfunction SideSheet({\n children,\n title,\n open,\n onClose,\n description,\n side = \"right\",\n floating,\n onBack,\n notDismissable,\n footer,\n className,\n}: SideSheetProps) {\n const showBack = onBack !== undefined\n\n return (\n <Sheet\n open={open}\n onOpenChange={\n notDismissable ? undefined : (isOpen) => !isOpen && onClose()\n }\n >\n <SheetContent\n side={side}\n showCloseButton={false}\n className={cn(\n \"flex w-full flex-col gap-0 overflow-hidden p-0\",\n // Override the base SheetContent's `data-[side]:sm:max-w-sm` cap.\n // tailwind-merge keeps both since they differ by variant, so we match\n // the same variant to win and widen the panel toward the reference.\n \"data-[side=left]:sm:max-w-[570px] data-[side=right]:sm:max-w-[570px]\",\n // Floating: detach from the edge with a margin, round all corners, and\n // cast a shadow. We re-target the base's `data-[side]` positioning so\n // tailwind-merge lets these win.\n floating &&\n cn(\n \"rounded-xl shadow-xl ring-1 ring-foreground/10\",\n \"data-[side=right]:inset-y-3 data-[side=right]:right-3 data-[side=right]:h-auto\",\n \"data-[side=left]:inset-y-3 data-[side=left]:left-3 data-[side=left]:h-auto\"\n ),\n className\n )}\n >\n {/* Pinned header */}\n <SheetHeader className=\"shrink-0 flex-row items-center gap-2 border-b border-border px-4 py-3\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={showBack ? \"Back\" : \"Close\"}\n className=\"-ml-1 shrink-0 text-muted-foreground\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n ;(showBack ? onBack! : onClose)()\n }}\n >\n {showBack ? <ChevronLeftIcon /> : <XIcon />}\n </Button>\n <div className=\"flex min-w-0 flex-col\">\n <SheetTitle className=\"truncate text-left text-lg font-semibold\">\n {title}\n </SheetTitle>\n {description && (\n <SheetDescription className=\"text-left\">\n {description}\n </SheetDescription>\n )}\n </div>\n </SheetHeader>\n\n {/* Scrollable body */}\n <div className=\"min-h-0 flex-1 space-y-4 overflow-y-auto p-4\">\n {children}\n </div>\n\n {/* Sticky footer */}\n {footer && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 border-t border-border px-4 py-4\">\n {footer}\n </div>\n )}\n </SheetContent>\n </Sheet>\n )\n}\n\n// ============================================================================\n// Side Sheet Section\n// ============================================================================\n\nexport interface SideSheetSectionProps extends React.ComponentProps<\"div\"> {\n /** Optional label rendered above the grouped panel, with a divider rule. */\n label?: React.ReactNode\n /** Optional trailing control beside the label (e.g. an expand button). */\n action?: React.ReactNode\n}\n\n/**\n * A labelled, grouped block for the sheet body — a divider-titled `bg-secondary`\n * panel, matching the \"Trigger Settings\" / \"Spray Stages\" grouping pattern.\n * Drop form rows in as children.\n */\nfunction SideSheetSection({\n label,\n action,\n className,\n children,\n ...props\n}: SideSheetSectionProps) {\n return (\n <div data-slot=\"side-sheet-section\" {...props}>\n {label && (\n <div className=\"mb-3 flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">{label}</span>\n <span className=\"h-px flex-1 bg-border\" />\n {action}\n </div>\n )}\n <div className={cn(\"space-y-4 rounded-lg bg-secondary p-4\", className)}>\n {children}\n </div>\n </div>\n )\n}\n\nexport { SideSheet, SideSheetSection }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Area, AreaChart, ResponsiveContainer } from \"recharts\"\nimport { TrendingDownIcon, TrendingUpIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card, CardContent, CardHeader } from \"@/components/ui/card\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type StatCardColor =\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\"\n\nexport interface StatCardTrend {\n /** Delta text, e.g. \"+20.1%\". */\n value: string\n /** Direction — sets the arrow icon and default color. */\n direction?: \"up\" | \"down\"\n /** Trailing context, e.g. \"from last month\". */\n label?: React.ReactNode\n}\n\nexport interface StatCardProgress {\n /** Completion percentage, 0–100. */\n value: number\n /** Caption under the bar, left-aligned. */\n caption?: React.ReactNode\n /** Caption under the bar, right-aligned (e.g. \"Target: $10,000\"). */\n target?: React.ReactNode\n}\n\nexport interface StatCardRing {\n /** Filled percentage, 0–100. */\n value: number\n /** Label inside the ring (defaults to `value%`). */\n label?: React.ReactNode\n /** Caption beside the ring (e.g. \"of 100 GB\"). */\n caption?: React.ReactNode\n}\n\nexport interface StatCardProps {\n /** Small muted heading. */\n title: React.ReactNode\n /** The headline figure, e.g. \"$45,231\". */\n value: React.ReactNode\n /** Muted supporting line under the value. */\n description?: React.ReactNode\n /** Icon shown in a tinted box at the top-right. */\n icon?: React.ReactNode\n /** Accent color for the icon box, trend, progress bar, and ring. */\n color?: StatCardColor\n /** A colored delta with a trend arrow, shown in place of `description`. */\n trend?: StatCardTrend\n /** A linear progress bar with optional captions, shown under the value. */\n progress?: StatCardProgress\n /** A small filled area chart (series of numbers), shown under the value. */\n sparkline?: number[]\n /** A radial progress ring shown beside the value. */\n ring?: StatCardRing\n className?: string\n}\n\n// ============================================================================\n// Color tokens\n// ============================================================================\n\nconst COLOR: Record<StatCardColor, { text: string; bg: string; soft: string }> =\n {\n primary: { text: \"text-primary\", bg: \"bg-primary\", soft: \"bg-primary/10\" },\n success: { text: \"text-green\", bg: \"bg-green\", soft: \"bg-green/10\" },\n warning: { text: \"text-orange\", bg: \"bg-orange\", soft: \"bg-orange/10\" },\n danger: { text: \"text-red\", bg: \"bg-red\", soft: \"bg-red/10\" },\n muted: {\n text: \"text-muted-foreground\",\n bg: \"bg-muted-foreground\",\n soft: \"bg-muted\",\n },\n }\n\n// ============================================================================\n// Accessories\n// ============================================================================\n\nfunction Sparkline({\n data,\n colorVar,\n}: {\n data: number[]\n colorVar: string\n}) {\n const id = React.useId().replace(/:/g, \"\")\n const series = data.map((y, x) => ({ x, y }))\n return (\n <div className=\"mt-3 h-16 w-full\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={series} margin={{ top: 4, right: 0, bottom: 0, left: 0 }}>\n <defs>\n <linearGradient id={`spark-${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colorVar} stopOpacity={0.25} />\n <stop offset=\"100%\" stopColor={colorVar} stopOpacity={0} />\n </linearGradient>\n </defs>\n <Area\n dataKey=\"y\"\n type=\"natural\"\n stroke={colorVar}\n strokeWidth={2}\n fill={`url(#spark-${id})`}\n fillOpacity={1}\n isAnimationActive={false}\n dot={false}\n />\n </AreaChart>\n </ResponsiveContainer>\n </div>\n )\n}\n\n// ============================================================================\n// Stat Card\n// ============================================================================\n\n/**\n * A dashboard stat card: a muted `title`, a bold `value`, and an optional\n * accessory — a tinted `icon` box, a colored `trend` delta, a linear\n * `progress` bar, a `sparkline` area chart, or a radial `ring`. Tint accessories\n * with `color`.\n */\nexport function StatCard({\n title,\n value,\n description,\n icon,\n color = \"primary\",\n trend,\n progress,\n sparkline,\n ring,\n className,\n}: StatCardProps) {\n const colors = COLOR[color]\n // Resolve the accent to a CSS variable recharts can read.\n const colorVar =\n color === \"muted\" ? \"var(--muted-foreground)\" : `var(--${cssVar(color)})`\n\n return (\n <Card className={cn(\"gap-3\", className)}>\n <CardHeader className=\"flex flex-row items-start justify-between gap-2 pb-0\">\n <span className=\"text-sm font-medium text-muted-foreground\">\n {title}\n </span>\n {icon && (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center rounded-md\",\n colors.soft,\n colors.text,\n \"[&_svg]:size-4\"\n )}\n >\n {icon}\n </span>\n )}\n </CardHeader>\n\n <CardContent>\n {ring ? (\n <div className=\"mt-1 flex items-center gap-4\">\n <RingOnly ring={ring} colors={colors} />\n <div className=\"flex flex-col\">\n <span className=\"text-2xl font-bold tracking-tight tabular-nums\">\n {value}\n </span>\n {ring.caption && (\n <span className=\"text-sm text-muted-foreground\">\n {ring.caption}\n </span>\n )}\n </div>\n </div>\n ) : (\n <span className=\"text-2xl font-bold tracking-tight tabular-nums\">\n {value}\n </span>\n )}\n\n {/* Trend / description line */}\n {trend ? (\n <p className=\"mt-1 flex items-center gap-1 text-sm text-muted-foreground\">\n <span\n className={cn(\n \"flex items-center gap-1 font-medium\",\n trend.direction === \"down\" ? \"text-red\" : \"text-green\"\n )}\n >\n {trend.direction === \"down\" ? (\n <TrendingDownIcon className=\"size-4\" />\n ) : (\n <TrendingUpIcon className=\"size-4\" />\n )}\n {trend.value}\n </span>\n {trend.label}\n </p>\n ) : description && !ring ? (\n <p className=\"mt-1 text-sm text-muted-foreground\">{description}</p>\n ) : null}\n\n {/* Progress */}\n {progress && (\n <div className=\"mt-3 flex flex-col gap-2\">\n <div className=\"h-2 w-full overflow-hidden rounded-full bg-muted\">\n <div\n className={cn(\"h-full rounded-full transition-all\", colors.bg)}\n style={{\n width: `${Math.max(0, Math.min(100, progress.value))}%`,\n }}\n />\n </div>\n {(progress.caption || progress.target) && (\n <div className=\"flex items-center justify-between text-sm text-muted-foreground\">\n <span>{progress.caption}</span>\n <span>{progress.target}</span>\n </div>\n )}\n </div>\n )}\n\n {/* Sparkline */}\n {sparkline && sparkline.length > 1 && (\n <Sparkline data={sparkline} colorVar={colorVar} />\n )}\n </CardContent>\n </Card>\n )\n}\n\n/** Maps a color name to its CSS custom-property name. */\nfunction cssVar(color: StatCardColor): string {\n switch (color) {\n case \"primary\":\n return \"primary\"\n case \"success\":\n return \"green\"\n case \"warning\":\n return \"orange\"\n case \"danger\":\n return \"red\"\n default:\n return \"muted-foreground\"\n }\n}\n\n/** Just the radial ring + centered label (value is rendered by the caller). */\nfunction RingOnly({\n ring,\n colors,\n}: {\n ring: StatCardRing\n colors: (typeof COLOR)[StatCardColor]\n}) {\n const pct = Math.max(0, Math.min(100, ring.value))\n const r = 34\n const c = 2 * Math.PI * r\n return (\n <div className=\"relative size-20 shrink-0\">\n <svg className=\"size-full -rotate-90\" viewBox=\"0 0 80 80\">\n <circle\n cx=\"40\"\n cy=\"40\"\n r={r}\n fill=\"none\"\n strokeWidth={8}\n className=\"stroke-muted\"\n />\n <circle\n cx=\"40\"\n cy=\"40\"\n r={r}\n fill=\"none\"\n strokeWidth={8}\n strokeLinecap=\"round\"\n strokeDasharray={c}\n strokeDashoffset={c - (pct / 100) * c}\n stroke=\"currentColor\"\n className={cn(\"transition-all\", colors.text)}\n />\n </svg>\n <span className=\"absolute inset-0 flex items-center justify-center text-sm font-semibold\">\n {ring.label ?? `${pct}%`}\n </span>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Badge } from \"@/components/ui/badge\"\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type StatusListTone =\n | \"neutral\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n\n/** How the right-side status renders. */\nexport type StatusVariant = \"pill\" | \"outline\" | \"text\"\n\n// ============================================================================\n// Tone tokens\n// ============================================================================\n\nconst TONE = {\n neutral: {\n text: \"text-muted-foreground\",\n pill: \"border-transparent bg-muted text-muted-foreground\",\n outline: \"border-border text-foreground\",\n softBox: \"bg-muted text-muted-foreground\",\n activeBg: \"bg-muted/50 ring-border\",\n avatar: \"bg-muted text-foreground\",\n },\n primary: {\n text: \"text-primary\",\n pill: \"border-transparent bg-primary/10 text-primary\",\n outline: \"border-primary/30 text-primary\",\n softBox: \"bg-primary/10 text-primary\",\n activeBg: \"bg-primary/5 ring-primary/30\",\n avatar: \"bg-primary/15 text-primary\",\n },\n success: {\n text: \"text-green\",\n pill: \"border-transparent bg-green/10 text-green\",\n outline: \"border-green/30 text-green\",\n softBox: \"bg-green/10 text-green\",\n activeBg: \"bg-green/5 ring-green/30\",\n avatar: \"bg-green/15 text-green\",\n },\n warning: {\n text: \"text-orange\",\n pill: \"border-transparent bg-orange/10 text-orange\",\n outline: \"border-orange/30 text-orange\",\n softBox: \"bg-orange/10 text-orange\",\n activeBg: \"bg-orange/5 ring-orange/30\",\n avatar: \"bg-orange/15 text-orange\",\n },\n danger: {\n text: \"text-red\",\n pill: \"border-transparent bg-red/10 text-red\",\n outline: \"border-red/30 text-red\",\n softBox: \"bg-red/10 text-red\",\n activeBg: \"bg-red/5 ring-red/30\",\n avatar: \"bg-red/15 text-red\",\n },\n} satisfies Record<StatusListTone, Record<string, string>>\n\n// ============================================================================\n// Leading-visual helpers\n// ============================================================================\n\n/** A soft, tone-tinted rounded-square icon box (the gateway-row style). */\nexport function StatusIcon({\n tone = \"neutral\",\n className,\n children,\n}: {\n tone?: StatusListTone\n className?: string\n children: React.ReactNode\n}) {\n return (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-5\",\n TONE[tone].softBox,\n className\n )}\n >\n {children}\n </span>\n )\n}\n\n/** A circular avatar — an image, or tone-tinted initials fallback. */\nexport function StatusAvatar({\n src,\n name,\n tone = \"primary\",\n className,\n}: {\n src?: string\n name: string\n tone?: StatusListTone\n className?: string\n}) {\n const initials = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((p) => p[0]?.toUpperCase() ?? \"\")\n .join(\"\")\n return (\n <span\n className={cn(\n \"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full text-xs font-semibold\",\n TONE[tone].avatar,\n className\n )}\n >\n {src ? (\n <img src={src} alt={name} className=\"size-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n )\n}\n\n// ============================================================================\n// Status List\n// ============================================================================\n\nexport function StatusList({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"status-list\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n )\n}\n\n/** An uppercase group header with an optional count, e.g. \"WORKERS (2)\". */\nexport function StatusListGroup({\n label,\n count,\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n label: React.ReactNode\n count?: number\n}) {\n return (\n <div data-slot=\"status-list-group\" className={className} {...props}>\n <p className=\"mb-2 px-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase\">\n {label}\n {count != null && (\n <span className=\"ml-1 text-muted-foreground/70\">({count})</span>\n )}\n </p>\n <div className=\"flex flex-col gap-2\">{children}</div>\n </div>\n )\n}\n\nexport interface StatusListItemProps\n extends Omit<React.ComponentProps<\"div\">, \"title\"> {\n /** Leading visual — pass a `StatusIcon`, `StatusAvatar`, or any node. */\n media?: React.ReactNode\n /** Primary label. */\n title: React.ReactNode\n /** Muted secondary line. */\n description?: React.ReactNode\n /** Status text shown on the right. */\n status?: React.ReactNode\n /** How the status renders: filled pill, outline pill, or plain text. */\n statusVariant?: StatusVariant\n /** Extra muted text before the status (e.g. \"3 min open\"). */\n hint?: React.ReactNode\n /** Tone — tints the status, hint, and (when `active`) the row background. */\n tone?: StatusListTone\n /** Highlight the row with a soft tinted background + ring. */\n active?: boolean\n}\n\n/**\n * A single status row: a leading visual (`media`), a title + description, and a\n * right-side status (`pill`, `outline`, or `text`). Set `active` to highlight\n * the row, and `tone` to color the status/hint/highlight.\n */\nexport function StatusListItem({\n media,\n title,\n description,\n status,\n statusVariant = \"pill\",\n hint,\n tone = \"neutral\",\n active = false,\n className,\n ...props\n}: StatusListItemProps) {\n const t = TONE[tone]\n\n return (\n <div\n data-slot=\"status-list-item\"\n className={cn(\n \"flex items-center gap-3 rounded-lg border p-3\",\n active ? cn(\"border-transparent ring-1\", t.activeBg) : \"bg-card\",\n className\n )}\n {...props}\n >\n {media}\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium\">{title}</p>\n {description != null && (\n <p className=\"truncate text-xs text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {hint != null && (\n <span className={cn(\"text-xs font-medium\", t.text)}>{hint}</span>\n )}\n {status != null &&\n (statusVariant === \"text\" ? (\n <span className={cn(\"text-sm font-medium\", t.text)}>{status}</span>\n ) : (\n <Badge\n variant=\"outline\"\n className={cn(\n \"font-medium\",\n statusVariant === \"outline\" ? t.outline : t.pill\n )}\n >\n {status}\n </Badge>\n ))}\n </div>\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Select as SelectPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { ChevronDownIcon, CheckIcon, ChevronUpIcon } from \"lucide-react\"\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn(\"scroll-my-1 p-1\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n className,\n size = \"default\",\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: \"sm\" | \"default\"\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n \"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-sm *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n position = \"item-aligned\",\n align = \"center\",\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n data-align-trigger={position === \"item-aligned\"}\n className={cn(\"relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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-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\", position ===\"popper\"&&\"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\", className )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n data-position={position}\n className={cn(\n \"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)\",\n position === \"popper\" && \"\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn(\"px-1.5 py-1 text-xs text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"pointer-events-none\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\"pointer-events-none -mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n \"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <ChevronUpIcon\n />\n </SelectPrimitive.ScrollUpButton>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n \"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <ChevronDownIcon\n />\n </SelectPrimitive.ScrollDownButton>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type Locale,\n} from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button, buttonVariants } from \"@/components/ui/button\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\"\nimport { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from \"lucide-react\"\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"]\n}) {\n const defaultClassNames = getDefaultClassNames()\n\n return (\n <DayPicker\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) =>\n date.toLocaleString(locale?.code, { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n // The nav overlays the caption row; make it click-through so the\n // dropdowns underneath stay interactive (only the arrows are clickable).\n nav: cn(\n \"pointer-events-none absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"pointer-events-auto 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 \"pointer-events-auto 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 // The native-select overlay styles (absolute/opacity-0) are dropped — we\n // render our own Select via the Dropdown component override.\n dropdown_root: \"relative\",\n dropdown: \"\",\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n table: \"w-full border-collapse\",\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(\n \"w-(--cell-size) select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\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-r-(--cell-radius)\",\n props.showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-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-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-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(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\n \"text-muted-foreground opacity-50\",\n defaultClassNames.disabled\n ),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n )\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n if (orientation === \"right\") {\n return (\n <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n return (\n <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n )\n },\n // Replace react-day-picker's native <select> month/year dropdowns with\n // our themed Select.\n Dropdown: ({ value, onChange, options = [], \"aria-label\": ariaLabel }) => {\n const selected = options.find((o) => o.value === Number(value))\n return (\n <Select\n value={value != null ? String(value) : undefined}\n onValueChange={(v) => {\n // RDP's onChange expects a change-like event with target.value.\n onChange?.({\n target: { value: v },\n } as React.ChangeEvent<HTMLSelectElement>)\n }}\n >\n <SelectTrigger\n size=\"sm\"\n aria-label={ariaLabel}\n className=\"h-7 gap-1 border-none px-2 font-medium shadow-none focus-visible:ring-0 [&_svg]:opacity-60\"\n >\n <SelectValue>{selected?.label}</SelectValue>\n </SelectTrigger>\n <SelectContent className=\"max-h-60\">\n {options.map((o) => (\n <SelectItem\n key={o.value}\n value={String(o.value)}\n disabled={o.disabled}\n >\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n },\n DayButton: ({ ...props }) => (\n <CalendarDayButton locale={locale} {...props} />\n ),\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n {children}\n </div>\n </td>\n )\n },\n ...components,\n }}\n {...props}\n />\n )\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames()\n\n const ref = React.useRef<HTMLButtonElement>(null)\n React.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={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\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-r-(--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-l-(--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\nexport { Calendar, CalendarDayButton }\n","// Pure helpers for DateTimeRangePicker — kept separate from the component file\n// so it can fast-refresh cleanly (a component module should only export\n// components).\n\nexport type TimePreset = \"hour\" | \"day\" | \"week\" | \"month\"\n\nexport interface TimeRange {\n preset: TimePreset | null\n /** ISO datetime: YYYY-MM-DDTHH:mm:ssZ */\n from: string\n /** ISO datetime: YYYY-MM-DDTHH:mm:ssZ */\n to: string\n}\n\nexport function toISOWithTime(date: Date): string {\n const y = date.getUTCFullYear()\n const mo = String(date.getUTCMonth() + 1).padStart(2, \"0\")\n const d = String(date.getUTCDate()).padStart(2, \"0\")\n const h = String(date.getUTCHours()).padStart(2, \"0\")\n const m = String(date.getUTCMinutes()).padStart(2, \"0\")\n const s = String(date.getUTCSeconds()).padStart(2, \"0\")\n return `${y}-${mo}-${d}T${h}:${m}:${s}Z`\n}\n\n/** Parse an ISO string into timezone-local parts. */\nexport function isoToTzParts(iso: string, timezone: string) {\n if (!iso) return null\n const date = new Date(iso)\n if (isNaN(date.getTime())) return null\n\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZone: timezone,\n }).formatToParts(date)\n\n const get = (type: string) =>\n parts.find((p) => p.type === type)?.value || \"0\"\n return {\n year: parseInt(get(\"year\"), 10),\n month: parseInt(get(\"month\"), 10) - 1, // 0-indexed\n day: parseInt(get(\"day\"), 10),\n h: get(\"hour\").padStart(2, \"0\"),\n m: get(\"minute\").padStart(2, \"0\"),\n s: get(\"second\").padStart(2, \"0\"),\n }\n}\n\n/** Build a UTC ISO string from timezone-local date/time parts. */\nexport function buildISOFromTz(\n year: number,\n month: number,\n day: number,\n h: string,\n m: string,\n s: string,\n timezone: string,\n): string {\n const localMs = Date.UTC(\n year,\n month,\n day,\n parseInt(h),\n parseInt(m),\n parseInt(s),\n )\n const utcDate = new Date(localMs)\n\n const tzParts = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n timeZone: timezone,\n }).formatToParts(utcDate)\n\n const get = (type: string) =>\n parseInt(tzParts.find((p) => p.type === type)?.value || \"0\", 10)\n const tzMs = Date.UTC(\n get(\"year\"),\n get(\"month\") - 1,\n get(\"day\"),\n get(\"hour\"),\n get(\"minute\"),\n get(\"second\"),\n )\n\n const offsetMs = tzMs - localMs\n return toISOWithTime(new Date(localMs - offsetMs))\n}\n\nexport const DEFAULT_PRESETS: { value: TimePreset; label: string }[] = [\n { value: \"hour\", label: \"Hour\" },\n { value: \"day\", label: \"Day\" },\n { value: \"week\", label: \"Week\" },\n { value: \"month\", label: \"Month\" },\n]\n\n/** Convert a relative preset to a concrete { from, to } ISO range ending now. */\nexport function presetToRange(preset: TimePreset): {\n from: string\n to: string\n} {\n const now = new Date()\n const to = toISOWithTime(now)\n const d = new Date(now)\n switch (preset) {\n case \"hour\":\n d.setUTCHours(d.getUTCHours() - 1)\n break\n case \"day\":\n d.setUTCHours(d.getUTCHours() - 24)\n break\n case \"week\":\n d.setUTCDate(d.getUTCDate() - 7)\n break\n case \"month\":\n d.setUTCDate(d.getUTCDate() - 30)\n break\n }\n return { from: toISOWithTime(d), to }\n}\n\n/** Shift a range backward/forward by its own duration. */\nexport function navigateRange(\n range: TimeRange,\n direction: \"prev\" | \"next\",\n): TimeRange {\n const fromMs = new Date(range.from).getTime()\n const toMs = new Date(range.to).getTime()\n const durationMs = toMs - fromMs\n const shift = direction === \"prev\" ? -durationMs : durationMs\n return {\n preset: range.preset,\n from: toISOWithTime(new Date(fromMs + shift)),\n to: toISOWithTime(new Date(toMs + shift)),\n }\n}\n\nexport function formatDisplayRange(\n range: TimeRange,\n timezone?: string,\n): string {\n if (range.preset) {\n return (\n DEFAULT_PRESETS.find((p) => p.value === range.preset)?.label ??\n range.preset\n )\n }\n if (range.from && range.to) {\n const fmt = (iso: string) =>\n new Date(iso).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n timeZone: timezone || \"UTC\",\n })\n return `${fmt(range.from)} – ${fmt(range.to)}`\n }\n return \"Select range\"\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Calendar as CalendarIcon, Clock } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Calendar } from \"@/components/ui/calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { buildISOFromTz, isoToTzParts } from \"./date-time-range-picker-utils\"\n\n// ============================================================================\n// TimeInput — a single padded H/M/S number field with arrow stepping\n// ============================================================================\n\nfunction TimeInput({\n value,\n max,\n onChange,\n}: {\n value: string\n max: number\n onChange: (v: string) => void\n}) {\n const [local, setLocal] = React.useState(value)\n\n React.useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setLocal(value)\n }, [value])\n\n const commit = (raw: string) => {\n const n = Math.min(Math.max(0, parseInt(raw || \"0\", 10)), max)\n const padded = isNaN(n) ? \"00\" : String(n).padStart(2, \"0\")\n setLocal(padded)\n onChange(padded)\n }\n\n const step = (delta: number) => {\n const n = Math.min(Math.max(parseInt(local || \"0\", 10) + delta, 0), max)\n const padded = String(n).padStart(2, \"0\")\n setLocal(padded)\n onChange(padded)\n }\n\n return (\n <input\n type=\"number\"\n min={0}\n max={max}\n value={local}\n onChange={(e) => setLocal(e.target.value)}\n onBlur={(e) => commit(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") commit((e.target as HTMLInputElement).value)\n if (e.key === \"ArrowUp\") {\n e.preventDefault()\n step(1)\n }\n if (e.key === \"ArrowDown\") {\n e.preventDefault()\n step(-1)\n }\n }}\n className={cn(\n \"h-8 w-12 rounded-md border border-input bg-transparent text-center text-sm font-medium dark:bg-input/30\",\n \"focus:border-ring focus:ring-3 focus:ring-ring/50 focus:outline-none\",\n \"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\",\n )}\n />\n )\n}\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DateTimePickerProps {\n /** Selected value as an ISO 8601 string (empty for none). Controlled. */\n value: string\n /** Called with the new ISO string when the date or time changes. */\n onChange: (iso: string) => void\n /** Optional label rendered above the trigger. */\n label?: React.ReactNode\n /** Trigger text when no value is selected. */\n placeholder?: string\n /** Hide the time row to pick a date only. */\n showTime?: boolean\n /** IANA timezone for display + emitted ISO. Defaults to `UTC`. */\n timezone?: string\n /** Disable days before this date (ISO/date string). */\n minDate?: string\n /** Disable days after this date (ISO/date string). */\n maxDate?: string\n /**\n * Caption style: `dropdown` (default) shows month + year dropdowns for quick\n * year jumps; `label` shows the month name with prev/next arrows only.\n */\n captionLayout?: \"dropdown\" | \"dropdown-months\" | \"dropdown-years\" | \"label\"\n /**\n * Selectable year span for the dropdown, `[from, to]`. Defaults to 100 years\n * back and 5 years ahead of the current year (clamped by min/maxDate).\n */\n yearRange?: [number, number]\n /** Disable the field. */\n disabled?: boolean\n /** Class for the wrapper. */\n className?: string\n}\n\n// ============================================================================\n// DateTimePicker — a single date (+ optional time) selector\n// ============================================================================\n\n/**\n * A single date-and-time selector: a trigger that opens a calendar with an\n * H:M:S time row in a popover. Controlled via `value` (ISO string) /`onChange`.\n * Set `showTime={false}` for date-only. This is the same field the\n * `DateTimeRangePicker` uses for its custom from/to inputs.\n */\nexport function DateTimePicker({\n value,\n onChange,\n label,\n placeholder = \"Select date & time\",\n showTime = true,\n timezone,\n minDate,\n maxDate,\n captionLayout = \"dropdown\",\n yearRange,\n disabled,\n className,\n}: DateTimePickerProps) {\n const [open, setOpen] = React.useState(false)\n const tz = timezone || \"UTC\"\n const parsed = isoToTzParts(value, tz)\n\n const [timeH, setTimeH] = React.useState(parsed?.h ?? \"00\")\n const [timeM, setTimeM] = React.useState(parsed?.m ?? \"00\")\n const [timeS, setTimeS] = React.useState(parsed?.s ?? \"00\")\n\n // Sync time inputs when the external value changes (intentional prop->state).\n React.useEffect(() => {\n const p = isoToTzParts(value, tz)\n /* eslint-disable react-hooks/set-state-in-effect */\n setTimeH(p?.h ?? \"00\")\n setTimeM(p?.m ?? \"00\")\n setTimeS(p?.s ?? \"00\")\n /* eslint-enable react-hooks/set-state-in-effect */\n }, [value, tz])\n\n const selectedDate = parsed\n ? new Date(parsed.year, parsed.month, parsed.day)\n : undefined\n\n const emit = (\n year: number,\n month: number,\n day: number,\n h: string,\n m: string,\n s: string,\n ) => onChange(buildISOFromTz(year, month, day, h, m, s, tz))\n\n const handleSelectDate = (date: Date | undefined) => {\n if (!date) return\n emit(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n showTime ? timeH : \"00\",\n showTime ? timeM : \"00\",\n showTime ? timeS : \"00\",\n )\n if (!showTime) setOpen(false)\n }\n\n const handleTime = (which: \"h\" | \"m\" | \"s\", v: string) => {\n const h = which === \"h\" ? v : timeH\n const m = which === \"m\" ? v : timeM\n const s = which === \"s\" ? v : timeS\n if (which === \"h\") setTimeH(v)\n if (which === \"m\") setTimeM(v)\n if (which === \"s\") setTimeS(v)\n if (parsed) emit(parsed.year, parsed.month, parsed.day, h, m, s)\n }\n\n const disabledMatcher = (date: Date) => {\n if (minDate) {\n const min = new Date(minDate)\n min.setHours(0, 0, 0, 0)\n if (date < min) return true\n }\n if (maxDate) {\n const max = new Date(maxDate)\n max.setHours(23, 59, 59, 999)\n if (date > max) return true\n }\n return false\n }\n\n // Bound the year dropdown. Default to 100 years back / 5 ahead, then clamp to\n // any min/maxDate so the dropdown only offers selectable years.\n const thisYear = new Date().getFullYear()\n const [fromYear, toYear] = yearRange ?? [thisYear - 100, thisYear + 5]\n const startYear = minDate\n ? Math.max(fromYear, new Date(minDate).getFullYear())\n : fromYear\n const endYear = maxDate\n ? Math.min(toYear, new Date(maxDate).getFullYear())\n : toYear\n const startMonth = new Date(startYear, 0, 1)\n const endMonth = new Date(endYear, 11, 31)\n\n const displayValue = parsed\n ? new Date(value).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n ...(showTime\n ? {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n }\n : {}),\n timeZone: tz,\n })\n : placeholder\n\n return (\n <div className={cn(\"flex flex-col gap-1\", className)}>\n {label != null && (\n <label className=\"px-0.5 text-xs text-muted-foreground\">{label}</label>\n )}\n <Popover open={open} onOpenChange={setOpen} modal={false}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"flex h-8 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-1 text-sm transition-colors outline-none dark:bg-input/30\",\n // Hover/focus like a standard Input: no background fill, just the\n // focus ring.\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n open && \"border-ring ring-3 ring-ring/50\",\n !parsed && \"text-muted-foreground\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n <span className=\"truncate\">{displayValue}</span>\n <CalendarIcon className=\"size-3.5 shrink-0 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\" sideOffset={4}>\n <Calendar\n mode=\"single\"\n selected={selectedDate}\n onSelect={handleSelectDate}\n disabled={disabledMatcher}\n defaultMonth={selectedDate}\n captionLayout={captionLayout}\n startMonth={startMonth}\n endMonth={endMonth}\n autoFocus\n />\n {showTime && (\n <div className=\"flex items-center gap-2 border-t px-3 py-2.5\">\n <Clock className=\"size-4 shrink-0 text-muted-foreground\" />\n <TimeInput value={timeH} max={23} onChange={(v) => handleTime(\"h\", v)} />\n <span className=\"text-sm font-medium text-muted-foreground\">:</span>\n <TimeInput value={timeM} max={59} onChange={(v) => handleTime(\"m\", v)} />\n <span className=\"text-sm font-medium text-muted-foreground\">:</span>\n <TimeInput value={timeS} max={59} onChange={(v) => handleTime(\"s\", v)} />\n </div>\n )}\n </PopoverContent>\n </Popover>\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Calendar as CalendarIcon, ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { DateTimePicker } from \"./date-time-picker\"\nimport {\n DEFAULT_PRESETS,\n formatDisplayRange,\n presetToRange,\n type TimePreset,\n type TimeRange,\n} from \"./date-time-range-picker-utils\"\n\n// Re-export the public types (type-only keeps this a component-only module;\n// the value helpers presetToRange/navigateRange are exported from the barrel).\nexport type {\n TimePreset,\n TimeRange,\n} from \"./date-time-range-picker-utils\"\n\nexport interface DateTimeRangePickerProps {\n value: TimeRange\n onChange: (range: TimeRange) => void\n className?: string\n timezone?: string\n presets?: { value: TimePreset; label: string }[]\n maxRangeDays?: number\n}\n\n// ============================================================================\n// DateTimeRangePicker\n// ============================================================================\n\nexport const DateTimeRangePicker = React.forwardRef<\n HTMLButtonElement,\n DateTimeRangePickerProps\n>(function DateTimeRangePicker(\n { value, onChange, className, timezone, presets: customPresets, maxRangeDays },\n ref,\n) {\n const activePresets = customPresets ?? DEFAULT_PRESETS\n const [open, setOpen] = React.useState(false)\n const [customFrom, setCustomFrom] = React.useState(value.from)\n const [customTo, setCustomTo] = React.useState(value.to)\n\n React.useEffect(() => {\n /* eslint-disable react-hooks/set-state-in-effect */\n setCustomFrom(value.from)\n setCustomTo(value.to)\n /* eslint-enable react-hooks/set-state-in-effect */\n }, [value])\n\n const handleCustomFromChange = (iso: string) => {\n setCustomFrom(iso)\n if (maxRangeDays && iso) {\n const maxTo = new Date(\n new Date(iso).getTime() + maxRangeDays * 86_400_000,\n )\n if (new Date(customTo) > maxTo) setCustomTo(maxTo.toISOString())\n }\n }\n\n const handlePreset = (preset: TimePreset) => {\n onChange({ preset, ...presetToRange(preset) })\n setOpen(false)\n }\n\n const handleCustomApply = () => {\n if (!customFrom || !customTo) return\n const from = customFrom <= customTo ? customFrom : customTo\n const to = customFrom <= customTo ? customTo : customFrom\n onChange({ preset: null, from, to })\n setOpen(false)\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n \"flex h-9 items-center justify-between gap-1.5 rounded-md border border-input bg-transparent px-3 py-1 text-sm transition-colors outline-none dark:bg-input/30\",\n // Hover/focus like a standard Input: no background fill, just the ring.\n \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n open && \"border-ring ring-3 ring-ring/50\",\n className,\n )}\n >\n <CalendarIcon className=\"size-3.5 shrink-0 opacity-60\" />\n <span className=\"truncate\">{formatDisplayRange(value, timezone)}</span>\n <ChevronDown\n className={cn(\n \"size-3.5 shrink-0 opacity-60 transition-transform\",\n open && \"rotate-180\",\n )}\n />\n </button>\n </PopoverTrigger>\n\n <PopoverContent align=\"end\" sideOffset={4} className=\"w-auto p-0\">\n <div className=\"flex min-w-60 flex-col\">\n {/* Presets */}\n <div className=\"border-b p-2\">\n <p className=\"mb-2 px-0.5 text-sm text-muted-foreground\">Presets</p>\n <div\n className=\"grid gap-1\"\n style={{\n gridTemplateColumns: `repeat(${activePresets.length}, minmax(0, 1fr))`,\n }}\n >\n {activePresets.map((preset) => (\n <button\n key={preset.value}\n type=\"button\"\n onClick={() => handlePreset(preset.value)}\n className={cn(\n \"rounded-md px-2 py-1.5 text-center text-xs font-medium transition-colors\",\n value.preset === preset.value\n ? \"bg-primary text-primary-foreground\"\n : \"bg-accent/50 text-foreground hover:bg-accent\",\n )}\n >\n {preset.label}\n </button>\n ))}\n </div>\n </div>\n\n {/* Custom range */}\n <div className=\"flex flex-col gap-3 p-2\">\n <p className=\"px-0.5 text-sm text-muted-foreground\">Custom range</p>\n <DateTimePicker\n value={customFrom}\n onChange={handleCustomFromChange}\n label=\"From\"\n placeholder=\"Start date & time\"\n timezone={timezone}\n maxDate={new Date().toISOString()}\n />\n <DateTimePicker\n value={customTo}\n onChange={setCustomTo}\n label=\"To\"\n placeholder=\"End date & time\"\n timezone={timezone}\n minDate={customFrom || undefined}\n maxDate={(() => {\n const now = new Date().toISOString()\n if (maxRangeDays && customFrom) {\n const fromPlusMax = new Date(\n new Date(customFrom).getTime() + maxRangeDays * 86_400_000,\n ).toISOString()\n return fromPlusMax < now ? fromPlusMax : now\n }\n return now\n })()}\n />\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"w-full\"\n disabled={!customFrom || !customTo}\n onClick={handleCustomApply}\n >\n Apply\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n})\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n \"group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 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 {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n destructive:\n \"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof alertVariants>) {\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<\"div\">) {\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 {...props}\n />\n )\n}\n\nfunction AlertDescription({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-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 [&_p:not(:last-child)]:mb-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-action\"\n className={cn(\"absolute top-2 right-2\", className)}\n {...props}\n />\n )\n}\n\nexport { Alert, AlertTitle, AlertDescription, AlertAction }\n","import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nconst buttonGroupVariants = cva(\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-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-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 },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean\n}) {\n const Comp = asChild ? Slot.Root : \"div\"\n\n return (\n <Comp\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\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n","import * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\nimport type { TooltipValueType } from \"recharts\"\n\nimport { cn } from \"@/lib/utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const\ntype TooltipNameType = number | string\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n>\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error(\"useChart must be used within a <ChartContainer />\")\n }\n\n return context\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<\"div\"> & {\n config: ChartConfig\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >[\"children\"]\n initialDimension?: {\n width: number\n height: number\n }\n}) {\n const uniqueId = React.useId()\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer\n initialDimension={initialDimension}\n >\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme ?? config.color\n )\n\n if (!colorConfig.length) {\n return null\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join(\"\\n\")}\n}\n`\n )\n .join(\"\\n\"),\n }}\n />\n )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = \"dot\",\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<\"div\"> & {\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n nameKey?: string\n labelKey?: string\n } & Omit<\n RechartsPrimitive.DefaultTooltipContentProps<\n TooltipValueType,\n TooltipNameType\n >,\n \"accessibilityLayer\"\n >) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === \"string\"\n ? (config[label]?.label ?? label)\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn(\"font-medium\", labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n <div\n className={cn(\n \"grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl\",\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color ?? item.payload?.fill ?? item.color\n\n return (\n <div\n key={index}\n className={cn(\n \"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n \"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)\",\n {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"w-1\": indicator === \"line\",\n \"w-0 border-[1.5px] border-dashed bg-transparent\":\n indicator === \"dashed\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n }\n )}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n \"flex flex-1 justify-between leading-none\",\n nestLabel ? \"items-end\" : \"items-center\"\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">\n {itemConfig?.label ?? item.name}\n </span>\n </div>\n {item.value != null && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {typeof item.value === \"number\"\n ? item.value.toLocaleString()\n : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = \"bottom\",\n nameKey,\n}: React.ComponentProps<\"div\"> & {\n hideIcon?: boolean\n nameKey?: string\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n \"flex items-center justify-center gap-4\",\n verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n className\n )}\n >\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={index}\n className={cn(\n \"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground\"\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== \"object\" || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n \"payload\" in payload &&\n typeof payload.payload === \"object\" &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === \"string\"\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key]\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { HoverCard as HoverCardPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction HoverCard({\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {\n return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />\n}\n\nfunction HoverCardTrigger({\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {\n return (\n <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />\n )\n}\n\nfunction HoverCardContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n <HoverCardPrimitive.Content\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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-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 </HoverCardPrimitive.Portal>\n )\n}\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nfunction ItemGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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 )\n}\n\nfunction ItemSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"item-separator\"\n orientation=\"horizontal\"\n className={cn(\"my-2\", className)}\n {...props}\n />\n )\n}\n\nconst itemVariants = cva(\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 {\n variants: {\n variant: {\n default: \"border-transparent\",\n outline: \"border-border\",\n muted: \"border-transparent bg-muted/50\",\n },\n size: {\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 },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Item({\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof itemVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot.Root : \"div\"\n return (\n <Comp\n data-slot=\"item\"\n data-variant={variant}\n data-size={size}\n className={cn(itemVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nconst itemMediaVariants = cva(\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 {\n variants: {\n variant: {\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 },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction ItemMedia({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof itemMediaVariants>) {\n return (\n <div\n data-slot=\"item-media\"\n data-variant={variant}\n className={cn(itemMediaVariants({ variant, className }))}\n {...props}\n />\n )\n}\n\nfunction ItemContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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\nfunction ItemTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\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\nfunction ItemDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"item-description\"\n className={cn(\n \"line-clamp-2 text-left 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\nfunction ItemActions({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-actions\"\n className={cn(\"flex items-center gap-2\", className)}\n {...props}\n />\n )\n}\n\nfunction ItemHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-header\"\n className={cn(\n \"flex basis-full items-center justify-between gap-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ItemFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"item-footer\"\n className={cn(\n \"flex basis-full items-center justify-between gap-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Item,\n ItemMedia,\n ItemContent,\n ItemActions,\n ItemGroup,\n ItemSeparator,\n ItemTitle,\n ItemDescription,\n ItemHeader,\n ItemFooter,\n}\n","\"use client\";\n\nimport MapLibreGL, { type PopupOptions, type MarkerOptions } from \"maplibre-gl\";\n// MapLibre's stylesheet is bundled via src/styles.css (not imported here) so the\n// published JS bundle stays a pure ESM module with no CSS side-effect imports —\n// a bare CSS import inside node_modules ESM breaks consumers' Vite/esbuild\n// dependency pre-bundling. Consumers already import florixui/dist/styles.css once.\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n X,\n Minus,\n Plus,\n Locate,\n Maximize,\n Loader2,\n Layers,\n Check,\n} from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst defaultStyles = {\n dark: \"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json\",\n light: \"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json\",\n};\n\n/** Selectable basemap tiles. The first is the default; the second is Voyager. */\nexport type MapTile = { label: string; url: string };\nconst defaultTiles: MapTile[] = [\n { label: \"Light\", url: \"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json\" },\n { label: \"Voyager\", url: \"https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json\" },\n { label: \"Dark\", url: \"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json\" },\n];\n\n// Maps default to the light basemap. A theme can still be forced per-map via\n// the `theme` prop; they do not auto-follow the app's light/dark mode.\ntype Theme = \"light\" | \"dark\";\n\ntype MapContextValue = {\n map: MapLibreGL.Map | null;\n isLoaded: boolean;\n};\n\nconst MapContext = createContext<MapContextValue | null>(null);\n\nfunction useMap() {\n const context = useContext(MapContext);\n if (!context) {\n throw new Error(\"useMap must be used within a Map component\");\n }\n return context;\n}\n\n/** Map viewport state */\ntype MapViewport = {\n /** Center coordinates [longitude, latitude] */\n center: [number, number];\n /** Zoom level */\n zoom: number;\n /** Bearing (rotation) in degrees */\n bearing: number;\n /** Pitch (tilt) in degrees */\n pitch: number;\n};\n\ntype MapStyleOption = string | MapLibreGL.StyleSpecification;\n\ntype MapRef = MapLibreGL.Map;\n\ntype MapProps = {\n children?: ReactNode;\n /** Additional CSS classes for the map container */\n className?: string;\n /**\n * Theme for the map. If not provided, automatically detects system preference.\n * Pass your theme value here.\n */\n theme?: Theme;\n /** Custom map styles for light and dark themes. Overrides the default Carto styles. */\n styles?: {\n light?: MapStyleOption;\n dark?: MapStyleOption;\n };\n /** Map projection type. Use `{ type: \"globe\" }` for 3D globe view. */\n projection?: MapLibreGL.ProjectionSpecification;\n /**\n * Controlled viewport. When provided with onViewportChange,\n * the map becomes controlled and viewport is driven by this prop.\n */\n viewport?: Partial<MapViewport>;\n /**\n * Callback fired continuously as the viewport changes (pan, zoom, rotate, pitch).\n * Can be used standalone to observe changes, or with `viewport` prop\n * to enable controlled mode where the map viewport is driven by your state.\n */\n onViewportChange?: (viewport: MapViewport) => void;\n /** Show a loading indicator on the map */\n loading?: boolean;\n /**\n * Render default zoom controls (bottom-right). Defaults to true.\n * Set to false to omit them or to supply your own <MapControls />.\n */\n controls?: boolean;\n /**\n * Selectable basemap tiles, shown as a picker (top-left). Defaults to\n * Light / Voyager / Dark. Set to false to hide the tile picker.\n */\n tiles?: MapTile[] | false;\n} & Omit<MapLibreGL.MapOptions, \"container\" | \"style\">;\n\nfunction DefaultLoader() {\n return (\n <div className=\"bg-background/50 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-xs\">\n <div className=\"flex gap-1\">\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full\" />\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full [animation-delay:150ms]\" />\n <span className=\"bg-muted-foreground/60 size-1.5 animate-pulse rounded-full [animation-delay:300ms]\" />\n </div>\n </div>\n );\n}\n\nfunction getViewport(map: MapLibreGL.Map): MapViewport {\n const center = map.getCenter();\n return {\n center: [center.lng, center.lat],\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n };\n}\n\nconst Map = forwardRef<MapRef, MapProps>(function Map(\n {\n children,\n className,\n theme: themeProp,\n styles,\n projection,\n viewport,\n onViewportChange,\n loading = false,\n controls = true,\n tiles = defaultTiles,\n ...props\n },\n ref,\n) {\n const tileList = tiles === false ? [] : tiles;\n const containerRef = useRef<HTMLDivElement>(null);\n const [mapInstance, setMapInstance] = useState<MapLibreGL.Map | null>(null);\n const [isLoaded, setIsLoaded] = useState(false);\n const [isStyleLoaded, setIsStyleLoaded] = useState(false);\n // Index of the selected basemap tile (when the tile picker is enabled).\n const [tileIndex, setTileIndex] = useState(0);\n const currentStyleRef = useRef<MapStyleOption | null>(null);\n const styleTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const internalUpdateRef = useRef(false);\n const isControlled = viewport !== undefined && onViewportChange !== undefined;\n\n const onViewportChangeRef = useRef(onViewportChange);\n onViewportChangeRef.current = onViewportChange;\n\n const mapStyles = useMemo(\n () => ({\n dark: styles?.dark ?? defaultStyles.dark,\n light: styles?.light ?? defaultStyles.light,\n }),\n [styles],\n );\n\n // Expose the map instance to the parent component\n useImperativeHandle(ref, () => mapInstance as MapLibreGL.Map, [mapInstance]);\n\n const clearStyleTimeout = useCallback(() => {\n if (styleTimeoutRef.current) {\n clearTimeout(styleTimeoutRef.current);\n styleTimeoutRef.current = null;\n }\n }, []);\n\n // Initialize the map\n useEffect(() => {\n if (!containerRef.current) return;\n\n // Use the selected tile if a picker is enabled, else the light basemap.\n const initialStyle = tileList[0]?.url ?? mapStyles.light;\n currentStyleRef.current = initialStyle;\n\n const map = new MapLibreGL.Map({\n container: containerRef.current,\n style: initialStyle,\n renderWorldCopies: false,\n attributionControl: false,\n ...props,\n ...viewport,\n });\n\n const styleDataHandler = () => {\n clearStyleTimeout();\n // Delay to ensure style is fully processed before allowing layer operations\n // This is a workaround to avoid race conditions with the style loading\n // else we have to force update every layer on setStyle change\n styleTimeoutRef.current = setTimeout(() => {\n setIsStyleLoaded(true);\n if (projection) {\n map.setProjection(projection);\n }\n }, 100);\n };\n const loadHandler = () => setIsLoaded(true);\n\n // Viewport change handler - skip if triggered by internal update\n const handleMove = () => {\n if (internalUpdateRef.current) return;\n onViewportChangeRef.current?.(getViewport(map));\n };\n\n map.on(\"load\", loadHandler);\n map.on(\"styledata\", styleDataHandler);\n map.on(\"move\", handleMove);\n setMapInstance(map);\n\n return () => {\n clearStyleTimeout();\n map.off(\"load\", loadHandler);\n map.off(\"styledata\", styleDataHandler);\n map.off(\"move\", handleMove);\n map.remove();\n setIsLoaded(false);\n setIsStyleLoaded(false);\n setMapInstance(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Sync controlled viewport to map\n useEffect(() => {\n if (!mapInstance || !isControlled || !viewport) return;\n if (mapInstance.isMoving()) return;\n\n const current = getViewport(mapInstance);\n const next = {\n center: viewport.center ?? current.center,\n zoom: viewport.zoom ?? current.zoom,\n bearing: viewport.bearing ?? current.bearing,\n pitch: viewport.pitch ?? current.pitch,\n };\n\n if (\n next.center[0] === current.center[0] &&\n next.center[1] === current.center[1] &&\n next.zoom === current.zoom &&\n next.bearing === current.bearing &&\n next.pitch === current.pitch\n ) {\n return;\n }\n\n internalUpdateRef.current = true;\n mapInstance.jumpTo(next);\n internalUpdateRef.current = false;\n }, [mapInstance, isControlled, viewport]);\n\n // Handle style change. When a tile picker is enabled, the selected tile wins;\n // otherwise fall back to the explicit `theme` prop (default light).\n useEffect(() => {\n if (!mapInstance) return;\n\n const newStyle =\n tileList[tileIndex]?.url ??\n (themeProp === \"dark\" ? mapStyles.dark : mapStyles.light);\n\n if (currentStyleRef.current === newStyle) return;\n\n clearStyleTimeout();\n currentStyleRef.current = newStyle;\n setIsStyleLoaded(false);\n\n mapInstance.setStyle(newStyle, { diff: true });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [mapInstance, tileIndex, themeProp, mapStyles, clearStyleTimeout]);\n\n const contextValue = useMemo(\n () => ({\n map: mapInstance,\n isLoaded: isLoaded && isStyleLoaded,\n }),\n [mapInstance, isLoaded, isStyleLoaded],\n );\n\n return (\n <MapContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n className={cn(\"relative h-full w-full\", className)}\n >\n {(!isLoaded || loading) && <DefaultLoader />}\n {/* SSR-safe: children render only when map is loaded on client */}\n {mapInstance && (\n <>\n {controls && (\n <MapControls\n position=\"top-right\"\n tiles={tileList}\n tileIndex={tileIndex}\n onTileChange={setTileIndex}\n />\n )}\n {children}\n </>\n )}\n </div>\n </MapContext.Provider>\n );\n});\n\ntype MarkerContextValue = {\n marker: MapLibreGL.Marker;\n map: MapLibreGL.Map | null;\n};\n\nconst MarkerContext = createContext<MarkerContextValue | null>(null);\n\nfunction useMarkerContext() {\n const context = useContext(MarkerContext);\n if (!context) {\n throw new Error(\"Marker components must be used within MapMarker\");\n }\n return context;\n}\n\ntype MapMarkerProps = {\n /** Longitude coordinate for marker position */\n longitude: number;\n /** Latitude coordinate for marker position */\n latitude: number;\n /** Marker subcomponents (MarkerContent, MarkerPopup, MarkerTooltip, MarkerLabel) */\n children: ReactNode;\n /** Callback when marker is clicked */\n onClick?: (e: MouseEvent) => void;\n /** Callback when mouse enters marker */\n onMouseEnter?: (e: MouseEvent) => void;\n /** Callback when mouse leaves marker */\n onMouseLeave?: (e: MouseEvent) => void;\n /** Callback when marker drag starts (requires draggable: true) */\n onDragStart?: (lngLat: { lng: number; lat: number }) => void;\n /** Callback during marker drag (requires draggable: true) */\n onDrag?: (lngLat: { lng: number; lat: number }) => void;\n /** Callback when marker drag ends (requires draggable: true) */\n onDragEnd?: (lngLat: { lng: number; lat: number }) => void;\n} & Omit<MarkerOptions, \"element\">;\n\nfunction MapMarker({\n longitude,\n latitude,\n children,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n draggable = false,\n ...markerOptions\n}: MapMarkerProps) {\n const { map } = useMap();\n\n const callbacksRef = useRef({\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n });\n callbacksRef.current = {\n onClick,\n onMouseEnter,\n onMouseLeave,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n const marker = useMemo(() => {\n const markerInstance = new MapLibreGL.Marker({\n ...markerOptions,\n element: document.createElement(\"div\"),\n draggable,\n }).setLngLat([longitude, latitude]);\n\n const handleClick = (e: MouseEvent) => callbacksRef.current.onClick?.(e);\n const handleMouseEnter = (e: MouseEvent) =>\n callbacksRef.current.onMouseEnter?.(e);\n const handleMouseLeave = (e: MouseEvent) =>\n callbacksRef.current.onMouseLeave?.(e);\n\n markerInstance.getElement()?.addEventListener(\"click\", handleClick);\n markerInstance\n .getElement()\n ?.addEventListener(\"mouseenter\", handleMouseEnter);\n markerInstance\n .getElement()\n ?.addEventListener(\"mouseleave\", handleMouseLeave);\n\n const handleDragStart = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDragStart?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n const handleDrag = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDrag?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n const handleDragEnd = () => {\n const lngLat = markerInstance.getLngLat();\n callbacksRef.current.onDragEnd?.({ lng: lngLat.lng, lat: lngLat.lat });\n };\n\n markerInstance.on(\"dragstart\", handleDragStart);\n markerInstance.on(\"drag\", handleDrag);\n markerInstance.on(\"dragend\", handleDragEnd);\n\n return markerInstance;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n marker.addTo(map);\n\n return () => {\n marker.remove();\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (\n marker.getLngLat().lng !== longitude ||\n marker.getLngLat().lat !== latitude\n ) {\n marker.setLngLat([longitude, latitude]);\n }\n if (marker.isDraggable() !== draggable) {\n marker.setDraggable(draggable);\n }\n\n const currentOffset = marker.getOffset();\n const newOffset = markerOptions.offset ?? [0, 0];\n const [newOffsetX, newOffsetY] = Array.isArray(newOffset)\n ? newOffset\n : [newOffset.x, newOffset.y];\n if (currentOffset.x !== newOffsetX || currentOffset.y !== newOffsetY) {\n marker.setOffset(newOffset);\n }\n\n if (marker.getRotation() !== markerOptions.rotation) {\n marker.setRotation(markerOptions.rotation ?? 0);\n }\n if (marker.getRotationAlignment() !== markerOptions.rotationAlignment) {\n marker.setRotationAlignment(markerOptions.rotationAlignment ?? \"auto\");\n }\n if (marker.getPitchAlignment() !== markerOptions.pitchAlignment) {\n marker.setPitchAlignment(markerOptions.pitchAlignment ?? \"auto\");\n }\n\n return (\n <MarkerContext.Provider value={{ marker, map }}>\n {children}\n </MarkerContext.Provider>\n );\n}\n\ntype MarkerContentProps = {\n /** Custom marker content. Defaults to a blue dot if not provided */\n children?: ReactNode;\n /** Additional CSS classes for the marker container */\n className?: string;\n};\n\nfunction MarkerContent({ children, className }: MarkerContentProps) {\n const { marker } = useMarkerContext();\n\n return createPortal(\n <div className={cn(\"relative cursor-pointer\", className)}>\n {children || <DefaultMarkerIcon />}\n </div>,\n marker.getElement(),\n );\n}\n\nfunction DefaultMarkerIcon() {\n return (\n <div className=\"relative h-4 w-4 rounded-full border-2 border-white bg-blue-500 shadow-lg\" />\n );\n}\n\nfunction PopupCloseButton({ onClick }: { onClick: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label=\"Close popup\"\n className=\"focus-visible:ring-ring hover:bg-muted text-foreground absolute top-0.5 right-0.5 z-10 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm transition-colors focus:outline-none focus-visible:ring-2\"\n >\n <X className=\"size-3.5\" />\n </button>\n );\n}\n\ntype MarkerPopupProps = {\n /** Popup content */\n children: ReactNode;\n /** Additional CSS classes for the popup container */\n className?: string;\n /** Show a close button in the popup (default: false) */\n closeButton?: boolean;\n} & Omit<PopupOptions, \"className\" | \"closeButton\">;\n\nfunction MarkerPopup({\n children,\n className,\n closeButton = false,\n ...popupOptions\n}: MarkerPopupProps) {\n const { marker, map } = useMarkerContext();\n const container = useMemo(() => document.createElement(\"div\"), []);\n const prevPopupOptions = useRef(popupOptions);\n\n const popup = useMemo(() => {\n const popupInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeButton: false,\n })\n .setMaxWidth(\"none\")\n .setDOMContent(container);\n\n return popupInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n popup.setDOMContent(container);\n marker.setPopup(popup);\n\n return () => {\n marker.setPopup(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (popup.isOpen()) {\n const prev = prevPopupOptions.current;\n\n if (prev.offset !== popupOptions.offset) {\n popup.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n popup.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n\n prevPopupOptions.current = popupOptions;\n }\n\n const handleClose = () => popup.remove();\n\n return createPortal(\n <div\n className={cn(\n \"bg-popover text-popover-foreground relative max-w-62 rounded-md border p-3 shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {closeButton && <PopupCloseButton onClick={handleClose} />}\n {children}\n </div>,\n container,\n );\n}\n\ntype MarkerTooltipProps = {\n /** Tooltip content */\n children: ReactNode;\n /** Additional CSS classes for the tooltip container */\n className?: string;\n} & Omit<PopupOptions, \"className\" | \"closeButton\" | \"closeOnClick\">;\n\nfunction MarkerTooltip({\n children,\n className,\n ...popupOptions\n}: MarkerTooltipProps) {\n const { marker, map } = useMarkerContext();\n const container = useMemo(() => document.createElement(\"div\"), []);\n const prevTooltipOptions = useRef(popupOptions);\n\n const tooltip = useMemo(() => {\n const tooltipInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeOnClick: true,\n closeButton: false,\n }).setMaxWidth(\"none\");\n\n return tooltipInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n tooltip.setDOMContent(container);\n\n const handleMouseEnter = () => {\n tooltip.setLngLat(marker.getLngLat()).addTo(map);\n };\n const handleMouseLeave = () => tooltip.remove();\n\n marker.getElement()?.addEventListener(\"mouseenter\", handleMouseEnter);\n marker.getElement()?.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n marker.getElement()?.removeEventListener(\"mouseenter\", handleMouseEnter);\n marker.getElement()?.removeEventListener(\"mouseleave\", handleMouseLeave);\n tooltip.remove();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (tooltip.isOpen()) {\n const prev = prevTooltipOptions.current;\n\n if (prev.offset !== popupOptions.offset) {\n tooltip.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n tooltip.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n\n prevTooltipOptions.current = popupOptions;\n }\n\n return createPortal(\n <div\n className={cn(\n \"bg-foreground text-background pointer-events-none rounded-md px-2 py-1 text-xs text-balance shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {children}\n </div>,\n container,\n );\n}\n\ntype MarkerLabelProps = {\n /** Label text content */\n children: ReactNode;\n /** Additional CSS classes for the label */\n className?: string;\n /** Position of the label relative to the marker (default: \"top\") */\n position?: \"top\" | \"bottom\";\n};\n\nfunction MarkerLabel({\n children,\n className,\n position = \"top\",\n}: MarkerLabelProps) {\n const positionClasses = {\n top: \"bottom-full mb-1\",\n bottom: \"top-full mt-1\",\n };\n\n return (\n <div\n className={cn(\n \"absolute left-1/2 -translate-x-1/2 whitespace-nowrap\",\n \"text-foreground text-[10px] font-medium\",\n positionClasses[position],\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\ntype MapControlsProps = {\n /** Position of the controls on the map (default: \"bottom-right\") */\n position?: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n /** Show zoom in/out buttons (default: true) */\n showZoom?: boolean;\n /** Show compass button to reset bearing (default: false) */\n showCompass?: boolean;\n /** Show locate button to find user's location (default: false) */\n showLocate?: boolean;\n /** Show fullscreen toggle button (default: false) */\n showFullscreen?: boolean;\n /** Additional CSS classes for the controls container */\n className?: string;\n /** Callback with user coordinates when located */\n onLocate?: (coords: { longitude: number; latitude: number }) => void;\n /** Basemap tiles for the tile-cycle button. Hidden when fewer than 2. */\n tiles?: MapTile[];\n /** Index of the active tile. */\n tileIndex?: number;\n /** Called with the next tile index when the tile button is clicked. */\n onTileChange?: (index: number) => void;\n};\n\nconst positionClasses = {\n \"top-left\": \"top-2 left-2\",\n \"top-right\": \"top-2 right-2\",\n \"bottom-left\": \"bottom-2 left-2\",\n \"bottom-right\": \"bottom-10 right-2\",\n};\n\nfunction ControlGroup({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"border-border bg-background [&>button:not(:last-child)]:border-border flex flex-col overflow-hidden rounded-md border shadow-sm [&>button:not(:last-child)]:border-b\">\n {children}\n </div>\n );\n}\n\nfunction ControlButton({\n onClick,\n label,\n children,\n disabled = false,\n}: {\n onClick: () => void;\n label: string;\n children: React.ReactNode;\n disabled?: boolean;\n}) {\n return (\n <button\n onClick={onClick}\n aria-label={label}\n type=\"button\"\n className={cn(\n \"flex size-8 items-center justify-center transition-all\",\n \"first:rounded-t-md last:rounded-b-md\",\n \"hover:bg-accent dark:hover:bg-accent/40\",\n \"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n disabled={disabled}\n >\n {children}\n </button>\n );\n}\n\nfunction TileSelectorButton({\n tiles,\n tileIndex,\n onTileChange,\n openLeft,\n}: {\n tiles: MapTile[];\n tileIndex: number;\n onTileChange?: (index: number) => void;\n openLeft: boolean;\n}) {\n const [open, setOpen] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (e: PointerEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n document.addEventListener(\"pointerdown\", onPointerDown);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"pointerdown\", onPointerDown);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [open]);\n\n return (\n <div ref={ref} className=\"relative\">\n <ControlGroup>\n <ControlButton\n onClick={() => setOpen((v) => !v)}\n label={`Basemap: ${tiles[tileIndex]?.label ?? \"\"}`}\n >\n <Layers className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n {open && (\n <div\n role=\"listbox\"\n aria-label=\"Basemap\"\n className={cn(\n \"border-border bg-background absolute top-0 z-20 min-w-32 overflow-hidden rounded-md border p-1 shadow-md\",\n openLeft ? \"right-9\" : \"left-9\",\n )}\n >\n {tiles.map((t, i) => (\n <button\n key={t.label}\n type=\"button\"\n role=\"option\"\n aria-selected={i === tileIndex}\n onClick={() => {\n onTileChange?.(i);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center justify-between gap-3 rounded-sm px-2 py-1.5 text-left text-xs font-medium transition-colors\",\n i === tileIndex\n ? \"bg-accent text-accent-foreground\"\n : \"hover:bg-accent/50\",\n )}\n >\n {t.label}\n {i === tileIndex && <Check className=\"size-3.5 shrink-0\" />}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction MapControls({\n position = \"bottom-right\",\n showZoom = true,\n showCompass = false,\n showLocate = false,\n showFullscreen = false,\n className,\n onLocate,\n tiles = [],\n tileIndex = 0,\n onTileChange,\n}: MapControlsProps) {\n const { map } = useMap();\n const [waitingForLocation, setWaitingForLocation] = useState(false);\n\n const handleZoomIn = useCallback(() => {\n map?.zoomTo(map.getZoom() + 1, { duration: 300 });\n }, [map]);\n\n const handleZoomOut = useCallback(() => {\n map?.zoomTo(map.getZoom() - 1, { duration: 300 });\n }, [map]);\n\n const handleResetBearing = useCallback(() => {\n map?.resetNorthPitch({ duration: 300 });\n }, [map]);\n\n const handleLocate = useCallback(() => {\n setWaitingForLocation(true);\n if (\"geolocation\" in navigator) {\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n const coords = {\n longitude: pos.coords.longitude,\n latitude: pos.coords.latitude,\n };\n map?.flyTo({\n center: [coords.longitude, coords.latitude],\n zoom: 14,\n duration: 1500,\n });\n onLocate?.(coords);\n setWaitingForLocation(false);\n },\n (error) => {\n console.error(\"Error getting location:\", error);\n setWaitingForLocation(false);\n },\n );\n }\n }, [map, onLocate]);\n\n const handleFullscreen = useCallback(() => {\n const container = map?.getContainer();\n if (!container) return;\n if (document.fullscreenElement) {\n document.exitFullscreen();\n } else {\n container.requestFullscreen();\n }\n }, [map]);\n\n return (\n <div\n className={cn(\n \"absolute z-10 flex flex-col gap-1.5\",\n positionClasses[position],\n className,\n )}\n >\n {showZoom && (\n <ControlGroup>\n <ControlButton onClick={handleZoomIn} label=\"Zoom in\">\n <Plus className=\"size-4\" />\n </ControlButton>\n <ControlButton onClick={handleZoomOut} label=\"Zoom out\">\n <Minus className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n )}\n {tiles.length > 1 && (\n <TileSelectorButton\n tiles={tiles}\n tileIndex={tileIndex}\n onTileChange={onTileChange}\n openLeft={position.endsWith(\"right\")}\n />\n )}\n {showCompass && (\n <ControlGroup>\n <CompassButton onClick={handleResetBearing} />\n </ControlGroup>\n )}\n {showLocate && (\n <ControlGroup>\n <ControlButton\n onClick={handleLocate}\n label=\"Find my location\"\n disabled={waitingForLocation}\n >\n {waitingForLocation ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Locate className=\"size-4\" />\n )}\n </ControlButton>\n </ControlGroup>\n )}\n {showFullscreen && (\n <ControlGroup>\n <ControlButton onClick={handleFullscreen} label=\"Toggle fullscreen\">\n <Maximize className=\"size-4\" />\n </ControlButton>\n </ControlGroup>\n )}\n </div>\n );\n}\n\nfunction CompassButton({ onClick }: { onClick: () => void }) {\n const { map } = useMap();\n const compassRef = useRef<SVGSVGElement>(null);\n\n useEffect(() => {\n if (!map || !compassRef.current) return;\n\n const compass = compassRef.current;\n\n const updateRotation = () => {\n const bearing = map.getBearing();\n const pitch = map.getPitch();\n compass.style.transform = `rotateX(${pitch}deg) rotateZ(${-bearing}deg)`;\n };\n\n map.on(\"rotate\", updateRotation);\n map.on(\"pitch\", updateRotation);\n updateRotation();\n\n return () => {\n map.off(\"rotate\", updateRotation);\n map.off(\"pitch\", updateRotation);\n };\n }, [map]);\n\n return (\n <ControlButton onClick={onClick} label=\"Reset bearing to north\">\n <svg\n ref={compassRef}\n viewBox=\"0 0 24 24\"\n className=\"size-5 transition-transform duration-200\"\n style={{ transformStyle: \"preserve-3d\" }}\n >\n <path d=\"M12 2L16 12H12V2Z\" className=\"fill-red-500\" />\n <path d=\"M12 2L8 12H12V2Z\" className=\"fill-red-300\" />\n <path d=\"M12 22L16 12H12V22Z\" className=\"fill-muted-foreground/60\" />\n <path d=\"M12 22L8 12H12V22Z\" className=\"fill-muted-foreground/30\" />\n </svg>\n </ControlButton>\n );\n}\n\ntype MapPopupProps = {\n /** Longitude coordinate for popup position */\n longitude: number;\n /** Latitude coordinate for popup position */\n latitude: number;\n /** Callback when popup is closed */\n onClose?: () => void;\n /** Popup content */\n children: ReactNode;\n /** Additional CSS classes for the popup container */\n className?: string;\n /** Show a close button in the popup (default: false) */\n closeButton?: boolean;\n} & Omit<PopupOptions, \"className\" | \"closeButton\">;\n\nfunction MapPopup({\n longitude,\n latitude,\n onClose,\n children,\n className,\n closeButton = false,\n ...popupOptions\n}: MapPopupProps) {\n const { map } = useMap();\n const popupOptionsRef = useRef(popupOptions);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const container = useMemo(() => document.createElement(\"div\"), []);\n\n const popup = useMemo(() => {\n const popupInstance = new MapLibreGL.Popup({\n offset: 16,\n ...popupOptions,\n closeButton: false,\n })\n .setMaxWidth(\"none\")\n .setLngLat([longitude, latitude]);\n\n return popupInstance;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!map) return;\n\n const onCloseProp = () => onCloseRef.current?.();\n\n popup.on(\"close\", onCloseProp);\n\n popup.setDOMContent(container);\n popup.addTo(map);\n\n return () => {\n popup.off(\"close\", onCloseProp);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map]);\n\n if (popup.isOpen()) {\n const prev = popupOptionsRef.current;\n\n if (\n popup.getLngLat().lng !== longitude ||\n popup.getLngLat().lat !== latitude\n ) {\n popup.setLngLat([longitude, latitude]);\n }\n\n if (prev.offset !== popupOptions.offset) {\n popup.setOffset(popupOptions.offset ?? 16);\n }\n if (prev.maxWidth !== popupOptions.maxWidth && popupOptions.maxWidth) {\n popup.setMaxWidth(popupOptions.maxWidth ?? \"none\");\n }\n popupOptionsRef.current = popupOptions;\n }\n\n const handleClose = () => {\n popup.remove();\n };\n\n return createPortal(\n <div\n className={cn(\n \"bg-popover text-popover-foreground relative max-w-62 rounded-md border p-3 shadow-md\",\n \"animate-in fade-in-0 zoom-in-95 duration-200 ease-out\",\n className,\n )}\n >\n {closeButton && <PopupCloseButton onClick={handleClose} />}\n {children}\n </div>,\n container,\n );\n}\n\ntype MapRouteProps = {\n /** Optional unique identifier for the route layer */\n id?: string;\n /** Array of [longitude, latitude] coordinate pairs defining the route */\n coordinates: [number, number][];\n /** Line color as CSS color value (default: \"#4285F4\") */\n color?: string;\n /** Line width in pixels (default: 3) */\n width?: number;\n /** Line opacity from 0 to 1 (default: 0.8) */\n opacity?: number;\n /** Dash pattern [dash length, gap length] for dashed lines */\n dashArray?: [number, number];\n /** Callback when the route line is clicked */\n onClick?: () => void;\n /** Callback when mouse enters the route line */\n onMouseEnter?: () => void;\n /** Callback when mouse leaves the route line */\n onMouseLeave?: () => void;\n /** Whether the route is interactive - shows pointer cursor on hover (default: true) */\n interactive?: boolean;\n};\n\nfunction MapRoute({\n id: propId,\n coordinates,\n color = \"#4285F4\",\n width = 3,\n opacity = 0.8,\n dashArray,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive = true,\n}: MapRouteProps) {\n const { map, isLoaded } = useMap();\n const autoId = useId();\n const id = propId ?? autoId;\n const sourceId = `route-source-${id}`;\n const layerId = `route-layer-${id}`;\n\n // Add source and layer on mount\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n map.addSource(sourceId, {\n type: \"geojson\",\n data: {\n type: \"Feature\",\n properties: {},\n geometry: { type: \"LineString\", coordinates: [] },\n },\n });\n\n map.addLayer({\n id: layerId,\n type: \"line\",\n source: sourceId,\n layout: { \"line-join\": \"round\", \"line-cap\": \"round\" },\n paint: {\n \"line-color\": color,\n \"line-width\": width,\n \"line-opacity\": opacity,\n ...(dashArray && { \"line-dasharray\": dashArray }),\n },\n });\n\n return () => {\n try {\n if (map.getLayer(layerId)) map.removeLayer(layerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map]);\n\n // When coordinates change, update the source data\n useEffect(() => {\n if (!isLoaded || !map || coordinates.length < 2) return;\n\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n if (source) {\n source.setData({\n type: \"Feature\",\n properties: {},\n geometry: { type: \"LineString\", coordinates },\n });\n }\n }, [isLoaded, map, coordinates, sourceId]);\n\n useEffect(() => {\n if (!isLoaded || !map || !map.getLayer(layerId)) return;\n\n map.setPaintProperty(layerId, \"line-color\", color);\n map.setPaintProperty(layerId, \"line-width\", width);\n map.setPaintProperty(layerId, \"line-opacity\", opacity);\n if (dashArray) {\n map.setPaintProperty(layerId, \"line-dasharray\", dashArray);\n }\n }, [isLoaded, map, layerId, color, width, opacity, dashArray]);\n\n // Handle click and hover events\n useEffect(() => {\n if (!isLoaded || !map || !interactive) return;\n\n const handleClick = () => {\n onClick?.();\n };\n const handleMouseEnter = () => {\n map.getCanvas().style.cursor = \"pointer\";\n onMouseEnter?.();\n };\n const handleMouseLeave = () => {\n map.getCanvas().style.cursor = \"\";\n onMouseLeave?.();\n };\n\n map.on(\"click\", layerId, handleClick);\n map.on(\"mouseenter\", layerId, handleMouseEnter);\n map.on(\"mouseleave\", layerId, handleMouseLeave);\n\n return () => {\n map.off(\"click\", layerId, handleClick);\n map.off(\"mouseenter\", layerId, handleMouseEnter);\n map.off(\"mouseleave\", layerId, handleMouseLeave);\n };\n }, [\n isLoaded,\n map,\n layerId,\n onClick,\n onMouseEnter,\n onMouseLeave,\n interactive,\n ]);\n\n return null;\n}\n\n/** A single arc to render inside <MapArc data={...}>. */\ntype MapArcDatum = {\n /** Unique identifier for this arc. Required for hover state tracking and event payloads. */\n id: string | number;\n /** Start coordinate as [longitude, latitude]. */\n from: [number, number];\n /** End coordinate as [longitude, latitude]. */\n to: [number, number];\n};\n\n/** Event payload passed to MapArc interaction callbacks. */\ntype MapArcEvent<T extends MapArcDatum = MapArcDatum> = {\n /** The arc datum that was hovered or clicked. */\n arc: T;\n /** Longitude of the cursor at the time of the event. */\n longitude: number;\n /** Latitude of the cursor at the time of the event. */\n latitude: number;\n /** The underlying MapLibre mouse event for advanced use cases. */\n originalEvent: MapLibreGL.MapMouseEvent;\n};\n\ntype MapArcLinePaint = NonNullable<MapLibreGL.LineLayerSpecification[\"paint\"]>;\ntype MapArcLineLayout = NonNullable<\n MapLibreGL.LineLayerSpecification[\"layout\"]\n>;\n\ntype MapArcProps<T extends MapArcDatum = MapArcDatum> = {\n /** Array of arcs to render. Each arc must have a unique `id`. */\n data: T[];\n /** Optional unique identifier prefix for the arc source/layers. Auto-generated if not provided. */\n id?: string;\n /**\n * How far each arc bows away from a straight line. `0` renders straight\n * lines; higher values bend further. Negative values bend to the opposite\n * side. Arcs are computed as a quadratic Bézier in lng/lat space and do not\n * account for the antimeridian. (default: 0.2)\n */\n curvature?: number;\n /** Number of samples used to render each curve. Higher = smoother. (default: 64) */\n samples?: number;\n /**\n * MapLibre paint properties for the arc layer. Merged on top of sensible\n * defaults (`line-color: #4285F4`, `line-width: 2`, `line-opacity: 0.85`).\n * Any value can be a MapLibre expression for per-feature styling, every\n * field on each arc datum (besides `from`/`to`) is exposed via `[\"get\", ...]`.\n */\n paint?: MapArcLinePaint;\n /** MapLibre layout properties for the arc layer. Defaults to rounded joins/caps. */\n layout?: MapArcLineLayout;\n /**\n * Paint properties applied to the arc currently under the cursor. Each key\n * is merged into `paint` as a `case` expression keyed on per-feature hover\n * state, so only the hovered arc changes appearance.\n */\n hoverPaint?: MapArcLinePaint;\n /** Callback when an arc is clicked. */\n onClick?: (e: MapArcEvent<T>) => void;\n /**\n * Callback fired when the hovered arc changes. Receives the cursor's\n * lng/lat at the moment of entry, and `null` when the cursor leaves the\n * last hovered arc.\n */\n onHover?: (e: MapArcEvent<T> | null) => void;\n /** Whether arcs respond to mouse events (default: true). */\n interactive?: boolean;\n /** Optional MapLibre layer id to insert the arc layers before (z-order control). */\n beforeId?: string;\n};\n\nconst DEFAULT_ARC_CURVATURE = 0.2;\nconst DEFAULT_ARC_SAMPLES = 64;\nconst ARC_HIT_MIN_WIDTH = 12;\nconst ARC_HIT_PADDING = 6;\n\nconst DEFAULT_ARC_PAINT: MapArcLinePaint = {\n \"line-color\": \"#4285F4\",\n \"line-width\": 2,\n \"line-opacity\": 0.85,\n};\n\nconst DEFAULT_ARC_LAYOUT: MapArcLineLayout = {\n \"line-join\": \"round\",\n \"line-cap\": \"round\",\n};\n\nfunction mergeArcPaint(\n paint: MapArcLinePaint,\n hoverPaint: MapArcLinePaint | undefined,\n): MapArcLinePaint {\n if (!hoverPaint) return paint;\n const merged: Record<string, unknown> = { ...paint };\n for (const [key, hoverValue] of Object.entries(hoverPaint)) {\n if (hoverValue === undefined) continue;\n const baseValue = merged[key];\n merged[key] =\n baseValue === undefined\n ? hoverValue\n : [\n \"case\",\n [\"boolean\", [\"feature-state\", \"hover\"], false],\n hoverValue,\n baseValue,\n ];\n }\n return merged as MapArcLinePaint;\n}\n\nfunction buildArcCoordinates(\n from: [number, number],\n to: [number, number],\n curvature: number,\n samples: number,\n): [number, number][] {\n const [x0, y0] = from;\n const [x2, y2] = to;\n const dx = x2 - x0;\n const dy = y2 - y0;\n const distance = Math.hypot(dx, dy);\n\n if (distance === 0 || curvature === 0) return [from, to];\n\n const mx = (x0 + x2) / 2;\n const my = (y0 + y2) / 2;\n const nx = -dy / distance;\n const ny = dx / distance;\n const offset = distance * curvature;\n const cx = mx + nx * offset;\n const cy = my + ny * offset;\n\n const points: [number, number][] = [];\n const segments = Math.max(2, Math.floor(samples));\n for (let i = 0; i <= segments; i += 1) {\n const t = i / segments;\n const inv = 1 - t;\n const x = inv * inv * x0 + 2 * inv * t * cx + t * t * x2;\n const y = inv * inv * y0 + 2 * inv * t * cy + t * t * y2;\n points.push([x, y]);\n }\n return points;\n}\n\nfunction MapArc<T extends MapArcDatum = MapArcDatum>({\n data,\n id: propId,\n curvature = DEFAULT_ARC_CURVATURE,\n samples = DEFAULT_ARC_SAMPLES,\n paint,\n layout,\n hoverPaint,\n onClick,\n onHover,\n interactive = true,\n beforeId,\n}: MapArcProps<T>) {\n const { map, isLoaded } = useMap();\n const autoId = useId();\n const id = propId ?? autoId;\n const sourceId = `arc-source-${id}`;\n const layerId = `arc-layer-${id}`;\n const hitLayerId = `arc-hit-layer-${id}`;\n\n const mergedPaint = useMemo(\n () => mergeArcPaint({ ...DEFAULT_ARC_PAINT, ...paint }, hoverPaint),\n [paint, hoverPaint],\n );\n const mergedLayout = useMemo(\n () => ({ ...DEFAULT_ARC_LAYOUT, ...layout }),\n [layout],\n );\n\n const hitWidth = useMemo(() => {\n const w = paint?.[\"line-width\"] ?? DEFAULT_ARC_PAINT[\"line-width\"];\n const base = typeof w === \"number\" ? w : ARC_HIT_MIN_WIDTH;\n return Math.max(base + ARC_HIT_PADDING, ARC_HIT_MIN_WIDTH);\n }, [paint]);\n\n const geoJSON = useMemo<GeoJSON.FeatureCollection<GeoJSON.LineString>>(\n () => ({\n type: \"FeatureCollection\",\n features: data.map((arc) => {\n const { from, to, ...properties } = arc;\n return {\n type: \"Feature\",\n properties,\n geometry: {\n type: \"LineString\",\n coordinates: buildArcCoordinates(from, to, curvature, samples),\n },\n };\n }),\n }),\n [data, curvature, samples],\n );\n\n const latestRef = useRef({ data, onClick, onHover });\n latestRef.current = { data, onClick, onHover };\n\n // Add source and layers on mount.\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n map.addSource(sourceId, {\n type: \"geojson\",\n data: geoJSON,\n promoteId: \"id\",\n });\n\n map.addLayer(\n {\n id: hitLayerId,\n type: \"line\",\n source: sourceId,\n layout: DEFAULT_ARC_LAYOUT,\n paint: {\n \"line-color\": \"rgba(0, 0, 0, 0)\",\n \"line-width\": hitWidth,\n \"line-opacity\": 1,\n },\n },\n beforeId,\n );\n\n map.addLayer(\n {\n id: layerId,\n type: \"line\",\n source: sourceId,\n layout: mergedLayout,\n paint: mergedPaint,\n },\n beforeId,\n );\n\n return () => {\n try {\n if (map.getLayer(layerId)) map.removeLayer(layerId);\n if (map.getLayer(hitLayerId)) map.removeLayer(hitLayerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map]);\n\n // Sync features when data / curvature / samples change.\n useEffect(() => {\n if (!isLoaded || !map) return;\n const source = map.getSource(sourceId) as\n | MapLibreGL.GeoJSONSource\n | undefined;\n source?.setData(geoJSON);\n }, [isLoaded, map, geoJSON, sourceId]);\n\n // Sync paint/layout when they change.\n useEffect(() => {\n if (!isLoaded || !map || !map.getLayer(layerId)) return;\n for (const [key, value] of Object.entries(mergedPaint)) {\n map.setPaintProperty(\n layerId,\n key as keyof MapArcLinePaint,\n value as never,\n );\n }\n for (const [key, value] of Object.entries(mergedLayout)) {\n map.setLayoutProperty(\n layerId,\n key as keyof MapArcLineLayout,\n value as never,\n );\n }\n if (map.getLayer(hitLayerId)) {\n map.setPaintProperty(hitLayerId, \"line-width\", hitWidth);\n }\n }, [isLoaded, map, layerId, hitLayerId, mergedPaint, mergedLayout, hitWidth]);\n\n // Interaction handlers\n useEffect(() => {\n if (!isLoaded || !map || !interactive) return;\n\n let hoveredId: string | number | null = null;\n\n const setHover = (next: string | number | null) => {\n if (next === hoveredId) return;\n const sourceExists = !!map.getSource(sourceId);\n if (hoveredId != null && sourceExists) {\n map.setFeatureState(\n { source: sourceId, id: hoveredId },\n { hover: false },\n );\n }\n hoveredId = next;\n if (next != null && sourceExists) {\n map.setFeatureState({ source: sourceId, id: next }, { hover: true });\n }\n };\n\n const findArc = (featureId: string | number | undefined) =>\n featureId == null\n ? undefined\n : latestRef.current.data.find(\n (arc) => String(arc.id) === String(featureId),\n );\n\n const handleMouseMove = (e: MapLibreGL.MapLayerMouseEvent) => {\n const featureId = e.features?.[0]?.id as string | number | undefined;\n if (featureId == null || featureId === hoveredId) return;\n\n setHover(featureId);\n map.getCanvas().style.cursor = \"pointer\";\n\n const arc = findArc(featureId);\n if (arc) {\n latestRef.current.onHover?.({\n arc: arc as T,\n longitude: e.lngLat.lng,\n latitude: e.lngLat.lat,\n originalEvent: e,\n });\n }\n };\n\n const handleMouseLeave = () => {\n setHover(null);\n map.getCanvas().style.cursor = \"\";\n latestRef.current.onHover?.(null);\n };\n\n const handleClick = (e: MapLibreGL.MapLayerMouseEvent) => {\n const arc = findArc(e.features?.[0]?.id as string | number | undefined);\n if (!arc) return;\n latestRef.current.onClick?.({\n arc: arc as T,\n longitude: e.lngLat.lng,\n latitude: e.lngLat.lat,\n originalEvent: e,\n });\n };\n\n map.on(\"mousemove\", hitLayerId, handleMouseMove);\n map.on(\"mouseleave\", hitLayerId, handleMouseLeave);\n map.on(\"click\", hitLayerId, handleClick);\n\n return () => {\n map.off(\"mousemove\", hitLayerId, handleMouseMove);\n map.off(\"mouseleave\", hitLayerId, handleMouseLeave);\n map.off(\"click\", hitLayerId, handleClick);\n setHover(null);\n map.getCanvas().style.cursor = \"\";\n };\n }, [isLoaded, map, hitLayerId, sourceId, interactive]);\n\n return null;\n}\n\ntype MapClusterLayerProps<\n P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties,\n> = {\n /** GeoJSON FeatureCollection data or URL to fetch GeoJSON from */\n data: string | GeoJSON.FeatureCollection<GeoJSON.Point, P>;\n /** Maximum zoom level to cluster points on (default: 14) */\n clusterMaxZoom?: number;\n /** Radius of each cluster when clustering points in pixels (default: 50) */\n clusterRadius?: number;\n /** Colors for cluster circles: [small, medium, large] based on point count (default: [\"#22c55e\", \"#eab308\", \"#ef4444\"]) */\n clusterColors?: [string, string, string];\n /** Point count thresholds for color/size steps: [medium, large] (default: [100, 750]) */\n clusterThresholds?: [number, number];\n /** Color for unclustered individual points (default: \"#3b82f6\") */\n pointColor?: string;\n /** Callback when an unclustered point is clicked */\n onPointClick?: (\n feature: GeoJSON.Feature<GeoJSON.Point, P>,\n coordinates: [number, number],\n ) => void;\n /** Callback when a cluster is clicked. If not provided, zooms into the cluster */\n onClusterClick?: (\n clusterId: number,\n coordinates: [number, number],\n pointCount: number,\n ) => void;\n};\n\nfunction MapClusterLayer<\n P extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties,\n>({\n data,\n clusterMaxZoom = 14,\n clusterRadius = 50,\n clusterColors = [\"#22c55e\", \"#eab308\", \"#ef4444\"],\n clusterThresholds = [100, 750],\n pointColor = \"#3b82f6\",\n onPointClick,\n onClusterClick,\n}: MapClusterLayerProps<P>) {\n const { map, isLoaded } = useMap();\n const id = useId();\n const sourceId = `cluster-source-${id}`;\n const clusterLayerId = `clusters-${id}`;\n const clusterCountLayerId = `cluster-count-${id}`;\n const unclusteredLayerId = `unclustered-point-${id}`;\n\n const stylePropsRef = useRef({\n clusterColors,\n clusterThresholds,\n pointColor,\n });\n\n // Add source and layers on mount\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n // Add clustered GeoJSON source\n map.addSource(sourceId, {\n type: \"geojson\",\n data,\n cluster: true,\n clusterMaxZoom,\n clusterRadius,\n });\n\n // Add cluster circles layer\n map.addLayer({\n id: clusterLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"has\", \"point_count\"],\n paint: {\n \"circle-color\": [\n \"step\",\n [\"get\", \"point_count\"],\n clusterColors[0],\n clusterThresholds[0],\n clusterColors[1],\n clusterThresholds[1],\n clusterColors[2],\n ],\n \"circle-radius\": [\n \"step\",\n [\"get\", \"point_count\"],\n 20,\n clusterThresholds[0],\n 30,\n clusterThresholds[1],\n 40,\n ],\n \"circle-stroke-width\": 1,\n \"circle-stroke-color\": \"#fff\",\n \"circle-opacity\": 0.85,\n },\n });\n\n // Add cluster count text layer\n map.addLayer({\n id: clusterCountLayerId,\n type: \"symbol\",\n source: sourceId,\n filter: [\"has\", \"point_count\"],\n layout: {\n \"text-field\": \"{point_count_abbreviated}\",\n \"text-font\": [\"Open Sans\"],\n \"text-size\": 12,\n },\n paint: {\n \"text-color\": \"#fff\",\n },\n });\n\n // Add unclustered point layer\n map.addLayer({\n id: unclusteredLayerId,\n type: \"circle\",\n source: sourceId,\n filter: [\"!\", [\"has\", \"point_count\"]],\n paint: {\n \"circle-color\": pointColor,\n \"circle-radius\": 5,\n \"circle-stroke-width\": 2,\n \"circle-stroke-color\": \"#fff\",\n },\n });\n\n return () => {\n try {\n if (map.getLayer(clusterCountLayerId))\n map.removeLayer(clusterCountLayerId);\n if (map.getLayer(unclusteredLayerId))\n map.removeLayer(unclusteredLayerId);\n if (map.getLayer(clusterLayerId)) map.removeLayer(clusterLayerId);\n if (map.getSource(sourceId)) map.removeSource(sourceId);\n } catch {\n // ignore\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoaded, map, sourceId]);\n\n // Update source data when data prop changes (only for non-URL data)\n useEffect(() => {\n if (!isLoaded || !map || typeof data === \"string\") return;\n\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n if (source) {\n source.setData(data);\n }\n }, [isLoaded, map, data, sourceId]);\n\n // Update layer styles when props change\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n const prev = stylePropsRef.current;\n const colorsChanged =\n prev.clusterColors !== clusterColors ||\n prev.clusterThresholds !== clusterThresholds;\n\n // Update cluster layer colors and sizes\n if (map.getLayer(clusterLayerId) && colorsChanged) {\n map.setPaintProperty(clusterLayerId, \"circle-color\", [\n \"step\",\n [\"get\", \"point_count\"],\n clusterColors[0],\n clusterThresholds[0],\n clusterColors[1],\n clusterThresholds[1],\n clusterColors[2],\n ]);\n map.setPaintProperty(clusterLayerId, \"circle-radius\", [\n \"step\",\n [\"get\", \"point_count\"],\n 20,\n clusterThresholds[0],\n 30,\n clusterThresholds[1],\n 40,\n ]);\n }\n\n // Update unclustered point layer color\n if (map.getLayer(unclusteredLayerId) && prev.pointColor !== pointColor) {\n map.setPaintProperty(unclusteredLayerId, \"circle-color\", pointColor);\n }\n\n stylePropsRef.current = { clusterColors, clusterThresholds, pointColor };\n }, [\n isLoaded,\n map,\n clusterLayerId,\n unclusteredLayerId,\n clusterColors,\n clusterThresholds,\n pointColor,\n ]);\n\n // Handle click events\n useEffect(() => {\n if (!isLoaded || !map) return;\n\n // Cluster click handler - zoom into cluster\n const handleClusterClick = async (\n e: MapLibreGL.MapMouseEvent & {\n features?: MapLibreGL.MapGeoJSONFeature[];\n },\n ) => {\n const features = map.queryRenderedFeatures(e.point, {\n layers: [clusterLayerId],\n });\n if (!features.length) return;\n\n const feature = features[0];\n const clusterId = feature.properties?.cluster_id as number;\n const pointCount = feature.properties?.point_count as number;\n const coordinates = (feature.geometry as GeoJSON.Point).coordinates as [\n number,\n number,\n ];\n\n if (onClusterClick) {\n onClusterClick(clusterId, coordinates, pointCount);\n } else {\n // Default behavior: zoom to cluster expansion zoom\n const source = map.getSource(sourceId) as MapLibreGL.GeoJSONSource;\n const zoom = await source.getClusterExpansionZoom(clusterId);\n map.easeTo({\n center: coordinates,\n zoom,\n });\n }\n };\n\n // Unclustered point click handler\n const handlePointClick = (\n e: MapLibreGL.MapMouseEvent & {\n features?: MapLibreGL.MapGeoJSONFeature[];\n },\n ) => {\n if (!onPointClick || !e.features?.length) return;\n\n const feature = e.features[0];\n const coordinates = (\n feature.geometry as GeoJSON.Point\n ).coordinates.slice() as [number, number];\n\n // Handle world copies\n while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {\n coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;\n }\n\n onPointClick(\n feature as unknown as GeoJSON.Feature<GeoJSON.Point, P>,\n coordinates,\n );\n };\n\n // Cursor style handlers\n const handleMouseEnterCluster = () => {\n map.getCanvas().style.cursor = \"pointer\";\n };\n const handleMouseLeaveCluster = () => {\n map.getCanvas().style.cursor = \"\";\n };\n const handleMouseEnterPoint = () => {\n if (onPointClick) {\n map.getCanvas().style.cursor = \"pointer\";\n }\n };\n const handleMouseLeavePoint = () => {\n map.getCanvas().style.cursor = \"\";\n };\n\n map.on(\"click\", clusterLayerId, handleClusterClick);\n map.on(\"click\", unclusteredLayerId, handlePointClick);\n map.on(\"mouseenter\", clusterLayerId, handleMouseEnterCluster);\n map.on(\"mouseleave\", clusterLayerId, handleMouseLeaveCluster);\n map.on(\"mouseenter\", unclusteredLayerId, handleMouseEnterPoint);\n map.on(\"mouseleave\", unclusteredLayerId, handleMouseLeavePoint);\n\n return () => {\n map.off(\"click\", clusterLayerId, handleClusterClick);\n map.off(\"click\", unclusteredLayerId, handlePointClick);\n map.off(\"mouseenter\", clusterLayerId, handleMouseEnterCluster);\n map.off(\"mouseleave\", clusterLayerId, handleMouseLeaveCluster);\n map.off(\"mouseenter\", unclusteredLayerId, handleMouseEnterPoint);\n map.off(\"mouseleave\", unclusteredLayerId, handleMouseLeavePoint);\n };\n }, [\n isLoaded,\n map,\n clusterLayerId,\n unclusteredLayerId,\n sourceId,\n onClusterClick,\n onPointClick,\n ]);\n\n return null;\n}\n\nexport {\n Map,\n useMap,\n MapMarker,\n MarkerContent,\n MarkerPopup,\n MarkerTooltip,\n MarkerLabel,\n MapPopup,\n MapControls,\n MapRoute,\n MapArc,\n MapClusterLayer,\n};\n\nexport type { MapRef, MapViewport, MapArcDatum, MapArcEvent };\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Progress as ProgressPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Progress({\n className,\n value,\n ...props\n}: React.ComponentProps<typeof ProgressPrimitive.Root>) {\n return (\n <ProgressPrimitive.Root\n data-slot=\"progress\"\n className={cn(\n \"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted\",\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className=\"size-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n )\n}\n\nexport { Progress }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Slider as SliderPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Slider({\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n ...props\n}: React.ComponentProps<typeof SliderPrimitive.Root>) {\n const _values = React.useMemo(\n () =>\n Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min, max],\n [value, defaultValue, min, max]\n )\n\n return (\n <SliderPrimitive.Root\n data-slot=\"slider\"\n defaultValue={defaultValue}\n value={value}\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 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 {Array.from({ length: _values.length }, (_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={index}\n className=\"relative block size-3 shrink-0 rounded-full border border-ring bg-white 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\nexport { Slider }\n","import { useTheme } from \"next-themes\"\nimport { Toaster as Sonner, type ToasterProps } from \"sonner\"\nimport { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from \"lucide-react\"\n\nconst Toaster = ({ ...props }: ToasterProps) => {\n const { theme = \"system\" } = useTheme()\n\n return (\n <Sonner\n theme={theme as ToasterProps[\"theme\"]}\n className=\"toaster group\"\n icons={{\n success: (\n <CircleCheckIcon className=\"size-4\" />\n ),\n info: (\n <InfoIcon className=\"size-4\" />\n ),\n warning: (\n <TriangleAlertIcon className=\"size-4\" />\n ),\n error: (\n <OctagonXIcon className=\"size-4\" />\n ),\n loading: (\n <Loader2Icon className=\"size-4 animate-spin\" />\n ),\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 } as React.CSSProperties\n }\n toastOptions={{\n classNames: {\n toast: \"cn-toast\",\n },\n }}\n {...props}\n />\n )\n}\n\nexport { Toaster }\n","\"use client\";\n\nimport { CheckIcon, LoaderCircleIcon } from \"lucide-react\";\nimport { Slot } from \"radix-ui\";\nimport * as React from \"react\";\nimport { createContext, useContext } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n// Types\ntype StepperContextValue = {\n activeStep: number;\n setActiveStep: (step: number) => void;\n orientation: \"horizontal\" | \"vertical\";\n};\n\ntype StepItemContextValue = {\n step: number;\n state: StepState;\n isDisabled: boolean;\n isLoading: boolean;\n};\n\ntype StepState = \"active\" | \"completed\" | \"inactive\" | \"loading\";\n\n// Contexts\nconst StepperContext = createContext<StepperContextValue | undefined>(\n undefined,\n);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(\n undefined,\n);\n\nconst useStepper = () => {\n const context = useContext(StepperContext);\n if (!context) {\n throw new Error(\"useStepper must be used within a Stepper\");\n }\n return context;\n};\n\nconst useStepItem = () => {\n const context = useContext(StepItemContext);\n if (!context) {\n throw new Error(\"useStepItem must be used within a StepperItem\");\n }\n return context;\n};\n\n// Components\ninterface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n defaultValue?: number;\n value?: number;\n onValueChange?: (value: number) => void;\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nfunction Stepper({\n defaultValue = 0,\n value,\n onValueChange,\n orientation = \"horizontal\",\n className,\n ...props\n}: StepperProps) {\n const [activeStep, setInternalStep] = React.useState(defaultValue);\n\n const setActiveStep = React.useCallback(\n (step: number) => {\n if (value === undefined) {\n setInternalStep(step);\n }\n onValueChange?.(step);\n },\n [value, onValueChange],\n );\n\n const currentStep = value ?? activeStep;\n\n return (\n <StepperContext.Provider\n value={{\n activeStep: currentStep,\n orientation,\n setActiveStep,\n }}\n >\n <div\n className={cn(\n \"group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col\",\n className,\n )}\n data-orientation={orientation}\n data-slot=\"stepper\"\n {...props}\n />\n </StepperContext.Provider>\n );\n}\n\n// StepperItem\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n step: number;\n completed?: boolean;\n disabled?: boolean;\n loading?: boolean;\n}\n\nfunction StepperItem({\n step,\n completed = false,\n disabled = false,\n loading = false,\n className,\n children,\n ...props\n}: StepperItemProps) {\n const { activeStep } = useStepper();\n\n const state: StepState =\n completed || step < activeStep\n ? \"completed\"\n : activeStep === step\n ? \"active\"\n : \"inactive\";\n\n const isLoading = loading && step === activeStep;\n\n return (\n <StepItemContext.Provider\n value={{ isDisabled: disabled, isLoading, state, step }}\n >\n <div\n className={cn(\n \"group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=vertical]/stepper:flex-col\",\n className,\n )}\n data-slot=\"stepper-item\"\n data-state={state}\n {...(isLoading ? { \"data-loading\": true } : {})}\n {...props}\n >\n {children}\n </div>\n </StepItemContext.Provider>\n );\n}\n\n// StepperTrigger\ninterface StepperTriggerProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean;\n}\n\nfunction StepperTrigger({\n asChild = false,\n className,\n children,\n ...props\n}: StepperTriggerProps) {\n const { setActiveStep } = useStepper();\n const { step, isDisabled } = useStepItem();\n\n if (asChild) {\n const Comp = asChild ? Slot.Root : \"span\";\n return (\n <Comp className={className} data-slot=\"stepper-trigger\">\n {children}\n </Comp>\n );\n }\n\n return (\n <button\n className={cn(\n \"inline-flex items-center gap-3 rounded-full outline-none focus-visible:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n data-slot=\"stepper-trigger\"\n disabled={isDisabled}\n onClick={() => setActiveStep(step)}\n type=\"button\"\n {...props}\n >\n {children}\n </button>\n );\n}\n\n// StepperIndicator\ninterface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nfunction StepperIndicator({\n asChild = false,\n className,\n children,\n ...props\n}: StepperIndicatorProps) {\n const { state, step, isLoading } = useStepItem();\n\n return (\n <span\n className={cn(\n \"relative flex size-6 shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs data-[state=active]:bg-primary data-[state=completed]:bg-primary data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground\",\n className,\n )}\n data-slot=\"stepper-indicator\"\n data-state={state}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n <span className=\"transition-all group-data-[state=completed]/step:scale-0 group-data-loading/step:scale-0 group-data-[state=completed]/step:opacity-0 group-data-loading/step:opacity-0 group-data-loading/step:transition-none\">\n {step}\n </span>\n <CheckIcon\n aria-hidden=\"true\"\n className=\"absolute scale-0 opacity-0 transition-all group-data-[state=completed]/step:scale-100 group-data-[state=completed]/step:opacity-100\"\n size={16}\n />\n {isLoading && (\n <span className=\"absolute transition-all\">\n <LoaderCircleIcon\n aria-hidden=\"true\"\n className=\"animate-spin\"\n size={14}\n />\n </span>\n )}\n </>\n )}\n </span>\n );\n}\n\n// StepperTitle\nfunction StepperTitle({\n className,\n ...props\n}: React.HTMLAttributes<HTMLHeadingElement>) {\n return (\n <h3\n className={cn(\"font-medium text-sm\", className)}\n data-slot=\"stepper-title\"\n {...props}\n />\n );\n}\n\n// StepperDescription\nfunction StepperDescription({\n className,\n ...props\n}: React.HTMLAttributes<HTMLParagraphElement>) {\n return (\n <p\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"stepper-description\"\n {...props}\n />\n );\n}\n\n// StepperSeparator\nfunction StepperSeparator({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\n \"m-0.5 bg-muted group-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=vertical]/stepper:h-12 group-data-[orientation=horizontal]/stepper:w-full group-data-[orientation=vertical]/stepper:w-0.5 group-data-[orientation=horizontal]/stepper:flex-1 group-data-[state=completed]/step:bg-primary\",\n className,\n )}\n data-slot=\"stepper-separator\"\n {...props}\n />\n );\n}\n\nexport {\n Stepper,\n StepperDescription,\n StepperIndicator,\n StepperItem,\n StepperSeparator,\n StepperTitle,\n StepperTrigger,\n};\n","import * as React from \"react\"\nimport { Switch as SwitchPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Switch({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof SwitchPrimitive.Root> & {\n size?: \"sm\" | \"default\"\n}) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className=\"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground\"\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Tabs as TabsPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Tabs({\n className,\n orientation = \"horizontal\",\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Root>) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n data-orientation={orientation}\n className={cn(\n \"group/tabs flex gap-2 data-horizontal:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva(\n \"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none\",\n {\n variants: {\n variant: {\n default: \"bg-muted\",\n line: \"gap-1 bg-transparent\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nfunction TabsList({\n className,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.List> &\n VariantProps<typeof tabsListVariants>) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"tabs-trigger\"\n className={cn(\n \"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n \"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent\",\n \"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground\",\n \"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TabsContent({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Content>) {\n return (\n <TabsPrimitive.Content\n data-slot=\"tabs-content\"\n className={cn(\"flex-1 text-sm outline-none\", className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }\n","\"use client\";\n\nimport { Slot } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n// Types\ntype TimelineContextValue = {\n activeStep: number;\n setActiveStep: (step: number) => void;\n};\n\n// Context\nconst TimelineContext = React.createContext<TimelineContextValue | undefined>(\n undefined,\n);\n\nconst useTimeline = () => {\n const context = React.useContext(TimelineContext);\n if (!context) {\n throw new Error(\"useTimeline must be used within a Timeline\");\n }\n return context;\n};\n\n// Components\ninterface TimelineProps extends React.HTMLAttributes<HTMLDivElement> {\n defaultValue?: number;\n value?: number;\n onValueChange?: (value: number) => void;\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nfunction Timeline({\n defaultValue = 1,\n value,\n onValueChange,\n orientation = \"vertical\",\n className,\n ...props\n}: TimelineProps) {\n const [activeStep, setInternalStep] = React.useState(defaultValue);\n\n const setActiveStep = React.useCallback(\n (step: number) => {\n if (value === undefined) {\n setInternalStep(step);\n }\n onValueChange?.(step);\n },\n [value, onValueChange],\n );\n\n const currentStep = value ?? activeStep;\n\n return (\n <TimelineContext.Provider\n value={{ activeStep: currentStep, setActiveStep }}\n >\n <div\n className={cn(\n \"group/timeline flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col\",\n className,\n )}\n data-orientation={orientation}\n data-slot=\"timeline\"\n {...props}\n />\n </TimelineContext.Provider>\n );\n}\n\n// TimelineContent\nfunction TimelineContent({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"timeline-content\"\n {...props}\n />\n );\n}\n\n// TimelineDate\ninterface TimelineDateProps extends React.HTMLAttributes<HTMLTimeElement> {\n asChild?: boolean;\n}\n\nfunction TimelineDate({\n asChild = false,\n className,\n ...props\n}: TimelineDateProps) {\n const Comp = asChild ? Slot.Root : \"time\";\n\n return (\n <Comp\n className={cn(\n \"mb-1 block font-medium text-muted-foreground text-xs group-data-[orientation=vertical]/timeline:max-sm:h-4\",\n className,\n )}\n data-slot=\"timeline-date\"\n {...props}\n />\n );\n}\n\n// TimelineHeader\nfunction TimelineHeader({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div className={cn(className)} data-slot=\"timeline-header\" {...props} />\n );\n}\n\n// TimelineIndicator\ninterface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nfunction TimelineIndicator({\n className,\n children,\n ...props\n}: TimelineIndicatorProps) {\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute size-4 rounded-full border-2 border-primary/20 group-data-[orientation=vertical]/timeline:top-0 group-data-[orientation=horizontal]/timeline:left-0 group-data-completed/timeline-item:border-primary\",\n className,\n )}\n data-slot=\"timeline-indicator\"\n {...props}\n >\n {children}\n </div>\n );\n}\n\n// TimelineItem\ninterface TimelineItemProps extends React.HTMLAttributes<HTMLDivElement> {\n step: number;\n}\n\nfunction TimelineItem({ step, className, ...props }: TimelineItemProps) {\n const { activeStep } = useTimeline();\n\n return (\n <div\n className={cn(\n \"group/timeline-item relative flex flex-1 flex-col gap-0.5 group-data-[orientation=vertical]/timeline:ms-8 group-data-[orientation=horizontal]/timeline:mt-8 group-data-[orientation=horizontal]/timeline:not-last:pe-8 group-data-[orientation=vertical]/timeline:not-last:pb-12 has-[+[data-completed]]:[&_[data-slot=timeline-separator]]:bg-primary\",\n className,\n )}\n data-completed={step <= activeStep || undefined}\n data-slot=\"timeline-item\"\n {...props}\n />\n );\n}\n\n// TimelineSeparator\nfunction TimelineSeparator({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute self-start bg-primary/10 group-last/timeline-item:hidden group-data-[orientation=horizontal]/timeline:h-0.5 group-data-[orientation=vertical]/timeline:h-[calc(100%-1rem-0.25rem)] group-data-[orientation=horizontal]/timeline:w-[calc(100%-1rem-0.25rem)] group-data-[orientation=vertical]/timeline:w-0.5 group-data-[orientation=horizontal]/timeline:translate-x-4.5 group-data-[orientation=vertical]/timeline:translate-y-4.5\",\n className,\n )}\n data-slot=\"timeline-separator\"\n {...props}\n />\n );\n}\n\n// TimelineTitle\nfunction TimelineTitle({\n className,\n ...props\n}: React.HTMLAttributes<HTMLHeadingElement>) {\n return (\n <h3\n className={cn(\"font-medium text-sm\", className)}\n data-slot=\"timeline-title\"\n {...props}\n />\n );\n}\n\nexport {\n Timeline,\n TimelineContent,\n TimelineDate,\n TimelineHeader,\n TimelineIndicator,\n TimelineItem,\n TimelineSeparator,\n TimelineTitle,\n};\n","\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline: \"border border-input bg-transparent hover:bg-muted\",\n },\n size: {\n default:\n \"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n sm: \"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Toggle({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>) {\n return (\n <TogglePrimitive.Root\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Toggle, toggleVariants }\n","\"use client\"\n\nimport * as React from \"react\"\nimport { type VariantProps } from \"class-variance-authority\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { toggleVariants } from \"@/components/ui/toggle\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 2,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 2,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants>) {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t\",\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n","import * as React from \"react\"\nimport { Tooltip as TooltipPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n )\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-50 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 has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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 {children}\n <TooltipPrimitive.Arrow className=\"z-50 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\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,CAAM,CAAC;AAC7B;;;ACwEA,IAAa,MAAe,GAAe,IAAW,MAAc;CAClE,IAAI,MAAU,GAAG,OAAO;CAExB,IAAM,IAAI,MACJ,IAAK,IAAW,IAAI,IAAI,GACxB,IAAQ;EAAC;EAAS;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI,GAEhE,IAAI,KAAK,MAAM,KAAK,IAAI,CAAK,IAAI,KAAK,IAAI,CAAC,CAAC;CAElD,OAAO,OAAO,YAAY,IAAQ,KAAK,GAAG,QAAQ,CAAE,CAAC,IAAI,EAAM;AACjE,GAUa,MACX,IAA6B,CAAC,MACW;CACzC,IAAM,EACJ,cAAW,UACX,aAAU,UACV,YAAS,KACT,cAAW,IACX,kBAAe,CAAC,GAChB,kBACA,oBACE,GAEE,CAAC,GAAO,KAAY,EAA0B;EAClD,QAAQ,CAAC;EACT,OAAO,EAAa,KAAK,OAAU;GACjC;GACA,IAAI,EAAK;GACT,SAAS,EAAK;EAChB,EAAE;EACF,YAAY;CACd,CAAC,GAEK,IAAW,EAAyB,IAAI,GAExC,IAAe,GAClB,MAA6C;EAC5C,IAAI,EAAK,OAAO,GACd,OAAO,SAAS,EAAK,KAAK,gCAAgC,GAAY,CAAO,EAAE;EAGjF,IAAI,MAAW,KAAK;GAClB,IAAM,IAAgB,EAAO,MAAM,GAAG,EAAE,KAAK,MAAS,EAAK,KAAK,CAAC,GAC3D,IAAW,aAAgB,OAAO,EAAK,QAAQ,KAAK,EAAK,MACzD,IAAgB,IAAI,EAAK,KAAK,MAAM,GAAG,EAAE,IAAI;GAanD,IAAI,CAXe,EAAc,MAAM,MAAS;IAC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