@ai-matrx/design-system 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/badge.tsx","../src/cn.ts","../src/bottom-sheet.tsx","../src/icons.tsx","../src/radix-dialog-modal-context.tsx","../src/button.tsx","../src/command.tsx","../src/portal-container.tsx","../src/creatable-picker.tsx","../src/popover.tsx","../src/editable-label.tsx","../src/input.tsx","../src/label.tsx","../src/overflow-toolbar.tsx","../src/score-ring.tsx","../src/segmented-control.tsx","../src/select.tsx","../src/separator.tsx","../src/sheet.tsx","../src/skeleton.tsx","../src/tabbed-bottom-sheet.tsx","../src/use-scroll-fade.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const badgeVariants = cva(\n \"inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary/15 text-primary\",\n secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n destructive: \"border-transparent bg-destructive/15 text-destructive\",\n outline: \"border-border text-foreground\",\n success: \"border-transparent bg-success/15 text-success\",\n warning: \"border-transparent bg-warning/15 text-warning\",\n info: \"border-blue-200 bg-blue-100 text-blue-800\",\n error: \"border-transparent bg-red-500/15 text-red-700 dark:text-red-400\",\n neutral: \"border-border bg-muted text-muted-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {}\n\nexport function Badge({ className, variant, ...props }: BadgeProps) {\n return <span className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\n/**\n * BottomSheet — the canonical mobile sheet. Ported verbatim from\n * matrx-frontend `components/official/bottom-sheet/BottomSheet.tsx` (S19).\n *\n * `vaul` is a sanctioned real dependency here, the same way\n * @radix-ui/react-alert-dialog is for @ai-matrx/kit `/confirm`: the drag-to-\n * dismiss drawer physics IS the component — there is no BottomSheet without\n * it, and reimplementing gesture/velocity handling would be a vendored twin\n * of a maintained library rather than of our own code. Rationale recorded in\n * FEATURE.md.\n *\n * Seam inversions:\n * - The host's `components/ui/drawer.tsx` wrappers are inlined as private\n * equivalents with identical behavior (thin over vaul + the shared\n * RadixDialogModalProvider); the host keeps its own drawer module for its\n * other drawer surfaces.\n * - `ChevronLeft` is the package's inlined SVG (C19).\n *\n * Host-owned CSS contracts (documented, not shipped): the glass tokens\n * `--matrx-glass-bg` / `--matrx-glass-border-color`, the utility classes\n * `matrx-glass-thin-border` and `pb-safe`, and semantic color tokens.\n */\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\ntype DrawerRootProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /** Vaul does not forward false to its underlying Radix root. */\n modal?: true;\n};\n\nconst DrawerRoot = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerRootProps) => (\n <RadixDialogModalProvider modal>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n >\n {children}\n </DrawerPrimitive.Root>\n </RadixDialogModalProvider>\n);\nDrawerRoot.displayName = \"DrawerRoot\";\n\n/**\n * Unstyled, non-portalling Content for custom Drawer layouts. It derives\n * explicit modal semantics while Vaul retains focus/background behavior.\n */\nconst DrawerContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(({ ...props }, ref) => (\n <DrawerPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nDrawerContentPrimitive.displayName = \"DrawerContentPrimitive\";\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title?: string;\n /**\n * `adaptive` (default) — the sheet sizes to its content between 60dvh and\n * 90dvh. Correct for a single short list.\n *\n * `full` — ONE fixed height (92dvh) that never changes as content changes.\n * Use it for any sheet whose body varies (multi-level navigation, tabs,\n * search results): an adaptive sheet there resizes under the user's thumb\n * on every keystroke and every drill-in, which reads as the panel jumping.\n */\n size?: \"adaptive\" | \"full\";\n /** Visual treatment for the panel. Solid is intended for dense, long-lived surfaces. */\n surface?: \"glass\" | \"solid\";\n /** Merged onto the sheet panel. */\n contentClassName?: string;\n children: React.ReactNode;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n title = \"Bottom Sheet\",\n size = \"adaptive\",\n surface = \"glass\",\n contentClassName,\n children,\n}: BottomSheetProps) {\n return (\n <DrawerRoot open={open} onOpenChange={onOpenChange}>\n <DrawerPrimitive.Portal>\n {/* Identical output to the host's DrawerOverlay wrapper: its base\n classes merged with the caller classes, inline background wins. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-50 bg-black/80\", \"fixed inset-0 z-50\")}\n style={{ background: \"rgba(0, 0, 0, 0.08)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n size === \"full\" ? \"h-[92dvh]\" : \"min-h-[60dvh] max-h-[90dvh]\",\n surface === \"solid\" &&\n \"border border-b-0 border-border bg-background shadow-2xl\",\n contentClassName,\n )}\n style={\n surface === \"glass\"\n ? {\n background: \"var(--matrx-glass-bg)\",\n backdropFilter: \"blur(20px) saturate(180%)\",\n WebkitBackdropFilter: \"blur(20px) saturate(180%)\",\n border: \"1px solid var(--matrx-glass-border-color)\",\n borderBottom: \"none\",\n }\n : undefined\n }\n >\n <VisuallyHidden>\n <DrawerPrimitive.Title>{title}</DrawerPrimitive.Title>\n <DrawerPrimitive.Description>\n Bottom sheet panel.\n </DrawerPrimitive.Description>\n </VisuallyHidden>\n <div className=\"mx-auto mt-3 mb-1 h-1.5 w-10 rounded-full bg-muted-foreground/30 flex-shrink-0\" />\n {children}\n </DrawerContentPrimitive>\n </DrawerPrimitive.Portal>\n </DrawerRoot>\n );\n}\n\nexport interface BottomSheetHeaderProps {\n title: string;\n showBack?: boolean;\n onBack?: () => void;\n trailing?: React.ReactNode;\n}\n\nexport function BottomSheetHeader({\n title,\n showBack = false,\n onBack,\n trailing,\n}: BottomSheetHeaderProps) {\n return (\n <div className=\"flex items-center px-2 pt-1 pb-2 flex-shrink-0 min-h-[44px]\">\n <div className=\"min-w-[44px] flex items-center justify-start\">\n <button\n onClick={onBack}\n className={cn(\n \"h-8 w-8 rounded-full matrx-glass-thin-border flex items-center justify-center transition-all active:scale-95\",\n showBack ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n aria-hidden={!showBack}\n tabIndex={showBack ? 0 : -1}\n >\n <ChevronLeftIcon className=\"h-4 w-4 text-foreground\" />\n </button>\n </div>\n <span className=\"text-[17px] font-semibold flex-1 text-center truncate\">\n {title}\n </span>\n <div className=\"min-w-[44px] flex items-center justify-end\">\n {trailing}\n </div>\n </div>\n );\n}\n\nexport interface BottomSheetBodyProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetBody({ children, className }: BottomSheetBodyProps) {\n return (\n <div\n className={cn(\n // min-h-0 is load-bearing: without it a flex child's min-height:auto\n // floors it at content height and the body grows instead of scrolling.\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-safe\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface BottomSheetFooterProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetFooter({\n children,\n className,\n}: BottomSheetFooterProps) {\n return (\n <div\n className={cn(\n \"flex-shrink-0 px-4 py-3 pb-safe border-t border-white/[0.06]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\ntype IconProps = React.SVGAttributes<SVGSVGElement>;\n\nfunction lucideProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** lucide `loader-2` — the spinner glyph. Callers add `animate-spin`. */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function LucideCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * Ported verbatim from matrx-frontend `components/ui/radix-dialog-modal-context.tsx`.\n * Shared by the Sheet and BottomSheet families (and available to hosts that\n * compose their own Radix Dialog-derived wrappers around these primitives).\n */\n\nimport * as React from \"react\";\n\nconst RadixDialogModalContext = React.createContext(true);\n\nexport interface RadixDialogModalProviderProps {\n children: React.ReactNode;\n modal: boolean;\n}\n\n/**\n * Keeps our Radix-based content wrappers aligned with the owning Root's\n * modality so ARIA semantics cannot drift from focus/pointer behavior.\n */\nexport function RadixDialogModalProvider({\n children,\n modal,\n}: RadixDialogModalProviderProps) {\n return (\n <RadixDialogModalContext.Provider value={modal}>\n {children}\n </RadixDialogModalContext.Provider>\n );\n}\n\n/** Returns whether the nearest Radix Dialog-derived root is modal. */\nexport function useRadixDialogModal(): boolean {\n return React.useContext(RadixDialogModalContext);\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const buttonVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n subtle:\n \"border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-6\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : \"button\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\n/**\n * Command — ported verbatim from matrx-frontend `components/ui/command.tsx`.\n *\n * `cmdk` is a SANCTIONED REAL DEPENDENCY (the vaul ↔ BottomSheet precedent):\n * the filtering/scoring/keyboard engine IS the component's product — there is\n * no Command palette without it, and reimplementing type-ahead ranking plus\n * roving keyboard selection would twin a maintained library rather than our\n * own code. See FEATURE.md.\n *\n * Seam inversions:\n * - `MagnifyingGlassIcon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `CommandDialog` composed the host dialog module (`Dialog`, `DialogContent`,\n * `DialogTitle`). Those pieces are inlined privately below with identical\n * behavior — modal context, overlay, desktop card / mobile bottom-sheet\n * geometry, close control, portal — except the host's popout-aware\n * `DialogPortal` becomes the package's `PortalContainerProvider` seam\n * (plus an explicit `container` prop, which keeps top priority).\n * - The host's `useIsMobile` (a plain matchMedia breakpoint hook, not\n * host-shaped) is inlined privately with the same 768px breakpoint.\n */\n\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MagnifyingGlassIcon, XIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\nexport const Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\n/* ------------------------------------------------------------------ */\n/* Private dialog internals for CommandDialog (host dialog module, */\n/* behavior-identical, portal seam inverted). */\n/* ------------------------------------------------------------------ */\n\nconst MOBILE_BREAKPOINT = 768;\n\n/** Host `hooks/use-mobile` inlined: false during SSR, matchMedia after mount. */\nfunction useIsMobile(): boolean {\n const [isMobile, setIsMobile] = React.useState(false);\n const [hasMounted, setHasMounted] = React.useState(false);\n\n React.useEffect(() => {\n setHasMounted(true);\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n onChange();\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n if (!hasMounted) {\n return false;\n }\n return isMobile;\n}\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so the sheet geometry always wins over any caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nconst CommandDialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, container, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n const portalContainer = usePortalContainer(container);\n return (\n <DialogPrimitive.Portal container={portalContainer}>\n {isModal ? (\n <DialogPrimitive.Overlay\n className=\"fixed inset-0 z-[10000] bg-black/20 dark:bg-black/30 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n />\n ) : null}\n <DialogPrimitive.Content\n ref={ref}\n aria-modal={isModal || undefined}\n aria-describedby={undefined}\n className={cn(\n isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,\n !isModal && \"z-[900]\",\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4\">\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nCommandDialogContent.displayName = \"CommandDialogContent\";\n\nexport interface CommandDialogProps extends DialogProps {\n /** Explicit portal target for the dialog; beats the injected seam. */\n container?: HTMLElement | null;\n}\n\nexport const CommandDialog = ({\n children,\n container,\n ...props\n}: CommandDialogProps) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n <CommandDialogContent\n className=\"overflow-hidden p-0\"\n {...(container !== undefined ? { container } : {})}\n >\n <DialogPrimitive.Title className=\"sr-only\"></DialogPrimitive.Title>\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </CommandDialogContent>\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\n\nexport const CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\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));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nexport const CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport const CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\nconst PortalContainerContext = React.createContext<HTMLElement | null | undefined>(\n undefined,\n);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","\"use client\";\n\n/**\n * CreatablePicker — ported verbatim from matrx-frontend\n * `components/ui/creatable-picker.tsx`.\n *\n * P23 — EVERY PICKER TAKES NEW INPUT.\n *\n * Arman, 2026-08-23: \"We have to annihilate the UIs that offer options but\n * don't allow custom entry because those are the ones that lose the platform\n * the best users… the moment I went in to assign a tier, I got a pop up that\n * forced me to choose from the shitty options I had in front of me. So instead\n * of our system getting significantly better because I took the initiative to\n * add something, our system was too arrogant and cocky and didn't want my\n * opinion. … It's the lazy coding agent who builds a popover with a drop down,\n * but is too lazy to include an add feature.\"\n *\n * THIS COMPONENT IS THE ANSWER, and it is the ONLY shape a keyword-system\n * choice control may take. Type-ahead over the existing options, and whatever\n * you typed that matched nothing is offered back as \"Create «what you typed»\".\n * One click turns it into a real row through the feature's ONE write path and\n * selects it — never a second creation path, never a \"go somewhere else first\".\n *\n * P11 — THE ONE EXCEPTION, AND IT IS NEVER A DEAD END. A platform-shared\n * vocabulary (traffic classes, the platform dimensions every tenant shares) is\n * governed centrally, so this control does not pretend it can widen it. It SAYS\n * so and offers the door instead: `lockedNote` + `lockedAction` render a\n * footer that takes the person to \"make this your own dimension\".\n *\n * It knows nothing about any vocabulary. The caller supplies the options and\n * ONE `onCreate` that writes through whatever the canonical path for that\n * vocabulary already is — this component must never grow a write path of its\n * own, or it becomes the second one.\n *\n * SoR: common-docs/systems/marketing/seo/seo-keywords/keyword-system-decisions.md\n * (P23, P11) + value-system.md § THE ASSIGNMENT LAYER.\n *\n * Seam inversions (the only changes from the origin):\n * - Popover/Command come from this package's own primitives (which route\n * portals through the `PortalContainerProvider` seam).\n * - The lucide icons become package-inlined SVGs (C19); `LucideIcon` in the\n * `footerActions` contract becomes the structural `PickerIcon`.\n */\n\nimport {\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./command\";\nimport {\n ChevronsUpDownIcon,\n ExternalLinkIcon,\n Loader2Icon,\n LockIcon,\n LucideCheckIcon,\n PlusIcon,\n} from \"./icons\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\n/** Structural stand-in for the host's `LucideIcon` in `footerActions`. */\nexport type PickerIcon = ComponentType<{ className?: string }>;\n\n/**\n * \"Add a offering…\" is the kind of small wrongness that makes a product feel\n * unfinished, and the noun is caller-supplied so the article has to be derived.\n */\nfunction article(noun: string): string {\n return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;\n}\n\nexport interface CreatableOption {\n value: string;\n label: string;\n /** Right-aligned detail — a count, a description, \"yours\". */\n hint?: string;\n /** Rendered instead of the plain label (a band chip, a coloured pill). */\n render?: ReactNode;\n /** Extra words the type-ahead should match on. */\n keywords?: string;\n /**\n * The heading this option files under. Options keep the caller's order; a\n * group is opened the first time an option names it. Omit on every option\n * for a single ungrouped list.\n *\n * THE CATALOG IS NOT A WALL (Arman, 2026-08-24, on being shown offerings\n * that were not his): a set that legitimately holds more than this tenant's\n * own rows says so with a heading instead of hiding the rest.\n */\n group?: string;\n}\n\nexport interface CreatablePickerProps {\n value: string | null;\n options: CreatableOption[];\n onSelect: (value: string) => void;\n placeholder: string;\n searchPlaceholder?: string;\n /** The noun in \"Add a level…\" / \"Create «x»\". Always a person's word. */\n noun: string;\n /**\n * Turns typed text into a real row and returns the option value to select.\n * Return null when the caller handled it another way (opened a dialog that\n * needs more than a name — a level needs a threshold).\n */\n onCreate?: (typed: string) => Promise<string | null>;\n /**\n * Creating this noun needs more than a name, so the picker hands the typed\n * text to the caller's dialog instead of writing anything itself.\n */\n onCreateRequiresMore?: (typed: string) => void;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n triggerClassName?: string;\n emptyLabel?: string;\n ariaLabel?: string;\n /** P11: a sentence saying this vocabulary is platform-governed. */\n lockedNote?: string;\n /** P11: the door out of that refusal — never leave them with only \"no\". */\n lockedAction?: { label: string; onSelect: () => void };\n /**\n * Rendered inside the create footer, above the create button — for the one\n * extra choice a vocabulary needs at creation time (a category's parent,\n * say). It is a SLOT, not a second write path: whatever it collects is read\n * by the caller's own `onCreate`. A function receives what the person typed,\n * so a slot can offer matching suggestions (e.g. a shared catalog) instead\n * of a fixed block.\n */\n createExtra?: ReactNode | ((typed: string) => ReactNode);\n /**\n * THE MANAGE DOOR. Arman, 2026-08-24: \"where we have 'add' we should also\n * have a 'manage' button that opens that thing in a new tab.\" A control that\n * names a vocabulary must also be able to reach the place that vocabulary is\n * governed — otherwise the person who wants to rename, re-parent, or retire\n * an option has to go hunting for a screen they may not know exists.\n *\n * It opens in a NEW TAB on purpose: nobody loses the row they were editing\n * in order to go look at the catalog.\n */\n manageAction?: { label: string; href: string };\n /**\n * Doors to a DIFFERENT answer than this vocabulary can give. The offering\n * picker's \"this isn't something we offer\" lives here, because that ruling\n * is a traffic class, not an offering — and sending someone to look for\n * another column on their own is the dead end this slot exists to close.\n */\n footerActions?: Array<{\n label: string;\n icon?: PickerIcon;\n onSelect: () => void;\n /** A sentence under the door saying what it does, when it needs one. */\n note?: string;\n }>;\n /**\n * What the TRIGGER shows for the current selection, when the caller wants\n * something other than the option row's own `render`. A dense table cell\n * needs one compact line (\"Data Destruction Services · ITAD\"); the list row\n * it came from is indented and annotated. Same selection, two jobs.\n */\n renderSelected?: ReactNode;\n size?: \"sm\" | \"md\";\n}\n\nexport function CreatablePicker({\n value,\n options,\n onSelect,\n placeholder,\n searchPlaceholder,\n noun,\n onCreate,\n onCreateRequiresMore,\n disabled,\n loading,\n className,\n triggerClassName,\n emptyLabel = \"No match.\",\n ariaLabel,\n lockedNote,\n lockedAction,\n createExtra,\n manageAction,\n footerActions,\n renderSelected,\n size = \"sm\",\n}: CreatablePickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n const [busy, setBusy] = useState(false);\n /**\n * THE FOOTER IS NEVER A DEAD CLICK. Arman, 2026-08-24: \"one of the options is\n * to allow you to add. When I click add offering, however, nothing happens.\"\n * He was right, and the cause was here, not in the popover: with nothing\n * typed, `create(\"\")` fell straight out of `if (!name) return` and the\n * button ate the click in silence. A control whose whole purpose is P23 may\n * not be the control that ignores you — so an empty \"Add…\" now puts the\n * cursor in the box and SAYS what it wants.\n */\n const inputRef = useRef<HTMLInputElement>(null);\n const [needsName, setNeedsName] = useState(false);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // Caller order is the order. A heading opens the first time an option names\n // it, so a tree stays in tree order inside its own heading.\n const groups: Array<{ heading?: string; options: CreatableOption[] }> = [];\n for (const option of options) {\n const last = groups[groups.length - 1];\n if (last && last.heading === option.group) last.options.push(option);\n else\n groups.push(\n option.group === undefined\n ? { options: [option] }\n : { heading: option.group, options: [option] },\n );\n }\n\n const typed = query.trim();\n const exactMatch = options.some(\n (option) => option.label.toLowerCase() === typed.toLowerCase(),\n );\n const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;\n\n const close = () => {\n setOpen(false);\n setQuery(\"\");\n setNeedsName(false);\n };\n\n const create = async (text: string) => {\n const name = text.trim();\n if (busy) return;\n // `onCreateRequiresMore` opens a dialog that asks for the name itself, so\n // a blank click there is legitimate — it opens the dialog empty. Only the\n // write-it-now path needs a name before it can do anything.\n if (onCreateRequiresMore) {\n close();\n onCreateRequiresMore(name);\n return;\n }\n if (!onCreate) return;\n if (!name) {\n setNeedsName(true);\n inputRef.current?.focus();\n return;\n }\n setBusy(true);\n try {\n const next = await onCreate(name);\n if (next) onSelect(next);\n close();\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={(next) => (next ? setOpen(true) : close())}>\n <PopoverTrigger asChild disabled={disabled}>\n <button\n type=\"button\"\n aria-label={ariaLabel ?? placeholder}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors\",\n \"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"sm\" ? \"h-8 text-xs\" : \"h-9 text-sm\",\n className,\n triggerClassName,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {selected ? (\n (renderSelected ?? selected.render ?? selected.label)\n ) : (\n <span className=\"text-muted-foreground\">\n {loading ? \"Loading…\" : placeholder}\n </span>\n )}\n </span>\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-[--radix-popover-trigger-width] min-w-56 p-0\">\n <Command\n filter={(itemValue, search, keywords) => {\n const haystack = `${itemValue} ${keywords?.join(\" \") ?? \"\"}`.toLowerCase();\n return haystack.includes(search.toLowerCase()) ? 1 : 0;\n }}\n >\n <CommandInput\n ref={inputRef}\n value={query}\n onValueChange={(next) => {\n setQuery(next);\n if (next.trim()) setNeedsName(false);\n }}\n placeholder={searchPlaceholder ?? `Search or add ${article(noun)}…`}\n />\n <CommandList>\n <CommandEmpty>{emptyLabel}</CommandEmpty>\n {groups.map((group) => (\n <CommandGroup\n key={group.heading ?? \"__ungrouped__\"}\n {...(group.heading === undefined\n ? {}\n : { heading: group.heading })}\n >\n {group.options.map((option) => (\n <CommandItem\n key={option.value}\n value={option.label}\n {...(option.keywords\n ? { keywords: [option.keywords] }\n : {})}\n onSelect={() => {\n onSelect(option.value);\n close();\n }}\n className=\"gap-2 text-xs\"\n >\n <LucideCheckIcon\n className={cn(\n \"size-3.5 shrink-0\",\n option.value === value ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n <span className=\"min-w-0 flex-1 truncate\">\n {option.render ?? option.label}\n </span>\n {option.hint ? (\n <span className=\"shrink-0 text-[10px] text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </CommandItem>\n ))}\n </CommandGroup>\n ))}\n </CommandList>\n\n {/* The \"+ Add\" footer sits OUTSIDE CommandList so the search can\n never hide the one thing the person came here to do (P23). */}\n {canCreate ? (\n <div className=\"space-y-1 border-t border-border p-1\">\n {createExtra && typed && !exactMatch ? (\n <div className=\"px-1 pt-0.5\">\n {typeof createExtra === \"function\"\n ? createExtra(typed)\n : createExtra}\n </div>\n ) : null}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => void create(typed)}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50\"\n >\n {busy ? (\n <Loader2Icon className=\"size-3.5 shrink-0 animate-spin\" />\n ) : (\n <PlusIcon className=\"size-3.5 shrink-0\" />\n )}\n <span className=\"min-w-0 truncate\">\n {typed && !exactMatch\n ? `Create “${typed}”`\n : `Add ${article(noun)}…`}\n </span>\n </button>\n {needsName ? (\n <p className=\"px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground\">\n Type the name of the {noun} you want to add — then this\n creates it.\n </p>\n ) : null}\n </div>\n ) : null}\n\n {/* THE DOORS. Everything this control names must be reachable from\n it: the place the vocabulary is governed, and the other answer\n when this vocabulary is the wrong one to be answering with. */}\n {footerActions?.length || manageAction ? (\n <div className=\"space-y-0.5 border-t border-border p-1\">\n {footerActions?.map((action) => {\n const Icon = action.icon;\n return (\n <div key={action.label}>\n <button\n type=\"button\"\n onClick={() => {\n close();\n action.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {Icon ? <Icon className=\"size-3.5 shrink-0\" /> : null}\n <span className=\"min-w-0 truncate\">{action.label}</span>\n </button>\n {action.note ? (\n <p className=\"px-2 pb-1 text-[10px] leading-snug text-muted-foreground\">\n {action.note}\n </p>\n ) : null}\n </div>\n );\n })}\n {manageAction ? (\n <a\n href={manageAction.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={close}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <ExternalLinkIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{manageAction.label}</span>\n </a>\n ) : null}\n </div>\n ) : null}\n\n {/* P11 — shared vocabulary. Say it, then hand them the door. */}\n {lockedNote ? (\n <div className=\"space-y-1 border-t border-border p-2\">\n <p className=\"flex gap-1.5 text-[11px] leading-snug text-muted-foreground\">\n <LockIcon className=\"mt-px size-3 shrink-0\" />\n <span>{lockedNote}</span>\n </p>\n {lockedAction ? (\n <button\n type=\"button\"\n onClick={() => {\n close();\n lockedAction.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-xs font-medium text-primary transition-colors hover:bg-accent\"\n >\n <PlusIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{lockedAction.label}</span>\n </button>\n ) : null}\n </div>\n ) : null}\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n","\"use client\";\n\n/**\n * Popover — ported verbatim from matrx-frontend `components/ui/popover.tsx`.\n *\n * Seam inversion: the host's `useNestedPortalContainer` (dialog/popout aware)\n * becomes the injected `PortalContainerProvider` seam (`portal-container.tsx`);\n * the explicit `container` prop keeps top priority, exactly as before.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-popover 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n */\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Popover = PopoverPrimitive.Root;\n\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, ...props },\n ref,\n ) => {\n const portalContainer = usePortalContainer(container);\n return (\n <PopoverPrimitive.Portal container={portalContainer}>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n // Cap to the viewport space Radix measured and scroll — a popover taller\n // than the screen must never trap the user with unreachable content.\n // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal\n // z, DOM portal order decides, so a dialog opened FROM a popover stacks\n // above it, and a popover opened from a dialog still stacks above the\n // dialog. z-[10001] buried dialogs behind fullscreen popovers.\n \"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n","\"use client\";\n\n/**\n * EditableLabel — inline rename-in-place text.\n *\n * Ported verbatim from matrx-frontend\n * `components/official/item/EditableLabel.tsx` (S16). Commit on Enter/blur,\n * Esc cancels, whitespace-only falls back to `emptyFallback` (or cancels),\n * stays in sync with upstream `value` while not editing. Decoupled from any\n * store — `onCommit(next)` is the only side-effect channel.\n *\n * Three activation modes:\n * - \"click\" → click the display text to edit (header titles)\n * - \"doubleClick\" → double-click to edit (rows where single-click selects)\n * - \"controlled\" → host owns `editing`; this renders ONLY the input while\n * editing (the host renders its own display element)\n *\n * Seam inversions:\n * - Prop types come with the component instead of the host's item-system\n * `types.ts` (identical shapes).\n * - The lucide `Loader2` busy spinner is the package's inlined SVG (C19).\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\n\nexport type EditableLabelCommitMode = \"optimistic\" | \"await\";\nexport type EditableLabelActivation = \"click\" | \"doubleClick\" | \"controlled\";\n\nexport interface EditableLabelProps {\n value: string;\n /**\n * Commit handler. optimistic (default): edit mode exits immediately, the\n * promise is fire-and-forget (owners do optimistic update + revert + toast).\n * await: input disables with a spinner until the promise resolves; a\n * rejection keeps edit mode open to retry.\n */\n onCommit: (next: string) => void | Promise<void>;\n commitMode?: EditableLabelCommitMode;\n /** Return an error message to block the commit (shown under the input). */\n validate?: (next: string) => string | null;\n /** Used when the trimmed draft is empty. Undefined → empty cancels. */\n emptyFallback?: string;\n maxLength?: number; // default 120\n /**\n * \"click\"/\"doubleClick\" — internal edit state (headers). \"controlled\" — host\n * owns `editing`; EditableLabel renders ONLY the input when editing.\n */\n activation?: EditableLabelActivation;\n editing?: boolean; // controlled mode\n /** Edit-state notifications. Controlled mode: the ONLY state channel.\n * Uncontrolled modes: fired as a notification (layout hooks etc.). */\n onEditingChange?: (editing: boolean) => void;\n selectOnEdit?: boolean; // default true\n placeholder?: string;\n /** Accessible name, e.g. \"Session title\". Default \"Name\". */\n ariaLabel?: string;\n truncate?: boolean; // display mode, default true\n className?: string; // both modes\n displayClassName?: string;\n inputClassName?: string;\n}\n\nexport function EditableLabel({\n value,\n onCommit,\n commitMode = \"optimistic\",\n validate,\n emptyFallback,\n maxLength = 120,\n activation = \"click\",\n editing: editingProp,\n onEditingChange,\n selectOnEdit = true,\n placeholder,\n ariaLabel = \"Name\",\n truncate = true,\n className,\n displayClassName,\n inputClassName,\n}: EditableLabelProps) {\n const controlled = activation === \"controlled\";\n const [internalEditing, setInternalEditing] = useState(false);\n const editing = controlled ? !!editingProp : internalEditing;\n\n const [draft, setDraft] = useState(value);\n const [error, setError] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Stay in sync with upstream changes (realtime / auto-label) while idle.\n useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n // Focus + select on entering edit mode.\n useEffect(() => {\n if (editing && inputRef.current) {\n inputRef.current.focus();\n if (selectOnEdit) inputRef.current.select();\n }\n }, [editing, selectOnEdit]);\n\n const setEditing = useCallback(\n (next: boolean) => {\n if (controlled) {\n onEditingChange?.(next);\n } else {\n // Uncontrolled hosts still get notified — lets them adjust layout\n // (e.g. widen the edit box) without taking over the edit state.\n setInternalEditing(next);\n onEditingChange?.(next);\n }\n },\n [controlled, onEditingChange],\n );\n\n const startEdit = useCallback(() => {\n setDraft(value);\n setError(null);\n setEditing(true);\n }, [value, setEditing]);\n\n const cancel = useCallback(() => {\n setDraft(value);\n setError(null);\n setBusy(false);\n setEditing(false);\n }, [value, setEditing]);\n\n const commit = useCallback(() => {\n if (busy) return;\n const trimmed = draft.trim();\n const next = trimmed || emptyFallback;\n\n // Empty + no fallback → cancel rather than commit garbage.\n if (next === undefined) {\n cancel();\n return;\n }\n\n const validationError = validate?.(next) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n\n // No-op commit — skip the side effect entirely.\n if (next === value) {\n setEditing(false);\n setError(null);\n return;\n }\n\n if (commitMode === \"await\") {\n const result = onCommit(next);\n if (result instanceof Promise) {\n setBusy(true);\n result\n .then(() => {\n setBusy(false);\n setEditing(false);\n })\n .catch(() => {\n // Keep edit mode open so the user can retry.\n setBusy(false);\n });\n return;\n }\n setEditing(false);\n return;\n }\n\n // optimistic — exit immediately, fire-and-forget.\n setEditing(false);\n setError(null);\n const result = onCommit(next);\n if (result instanceof Promise) result.catch(() => {});\n }, [\n busy,\n draft,\n emptyFallback,\n validate,\n value,\n commitMode,\n onCommit,\n cancel,\n setEditing,\n ]);\n\n if (editing) {\n return (\n <span className={cn(\"relative flex min-w-0 flex-1 items-center\", className)}>\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n disabled={busy}\n placeholder={placeholder}\n onChange={(e) => {\n setDraft(e.target.value);\n if (error) setError(null);\n }}\n onBlur={commit}\n onClick={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Contain editing keystrokes so host rows / global hotkeys stay quiet.\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.stopPropagation();\n commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n cancel();\n } else if (e.key === \" \") {\n e.stopPropagation();\n }\n }}\n maxLength={maxLength}\n aria-label={ariaLabel}\n aria-invalid={error ? true : undefined}\n // 16px on mobile prevents iOS focus-zoom; sm on desktop.\n className={cn(\n \"w-full min-w-0 rounded-sm bg-transparent px-1 outline-none\",\n \"text-base md:text-sm\",\n \"focus:bg-background focus:ring-1 focus:ring-ring\",\n busy && \"opacity-60\",\n inputClassName,\n )}\n />\n {busy && (\n <Loader2Icon className=\"absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground\" />\n )}\n {error && (\n <span className=\"absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive\">\n {error}\n </span>\n )}\n </span>\n );\n }\n\n // Controlled mode: host owns the display; render nothing while idle.\n if (controlled) return null;\n\n return (\n <button\n type=\"button\"\n onClick={\n activation === \"click\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onDoubleClick={\n activation === \"doubleClick\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n e.stopPropagation();\n startEdit();\n }\n }}\n title={activation === \"doubleClick\" ? \"Double-click to rename\" : \"Click to rename\"}\n aria-label={`Rename ${ariaLabel.toLowerCase()}: ${value}`}\n className={cn(\n \"min-w-0 max-w-full rounded-sm px-1 text-left transition-colors\",\n \"hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n truncate && \"block truncate\",\n className,\n displayClassName,\n )}\n >\n {value || placeholder || \"\"}\n </button>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full border border-border bg-background text-black dark:text-white shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium placeholder:text-neutral-400 dark:placeholder-text-neutral-600\n focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-neutral-400 dark:focus-visible:ring-neutral-600\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-[0px_0px_1px_1px_var(--neutral-700)]\n transition duration-400\n [&:-webkit-autofill]:bg-background [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:white]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--background))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, className, wrapperClassName, ...props }, ref) => {\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && \"pl-10\", className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","\"use client\";\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Label = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * OverflowToolbar — a horizontal row of consistent, compact action buttons\n * that collapses the buttons that don't fit into a single \"more\" (…) menu.\n * Ported verbatim from matrx-frontend\n * `components/official/toolbar/OverflowToolbar.tsx` (S20).\n *\n * ┌───────────────────────────────────────────────┐\n * │ [leading] [Btn] [Btn] [Btn] [ … ] │\n * └───────────────────────────────────────────────┘\n *\n * Design rules (the primitive enforces them so callers can't drift):\n * - Every button is the same height (h-7), padding, text size, icon size.\n * - `hideLabel` renders an icon-only button with a tooltip — use it for\n * \"obvious\" actions (Find, Source, …).\n * - `tone: \"primary\"` colors a button without changing its size, so the\n * primary action is NOT visually larger than the rest.\n * - When the row is too narrow, the LAST actions collapse into the overflow\n * menu first. Order your actions most-important-first.\n *\n * Measurement is done with a hidden \"ghost\" row (always renders every action\n * + the kebab) read via a ResizeObserver, so the visible row never reflows\n * mid-frame.\n *\n * Seam inversions (host-shaped chrome becomes injected):\n * - `icon: LucideIcon` → the structural `ToolbarIcon`\n * (`ComponentType<{ className?: string }>`) — any SVG component fits.\n * - The host Tooltip wrapper → `renderTooltip` prop. Without it, icon-only\n * buttons render bare (they always carry `aria-label`); hosts inject their\n * tooltip system for the original hover behavior.\n * - The host ItemMenu overflow menu → `renderOverflowMenu` prop (required):\n * the host receives the collapsed actions plus the ready-made kebab trigger\n * and renders them with its own menu system.\n */\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon, MoreHorizontalIcon } from \"./icons\";\n\nexport type ToolbarActionTone = \"default\" | \"primary\" | \"destructive\";\n\n/** Structural icon contract (a lucide icon satisfies it, so does any SVG component). */\nexport type ToolbarIcon = React.ComponentType<{ className?: string }>;\n\nexport interface ToolbarAction {\n id: string;\n label: string;\n icon: ToolbarIcon;\n /** Click handler. Ignored when `href` is set. */\n onSelect?: () => void;\n /** Renders an anchor instead of a button. */\n href?: string;\n target?: \"_blank\";\n disabled?: boolean;\n /** Swaps the icon for a spinner and (optionally) shows `runningLabel`. */\n running?: boolean;\n runningLabel?: string;\n tone?: ToolbarActionTone;\n /** Icon-only button (tooltip carries the label). For obvious actions. */\n hideLabel?: boolean;\n /** Drop the action entirely. */\n hidden?: boolean;\n}\n\nexport interface OverflowToolbarProps {\n actions: ToolbarAction[];\n /**\n * Optional element pinned at the start of the row — never collapsed, never\n * measured into the action budget except as a fixed prefix (e.g. a surface\n * switcher / context chip cluster).\n */\n leading?: React.ReactNode;\n /** Accessible label for the overflow trigger. */\n overflowAriaLabel?: string;\n className?: string;\n /**\n * Injected overflow-menu seam: render the collapsed actions with the host's\n * menu system, using `trigger` (the ready-made kebab button) as the menu\n * trigger element.\n */\n renderOverflowMenu: (args: {\n actions: ToolbarAction[];\n trigger: React.ReactNode;\n }) => React.ReactNode;\n /**\n * Injected tooltip seam for icon-only buttons (their label lives nowhere\n * else on screen). Omitted → the bare control renders (aria-label intact).\n */\n renderTooltip?: (control: React.ReactElement, label: string) => React.ReactNode;\n}\n\nconst GAP_PX = 6; // gap-1.5\n\n// ── Button ──────────────────────────────────────────────────────────────────\n\nconst TONE: Record<ToolbarActionTone, string> = {\n default: \"border border-border bg-background hover:bg-accent text-foreground\",\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"border border-destructive/40 text-destructive hover:bg-destructive/10\",\n};\n\nfunction ToolbarButton({\n action,\n enableTooltip = false,\n renderTooltip,\n}: {\n action: ToolbarAction;\n /** Wrap icon-only buttons in a styled tooltip. Off for the ghost row. */\n enableTooltip?: boolean;\n renderTooltip?:\n | ((control: React.ReactElement, label: string) => React.ReactNode)\n | undefined;\n}) {\n const tone = action.tone ?? \"default\";\n const Icon = action.running ? Loader2Icon : action.icon;\n const showLabel =\n !action.hideLabel || (action.running && action.runningLabel);\n const text =\n action.running && action.runningLabel ? action.runningLabel : action.label;\n\n const className = cn(\n \"inline-flex items-center gap-1 h-7 rounded-md text-[11px] font-medium transition-colors whitespace-nowrap\",\n \"disabled:opacity-50 disabled:pointer-events-none\",\n action.hideLabel && !action.running ? \"w-7 justify-center px-0\" : \"px-2\",\n TONE[tone],\n );\n\n const inner = (\n <>\n <Icon\n className={cn(\"w-3.5 h-3.5 shrink-0\", action.running && \"animate-spin\")}\n />\n {showLabel && <span>{text}</span>}\n </>\n );\n\n const control =\n action.href && !action.disabled ? (\n <a\n href={action.href}\n target={action.target}\n rel={action.target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={action.onSelect}\n disabled={action.disabled}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </button>\n );\n\n // Icon-only buttons need a styled tooltip to be discoverable — the label\n // lives nowhere else on screen. Labeled buttons are self-describing.\n if (enableTooltip && action.hideLabel && renderTooltip) {\n return <>{renderTooltip(control, action.label)}</>;\n }\n\n return control;\n}\n\nfunction OverflowTrigger({ ariaLabel }: { ariaLabel: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-haspopup=\"menu\"\n title=\"More actions\"\n className={cn(\n \"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors\",\n \"border border-border bg-background hover:bg-accent text-foreground\",\n )}\n >\n <MoreHorizontalIcon className=\"w-3.5 h-3.5\" />\n </button>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────\n\nexport function OverflowToolbar({\n actions,\n leading,\n overflowAriaLabel = \"More actions\",\n className,\n renderOverflowMenu,\n renderTooltip,\n}: OverflowToolbarProps) {\n const visibleActions = useMemo(\n () => actions.filter((a) => !a.hidden),\n [actions],\n );\n\n const containerRef = useRef<HTMLDivElement>(null);\n const ghostRef = useRef<HTMLDivElement>(null);\n // The leading slot renders ONCE (in the visible row) — it may host a\n // stateful/data-fetching component, so we never duplicate it into the ghost.\n // Its width is read directly off this ref instead.\n const leadingRef = useRef<HTMLSpanElement>(null);\n const [visibleCount, setVisibleCount] = useState(visibleActions.length);\n\n // Re-measure whenever the rendered text/state of any action changes (label,\n // icon-only mode, or running label all change a button's width).\n const signature = visibleActions\n .map(\n (a) =>\n `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? \"\"}:${a.label}`,\n )\n .join(\"|\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const ghost = ghostRef.current;\n if (!container || !ghost) return undefined;\n\n const compute = () => {\n const available = container.clientWidth;\n const n = visibleActions.length;\n const children = Array.from(ghost.children) as HTMLElement[];\n const hasLeading = leading != null;\n const leadingW = hasLeading ? (leadingRef.current?.offsetWidth ?? 0) : 0;\n const itemW = (i: number) => children[i]?.offsetWidth ?? 0;\n const kebabW = children[n]?.offsetWidth ?? 28;\n\n // Width consumed by the always-present leading slot.\n const base = leadingW + (hasLeading && n > 0 ? GAP_PX : 0);\n\n // Does everything fit with no kebab?\n let totalAll = base;\n for (let i = 0; i < n; i++) totalAll += itemW(i) + (i > 0 ? GAP_PX : 0);\n if (totalAll <= available) {\n setVisibleCount(n);\n return;\n }\n\n // Otherwise fit as many as possible while reserving room for the kebab.\n let used = base;\n let count = 0;\n for (let i = 0; i < n; i++) {\n const add = itemW(i) + (count > 0 ? GAP_PX : 0);\n if (used + add + GAP_PX + kebabW <= available) {\n used += add;\n count += 1;\n } else break;\n }\n setVisibleCount(count);\n };\n\n compute();\n const ro = new ResizeObserver(compute);\n ro.observe(container);\n return () => ro.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature, leading != null]);\n\n const shown = visibleActions.slice(0, visibleCount);\n const hidden = visibleActions.slice(visibleCount);\n\n return (\n <div ref={containerRef} className={cn(\"relative min-w-0\", className)}>\n {/* Ghost measuring row — every action button + kebab, never visible.\n The leading slot is intentionally NOT duplicated here (it may be a\n stateful/fetching component); its width is read off `leadingRef`. */}\n <div\n ref={ghostRef}\n aria-hidden\n className=\"pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0\"\n >\n {visibleActions.map((a) => (\n <ToolbarButton key={a.id} action={a} />\n ))}\n <OverflowTrigger ariaLabel={overflowAriaLabel} />\n </div>\n\n {/* Visible row — right-aligned cluster that collapses overflow. */}\n <div className=\"flex items-center justify-end gap-1.5\">\n {leading != null && (\n <span ref={leadingRef} className=\"shrink-0\">\n {leading}\n </span>\n )}\n {shown.map((a) => (\n <ToolbarButton\n key={a.id}\n action={a}\n enableTooltip\n renderTooltip={renderTooltip}\n />\n ))}\n {hidden.length > 0 &&\n renderOverflowMenu({\n actions: hidden,\n trigger: <OverflowTrigger ariaLabel={overflowAriaLabel} />,\n })}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * ScoreRing — SVG progress ring + the shared score→color threshold semantics.\n * Ported verbatim from matrx-frontend `components/official/ScoreRing.tsx`\n * (S18). The thresholds ARE the product: green at/above `good`, orange\n * at/above `warning`, red below, muted for null. No seams.\n */\n\nimport { cn } from \"./cn\";\n\nexport interface ScoreThresholds {\n /** Scores at or above this value are green. */\n good: number;\n /** Scores at or above this value (but below good) are orange. */\n warning: number;\n}\n\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = {\n good: 75,\n warning: 50,\n};\n\n/** Semantic score color shared by ring and accent consumers. */\nexport function scoreRingColorClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"text-muted-foreground\";\n if (pct >= thresholds.good) return \"text-green-500\";\n if (pct >= thresholds.warning) return \"text-orange-500\";\n return \"text-red-500\";\n}\n\n/** Solid-background twin of `scoreRingColorClasses`. */\nexport function scoreAccentBgClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"bg-muted-foreground/30\";\n if (pct >= thresholds.good) return \"bg-green-500\";\n if (pct >= thresholds.warning) return \"bg-orange-500\";\n return \"bg-red-500\";\n}\n\nexport interface ScoreRingProps {\n pct: number | null;\n size?: number;\n strokeWidth?: number;\n label?: string;\n valueClassName?: string;\n className?: string;\n thresholds?: ScoreThresholds;\n /** Visible suffix; study keeps `%`, while Lighthouse convention omits it. */\n suffix?: string;\n}\n\n/**\n * Shared SVG score ring. `pct` is 0–100; threshold semantics are supplied by\n * the domain (for example Lighthouse uses 90/50 while study uses 75/50).\n */\nexport function ScoreRing({\n pct,\n size = 112,\n strokeWidth = 8,\n label,\n valueClassName,\n className,\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n suffix = \"%\",\n}: ScoreRingProps) {\n const radius = 50 - strokeWidth / 2;\n const circumference = 2 * Math.PI * radius;\n const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));\n const dashOffset = circumference * (1 - boundedPct / 100);\n\n return (\n <div\n className={cn(\n \"relative flex shrink-0 items-center justify-center\",\n className,\n )}\n style={{ width: size, height: size }}\n role=\"img\"\n aria-label={`${label ?? \"Score\"}: ${pct === null ? \"not available\" : `${pct} out of 100`}`}\n >\n <svg viewBox=\"0 0 100 100\" className=\"h-full w-full -rotate-90\">\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className=\"stroke-muted\"\n strokeWidth={strokeWidth}\n fill=\"none\"\n />\n {pct !== null ? (\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className={cn(\n \"transition-[stroke-dashoffset] duration-700 ease-out\",\n scoreRingColorClasses(pct, thresholds),\n )}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={dashOffset}\n />\n ) : null}\n </svg>\n <div className=\"absolute flex flex-col items-center justify-center\">\n <span\n className={cn(\n \"font-bold tabular-nums text-foreground\",\n valueClassName ?? \"text-2xl\",\n )}\n >\n {pct === null ? \"—\" : `${pct}${suffix}`}\n </span>\n {label ? (\n <span className=\"max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </span>\n ) : null}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * SegmentedControl — sized accessible segmented toggle.\n * Ported verbatim from matrx-frontend `components/ui/segmented-control.tsx`\n * (S17). No seams: pure markup over host semantic tokens. The option/prop\n * interfaces are exported here (the original kept them file-local).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface SegmentOption {\n value: string;\n label: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n value: string;\n onValueChange: (value: string) => void;\n data: SegmentOption[];\n name?: string;\n className?: string;\n fullWidth?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport function SegmentedControl({\n value,\n onValueChange,\n data,\n name: _name,\n className,\n fullWidth = false,\n size = \"md\",\n}: SegmentedControlProps) {\n // Handle size classes\n const sizeClasses = {\n sm: \"h-7 text-xs\",\n md: \"h-9 text-sm\",\n lg: \"h-10 text-base\",\n };\n\n return (\n <div\n className={cn(\n \"inline-flex p-0.5 bg-muted rounded-md\",\n fullWidth && \"w-full\",\n className\n )}\n role=\"tablist\"\n >\n {data.map((option) => {\n const isActive = value === option.value;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n disabled={option.disabled}\n onClick={() => onValueChange(option.value)}\n className={cn(\n \"relative flex items-center justify-center rounded-[0.2rem] px-3 py-1.5 transition-all\",\n sizeClasses[size],\n fullWidth && \"flex-1\",\n isActive\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground hover:bg-background/50\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Select — ported verbatim from matrx-frontend `components/ui/select.tsx`.\n *\n * Seam inversions:\n * - The host's `useNestedPortalContainer` (dialog/popout aware) becomes the\n * injected `PortalContainerProvider` seam (`portal-container.tsx`); the\n * explicit `container` prop keeps top priority, exactly as before.\n * - `ChevronDownIcon` / `ChevronUpIcon` / `CheckIcon` come from the package's\n * inlined SVGs (C19), not @radix-ui/react-icons — same glyphs, same\n * viewBoxes. (The origin also imported `CaretSortIcon` without ever using\n * it; the dead import is not carried along.)\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-select 2.3.1 / react-id 1.1.2). The gate was actively\n * harmful — it deleted the ALWAYS-VISIBLE select trigger (a form control)\n * from SSR and the first client paint.\n */\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n RadixChevronDownIcon,\n RadixChevronUpIcon,\n} from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Select = SelectPrimitive.Root;\n\nexport const SelectGroup = SelectPrimitive.Group;\n\nexport const SelectValue = SelectPrimitive.Value;\n\nexport const selectTriggerVariants = cva(\n \"flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 py-1 text-xs\",\n default: \"h-9 px-3 py-1\",\n lg: \"h-10 px-3 py-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nexport interface SelectTriggerProps\n extends\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n VariantProps<typeof selectTriggerVariants> {\n hideArrow?: boolean;\n}\n\nexport const SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(({ className, children, hideArrow = false, size, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(selectTriggerVariants({ size, className }))}\n {...props}\n >\n {children}\n {!hideArrow && (\n <SelectPrimitive.Icon asChild>\n <RadixChevronDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nexport const SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nexport const SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, position = \"popper\", container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <SelectPrimitive.Portal container={portalContainer}>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-0.5 overflow-y-auto\",\n position === \"popper\" &&\n \"w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {\n /**\n * Secondary line shown under the label IN THE LIST ONLY. Rendered outside\n * Radix `ItemText` on purpose: everything inside `ItemText` is what the\n * closed trigger displays, so a description passed as `children` gets\n * squeezed into the fixed-height trigger and clipped. This prop keeps the\n * trigger to the one-line label while the open list shows both lines.\n */\n description?: React.ReactNode;\n }\n>(({ className, children, description, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n description ? \"flex-col items-start gap-0.5 py-1.5\" : \"items-center\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n {description ? (\n <span className=\"block text-xs leading-snug text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n","\"use client\";\n\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Separator = React.forwardRef<\n React.ComponentRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * Sheet — ported verbatim from matrx-frontend `components/ui/sheet.tsx`.\n *\n * Seam inversions:\n * - The host's `DialogContentPrimitive` (from its dialog module) is inlined\n * here as a private wrapper with identical behavior: unstyled non-portalling\n * Radix Content that derives `aria-modal` from the owning Root's modality.\n * - `Cross2Icon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `treeContainsComponent` stays the ONE kit implementation\n * (@ai-matrx/kit/react-tree) — never a vendored twin.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-dialog 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n * The RadixDialogModalProvider wrapper stays — it is unrelated to hydration.\n */\n\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Cross2Icon } from \"./icons\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\n/**\n * Unstyled, non-portalling Content for Sheet layouts. It preserves Radix\n * focus/background behavior and derives `aria-modal` from the owning Root\n * (identical to the host dialog module's DialogContentPrimitive).\n */\nconst SheetContentBase = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>\n>(({ ...props }, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nSheetContentBase.displayName = \"SheetContentBase\";\n\nexport const Sheet = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Root>\n>(({ children, ...props }, _ref) => {\n const modal = props.modal ?? true;\n\n return (\n <RadixDialogModalProvider modal={modal}>\n <SheetPrimitive.Root {...props} modal={modal}>\n {children}\n </SheetPrimitive.Root>\n </RadixDialogModalProvider>\n );\n});\nSheet.displayName = \"Sheet\";\n\nexport const SheetTrigger = SheetPrimitive.Trigger;\n\nexport const SheetClose = SheetPrimitive.Close;\n\nexport const SheetPortal = SheetPrimitive.Portal;\n\nexport const SheetOverlay = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n center:\n \"inset-0 m-auto max-h-full max-w-full border rounded-lg data-[state=closed]:fade-out data-[state=open]:fade-in\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\nexport interface SheetContentProps\n extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n hideCloseButton?: boolean;\n /** Skip the dimming overlay — for non-modal side panels (e.g. chat canvas). */\n hideOverlay?: boolean;\n /** Optional className for the overlay when shown. */\n overlayClassName?: string;\n}\n\nexport const SheetDescription = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport const SheetContent = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(\n (\n {\n side = \"right\",\n className,\n children,\n hideCloseButton = false,\n hideOverlay = false,\n overlayClassName,\n ...props\n },\n ref,\n ) => {\n const hasDescription =\n treeContainsComponent(children, SheetDescription) ||\n treeContainsComponent(children, SheetPrimitive.Description);\n return (\n <SheetPortal>\n {!hideOverlay && <SheetOverlay className={overlayClassName} />}\n <SheetContentBase\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {!hideCloseButton && (\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <Cross2Icon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetContentBase>\n </SheetPortal>\n );\n },\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nexport const SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nexport const SheetTitle = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-foreground\", className)}\n {...props}\n />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n","/**\n * Skeleton — ported verbatim from matrx-frontend `components/ui/skeleton.tsx`.\n * No seams: pure markup over host semantic tokens.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-primary/10\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\n/**\n * TabbedBottomSheet — iOS Settings–style two-level navigation for tabbed menus.\n * Ported verbatim from matrx-frontend\n * `components/official/bottom-sheet/TabbedBottomSheet.tsx` (S19).\n *\n * Level 1: a scrollable list of tabs (icon + label + chevron).\n * Level 2: drill into one tab's content with a back button in the header.\n *\n * Two invariants make this ONE surface instead of a different panel per tab:\n *\n * 1. **Fixed height** (`size=\"full\"`) — the sheet is the same near-full\n * height on the index and inside every tab, and it never resizes as\n * content loads, filters, or expands. An adaptive height here meant the\n * panel grew and shrank under the user's thumb on every keystroke.\n * 2. **One typography scale** (`matrx-mobile-sheet`, host globals.css) —\n * the tab bodies are the same components the desktop window renders at\n * desktop density (11–12px). That is unreadable and untappable on a\n * phone, so the sheet promotes small text to mobile sizes and every\n * field to the 16px that stops iOS focus-zoom. Panels stay density-free;\n * the host decides the density.\n *\n * Seam inversions: `ChevronRight` is the package's inlined SVG (C19); the\n * `matrx-mobile-sheet` and `pb-safe` utility classes are host-owned CSS.\n */\n\nimport { useState, type ComponentType, type ReactNode } from \"react\";\n\nimport { BottomSheet, BottomSheetBody, BottomSheetHeader } from \"./bottom-sheet\";\nimport { ChevronRightIcon } from \"./icons\";\n\nexport interface TabbedBottomSheetTab {\n id: string;\n label: string;\n icon?: ComponentType<{ className?: string }>;\n /** Optional trailing badge / dot shown on the index row. */\n trailing?: ReactNode;\n content: ReactNode;\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(null);\n\n // Every open starts on the index. Adjusted during render (the React-docs\n // pattern for state derived from a prop change) rather than in an effect,\n // which would render the previous tab's body for one frame first.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) setSelectedTabId(null);\n }\n\n const selectedTab = selectedTabId\n ? tabs.find((tab) => tab.id === selectedTabId)\n : null;\n\n return (\n <BottomSheet\n open={open}\n onOpenChange={onOpenChange}\n title={title}\n size=\"full\"\n >\n <div className=\"matrx-mobile-sheet flex min-h-0 flex-1 flex-col\">\n <BottomSheetHeader\n title={selectedTab ? selectedTab.label : title}\n showBack={!!selectedTab}\n onBack={() => setSelectedTabId(null)}\n />\n {selectedTab ? (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden pb-safe\">\n {selectedTab.content}\n </div>\n ) : (\n <BottomSheetBody>\n <ul className=\"divide-y divide-border\">\n {tabs.map((tab) => {\n const Icon = tab.icon;\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n onClick={() => setSelectedTabId(tab.id)}\n className=\"flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted\"\n >\n {Icon ? (\n <Icon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n ) : null}\n <span className=\"min-w-0 flex-1 text-base text-foreground\">\n {tab.label}\n </span>\n {tab.trailing}\n <ChevronRightIcon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetBody>\n )}\n </div>\n </BottomSheet>\n );\n}\n","\"use client\";\n\n// useScrollFade — ported verbatim from matrx-frontend\n// `components/official/scroll-fade/useScrollFade.ts` (S21).\n//\n// \"There is more below\" — told to the eye, not to nobody.\n//\n// A scroll container that simply hard-clips its last row reads as FINISHED.\n// The user never scrolls, because nothing suggested there was anything to\n// scroll to. A soft fade at the overflowing edge is the standard cue, and it\n// must appear ONLY on the edges that actually overflow — a permanent fade on a\n// non-scrolling list just makes the last item look broken.\n//\n// Attach `ref` to the scrolling element and spread `fadeProps`. Styling is\n// host-owned CSS (the `.matrx-scroll-fade` class in the host's globals.css),\n// keyed off the data attributes.\n//\n// The ref is a CALLBACK ref, not a useRef object, on purpose: these containers\n// are usually mounted conditionally (a popover body, a lazily-resolved menu),\n// so an effect that reads `ref.current` on mount finds null and — with no\n// dependency that ever changes — never runs again. The fade then silently\n// never appears, which is exactly the failure this hook exists to prevent.\n//\n// TWO RULES THE CALLBACK MUST OBEY (both learned the hard way — breaking\n// either one produced \"Maximum update depth exceeded\" on a page of 13 menus):\n// 1. NEVER setState synchronously inside the callback. Radix composes our\n// ref with its own via useComposedRefs, whose identity changes every render,\n// so the ref detaches+reattaches on every commit. A synchronous setState\n// there re-renders, which re-attaches, which sets state again — forever.\n// Measurement is always deferred to rAF.\n// 2. NEVER setState on detach (node === null). A detach/attach pair would\n// otherwise flip the fade off and on and drive the same loop.\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface ScrollFadeState {\n top: boolean;\n bottom: boolean;\n}\n\nexport interface UseScrollFadeResult {\n ref: (node: HTMLElement | null) => void;\n fadeProps: {\n \"data-fade-top\": \"\" | undefined;\n \"data-fade-bottom\": \"\" | undefined;\n className: string;\n };\n state: ScrollFadeState;\n}\n\n/** Slack below which we treat the edge as reached (sub-pixel scroll math). */\nconst EPSILON = 2;\n\nexport function useScrollFade(): UseScrollFadeResult {\n const [state, setState] = useState<ScrollFadeState>({\n top: false,\n bottom: false,\n });\n const nodeRef = useRef<HTMLElement | null>(null);\n const cleanupRef = useRef<(() => void) | null>(null);\n\n const measure = useCallback(() => {\n const el = nodeRef.current;\n if (!el) return;\n const overflowing = el.scrollHeight - el.clientHeight > EPSILON;\n const next: ScrollFadeState = {\n top: overflowing && el.scrollTop > EPSILON,\n bottom:\n overflowing &&\n el.scrollTop + el.clientHeight < el.scrollHeight - EPSILON,\n };\n setState((prev) =>\n prev.top === next.top && prev.bottom === next.bottom ? prev : next,\n );\n }, []);\n\n const ref = useCallback(\n (node: HTMLElement | null) => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n nodeRef.current = node;\n // Rule 2: no state change on detach.\n if (!node) return;\n\n node.addEventListener(\"scroll\", measure, { passive: true });\n // Content can arrive after mount (lazy menu configs, async lists) and the\n // box can be resized by the viewport, so watch both.\n const ro = new ResizeObserver(measure);\n ro.observe(node);\n const mo = new MutationObserver(measure);\n mo.observe(node, { childList: true, subtree: true });\n\n cleanupRef.current = () => {\n node.removeEventListener(\"scroll\", measure);\n ro.disconnect();\n mo.disconnect();\n };\n\n // Rule 1: deferred, never synchronous. Radix also animates the panel in,\n // so its final height is not known on the frame it mounts anyway.\n requestAnimationFrame(measure);\n },\n [measure],\n );\n\n useEffect(() => () => cleanupRef.current?.(), []);\n\n return {\n ref,\n state,\n fadeProps: {\n \"data-fade-top\": state.top ? \"\" : undefined,\n \"data-fade-bottom\": state.bottom ? \"\" : undefined,\n className: \"matrx-scroll-fade\",\n },\n };\n}\n"],"mappings":";;;AAAA,SAAS,WAA8B;;;ACAvC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AD2BS;AA3BF,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aAAa;AAAA,QACb,SAAS;AAAA,QACT,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAMO,SAAS,MAAM,EAAE,WAAW,SAAS,GAAG,MAAM,GAAe;AAClE,SAAO,oBAAC,UAAK,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAI,GAAG,OAAO;AAChF;;;AERA,SA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AAI,CAAC,KAAM;AAEX,WAAK,iBAAiB,UAAU,SAAS,EAAE,SAAS,KAAK,CAAC;AAG1D,YAAM,KAAK,IAAI,eAAe,OAAO;AACrC,SAAG,QAAQ,IAAI;AACf,YAAM,KAAK,IAAI,iBAAiB,OAAO;AACvC,SAAG,QAAQ,MAAM,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAEnD,iBAAW,UAAU,MAAM;AACzB,aAAK,oBAAoB,UAAU,OAAO;AAC1C,WAAG,WAAW;AACd,WAAG,WAAW;AAAA,MAChB;AAIA,4BAAsB,OAAO;AAAA,IAC/B;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,EAAAC,WAAU,MAAM,MAAM,WAAW,UAAU,GAAG,CAAC,CAAC;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB,MAAM,MAAM,KAAK;AAAA,MAClC,oBAAoB,MAAM,SAAS,KAAK;AAAA,MACxC,WAAW;AAAA,IACb;AAAA,EACF;AACF;","names":["React","jsx","jsx","jsx","jsxs","cva","React","jsx","cva","React","React","jsx","jsx","jsxs","useState","React","jsx","jsx","jsxs","useState","Icon","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","result","React","jsx","jsxs","React","jsx","useRef","useState","jsx","jsxs","Icon","useRef","useState","jsx","jsxs","jsx","cva","React","jsx","jsxs","cva","React","jsx","Separator","cva","React","jsx","jsxs","cva","jsx","useState","jsx","jsxs","useState","Icon","useCallback","useEffect","useRef","useState"]}
1
+ {"version":3,"sources":["../src/badge.tsx","../src/cn.ts","../src/bottom-sheet.tsx","../src/icons.tsx","../src/radix-dialog-modal-context.tsx","../src/button.tsx","../src/command.tsx","../src/portal-container.tsx","../src/creatable-picker.tsx","../src/popover.tsx","../src/editable-label.tsx","../src/input.tsx","../src/label.tsx","../src/overflow-toolbar.tsx","../src/score-ring.tsx","../src/segmented-control.tsx","../src/select.tsx","../src/separator.tsx","../src/sheet.tsx","../src/skeleton.tsx","../src/tabbed-bottom-sheet.tsx","../src/use-scroll-fade.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const badgeVariants = cva(\n \"inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary/15 text-primary\",\n secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n destructive: \"border-transparent bg-destructive/15 text-destructive\",\n outline: \"border-border text-foreground\",\n success: \"border-transparent bg-success/15 text-success\",\n warning: \"border-transparent bg-warning/15 text-warning\",\n info: \"border-info/30 bg-info/15 text-info\",\n error: \"border-transparent bg-destructive/15 text-destructive\",\n neutral: \"border-border bg-muted text-muted-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {}\n\nexport function Badge({ className, variant, ...props }: BadgeProps) {\n return <span className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\n/**\n * BottomSheet — the canonical mobile sheet. Ported verbatim from\n * matrx-frontend `components/official/bottom-sheet/BottomSheet.tsx` (S19).\n *\n * `vaul` is a sanctioned real dependency here, the same way\n * @radix-ui/react-alert-dialog is for @ai-matrx/kit `/confirm`: the drag-to-\n * dismiss drawer physics IS the component — there is no BottomSheet without\n * it, and reimplementing gesture/velocity handling would be a vendored twin\n * of a maintained library rather than of our own code. Rationale recorded in\n * FEATURE.md.\n *\n * Seam inversions:\n * - The host's `components/ui/drawer.tsx` wrappers are inlined as private\n * equivalents with identical behavior (thin over vaul + the shared\n * RadixDialogModalProvider); the host keeps its own drawer module for its\n * other drawer surfaces.\n * - `ChevronLeft` is the package's inlined SVG (C19).\n *\n * Host-owned CSS contracts (documented, not shipped): the glass tokens\n * `--matrx-glass-bg` / `--matrx-glass-border-color`, the utility classes\n * `matrx-glass-thin-border` and `pb-safe`, and semantic color tokens.\n */\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\ntype DrawerRootProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /** Vaul does not forward false to its underlying Radix root. */\n modal?: true;\n};\n\nconst DrawerRoot = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerRootProps) => (\n <RadixDialogModalProvider modal>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n >\n {children}\n </DrawerPrimitive.Root>\n </RadixDialogModalProvider>\n);\nDrawerRoot.displayName = \"DrawerRoot\";\n\n/**\n * Unstyled, non-portalling Content for custom Drawer layouts. It derives\n * explicit modal semantics while Vaul retains focus/background behavior.\n */\nconst DrawerContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(({ ...props }, ref) => (\n <DrawerPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nDrawerContentPrimitive.displayName = \"DrawerContentPrimitive\";\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title?: string;\n /**\n * `adaptive` (default) — the sheet sizes to its content between 60dvh and\n * 90dvh. Correct for a single short list.\n *\n * `full` — ONE fixed height (92dvh) that never changes as content changes.\n * Use it for any sheet whose body varies (multi-level navigation, tabs,\n * search results): an adaptive sheet there resizes under the user's thumb\n * on every keystroke and every drill-in, which reads as the panel jumping.\n */\n size?: \"adaptive\" | \"full\";\n /** Visual treatment for the panel. Solid is intended for dense, long-lived surfaces. */\n surface?: \"glass\" | \"solid\";\n /** Merged onto the sheet panel. */\n contentClassName?: string;\n children: React.ReactNode;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n title = \"Bottom Sheet\",\n size = \"adaptive\",\n surface = \"glass\",\n contentClassName,\n children,\n}: BottomSheetProps) {\n return (\n <DrawerRoot open={open} onOpenChange={onOpenChange}>\n <DrawerPrimitive.Portal>\n {/* Identical output to the host's DrawerOverlay wrapper: its base\n classes merged with the caller classes, inline background wins. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)]\", \"fixed inset-0 z-50\")}\n style={{ background: \"var(--matrx-overlay-scrim-drawer)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n size === \"full\" ? \"h-[92dvh]\" : \"min-h-[60dvh] max-h-[90dvh]\",\n surface === \"solid\" &&\n \"border border-b-0 border-border bg-background shadow-2xl\",\n contentClassName,\n )}\n style={\n surface === \"glass\"\n ? {\n background: \"var(--matrx-glass-bg)\",\n backdropFilter: \"blur(20px) saturate(180%)\",\n WebkitBackdropFilter: \"blur(20px) saturate(180%)\",\n border: \"1px solid var(--matrx-glass-border-color)\",\n borderBottom: \"none\",\n }\n : undefined\n }\n >\n <VisuallyHidden>\n <DrawerPrimitive.Title>{title}</DrawerPrimitive.Title>\n <DrawerPrimitive.Description>\n Bottom sheet panel.\n </DrawerPrimitive.Description>\n </VisuallyHidden>\n <div className=\"mx-auto mt-3 mb-1 h-1.5 w-10 rounded-full bg-muted-foreground/30 flex-shrink-0\" />\n {children}\n </DrawerContentPrimitive>\n </DrawerPrimitive.Portal>\n </DrawerRoot>\n );\n}\n\nexport interface BottomSheetHeaderProps {\n title: string;\n showBack?: boolean;\n onBack?: () => void;\n trailing?: React.ReactNode;\n}\n\nexport function BottomSheetHeader({\n title,\n showBack = false,\n onBack,\n trailing,\n}: BottomSheetHeaderProps) {\n return (\n <div className=\"flex items-center px-2 pt-1 pb-2 flex-shrink-0 min-h-[44px]\">\n <div className=\"min-w-[44px] flex items-center justify-start\">\n <button\n onClick={onBack}\n className={cn(\n \"h-8 w-8 rounded-full matrx-glass-thin-border flex items-center justify-center transition-all active:scale-95\",\n showBack ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n aria-hidden={!showBack}\n tabIndex={showBack ? 0 : -1}\n >\n <ChevronLeftIcon className=\"h-4 w-4 text-foreground\" />\n </button>\n </div>\n <span className=\"text-[17px] font-semibold flex-1 text-center truncate\">\n {title}\n </span>\n <div className=\"min-w-[44px] flex items-center justify-end\">\n {trailing}\n </div>\n </div>\n );\n}\n\nexport interface BottomSheetBodyProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetBody({ children, className }: BottomSheetBodyProps) {\n return (\n <div\n className={cn(\n // min-h-0 is load-bearing: without it a flex child's min-height:auto\n // floors it at content height and the body grows instead of scrolling.\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-safe\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface BottomSheetFooterProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetFooter({\n children,\n className,\n}: BottomSheetFooterProps) {\n return (\n <div\n className={cn(\n \"flex-shrink-0 px-4 py-3 pb-safe border-t border-[var(--matrx-sheet-divider)]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\ntype IconProps = React.SVGAttributes<SVGSVGElement>;\n\nfunction lucideProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** lucide `loader-2` — the spinner glyph. Callers add `animate-spin`. */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function LucideCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * Ported verbatim from matrx-frontend `components/ui/radix-dialog-modal-context.tsx`.\n * Shared by the Sheet and BottomSheet families (and available to hosts that\n * compose their own Radix Dialog-derived wrappers around these primitives).\n */\n\nimport * as React from \"react\";\n\nconst RadixDialogModalContext = React.createContext(true);\n\nexport interface RadixDialogModalProviderProps {\n children: React.ReactNode;\n modal: boolean;\n}\n\n/**\n * Keeps our Radix-based content wrappers aligned with the owning Root's\n * modality so ARIA semantics cannot drift from focus/pointer behavior.\n */\nexport function RadixDialogModalProvider({\n children,\n modal,\n}: RadixDialogModalProviderProps) {\n return (\n <RadixDialogModalContext.Provider value={modal}>\n {children}\n </RadixDialogModalContext.Provider>\n );\n}\n\n/** Returns whether the nearest Radix Dialog-derived root is modal. */\nexport function useRadixDialogModal(): boolean {\n return React.useContext(RadixDialogModalContext);\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const buttonVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n subtle:\n \"border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-6\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : \"button\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\n/**\n * Command — ported verbatim from matrx-frontend `components/ui/command.tsx`.\n *\n * `cmdk` is a SANCTIONED REAL DEPENDENCY (the vaul ↔ BottomSheet precedent):\n * the filtering/scoring/keyboard engine IS the component's product — there is\n * no Command palette without it, and reimplementing type-ahead ranking plus\n * roving keyboard selection would twin a maintained library rather than our\n * own code. See FEATURE.md.\n *\n * Seam inversions:\n * - `MagnifyingGlassIcon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `CommandDialog` composed the host dialog module (`Dialog`, `DialogContent`,\n * `DialogTitle`). Those pieces are inlined privately below with identical\n * behavior — modal context, overlay, desktop card / mobile bottom-sheet\n * geometry, close control, portal — except the host's popout-aware\n * `DialogPortal` becomes the package's `PortalContainerProvider` seam\n * (plus an explicit `container` prop, which keeps top priority).\n * - The host's `useIsMobile` (a plain matchMedia breakpoint hook, not\n * host-shaped) is inlined privately with the same 768px breakpoint.\n */\n\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MagnifyingGlassIcon, XIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\nexport const Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\n/* ------------------------------------------------------------------ */\n/* Private dialog internals for CommandDialog (host dialog module, */\n/* behavior-identical, portal seam inverted). */\n/* ------------------------------------------------------------------ */\n\nconst MOBILE_BREAKPOINT = 768;\n\n/** Host `hooks/use-mobile` inlined: false during SSR, matchMedia after mount. */\nfunction useIsMobile(): boolean {\n const [isMobile, setIsMobile] = React.useState(false);\n const [hasMounted, setHasMounted] = React.useState(false);\n\n React.useEffect(() => {\n setHasMounted(true);\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n onChange();\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n if (!hasMounted) {\n return false;\n }\n return isMobile;\n}\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so the sheet geometry always wins over any caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nconst CommandDialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, container, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n const portalContainer = usePortalContainer(container);\n return (\n <DialogPrimitive.Portal container={portalContainer}>\n {isModal ? (\n <DialogPrimitive.Overlay\n className=\"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n />\n ) : null}\n <DialogPrimitive.Content\n ref={ref}\n aria-modal={isModal || undefined}\n aria-describedby={undefined}\n className={cn(\n isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,\n !isModal && \"z-[900]\",\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4\">\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nCommandDialogContent.displayName = \"CommandDialogContent\";\n\nexport interface CommandDialogProps extends DialogProps {\n /** Explicit portal target for the dialog; beats the injected seam. */\n container?: HTMLElement | null;\n}\n\nexport const CommandDialog = ({\n children,\n container,\n ...props\n}: CommandDialogProps) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n <CommandDialogContent\n className=\"overflow-hidden p-0\"\n {...(container !== undefined ? { container } : {})}\n >\n <DialogPrimitive.Title className=\"sr-only\"></DialogPrimitive.Title>\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </CommandDialogContent>\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\n\nexport const CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\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));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nexport const CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport const CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\nconst PortalContainerContext = React.createContext<HTMLElement | null | undefined>(\n undefined,\n);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","\"use client\";\n\n/**\n * CreatablePicker — ported verbatim from matrx-frontend\n * `components/ui/creatable-picker.tsx`.\n *\n * P23 — EVERY PICKER TAKES NEW INPUT.\n *\n * Arman, 2026-08-23: \"We have to annihilate the UIs that offer options but\n * don't allow custom entry because those are the ones that lose the platform\n * the best users… the moment I went in to assign a tier, I got a pop up that\n * forced me to choose from the shitty options I had in front of me. So instead\n * of our system getting significantly better because I took the initiative to\n * add something, our system was too arrogant and cocky and didn't want my\n * opinion. … It's the lazy coding agent who builds a popover with a drop down,\n * but is too lazy to include an add feature.\"\n *\n * THIS COMPONENT IS THE ANSWER, and it is the ONLY shape a keyword-system\n * choice control may take. Type-ahead over the existing options, and whatever\n * you typed that matched nothing is offered back as \"Create «what you typed»\".\n * One click turns it into a real row through the feature's ONE write path and\n * selects it — never a second creation path, never a \"go somewhere else first\".\n *\n * P11 — THE ONE EXCEPTION, AND IT IS NEVER A DEAD END. A platform-shared\n * vocabulary (traffic classes, the platform dimensions every tenant shares) is\n * governed centrally, so this control does not pretend it can widen it. It SAYS\n * so and offers the door instead: `lockedNote` + `lockedAction` render a\n * footer that takes the person to \"make this your own dimension\".\n *\n * It knows nothing about any vocabulary. The caller supplies the options and\n * ONE `onCreate` that writes through whatever the canonical path for that\n * vocabulary already is — this component must never grow a write path of its\n * own, or it becomes the second one.\n *\n * SoR: common-docs/systems/marketing/seo/seo-keywords/keyword-system-decisions.md\n * (P23, P11) + value-system.md § THE ASSIGNMENT LAYER.\n *\n * Seam inversions (the only changes from the origin):\n * - Popover/Command come from this package's own primitives (which route\n * portals through the `PortalContainerProvider` seam).\n * - The lucide icons become package-inlined SVGs (C19); `LucideIcon` in the\n * `footerActions` contract becomes the structural `PickerIcon`.\n */\n\nimport {\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./command\";\nimport {\n ChevronsUpDownIcon,\n ExternalLinkIcon,\n Loader2Icon,\n LockIcon,\n LucideCheckIcon,\n PlusIcon,\n} from \"./icons\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\n/** Structural stand-in for the host's `LucideIcon` in `footerActions`. */\nexport type PickerIcon = ComponentType<{ className?: string }>;\n\n/**\n * \"Add a offering…\" is the kind of small wrongness that makes a product feel\n * unfinished, and the noun is caller-supplied so the article has to be derived.\n */\nfunction article(noun: string): string {\n return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;\n}\n\nexport interface CreatableOption {\n value: string;\n label: string;\n /** Right-aligned detail — a count, a description, \"yours\". */\n hint?: string;\n /** Rendered instead of the plain label (a band chip, a coloured pill). */\n render?: ReactNode;\n /** Extra words the type-ahead should match on. */\n keywords?: string;\n /**\n * The heading this option files under. Options keep the caller's order; a\n * group is opened the first time an option names it. Omit on every option\n * for a single ungrouped list.\n *\n * THE CATALOG IS NOT A WALL (Arman, 2026-08-24, on being shown offerings\n * that were not his): a set that legitimately holds more than this tenant's\n * own rows says so with a heading instead of hiding the rest.\n */\n group?: string;\n}\n\nexport interface CreatablePickerProps {\n value: string | null;\n options: CreatableOption[];\n onSelect: (value: string) => void;\n placeholder: string;\n searchPlaceholder?: string;\n /** The noun in \"Add a level…\" / \"Create «x»\". Always a person's word. */\n noun: string;\n /**\n * Turns typed text into a real row and returns the option value to select.\n * Return null when the caller handled it another way (opened a dialog that\n * needs more than a name — a level needs a threshold).\n */\n onCreate?: (typed: string) => Promise<string | null>;\n /**\n * Creating this noun needs more than a name, so the picker hands the typed\n * text to the caller's dialog instead of writing anything itself.\n */\n onCreateRequiresMore?: (typed: string) => void;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n triggerClassName?: string;\n emptyLabel?: string;\n ariaLabel?: string;\n /** P11: a sentence saying this vocabulary is platform-governed. */\n lockedNote?: string;\n /** P11: the door out of that refusal — never leave them with only \"no\". */\n lockedAction?: { label: string; onSelect: () => void };\n /**\n * Rendered inside the create footer, above the create button — for the one\n * extra choice a vocabulary needs at creation time (a category's parent,\n * say). It is a SLOT, not a second write path: whatever it collects is read\n * by the caller's own `onCreate`. A function receives what the person typed,\n * so a slot can offer matching suggestions (e.g. a shared catalog) instead\n * of a fixed block.\n */\n createExtra?: ReactNode | ((typed: string) => ReactNode);\n /**\n * THE MANAGE DOOR. Arman, 2026-08-24: \"where we have 'add' we should also\n * have a 'manage' button that opens that thing in a new tab.\" A control that\n * names a vocabulary must also be able to reach the place that vocabulary is\n * governed — otherwise the person who wants to rename, re-parent, or retire\n * an option has to go hunting for a screen they may not know exists.\n *\n * It opens in a NEW TAB on purpose: nobody loses the row they were editing\n * in order to go look at the catalog.\n */\n manageAction?: { label: string; href: string };\n /**\n * Doors to a DIFFERENT answer than this vocabulary can give. The offering\n * picker's \"this isn't something we offer\" lives here, because that ruling\n * is a traffic class, not an offering — and sending someone to look for\n * another column on their own is the dead end this slot exists to close.\n */\n footerActions?: Array<{\n label: string;\n icon?: PickerIcon;\n onSelect: () => void;\n /** A sentence under the door saying what it does, when it needs one. */\n note?: string;\n }>;\n /**\n * What the TRIGGER shows for the current selection, when the caller wants\n * something other than the option row's own `render`. A dense table cell\n * needs one compact line (\"Data Destruction Services · ITAD\"); the list row\n * it came from is indented and annotated. Same selection, two jobs.\n */\n renderSelected?: ReactNode;\n size?: \"sm\" | \"md\";\n}\n\nexport function CreatablePicker({\n value,\n options,\n onSelect,\n placeholder,\n searchPlaceholder,\n noun,\n onCreate,\n onCreateRequiresMore,\n disabled,\n loading,\n className,\n triggerClassName,\n emptyLabel = \"No match.\",\n ariaLabel,\n lockedNote,\n lockedAction,\n createExtra,\n manageAction,\n footerActions,\n renderSelected,\n size = \"sm\",\n}: CreatablePickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n const [busy, setBusy] = useState(false);\n /**\n * THE FOOTER IS NEVER A DEAD CLICK. Arman, 2026-08-24: \"one of the options is\n * to allow you to add. When I click add offering, however, nothing happens.\"\n * He was right, and the cause was here, not in the popover: with nothing\n * typed, `create(\"\")` fell straight out of `if (!name) return` and the\n * button ate the click in silence. A control whose whole purpose is P23 may\n * not be the control that ignores you — so an empty \"Add…\" now puts the\n * cursor in the box and SAYS what it wants.\n */\n const inputRef = useRef<HTMLInputElement>(null);\n const [needsName, setNeedsName] = useState(false);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // Caller order is the order. A heading opens the first time an option names\n // it, so a tree stays in tree order inside its own heading.\n const groups: Array<{ heading?: string; options: CreatableOption[] }> = [];\n for (const option of options) {\n const last = groups[groups.length - 1];\n if (last && last.heading === option.group) last.options.push(option);\n else\n groups.push(\n option.group === undefined\n ? { options: [option] }\n : { heading: option.group, options: [option] },\n );\n }\n\n const typed = query.trim();\n const exactMatch = options.some(\n (option) => option.label.toLowerCase() === typed.toLowerCase(),\n );\n const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;\n\n const close = () => {\n setOpen(false);\n setQuery(\"\");\n setNeedsName(false);\n };\n\n const create = async (text: string) => {\n const name = text.trim();\n if (busy) return;\n // `onCreateRequiresMore` opens a dialog that asks for the name itself, so\n // a blank click there is legitimate — it opens the dialog empty. Only the\n // write-it-now path needs a name before it can do anything.\n if (onCreateRequiresMore) {\n close();\n onCreateRequiresMore(name);\n return;\n }\n if (!onCreate) return;\n if (!name) {\n setNeedsName(true);\n inputRef.current?.focus();\n return;\n }\n setBusy(true);\n try {\n const next = await onCreate(name);\n if (next) onSelect(next);\n close();\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={(next) => (next ? setOpen(true) : close())}>\n <PopoverTrigger asChild disabled={disabled}>\n <button\n type=\"button\"\n aria-label={ariaLabel ?? placeholder}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors\",\n \"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"sm\" ? \"h-8 text-xs\" : \"h-9 text-sm\",\n className,\n triggerClassName,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {selected ? (\n (renderSelected ?? selected.render ?? selected.label)\n ) : (\n <span className=\"text-muted-foreground\">\n {loading ? \"Loading…\" : placeholder}\n </span>\n )}\n </span>\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-[--radix-popover-trigger-width] min-w-56 p-0\">\n <Command\n filter={(itemValue, search, keywords) => {\n const haystack = `${itemValue} ${keywords?.join(\" \") ?? \"\"}`.toLowerCase();\n return haystack.includes(search.toLowerCase()) ? 1 : 0;\n }}\n >\n <CommandInput\n ref={inputRef}\n value={query}\n onValueChange={(next) => {\n setQuery(next);\n if (next.trim()) setNeedsName(false);\n }}\n placeholder={searchPlaceholder ?? `Search or add ${article(noun)}…`}\n />\n <CommandList>\n <CommandEmpty>{emptyLabel}</CommandEmpty>\n {groups.map((group) => (\n <CommandGroup\n key={group.heading ?? \"__ungrouped__\"}\n {...(group.heading === undefined\n ? {}\n : { heading: group.heading })}\n >\n {group.options.map((option) => (\n <CommandItem\n key={option.value}\n value={option.label}\n {...(option.keywords\n ? { keywords: [option.keywords] }\n : {})}\n onSelect={() => {\n onSelect(option.value);\n close();\n }}\n className=\"gap-2 text-xs\"\n >\n <LucideCheckIcon\n className={cn(\n \"size-3.5 shrink-0\",\n option.value === value ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n <span className=\"min-w-0 flex-1 truncate\">\n {option.render ?? option.label}\n </span>\n {option.hint ? (\n <span className=\"shrink-0 text-[10px] text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </CommandItem>\n ))}\n </CommandGroup>\n ))}\n </CommandList>\n\n {/* The \"+ Add\" footer sits OUTSIDE CommandList so the search can\n never hide the one thing the person came here to do (P23). */}\n {canCreate ? (\n <div className=\"space-y-1 border-t border-border p-1\">\n {createExtra && typed && !exactMatch ? (\n <div className=\"px-1 pt-0.5\">\n {typeof createExtra === \"function\"\n ? createExtra(typed)\n : createExtra}\n </div>\n ) : null}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => void create(typed)}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50\"\n >\n {busy ? (\n <Loader2Icon className=\"size-3.5 shrink-0 animate-spin\" />\n ) : (\n <PlusIcon className=\"size-3.5 shrink-0\" />\n )}\n <span className=\"min-w-0 truncate\">\n {typed && !exactMatch\n ? `Create “${typed}”`\n : `Add ${article(noun)}…`}\n </span>\n </button>\n {needsName ? (\n <p className=\"px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground\">\n Type the name of the {noun} you want to add — then this\n creates it.\n </p>\n ) : null}\n </div>\n ) : null}\n\n {/* THE DOORS. Everything this control names must be reachable from\n it: the place the vocabulary is governed, and the other answer\n when this vocabulary is the wrong one to be answering with. */}\n {footerActions?.length || manageAction ? (\n <div className=\"space-y-0.5 border-t border-border p-1\">\n {footerActions?.map((action) => {\n const Icon = action.icon;\n return (\n <div key={action.label}>\n <button\n type=\"button\"\n onClick={() => {\n close();\n action.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {Icon ? <Icon className=\"size-3.5 shrink-0\" /> : null}\n <span className=\"min-w-0 truncate\">{action.label}</span>\n </button>\n {action.note ? (\n <p className=\"px-2 pb-1 text-[10px] leading-snug text-muted-foreground\">\n {action.note}\n </p>\n ) : null}\n </div>\n );\n })}\n {manageAction ? (\n <a\n href={manageAction.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={close}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <ExternalLinkIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{manageAction.label}</span>\n </a>\n ) : null}\n </div>\n ) : null}\n\n {/* P11 — shared vocabulary. Say it, then hand them the door. */}\n {lockedNote ? (\n <div className=\"space-y-1 border-t border-border p-2\">\n <p className=\"flex gap-1.5 text-[11px] leading-snug text-muted-foreground\">\n <LockIcon className=\"mt-px size-3 shrink-0\" />\n <span>{lockedNote}</span>\n </p>\n {lockedAction ? (\n <button\n type=\"button\"\n onClick={() => {\n close();\n lockedAction.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-xs font-medium text-primary transition-colors hover:bg-accent\"\n >\n <PlusIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{lockedAction.label}</span>\n </button>\n ) : null}\n </div>\n ) : null}\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n","\"use client\";\n\n/**\n * Popover — ported verbatim from matrx-frontend `components/ui/popover.tsx`.\n *\n * Seam inversion: the host's `useNestedPortalContainer` (dialog/popout aware)\n * becomes the injected `PortalContainerProvider` seam (`portal-container.tsx`);\n * the explicit `container` prop keeps top priority, exactly as before.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-popover 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n */\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Popover = PopoverPrimitive.Root;\n\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, ...props },\n ref,\n ) => {\n const portalContainer = usePortalContainer(container);\n return (\n <PopoverPrimitive.Portal container={portalContainer}>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n // Cap to the viewport space Radix measured and scroll — a popover taller\n // than the screen must never trap the user with unreachable content.\n // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal\n // z, DOM portal order decides, so a dialog opened FROM a popover stacks\n // above it, and a popover opened from a dialog still stacks above the\n // dialog. z-[10001] buried dialogs behind fullscreen popovers.\n \"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n","\"use client\";\n\n/**\n * EditableLabel — inline rename-in-place text.\n *\n * Ported verbatim from matrx-frontend\n * `components/official/item/EditableLabel.tsx` (S16). Commit on Enter/blur,\n * Esc cancels, whitespace-only falls back to `emptyFallback` (or cancels),\n * stays in sync with upstream `value` while not editing. Decoupled from any\n * store — `onCommit(next)` is the only side-effect channel.\n *\n * Three activation modes:\n * - \"click\" → click the display text to edit (header titles)\n * - \"doubleClick\" → double-click to edit (rows where single-click selects)\n * - \"controlled\" → host owns `editing`; this renders ONLY the input while\n * editing (the host renders its own display element)\n *\n * Seam inversions:\n * - Prop types come with the component instead of the host's item-system\n * `types.ts` (identical shapes).\n * - The lucide `Loader2` busy spinner is the package's inlined SVG (C19).\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\n\nexport type EditableLabelCommitMode = \"optimistic\" | \"await\";\nexport type EditableLabelActivation = \"click\" | \"doubleClick\" | \"controlled\";\n\nexport interface EditableLabelProps {\n value: string;\n /**\n * Commit handler. optimistic (default): edit mode exits immediately, the\n * promise is fire-and-forget (owners do optimistic update + revert + toast).\n * await: input disables with a spinner until the promise resolves; a\n * rejection keeps edit mode open to retry.\n */\n onCommit: (next: string) => void | Promise<void>;\n commitMode?: EditableLabelCommitMode;\n /** Return an error message to block the commit (shown under the input). */\n validate?: (next: string) => string | null;\n /** Used when the trimmed draft is empty. Undefined → empty cancels. */\n emptyFallback?: string;\n maxLength?: number; // default 120\n /**\n * \"click\"/\"doubleClick\" — internal edit state (headers). \"controlled\" — host\n * owns `editing`; EditableLabel renders ONLY the input when editing.\n */\n activation?: EditableLabelActivation;\n editing?: boolean; // controlled mode\n /** Edit-state notifications. Controlled mode: the ONLY state channel.\n * Uncontrolled modes: fired as a notification (layout hooks etc.). */\n onEditingChange?: (editing: boolean) => void;\n selectOnEdit?: boolean; // default true\n placeholder?: string;\n /** Accessible name, e.g. \"Session title\". Default \"Name\". */\n ariaLabel?: string;\n truncate?: boolean; // display mode, default true\n className?: string; // both modes\n displayClassName?: string;\n inputClassName?: string;\n}\n\nexport function EditableLabel({\n value,\n onCommit,\n commitMode = \"optimistic\",\n validate,\n emptyFallback,\n maxLength = 120,\n activation = \"click\",\n editing: editingProp,\n onEditingChange,\n selectOnEdit = true,\n placeholder,\n ariaLabel = \"Name\",\n truncate = true,\n className,\n displayClassName,\n inputClassName,\n}: EditableLabelProps) {\n const controlled = activation === \"controlled\";\n const [internalEditing, setInternalEditing] = useState(false);\n const editing = controlled ? !!editingProp : internalEditing;\n\n const [draft, setDraft] = useState(value);\n const [error, setError] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Stay in sync with upstream changes (realtime / auto-label) while idle.\n useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n // Focus + select on entering edit mode.\n useEffect(() => {\n if (editing && inputRef.current) {\n inputRef.current.focus();\n if (selectOnEdit) inputRef.current.select();\n }\n }, [editing, selectOnEdit]);\n\n const setEditing = useCallback(\n (next: boolean) => {\n if (controlled) {\n onEditingChange?.(next);\n } else {\n // Uncontrolled hosts still get notified — lets them adjust layout\n // (e.g. widen the edit box) without taking over the edit state.\n setInternalEditing(next);\n onEditingChange?.(next);\n }\n },\n [controlled, onEditingChange],\n );\n\n const startEdit = useCallback(() => {\n setDraft(value);\n setError(null);\n setEditing(true);\n }, [value, setEditing]);\n\n const cancel = useCallback(() => {\n setDraft(value);\n setError(null);\n setBusy(false);\n setEditing(false);\n }, [value, setEditing]);\n\n const commit = useCallback(() => {\n if (busy) return;\n const trimmed = draft.trim();\n const next = trimmed || emptyFallback;\n\n // Empty + no fallback → cancel rather than commit garbage.\n if (next === undefined) {\n cancel();\n return;\n }\n\n const validationError = validate?.(next) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n\n // No-op commit — skip the side effect entirely.\n if (next === value) {\n setEditing(false);\n setError(null);\n return;\n }\n\n if (commitMode === \"await\") {\n const result = onCommit(next);\n if (result instanceof Promise) {\n setBusy(true);\n result\n .then(() => {\n setBusy(false);\n setEditing(false);\n })\n .catch(() => {\n // Keep edit mode open so the user can retry.\n setBusy(false);\n });\n return;\n }\n setEditing(false);\n return;\n }\n\n // optimistic — exit immediately, fire-and-forget.\n setEditing(false);\n setError(null);\n const result = onCommit(next);\n if (result instanceof Promise) result.catch(() => {});\n }, [\n busy,\n draft,\n emptyFallback,\n validate,\n value,\n commitMode,\n onCommit,\n cancel,\n setEditing,\n ]);\n\n if (editing) {\n return (\n <span className={cn(\"relative flex min-w-0 flex-1 items-center\", className)}>\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n disabled={busy}\n placeholder={placeholder}\n onChange={(e) => {\n setDraft(e.target.value);\n if (error) setError(null);\n }}\n onBlur={commit}\n onClick={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Contain editing keystrokes so host rows / global hotkeys stay quiet.\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.stopPropagation();\n commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n cancel();\n } else if (e.key === \" \") {\n e.stopPropagation();\n }\n }}\n maxLength={maxLength}\n aria-label={ariaLabel}\n aria-invalid={error ? true : undefined}\n // 16px on mobile prevents iOS focus-zoom; sm on desktop.\n className={cn(\n \"w-full min-w-0 rounded-sm bg-transparent px-1 outline-none\",\n \"text-base md:text-sm\",\n \"focus:bg-background focus:ring-1 focus:ring-ring\",\n busy && \"opacity-60\",\n inputClassName,\n )}\n />\n {busy && (\n <Loader2Icon className=\"absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground\" />\n )}\n {error && (\n <span className=\"absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive\">\n {error}\n </span>\n )}\n </span>\n );\n }\n\n // Controlled mode: host owns the display; render nothing while idle.\n if (controlled) return null;\n\n return (\n <button\n type=\"button\"\n onClick={\n activation === \"click\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onDoubleClick={\n activation === \"doubleClick\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n e.stopPropagation();\n startEdit();\n }\n }}\n title={activation === \"doubleClick\" ? \"Double-click to rename\" : \"Click to rename\"}\n aria-label={`Rename ${ariaLabel.toLowerCase()}: ${value}`}\n className={cn(\n \"min-w-0 max-w-full rounded-sm px-1 text-left transition-colors\",\n \"hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n truncate && \"block truncate\",\n className,\n displayClassName,\n )}\n >\n {value || placeholder || \"\"}\n </button>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full border border-border bg-background text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium placeholder:text-muted-foreground\n focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-ring\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-none\n transition duration-400\n [&:-webkit-autofill]:bg-background [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--background))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, className, wrapperClassName, ...props }, ref) => {\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && \"pl-10\", className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","\"use client\";\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Label = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * OverflowToolbar — a horizontal row of consistent, compact action buttons\n * that collapses the buttons that don't fit into a single \"more\" (…) menu.\n * Ported verbatim from matrx-frontend\n * `components/official/toolbar/OverflowToolbar.tsx` (S20).\n *\n * ┌───────────────────────────────────────────────┐\n * │ [leading] [Btn] [Btn] [Btn] [ … ] │\n * └───────────────────────────────────────────────┘\n *\n * Design rules (the primitive enforces them so callers can't drift):\n * - Every button is the same height (h-7), padding, text size, icon size.\n * - `hideLabel` renders an icon-only button with a tooltip — use it for\n * \"obvious\" actions (Find, Source, …).\n * - `tone: \"primary\"` colors a button without changing its size, so the\n * primary action is NOT visually larger than the rest.\n * - When the row is too narrow, the LAST actions collapse into the overflow\n * menu first. Order your actions most-important-first.\n *\n * Measurement is done with a hidden \"ghost\" row (always renders every action\n * + the kebab) read via a ResizeObserver, so the visible row never reflows\n * mid-frame.\n *\n * Seam inversions (host-shaped chrome becomes injected):\n * - `icon: LucideIcon` → the structural `ToolbarIcon`\n * (`ComponentType<{ className?: string }>`) — any SVG component fits.\n * - The host Tooltip wrapper → `renderTooltip` prop. Without it, icon-only\n * buttons render bare (they always carry `aria-label`); hosts inject their\n * tooltip system for the original hover behavior.\n * - The host ItemMenu overflow menu → `renderOverflowMenu` prop (required):\n * the host receives the collapsed actions plus the ready-made kebab trigger\n * and renders them with its own menu system.\n */\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon, MoreHorizontalIcon } from \"./icons\";\n\nexport type ToolbarActionTone = \"default\" | \"primary\" | \"destructive\";\n\n/** Structural icon contract (a lucide icon satisfies it, so does any SVG component). */\nexport type ToolbarIcon = React.ComponentType<{ className?: string }>;\n\nexport interface ToolbarAction {\n id: string;\n label: string;\n icon: ToolbarIcon;\n /** Click handler. Ignored when `href` is set. */\n onSelect?: () => void;\n /** Renders an anchor instead of a button. */\n href?: string;\n target?: \"_blank\";\n disabled?: boolean;\n /** Swaps the icon for a spinner and (optionally) shows `runningLabel`. */\n running?: boolean;\n runningLabel?: string;\n tone?: ToolbarActionTone;\n /** Icon-only button (tooltip carries the label). For obvious actions. */\n hideLabel?: boolean;\n /** Drop the action entirely. */\n hidden?: boolean;\n}\n\nexport interface OverflowToolbarProps {\n actions: ToolbarAction[];\n /**\n * Optional element pinned at the start of the row — never collapsed, never\n * measured into the action budget except as a fixed prefix (e.g. a surface\n * switcher / context chip cluster).\n */\n leading?: React.ReactNode;\n /** Accessible label for the overflow trigger. */\n overflowAriaLabel?: string;\n className?: string;\n /**\n * Injected overflow-menu seam: render the collapsed actions with the host's\n * menu system, using `trigger` (the ready-made kebab button) as the menu\n * trigger element.\n */\n renderOverflowMenu: (args: {\n actions: ToolbarAction[];\n trigger: React.ReactNode;\n }) => React.ReactNode;\n /**\n * Injected tooltip seam for icon-only buttons (their label lives nowhere\n * else on screen). Omitted → the bare control renders (aria-label intact).\n */\n renderTooltip?: (control: React.ReactElement, label: string) => React.ReactNode;\n}\n\nconst GAP_PX = 6; // gap-1.5\n\n// ── Button ──────────────────────────────────────────────────────────────────\n\nconst TONE: Record<ToolbarActionTone, string> = {\n default: \"border border-border bg-background hover:bg-accent text-foreground\",\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"border border-destructive/40 text-destructive hover:bg-destructive/10\",\n};\n\nfunction ToolbarButton({\n action,\n enableTooltip = false,\n renderTooltip,\n}: {\n action: ToolbarAction;\n /** Wrap icon-only buttons in a styled tooltip. Off for the ghost row. */\n enableTooltip?: boolean;\n renderTooltip?:\n | ((control: React.ReactElement, label: string) => React.ReactNode)\n | undefined;\n}) {\n const tone = action.tone ?? \"default\";\n const Icon = action.running ? Loader2Icon : action.icon;\n const showLabel =\n !action.hideLabel || (action.running && action.runningLabel);\n const text =\n action.running && action.runningLabel ? action.runningLabel : action.label;\n\n const className = cn(\n \"inline-flex items-center gap-1 h-7 rounded-md text-[11px] font-medium transition-colors whitespace-nowrap\",\n \"disabled:opacity-50 disabled:pointer-events-none\",\n action.hideLabel && !action.running ? \"w-7 justify-center px-0\" : \"px-2\",\n TONE[tone],\n );\n\n const inner = (\n <>\n <Icon\n className={cn(\"w-3.5 h-3.5 shrink-0\", action.running && \"animate-spin\")}\n />\n {showLabel && <span>{text}</span>}\n </>\n );\n\n const control =\n action.href && !action.disabled ? (\n <a\n href={action.href}\n target={action.target}\n rel={action.target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={action.onSelect}\n disabled={action.disabled}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </button>\n );\n\n // Icon-only buttons need a styled tooltip to be discoverable — the label\n // lives nowhere else on screen. Labeled buttons are self-describing.\n if (enableTooltip && action.hideLabel && renderTooltip) {\n return <>{renderTooltip(control, action.label)}</>;\n }\n\n return control;\n}\n\nfunction OverflowTrigger({ ariaLabel }: { ariaLabel: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-haspopup=\"menu\"\n title=\"More actions\"\n className={cn(\n \"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors\",\n \"border border-border bg-background hover:bg-accent text-foreground\",\n )}\n >\n <MoreHorizontalIcon className=\"w-3.5 h-3.5\" />\n </button>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────\n\nexport function OverflowToolbar({\n actions,\n leading,\n overflowAriaLabel = \"More actions\",\n className,\n renderOverflowMenu,\n renderTooltip,\n}: OverflowToolbarProps) {\n const visibleActions = useMemo(\n () => actions.filter((a) => !a.hidden),\n [actions],\n );\n\n const containerRef = useRef<HTMLDivElement>(null);\n const ghostRef = useRef<HTMLDivElement>(null);\n // The leading slot renders ONCE (in the visible row) — it may host a\n // stateful/data-fetching component, so we never duplicate it into the ghost.\n // Its width is read directly off this ref instead.\n const leadingRef = useRef<HTMLSpanElement>(null);\n const [visibleCount, setVisibleCount] = useState(visibleActions.length);\n\n // Re-measure whenever the rendered text/state of any action changes (label,\n // icon-only mode, or running label all change a button's width).\n const signature = visibleActions\n .map(\n (a) =>\n `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? \"\"}:${a.label}`,\n )\n .join(\"|\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const ghost = ghostRef.current;\n if (!container || !ghost) return undefined;\n\n const compute = () => {\n const available = container.clientWidth;\n const n = visibleActions.length;\n const children = Array.from(ghost.children) as HTMLElement[];\n const hasLeading = leading != null;\n const leadingW = hasLeading ? (leadingRef.current?.offsetWidth ?? 0) : 0;\n const itemW = (i: number) => children[i]?.offsetWidth ?? 0;\n const kebabW = children[n]?.offsetWidth ?? 28;\n\n // Width consumed by the always-present leading slot.\n const base = leadingW + (hasLeading && n > 0 ? GAP_PX : 0);\n\n // Does everything fit with no kebab?\n let totalAll = base;\n for (let i = 0; i < n; i++) totalAll += itemW(i) + (i > 0 ? GAP_PX : 0);\n if (totalAll <= available) {\n setVisibleCount(n);\n return;\n }\n\n // Otherwise fit as many as possible while reserving room for the kebab.\n let used = base;\n let count = 0;\n for (let i = 0; i < n; i++) {\n const add = itemW(i) + (count > 0 ? GAP_PX : 0);\n if (used + add + GAP_PX + kebabW <= available) {\n used += add;\n count += 1;\n } else break;\n }\n setVisibleCount(count);\n };\n\n compute();\n const ro = new ResizeObserver(compute);\n ro.observe(container);\n return () => ro.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature, leading != null]);\n\n const shown = visibleActions.slice(0, visibleCount);\n const hidden = visibleActions.slice(visibleCount);\n\n return (\n <div ref={containerRef} className={cn(\"relative min-w-0\", className)}>\n {/* Ghost measuring row — every action button + kebab, never visible.\n The leading slot is intentionally NOT duplicated here (it may be a\n stateful/fetching component); its width is read off `leadingRef`. */}\n <div\n ref={ghostRef}\n aria-hidden\n className=\"pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0\"\n >\n {visibleActions.map((a) => (\n <ToolbarButton key={a.id} action={a} />\n ))}\n <OverflowTrigger ariaLabel={overflowAriaLabel} />\n </div>\n\n {/* Visible row — right-aligned cluster that collapses overflow. */}\n <div className=\"flex items-center justify-end gap-1.5\">\n {leading != null && (\n <span ref={leadingRef} className=\"shrink-0\">\n {leading}\n </span>\n )}\n {shown.map((a) => (\n <ToolbarButton\n key={a.id}\n action={a}\n enableTooltip\n renderTooltip={renderTooltip}\n />\n ))}\n {hidden.length > 0 &&\n renderOverflowMenu({\n actions: hidden,\n trigger: <OverflowTrigger ariaLabel={overflowAriaLabel} />,\n })}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * ScoreRing — SVG progress ring + the shared score→color threshold semantics.\n * Ported verbatim from matrx-frontend `components/official/ScoreRing.tsx`\n * (S18). The thresholds ARE the product: green at/above `good`, orange\n * at/above `warning`, red below, muted for null. No seams.\n */\n\nimport { cn } from \"./cn\";\n\nexport interface ScoreThresholds {\n /** Scores at or above this value are green. */\n good: number;\n /** Scores at or above this value (but below good) are orange. */\n warning: number;\n}\n\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = {\n good: 75,\n warning: 50,\n};\n\n/** Semantic score color shared by ring and accent consumers. */\nexport function scoreRingColorClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"text-muted-foreground\";\n if (pct >= thresholds.good) return \"text-success\";\n if (pct >= thresholds.warning) return \"text-warning\";\n return \"text-destructive\";\n}\n\n/** Solid-background twin of `scoreRingColorClasses`. */\nexport function scoreAccentBgClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"bg-muted-foreground/30\";\n if (pct >= thresholds.good) return \"bg-success\";\n if (pct >= thresholds.warning) return \"bg-warning\";\n return \"bg-destructive\";\n}\n\nexport interface ScoreRingProps {\n pct: number | null;\n size?: number;\n strokeWidth?: number;\n label?: string;\n valueClassName?: string;\n className?: string;\n thresholds?: ScoreThresholds;\n /** Visible suffix; study keeps `%`, while Lighthouse convention omits it. */\n suffix?: string;\n}\n\n/**\n * Shared SVG score ring. `pct` is 0–100; threshold semantics are supplied by\n * the domain (for example Lighthouse uses 90/50 while study uses 75/50).\n */\nexport function ScoreRing({\n pct,\n size = 112,\n strokeWidth = 8,\n label,\n valueClassName,\n className,\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n suffix = \"%\",\n}: ScoreRingProps) {\n const radius = 50 - strokeWidth / 2;\n const circumference = 2 * Math.PI * radius;\n const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));\n const dashOffset = circumference * (1 - boundedPct / 100);\n\n return (\n <div\n className={cn(\n \"relative flex shrink-0 items-center justify-center\",\n className,\n )}\n style={{ width: size, height: size }}\n role=\"img\"\n aria-label={`${label ?? \"Score\"}: ${pct === null ? \"not available\" : `${pct} out of 100`}`}\n >\n <svg viewBox=\"0 0 100 100\" className=\"h-full w-full -rotate-90\">\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className=\"stroke-muted\"\n strokeWidth={strokeWidth}\n fill=\"none\"\n />\n {pct !== null ? (\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className={cn(\n \"transition-[stroke-dashoffset] duration-700 ease-out\",\n scoreRingColorClasses(pct, thresholds),\n )}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={dashOffset}\n />\n ) : null}\n </svg>\n <div className=\"absolute flex flex-col items-center justify-center\">\n <span\n className={cn(\n \"font-bold tabular-nums text-foreground\",\n valueClassName ?? \"text-2xl\",\n )}\n >\n {pct === null ? \"—\" : `${pct}${suffix}`}\n </span>\n {label ? (\n <span className=\"max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </span>\n ) : null}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * SegmentedControl — sized accessible segmented toggle.\n * Ported verbatim from matrx-frontend `components/ui/segmented-control.tsx`\n * (S17). No seams: pure markup over host semantic tokens. The option/prop\n * interfaces are exported here (the original kept them file-local).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface SegmentOption {\n value: string;\n label: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n value: string;\n onValueChange: (value: string) => void;\n data: SegmentOption[];\n name?: string;\n className?: string;\n fullWidth?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport function SegmentedControl({\n value,\n onValueChange,\n data,\n name: _name,\n className,\n fullWidth = false,\n size = \"md\",\n}: SegmentedControlProps) {\n // Handle size classes\n const sizeClasses = {\n sm: \"h-7 text-xs\",\n md: \"h-9 text-sm\",\n lg: \"h-10 text-base\",\n };\n\n return (\n <div\n className={cn(\n \"inline-flex p-0.5 bg-muted rounded-md\",\n fullWidth && \"w-full\",\n className\n )}\n role=\"tablist\"\n >\n {data.map((option) => {\n const isActive = value === option.value;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n disabled={option.disabled}\n onClick={() => onValueChange(option.value)}\n className={cn(\n \"relative flex items-center justify-center rounded-[0.2rem] px-3 py-1.5 transition-all\",\n sizeClasses[size],\n fullWidth && \"flex-1\",\n isActive\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground hover:bg-background/50\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Select — ported verbatim from matrx-frontend `components/ui/select.tsx`.\n *\n * Seam inversions:\n * - The host's `useNestedPortalContainer` (dialog/popout aware) becomes the\n * injected `PortalContainerProvider` seam (`portal-container.tsx`); the\n * explicit `container` prop keeps top priority, exactly as before.\n * - `ChevronDownIcon` / `ChevronUpIcon` / `CheckIcon` come from the package's\n * inlined SVGs (C19), not @radix-ui/react-icons — same glyphs, same\n * viewBoxes. (The origin also imported `CaretSortIcon` without ever using\n * it; the dead import is not carried along.)\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-select 2.3.1 / react-id 1.1.2). The gate was actively\n * harmful — it deleted the ALWAYS-VISIBLE select trigger (a form control)\n * from SSR and the first client paint.\n */\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n RadixChevronDownIcon,\n RadixChevronUpIcon,\n} from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Select = SelectPrimitive.Root;\n\nexport const SelectGroup = SelectPrimitive.Group;\n\nexport const SelectValue = SelectPrimitive.Value;\n\nexport const selectTriggerVariants = cva(\n \"flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 py-1 text-xs\",\n default: \"h-9 px-3 py-1\",\n lg: \"h-10 px-3 py-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nexport interface SelectTriggerProps\n extends\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n VariantProps<typeof selectTriggerVariants> {\n hideArrow?: boolean;\n}\n\nexport const SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(({ className, children, hideArrow = false, size, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(selectTriggerVariants({ size, className }))}\n {...props}\n >\n {children}\n {!hideArrow && (\n <SelectPrimitive.Icon asChild>\n <RadixChevronDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nexport const SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nexport const SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, position = \"popper\", container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <SelectPrimitive.Portal container={portalContainer}>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-0.5 overflow-y-auto\",\n position === \"popper\" &&\n \"w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {\n /**\n * Secondary line shown under the label IN THE LIST ONLY. Rendered outside\n * Radix `ItemText` on purpose: everything inside `ItemText` is what the\n * closed trigger displays, so a description passed as `children` gets\n * squeezed into the fixed-height trigger and clipped. This prop keeps the\n * trigger to the one-line label while the open list shows both lines.\n */\n description?: React.ReactNode;\n }\n>(({ className, children, description, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n description ? \"flex-col items-start gap-0.5 py-1.5\" : \"items-center\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n {description ? (\n <span className=\"block text-xs leading-snug text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n","\"use client\";\n\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Separator = React.forwardRef<\n React.ComponentRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * Sheet — ported verbatim from matrx-frontend `components/ui/sheet.tsx`.\n *\n * Seam inversions:\n * - The host's `DialogContentPrimitive` (from its dialog module) is inlined\n * here as a private wrapper with identical behavior: unstyled non-portalling\n * Radix Content that derives `aria-modal` from the owning Root's modality.\n * - `Cross2Icon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `treeContainsComponent` stays the ONE kit implementation\n * (@ai-matrx/kit/react-tree) — never a vendored twin.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-dialog 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n * The RadixDialogModalProvider wrapper stays — it is unrelated to hydration.\n */\n\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Cross2Icon } from \"./icons\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\n/**\n * Unstyled, non-portalling Content for Sheet layouts. It preserves Radix\n * focus/background behavior and derives `aria-modal` from the owning Root\n * (identical to the host dialog module's DialogContentPrimitive).\n */\nconst SheetContentBase = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>\n>(({ ...props }, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nSheetContentBase.displayName = \"SheetContentBase\";\n\nexport const Sheet = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Root>\n>(({ children, ...props }, _ref) => {\n const modal = props.modal ?? true;\n\n return (\n <RadixDialogModalProvider modal={modal}>\n <SheetPrimitive.Root {...props} modal={modal}>\n {children}\n </SheetPrimitive.Root>\n </RadixDialogModalProvider>\n );\n});\nSheet.displayName = \"Sheet\";\n\nexport const SheetTrigger = SheetPrimitive.Trigger;\n\nexport const SheetClose = SheetPrimitive.Close;\n\nexport const SheetPortal = SheetPrimitive.Portal;\n\nexport const SheetOverlay = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n center:\n \"inset-0 m-auto max-h-full max-w-full border rounded-lg data-[state=closed]:fade-out data-[state=open]:fade-in\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\nexport interface SheetContentProps\n extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n hideCloseButton?: boolean;\n /** Skip the dimming overlay — for non-modal side panels (e.g. chat canvas). */\n hideOverlay?: boolean;\n /** Optional className for the overlay when shown. */\n overlayClassName?: string;\n}\n\nexport const SheetDescription = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport const SheetContent = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(\n (\n {\n side = \"right\",\n className,\n children,\n hideCloseButton = false,\n hideOverlay = false,\n overlayClassName,\n ...props\n },\n ref,\n ) => {\n const hasDescription =\n treeContainsComponent(children, SheetDescription) ||\n treeContainsComponent(children, SheetPrimitive.Description);\n return (\n <SheetPortal>\n {!hideOverlay && <SheetOverlay className={overlayClassName} />}\n <SheetContentBase\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {!hideCloseButton && (\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <Cross2Icon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetContentBase>\n </SheetPortal>\n );\n },\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nexport const SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nexport const SheetTitle = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-foreground\", className)}\n {...props}\n />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n","/**\n * Skeleton — ported verbatim from matrx-frontend `components/ui/skeleton.tsx`.\n * No seams: pure markup over host semantic tokens.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-primary/10\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\n/**\n * TabbedBottomSheet — iOS Settings–style two-level navigation for tabbed menus.\n * Ported verbatim from matrx-frontend\n * `components/official/bottom-sheet/TabbedBottomSheet.tsx` (S19).\n *\n * Level 1: a scrollable list of tabs (icon + label + chevron).\n * Level 2: drill into one tab's content with a back button in the header.\n *\n * Two invariants make this ONE surface instead of a different panel per tab:\n *\n * 1. **Fixed height** (`size=\"full\"`) — the sheet is the same near-full\n * height on the index and inside every tab, and it never resizes as\n * content loads, filters, or expands. An adaptive height here meant the\n * panel grew and shrank under the user's thumb on every keystroke.\n * 2. **One typography scale** (`matrx-mobile-sheet`, host globals.css) —\n * the tab bodies are the same components the desktop window renders at\n * desktop density (11–12px). That is unreadable and untappable on a\n * phone, so the sheet promotes small text to mobile sizes and every\n * field to the 16px that stops iOS focus-zoom. Panels stay density-free;\n * the host decides the density.\n *\n * Seam inversions: `ChevronRight` is the package's inlined SVG (C19); the\n * `matrx-mobile-sheet` and `pb-safe` utility classes are host-owned CSS.\n */\n\nimport { useState, type ComponentType, type ReactNode } from \"react\";\n\nimport { BottomSheet, BottomSheetBody, BottomSheetHeader } from \"./bottom-sheet\";\nimport { ChevronRightIcon } from \"./icons\";\n\nexport interface TabbedBottomSheetTab {\n id: string;\n label: string;\n icon?: ComponentType<{ className?: string }>;\n /** Optional trailing badge / dot shown on the index row. */\n trailing?: ReactNode;\n content: ReactNode;\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(null);\n\n // Every open starts on the index. Adjusted during render (the React-docs\n // pattern for state derived from a prop change) rather than in an effect,\n // which would render the previous tab's body for one frame first.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) setSelectedTabId(null);\n }\n\n const selectedTab = selectedTabId\n ? tabs.find((tab) => tab.id === selectedTabId)\n : null;\n\n return (\n <BottomSheet\n open={open}\n onOpenChange={onOpenChange}\n title={title}\n size=\"full\"\n >\n <div className=\"matrx-mobile-sheet flex min-h-0 flex-1 flex-col\">\n <BottomSheetHeader\n title={selectedTab ? selectedTab.label : title}\n showBack={!!selectedTab}\n onBack={() => setSelectedTabId(null)}\n />\n {selectedTab ? (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden pb-safe\">\n {selectedTab.content}\n </div>\n ) : (\n <BottomSheetBody>\n <ul className=\"divide-y divide-border\">\n {tabs.map((tab) => {\n const Icon = tab.icon;\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n onClick={() => setSelectedTabId(tab.id)}\n className=\"flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted\"\n >\n {Icon ? (\n <Icon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n ) : null}\n <span className=\"min-w-0 flex-1 text-base text-foreground\">\n {tab.label}\n </span>\n {tab.trailing}\n <ChevronRightIcon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetBody>\n )}\n </div>\n </BottomSheet>\n );\n}\n","\"use client\";\n\n// useScrollFade — ported verbatim from matrx-frontend\n// `components/official/scroll-fade/useScrollFade.ts` (S21).\n//\n// \"There is more below\" — told to the eye, not to nobody.\n//\n// A scroll container that simply hard-clips its last row reads as FINISHED.\n// The user never scrolls, because nothing suggested there was anything to\n// scroll to. A soft fade at the overflowing edge is the standard cue, and it\n// must appear ONLY on the edges that actually overflow — a permanent fade on a\n// non-scrolling list just makes the last item look broken.\n//\n// Attach `ref` to the scrolling element and spread `fadeProps`. Styling is\n// host-owned CSS (the `.matrx-scroll-fade` class in the host's globals.css),\n// keyed off the data attributes.\n//\n// The ref is a CALLBACK ref, not a useRef object, on purpose: these containers\n// are usually mounted conditionally (a popover body, a lazily-resolved menu),\n// so an effect that reads `ref.current` on mount finds null and — with no\n// dependency that ever changes — never runs again. The fade then silently\n// never appears, which is exactly the failure this hook exists to prevent.\n//\n// TWO RULES THE CALLBACK MUST OBEY (both learned the hard way — breaking\n// either one produced \"Maximum update depth exceeded\" on a page of 13 menus):\n// 1. NEVER setState synchronously inside the callback. Radix composes our\n// ref with its own via useComposedRefs, whose identity changes every render,\n// so the ref detaches+reattaches on every commit. A synchronous setState\n// there re-renders, which re-attaches, which sets state again — forever.\n// Measurement is always deferred to rAF.\n// 2. NEVER setState on detach (node === null). A detach/attach pair would\n// otherwise flip the fade off and on and drive the same loop.\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface ScrollFadeState {\n top: boolean;\n bottom: boolean;\n}\n\nexport interface UseScrollFadeResult {\n ref: (node: HTMLElement | null) => void;\n fadeProps: {\n \"data-fade-top\": \"\" | undefined;\n \"data-fade-bottom\": \"\" | undefined;\n className: string;\n };\n state: ScrollFadeState;\n}\n\n/** Slack below which we treat the edge as reached (sub-pixel scroll math). */\nconst EPSILON = 2;\n\nexport function useScrollFade(): UseScrollFadeResult {\n const [state, setState] = useState<ScrollFadeState>({\n top: false,\n bottom: false,\n });\n const nodeRef = useRef<HTMLElement | null>(null);\n const cleanupRef = useRef<(() => void) | null>(null);\n\n const measure = useCallback(() => {\n const el = nodeRef.current;\n if (!el) return;\n const overflowing = el.scrollHeight - el.clientHeight > EPSILON;\n const next: ScrollFadeState = {\n top: overflowing && el.scrollTop > EPSILON,\n bottom:\n overflowing &&\n el.scrollTop + el.clientHeight < el.scrollHeight - EPSILON,\n };\n setState((prev) =>\n prev.top === next.top && prev.bottom === next.bottom ? prev : next,\n );\n }, []);\n\n const ref = useCallback(\n (node: HTMLElement | null) => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n nodeRef.current = node;\n // Rule 2: no state change on detach.\n if (!node) return;\n\n node.addEventListener(\"scroll\", measure, { passive: true });\n // Content can arrive after mount (lazy menu configs, async lists) and the\n // box can be resized by the viewport, so watch both.\n const ro = new ResizeObserver(measure);\n ro.observe(node);\n const mo = new MutationObserver(measure);\n mo.observe(node, { childList: true, subtree: true });\n\n cleanupRef.current = () => {\n node.removeEventListener(\"scroll\", measure);\n ro.disconnect();\n mo.disconnect();\n };\n\n // Rule 1: deferred, never synchronous. Radix also animates the panel in,\n // so its final height is not known on the frame it mounts anyway.\n requestAnimationFrame(measure);\n },\n [measure],\n );\n\n useEffect(() => () => cleanupRef.current?.(), []);\n\n return {\n ref,\n state,\n fadeProps: {\n \"data-fade-top\": state.top ? \"\" : undefined,\n \"data-fade-bottom\": state.bottom ? \"\" : undefined,\n className: \"matrx-scroll-fade\",\n },\n };\n}\n"],"mappings":";;;AAAA,SAAS,WAA8B;;;ACAvC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AD2BS;AA3BF,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aAAa;AAAA,QACb,SAAS;AAAA,QACT,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAMO,SAAS,MAAM,EAAE,WAAW,SAAS,GAAG,MAAM,GAAe;AAClE,SAAO,oBAAC,UAAK,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAI,GAAG,OAAO;AAChF;;;AERA,SAAS,sBAAsB;AAC/B,YAAYA,YAAW;AACvB,SAAS,UAAU,uBAAuB;;;ACMpC,gBAAAC,MA0BF,YA1BE;AAlBN,SAAS,YAAY,OAAsD;AACzE,SAAO;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,GAAG;AAAA,EACL;AACF;AAGO,SAAS,YAAY,OAAkB;AAC5C,SACE,gBAAAA,KAAC,SAAK,GAAG,YAAY,KAAK,GACxB,0BAAAA,KAAC,UAAK,GAAE,+BAA8B,GACxC;AAEJ;AAGO,SAAS,gBAAgB,OAAkB;AAChD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CAAC;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB,MAAM,MAAM,KAAK;AAAA,MAClC,oBAAoB,MAAM,SAAS,KAAK;AAAA,MACxC,WAAW;AAAA,IACb;AAAA,EACF;AACF;","names":["React","jsx","jsx","jsx","jsxs","cva","React","jsx","cva","React","React","jsx","jsx","jsxs","useState","React","jsx","jsx","jsxs","useState","Icon","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","result","React","jsx","jsxs","React","jsx","useRef","useState","jsx","jsxs","Icon","useRef","useState","jsx","jsxs","jsx","cva","React","jsx","jsxs","cva","React","jsx","Separator","cva","React","jsx","jsxs","cva","jsx","useState","jsx","jsxs","useState","Icon","useCallback","useEffect","useRef","useState"]}