@exegia/corpora-ui 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist-lib/components/blocks/shell/animated-panel-provider.d.ts +1 -1
  2. package/dist-lib/components/blocks/shell/shell-layout.d.ts +1 -1
  3. package/dist-lib/components/blocks/shell/type.d.ts +21 -1
  4. package/dist-lib/components/icons/__tests__/icons.test.d.ts +1 -0
  5. package/dist-lib/components/icons/file-badge-cfm.d.ts +7 -0
  6. package/dist-lib/components/icons/file-badge-corpus.d.ts +7 -0
  7. package/dist-lib/components/icons/file-badge-pdf.d.ts +7 -0
  8. package/dist-lib/components/icons/file-badge-tei.d.ts +7 -0
  9. package/dist-lib/components/icons/file-badge-tf.d.ts +7 -0
  10. package/dist-lib/components/icons/file-badge-txt.d.ts +7 -0
  11. package/dist-lib/components/icons/file-badge-xml.d.ts +7 -0
  12. package/dist-lib/components/icons/file-wordmark-cfm.d.ts +7 -0
  13. package/dist-lib/components/icons/file-wordmark-corpus.d.ts +7 -0
  14. package/dist-lib/components/icons/file-wordmark-pdf.d.ts +7 -0
  15. package/dist-lib/components/icons/file-wordmark-tei.d.ts +7 -0
  16. package/dist-lib/components/icons/file-wordmark-tf.d.ts +7 -0
  17. package/dist-lib/components/icons/file-wordmark-txt.d.ts +7 -0
  18. package/dist-lib/components/icons/file-wordmark-xml.d.ts +7 -0
  19. package/dist-lib/components/icons/index.d.ts +15 -0
  20. package/dist-lib/components/icons/types.d.ts +7 -0
  21. package/dist-lib/index.d.ts +1 -0
  22. package/dist-lib/index.js +9134 -1920
  23. package/dist-lib/index.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/blocks/shell/__tests__/shell-layout.test.tsx +65 -0
  26. package/src/components/blocks/shell/animated-panel-provider.tsx +2 -0
  27. package/src/components/blocks/shell/shell-layout.tsx +28 -16
  28. package/src/components/blocks/shell/type.ts +22 -0
  29. package/src/components/blocks/shell/use-shell-panels.ts +30 -1
  30. package/src/components/icons/README.md +91 -0
  31. package/src/components/icons/__tests__/icons.test.tsx +58 -0
  32. package/src/components/icons/file-badge-cfm.tsx +615 -0
  33. package/src/components/icons/file-badge-corpus.tsx +604 -0
  34. package/src/components/icons/file-badge-pdf.tsx +570 -0
  35. package/src/components/icons/file-badge-tei.tsx +524 -0
  36. package/src/components/icons/file-badge-tf.tsx +620 -0
  37. package/src/components/icons/file-badge-txt.tsx +607 -0
  38. package/src/components/icons/file-badge-xml.tsx +576 -0
  39. package/src/components/icons/file-wordmark-cfm.tsx +424 -0
  40. package/src/components/icons/file-wordmark-corpus.tsx +454 -0
  41. package/src/components/icons/file-wordmark-pdf.tsx +470 -0
  42. package/src/components/icons/file-wordmark-tei.tsx +424 -0
  43. package/src/components/icons/file-wordmark-tf.tsx +406 -0
  44. package/src/components/icons/file-wordmark-txt.tsx +421 -0
  45. package/src/components/icons/file-wordmark-xml.tsx +424 -0
  46. package/src/components/icons/index.ts +16 -0
  47. package/src/components/icons/types.ts +8 -0
  48. package/src/index.ts +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lib/utils.ts","../src/components/ui/avatar.tsx","../src/components/ui/spinner.tsx","../src/components/ui/glasscn/liquid-glass.tsx","../src/lib/glass-variants.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/lib/sound.ts","../src/components/ui/checkbox.tsx","../src/components/ui/field.tsx","../src/components/ui/frame.tsx","../src/components/ui/input.tsx","../src/components/ui/textarea.tsx","../src/components/ui/input-group.tsx","../src/components/ui/label.tsx","../src/components/ui/menu.tsx","../src/components/ui/separator.tsx","../src/components/ui/otp-field.tsx","../src/components/ui/skeleton.tsx","../src/lib/ease.ts","../src/components/user-avatar/utils.ts","../src/components/user-avatar/fallback.tsx","../src/components/user-avatar/presence-badge.tsx","../src/components/user-avatar/user-avatar-atom.ts","../src/components/user-avatar/use-user-avatar.ts","../src/components/user-avatar/component.tsx","../src/components/user-avatar/use-user-avatar-state.ts","../src/components/composed/logo.tsx","../src/components/composed/password-input.tsx","../src/components/composed/social-providers.tsx","../src/components/ui/tooltip.tsx","../src/components/composed/tree/tree-context.ts","../src/components/composed/tree/constants.ts","../src/components/composed/tree/utils.ts","../src/components/composed/tree/tree-atom.ts","../src/components/composed/tree/tree-node.tsx","../src/components/composed/tree/use-tree-dnd.ts","../src/components/composed/tree/use-tree.ts","../src/components/composed/tree/tree.tsx","../src/components/composed/tree/use-tree-state.ts","../src/lib/auth-accent.ts","../src/components/blocks/auth/auth-shell.tsx","../src/components/blocks/auth/code-auth-block.tsx","../src/components/blocks/auth/forgot-password-block.tsx","../src/components/blocks/auth/login-block.tsx","../src/components/blocks/auth/onboarding/profile-step.tsx","../src/components/blocks/auth/onboarding-block.tsx","../src/components/blocks/auth/signup-block.tsx","../src/components/blocks/auth/update-password-block.tsx","../src/components/blocks/auth/auth-session-atom.ts","../src/components/blocks/auth/auth-flow-atom.ts","../src/components/blocks/auth/use-auth-state.ts","../src/components/blocks/auth/auth-flow-block.tsx","../src/components/blocks/auth/linked-accounts-block.tsx","../src/components/blocks/auth/passkey-manager-block.tsx","../src/components/blocks/auth/passkey-sign-in-block.tsx","../src/components/blocks/nav/sidebar/utils.ts","../src/components/blocks/nav/sidebar/ai-sidebar-atom.ts","../src/components/blocks/nav/sidebar/use-ai-sidebar.ts","../src/components/blocks/nav/sidebar/sidebar-context.ts","../src/components/blocks/nav/sidebar/sidebar-icon.tsx","../src/components/blocks/nav/sidebar/marquee-label.tsx","../src/components/motion/popover-position.ts","../src/components/motion/popover-morph.tsx","../src/components/blocks/nav/sidebar/sidebar-row.tsx","../src/components/blocks/nav/sidebar/ai-sidebar.tsx","../src/components/blocks/nav/sidebar/use-ai-sidebar-state.ts","../src/components/blocks/nav/sidebar/index.ts","../src/components/blocks/shell/utils.ts","../src/components/blocks/shell/animated-panel.tsx","../src/components/blocks/shell/shell-metrics.ts","../src/components/blocks/shell/shell-fit-atom.ts","../src/components/blocks/shell/use-shell-fit.ts","../src/components/blocks/shell/animated-panel-provider.tsx","../src/components/blocks/shell/animated-panel-trigger.tsx","../src/components/blocks/shell/animated-panel-inset.tsx","../src/components/blocks/shell/shell-layout.tsx","../src/components/blocks/shell/use-shell-panels.ts","../src/components/blocks/shell/use-shell-fit-state.ts","../src/components/blocks/scaffold/constants.ts","../src/components/blocks/scaffold/utils.ts","../src/components/blocks/scaffold/panel-close-button.tsx","../src/components/ui/button-group.tsx","../src/components/ui/glasscn/glass-button-group.tsx","../src/lib/hooks/use-hover-capable.ts","../src/components/blocks/scaffold/panel-menu-button.tsx","../src/components/blocks/scaffold/scaffold-atom.ts","../src/components/blocks/scaffold/scaffold-context.ts","../src/components/blocks/scaffold/scaffold-actions.tsx","../src/components/blocks/scaffold/scaffold-canvas.tsx","../src/components/ui/glasscn/glass-container.tsx","../src/components/blocks/scaffold/scaffold-inspector.tsx","../src/components/blocks/scaffold/scaffold-main.tsx","../src/components/blocks/scaffold/scaffold-sub-panel.tsx","../src/components/blocks/scaffold/scaffold-panel.tsx","../src/components/blocks/scaffold/scaffold-root.tsx","../src/components/blocks/scaffold/scaffold-sidebar.tsx","../src/components/blocks/scaffold/scaffold-tab.tsx","../src/components/blocks/scaffold/use-scaffold.ts","../src/components/blocks/scaffold/use-scaffold-state.ts","../src/components/blocks/scaffold/index.ts","../src/components/blocks/layout.ts","../src/components/blocks/profile/profile-card-atom.ts","../src/components/blocks/profile/use-profile-card.ts","../src/components/blocks/profile/profile-card-block.tsx","../src/components/blocks/profile/use-profile-card-state.ts","../src/components/motion/shared-layout-bg.tsx","../src/components/theme-provider.tsx","../src/state/store.ts","../src/state/exegia-provider.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\";\n\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Avatar({\n className,\n ...props\n}: AvatarPrimitive.Root.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Root\n className={cn(\n \"inline-flex size-8 shrink-0 select-none items-center justify-center overflow-hidden rounded-full bg-background align-middle font-medium text-xs\",\n className,\n )}\n data-slot=\"avatar\"\n {...props}\n />\n );\n}\n\nexport function AvatarImage({\n className,\n ...props\n}: AvatarPrimitive.Image.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Image\n className={cn(\"size-full object-cover\", className)}\n data-slot=\"avatar-image\"\n {...props}\n />\n );\n}\n\nexport function AvatarFallback({\n className,\n ...props\n}: AvatarPrimitive.Fallback.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Fallback\n className={cn(\n \"flex size-full items-center justify-center rounded-full bg-muted\",\n className,\n )}\n data-slot=\"avatar-fallback\"\n {...props}\n />\n );\n}\n\nexport { AvatarPrimitive };\n","import { Loader2Icon } from \"lucide-react\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Spinner({\n className,\n ...props\n}: React.ComponentProps<typeof Loader2Icon>): React.ReactElement {\n return (\n <Loader2Icon\n aria-label=\"Loading\"\n className={cn(\"animate-spin\", className)}\n role=\"status\"\n {...props}\n />\n );\n}\n","\"use client\"\n\nimport {\n type CSSProperties,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype MapGeometry = {\n width: number // element width, CSS px, integer\n height: number // element height, CSS px, integer\n radius: number // corner radius, CSS px, already clamped to min(width, height) / 2\n bezel: number // fraction (0..1] of the half-min-dimension used as the refractive band\n}\n\nconst MAX_TEXTURE_SIZE = 480\nconst EDGE_TAPER_PX = 1.25\n\nconst displacementMapCache = new Map<string, string>()\n\n// CSS.supports(\"backdrop-filter\", \"url(#f)\") returns true in Safari and\n// Firefox (they parse the value) but neither browser actually renders SVG\n// filters through backdrop-filter. UA sniffing is the only reliable approach.\n// When WebKit ships support (track WebKit bug 245510), loosen this function.\nfunction supportsSvgBackdropFilter() {\n if (typeof navigator === \"undefined\") return false\n const ua = navigator.userAgent\n const isChromium = /Chrom(e|ium)/.test(ua) || /Edg\\//.test(ua)\n return isChromium && !/Firefox/.test(ua)\n}\n\n// NOTE: Per-corner radii and percentage radii are NOT supported. The map\n// reads only borderTopLeftRadius in px. If a future consumer needs\n// asymmetric corners, extend the corner SDF branch to accept four radii.\n//\n// NOTE: Map regeneration renders a ≤480 px texture and encodes a PNG for\n// each unique (width, height, radius, bezel). Continuously animating the\n// element's SIZE will thrash the cache; animate transform: scale instead.\nfunction createDisplacementMap({ width, height, radius, bezel }: MapGeometry) {\n const cacheKey = `${width}:${height}:${radius}:${bezel}`\n const cached = displacementMapCache.get(cacheKey)\n if (cached !== undefined) return cached\n\n const downscale = Math.min(1, MAX_TEXTURE_SIZE / Math.max(width, height))\n const texWidth = Math.max(2, Math.round(width * downscale))\n const texHeight = Math.max(2, Math.round(height * downscale))\n\n const canvas = document.createElement(\"canvas\")\n canvas.width = texWidth\n canvas.height = texHeight\n const ctx = canvas.getContext(\"2d\")\n if (!ctx) return \"\"\n\n const image = ctx.createImageData(texWidth, texHeight)\n const data = image.data\n const halfWidth = width / 2\n const halfHeight = height / 2\n const r = Math.min(radius, halfWidth, halfHeight)\n const bezelPx = Math.max(1, bezel * Math.min(halfWidth, halfHeight))\n\n for (let ty = 0; ty < texHeight; ty += 1) {\n for (let tx = 0; tx < texWidth; tx += 1) {\n // Texel center in element coordinates, origin at element center.\n const px = ((tx + 0.5) / texWidth) * width - halfWidth\n const py = ((ty + 0.5) / texHeight) * height - halfHeight\n\n // Signed distance + outward normal of the rounded-rectangle contour.\n const qx = Math.abs(px) - (halfWidth - r)\n const qy = Math.abs(py) - (halfHeight - r)\n let signedDistance: number\n let dirX = 0\n let dirY = 0\n if (qx > 0 && qy > 0) {\n const len = Math.hypot(qx, qy)\n signedDistance = len - r\n dirX = (Math.sign(px) * qx) / len\n dirY = (Math.sign(py) * qy) / len\n } else if (qx > qy) {\n signedDistance = qx - r\n dirX = Math.sign(px)\n } else {\n signedDistance = qy - r\n dirY = Math.sign(py)\n }\n\n const index = (ty * texWidth + tx) * 4\n const inside = -signedDistance // px from the contour, positive inside\n\n if (inside <= 0) {\n data[index] = 128\n data[index + 1] = 128\n data[index + 2] = 128\n data[index + 3] = 255\n continue\n }\n\n const t = Math.min(1, inside / bezelPx) // 0 at the edge → 1 at the bezel's inner end\n let magnitude = 1 - convexSquircle(t) // max refraction at the edge, optically flat interior\n magnitude *= Math.min(1, inside / EDGE_TAPER_PX) // avoid sampling artifacts on the outermost pixels\n\n data[index] = Math.round(128 + dirX * magnitude * 127)\n data[index + 1] = Math.round(128 + dirY * magnitude * 127)\n data[index + 2] = 128\n data[index + 3] = 255\n }\n }\n\n ctx.putImageData(image, 0, 0)\n const mapUrl = canvas.toDataURL(\"image/png\")\n displacementMapCache.set(cacheKey, mapUrl)\n return mapUrl\n}\n\nfunction convexSquircle(x: number) {\n return Math.pow(1 - Math.pow(1 - x, 4), 0.25)\n}\n\nexport type LiquidGlassProps = HTMLAttributes<HTMLDivElement> & {\n /** Extra blur mixed into the backdrop-filter after the SVG refraction. */\n blur?: number\n /** SVG displacement strength. Higher values bend the sampled backdrop more. */\n refraction?: number\n /**\n * @deprecated Texture size now derives from element size. Accepted for\n * backwards-compatibility but has no effect.\n */\n mapSize?: number\n /** Fraction of the radius used as the curved edge where most refraction happens. */\n bezel?: number\n /** Backdrop saturation. */\n saturation?: number\n}\n\nexport const LiquidGlass = forwardRef<HTMLDivElement, LiquidGlassProps>(\n function LiquidGlass(\n {\n blur = 2,\n refraction = 15,\n mapSize: _mapSize,\n bezel = 0.34,\n saturation = 1.28,\n className,\n style,\n children,\n ...props\n },\n ref\n ) {\n const rawId = useId()\n const filterId = useMemo(\n () => `liquid-glass-${rawId.replace(/:/g, \"\")}`,\n [rawId]\n )\n\n // -------------------------------------------------------------------------\n // Ref merge — we need the DOM node to measure geometry while still\n // forwarding the ref to the consumer.\n // -------------------------------------------------------------------------\n\n const localRef = useRef<HTMLDivElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node\n if (typeof ref === \"function\") ref(node)\n else if (ref) ref.current = node\n },\n [ref]\n )\n\n // -------------------------------------------------------------------------\n // Geometry measurement via ResizeObserver\n // -------------------------------------------------------------------------\n\n const [geometry, setGeometry] = useState<MapGeometry | null>(null)\n\n useEffect(() => {\n const el = localRef.current\n if (!el) return\n const measure = () => {\n const rect = el.getBoundingClientRect()\n const width = Math.round(rect.width)\n const height = Math.round(rect.height)\n if (!width || !height) return\n const parsed = Number.parseFloat(\n getComputedStyle(el).borderTopLeftRadius\n )\n const radius = Math.min(\n Number.isFinite(parsed) ? parsed : Math.min(width, height) / 2,\n width / 2,\n height / 2\n )\n setGeometry((prev) =>\n prev &&\n prev.width === width &&\n prev.height === height &&\n prev.radius === radius &&\n prev.bezel === bezel\n ? prev\n : { width, height, radius, bezel }\n )\n }\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(el)\n return () => observer.disconnect()\n }, [bezel])\n\n const mapUrl = useMemo(\n () => (geometry ? createDisplacementMap(geometry) : \"\"),\n [geometry]\n )\n\n // -------------------------------------------------------------------------\n // Browser capability gate\n //\n // Both SSR and the first client render take the fallback branch so hydration\n // never mismatches. The state is set in an effect (client-only).\n // -------------------------------------------------------------------------\n\n const [supported, setSupported] = useState(false)\n\n useEffect(() => {\n setSupported(supportsSvgBackdropFilter())\n }, [])\n\n const refractionActive = supported && mapUrl !== \"\"\n const backdropFilter = refractionActive\n ? `url(#${filterId}) blur(${blur}px) saturate(${saturation})`\n : `blur(${blur + 2}px) saturate(${saturation})`\n\n return (\n <>\n <div\n ref={setRefs}\n className={cn(\n \"relative overflow-hidden rounded-full bg-white/[0.08]\",\n className\n )}\n style={\n {\n ...style,\n backdropFilter,\n WebkitBackdropFilter: backdropFilter,\n } as CSSProperties\n }\n {...props}\n >\n {children}\n <span\n aria-hidden\n className=\"pointer-events-none absolute inset-0 rounded-[inherit]\"\n style={{\n // Rim thickness, overridable per-consumer via --liquid-glass-rim-width.\n padding: \"var(--liquid-glass-rim-width, 0.5px)\",\n background:\n // iOS 27 liquid-glass rim. Each gradient runs ALONG its edges and\n // fades to nothing at the corners, uniform in between:\n // - to right → white streak on the top + bottom runs\n // - to bottom → dark streak on the left + right runs\n // Streak colors are overridable per-consumer via the\n // --liquid-glass-rim-light / --liquid-glass-rim-dark variables;\n // --liquid-glass-rim-fade sets how far from each corner the\n // streak takes to reach full strength (smaller = longer streak).\n \"linear-gradient(to right, rgba(255,255,255,0), var(--liquid-glass-rim-light, rgba(255,255,255,0.25)) var(--liquid-glass-rim-fade, 18%), var(--liquid-glass-rim-light, rgba(255,255,255,0.25)) calc(100% - var(--liquid-glass-rim-fade, 18%)), rgba(255,255,255,0)), \" +\n \"linear-gradient(to bottom, rgba(0,0,0,0), var(--liquid-glass-rim-dark, rgba(0,0,0,0.2)) var(--liquid-glass-rim-fade, 18%), var(--liquid-glass-rim-dark, rgba(0,0,0,0.2)) calc(100% - var(--liquid-glass-rim-fade, 18%)), rgba(0,0,0,0))\",\n WebkitMask:\n \"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\",\n WebkitMaskComposite: \"xor\",\n mask: \"linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0)\",\n }}\n />\n </div>\n\n {refractionActive && (\n <svg className=\"absolute size-0 overflow-hidden\" aria-hidden>\n <filter\n id={filterId}\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feImage\n href={mapUrl}\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n preserveAspectRatio=\"none\"\n result=\"map\"\n />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"map\"\n scale={refraction}\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n result=\"displaced\"\n />\n <feGaussianBlur in=\"displaced\" stdDeviation=\"0.15\" />\n </filter>\n </svg>\n )}\n </>\n )\n }\n)\n","export type FrostGlassVariant = \"clear\" | \"frosted\" | \"subtle\" | \"liquid\" | \"liquid-refract\";\nexport type FrostGlassVariantProp = { glassVariant?: FrostGlassVariant };\n\nexport const liquidRefractStyles = \"bg-transparent border-0 shadow-none\";\n\nexport const glassVariantStyles: Record<FrostGlassVariant, string> = {\n clear: [\n \"backdrop-blur-[2px] backdrop-saturate-[1.9]\",\n \"bg-white/[0.25] dark:bg-black/[0.25]\",\n \"border border-white/[0.5] dark:border-white/[0.12]\",\n \"shadow-[0_1px_12px_rgba(0,0,0,0.05)] dark:shadow-[0_1px_12px_rgba(0,0,0,0.2)]\",\n ].join(\" \"),\n frosted: [\n \"backdrop-blur-[16px] backdrop-saturate-[1.6]\",\n \"bg-white/[0.55] dark:bg-black/[0.35]\",\n \"border border-white/[0.4] dark:border-white/10\",\n \"shadow-[0_2px_20px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_20px_rgba(0,0,0,0.3)]\",\n ].join(\" \"),\n subtle: [\n \"backdrop-blur-[4px] backdrop-saturate-[1.5]\",\n \"bg-white/[0.3] dark:bg-white/[0.06]\",\n \"border border-black/[0.05] dark:border-white/[0.08]\",\n \"shadow-sm\",\n ].join(\" \"),\n liquid: [\n // 1) Refractive backdrop — lighter than frosted so the background reads\n // clearly through the lens; saturation + brightness lift makes it bloom.\n \"backdrop-blur-[12px] backdrop-saturate-[1.8] backdrop-brightness-[1.05]\",\n \"dark:backdrop-saturate-[1.6] dark:backdrop-brightness-[0.95]\",\n\n // 2) Base translucent fill (acts as the panel's \"tint\").\n \"bg-white/[0.10] dark:bg-white/[0.04]\",\n\n // 3) Layered radial-gradient sheen + warm bottom tint + vertical wash.\n // Underscores represent spaces inside Tailwind arbitrary values.\n \"[background-image:radial-gradient(120%_85%_at_15%_8%,rgba(255,255,255,0.55)_0%,rgba(255,255,255,0.18)_38%,rgba(255,255,255,0)_70%),radial-gradient(110%_80%_at_85%_100%,rgba(255,210,230,0.22)_0%,rgba(255,255,255,0)_60%),linear-gradient(180deg,rgba(255,255,255,0.28)_0%,rgba(255,255,255,0.12)_100%)]\",\n \"dark:[background-image:radial-gradient(120%_85%_at_15%_8%,rgba(255,255,255,0.18)_0%,rgba(255,255,255,0.05)_40%,rgba(255,255,255,0)_70%),radial-gradient(110%_80%_at_85%_100%,rgba(120,170,255,0.12)_0%,rgba(0,0,0,0)_60%),linear-gradient(180deg,rgba(255,255,255,0.06)_0%,rgba(0,0,0,0.18)_100%)]\",\n \"[background-size:200%_200%,180%_180%,100%_100%]\",\n \"[background-repeat:no-repeat]\",\n\n // 4) Multi-layer bevel:\n // - inset top hairline highlight (light-from-above)\n // - inset fish-eye glow at the bottom (lensing artifact)\n // - thin inset side rails\n // - outer contact shadow + broader halo (panel feels floating)\n \"shadow-[inset_0_1px_0_0_rgba(255,255,255,0.65),inset_0_-12px_24px_-10px_rgba(255,255,255,0.45),inset_1px_0_0_0_rgba(255,255,255,0.22),inset_-1px_0_0_0_rgba(255,255,255,0.18),0_24px_60px_-18px_rgba(15,23,42,0.30),0_8px_24px_-8px_rgba(15,23,42,0.18)]\",\n \"dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.30),inset_0_-14px_28px_-10px_rgba(180,210,255,0.18),inset_1px_0_0_0_rgba(255,255,255,0.10),inset_-1px_0_0_0_rgba(255,255,255,0.08),0_28px_70px_-18px_rgba(0,0,0,0.55),0_10px_28px_-10px_rgba(0,0,0,0.40)]\",\n\n // 5) Hairline border for the chamfer's outer edge.\n \"border border-white/[0.45] dark:border-white/[0.10]\",\n\n // 6) Slow ambient drift; respects prefers-reduced-motion.\n \"animate-[liquid-drift_18s_ease-in-out_infinite] motion-reduce:animate-none\",\n \"[will-change:background-position]\",\n ].join(\" \"),\n \"liquid-refract\": \"\",\n};\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Spinner } from \"@/components/ui/spinner\";\nimport { LiquidGlass } from \"@/components/ui/glasscn/liquid-glass\";\nimport {\n type FrostGlassVariant,\n glassVariantStyles,\n liquidRefractStyles,\n} from \"@/lib/glass-variants\";\n\nexport const buttonVariants = cva(\n \"relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-[scale,box-shadow,width,height,background-color,border-color] [transition-duration:150ms,150ms,300ms,300ms,150ms,150ms] ease-smooth-out active:scale-97 data-pressed:scale-97 motion-reduce:transition-none motion-reduce:active:scale-100 motion-reduce:data-pressed:scale-100 [&_svg]:transition-transform [&_svg]:duration-150 [&_svg]:ease-smooth-out motion-reduce:[&_svg]:transition-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-loading:select-none sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0\",\n {\n compoundVariants: [\n {\n // `link` is inline text, not a control surface: drop the button box so\n // it sits with the surrounding copy instead of riding high in a 32/36px\n // flex box. Both the bare and `sm:` heights have to be reset —\n // tailwind-merge keeps modifier-prefixed classes in a separate group,\n // so a call-site `h-auto` alone still loses to `sm:h-8`. border-0 makes\n // the inline box exactly one line-height so it doesn't grow the line.\n //\n // align-middle is the alignment that holds: an inline-flex box exposes\n // the baseline of its *first* flex item, which here is the always-\n // mounted loading indicator rather than the label, so plain baseline\n // alignment leaves the text ~3px high. `items-baseline` fixes that but\n // then hangs icons 3px above the label. Centering the box lands within\n // ~1px in every state without touching the loading-morph machinery.\n //\n // Icon sizes are excluded; they keep their square hit area.\n class: \"h-auto border-0 px-0 align-middle sm:h-auto\",\n size: [\"xs\", \"sm\", \"default\", \"lg\", \"xl\"],\n variant: \"link\",\n },\n ],\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n default: \"h-9 px-[calc(--spacing(3)-1px)] sm:h-8\",\n icon: \"size-9 sm:size-8\",\n \"icon-lg\": \"size-8 sm:size-8\",\n \"icon-sm\": \"size-7 sm:size-6\",\n \"icon-xl\":\n \"size-10 sm:size-9 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n \"icon-xs\":\n \"size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9\",\n sm: \"h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7\",\n xl: \"h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n xs: \"h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5\",\n },\n variant: {\n default:\n \"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n destructive:\n \"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n \"destructive-outline\":\n \"border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n ghost:\n \"border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground\",\n // Base for the glass treatment. The finish itself (blur, tint, bevel)\n // comes from glassVariantStyles keyed by the `glassVariant` prop,\n // which is only accepted when variant is \"glass\".\n glass:\n \"border-transparent text-foreground *:data-[slot=button-loading-indicator]:text-foreground\",\n link: \"border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground\",\n outline:\n \"border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80\",\n },\n },\n },\n);\n\ntype ButtonVariant = VariantProps<typeof buttonVariants>[\"variant\"];\n\ninterface ButtonBaseProps extends useRender.ComponentProps<\"button\"> {\n size?: VariantProps<typeof buttonVariants>[\"size\"];\n loading?: boolean;\n /**\n * Emit cuelume press/release attributes. Inert unless the app opts into\n * interaction sound by calling `bindSounds()` once.\n */\n sound?: boolean;\n}\n\nexport type ButtonProps = ButtonBaseProps &\n (\n | {\n variant: \"glass\";\n /** Glass finish. Only available when `variant` is \"glass\". */\n glassVariant?: FrostGlassVariant;\n }\n | {\n variant?: Exclude<ButtonVariant, \"glass\">;\n glassVariant?: never;\n }\n );\n\nexport function Button({\n className,\n variant,\n size,\n render,\n children,\n loading = false,\n disabled: disabledProp,\n glassVariant,\n sound = true,\n ...props\n}: ButtonProps): React.ReactElement {\n const isDisabled: boolean = Boolean(loading || disabledProp);\n const typeValue: React.ButtonHTMLAttributes<HTMLButtonElement>[\"type\"] =\n render ? undefined : \"button\";\n\n const resolvedGlassVariant: FrostGlassVariant | undefined =\n variant === \"glass\" ? (glassVariant ?? \"liquid-refract\") : undefined;\n const isLiquidRefract = resolvedGlassVariant === \"liquid-refract\";\n\n // Icon-only sizes overlay the spinner on top of the (hidden) icon; text\n // sizes keep the label visible and show the spinner inline before it.\n const isIconSize = (size ?? \"default\").startsWith(\"icon\");\n\n const defaultProps = {\n children: (\n <>\n {!isIconSize && (\n // Always mounted so the button width morphs as the slot collapses\n // and expands; the closed state cancels the flex gap (which varies\n // per size) with a matching negative margin.\n <span\n aria-hidden={loading ? undefined : true}\n data-slot=\"button-loading-indicator\"\n className={cn(\n \"pointer-events-none inline-flex shrink-0 items-center overflow-hidden transition-[max-width,margin-inline-start,opacity,filter] duration-300 ease-smooth-out motion-reduce:transition-none\",\n loading\n ? \"max-w-6\"\n : cn(\n \"max-w-0 opacity-0 blur-[2px]\",\n size === \"xs\" ? \"-ms-1\" : size === \"sm\" ? \"-ms-1.5\" : \"-ms-2\",\n ),\n )}\n >\n <Spinner className={loading ? undefined : \"animate-none\"} />\n </span>\n )}\n {children}\n {loading && isIconSize && (\n <Spinner\n className=\"pointer-events-none absolute\"\n data-slot=\"button-loading-indicator\"\n />\n )}\n </>\n ),\n className: cn(\n buttonVariants({ size, variant }),\n // Label + icon buttons: icons do a gentle scale bump on hover. The\n // class-based :not() skips the spinner (animate-spin / animate-none).\n !isIconSize &&\n \"hover:[&_svg:not([class*='animate-'])]:scale-110 motion-reduce:hover:[&_svg]:scale-100\",\n loading && isIconSize && \"data-loading:text-transparent\",\n resolvedGlassVariant && glassVariantStyles[resolvedGlassVariant],\n isLiquidRefract && liquidRefractStyles,\n className,\n ),\n \"aria-disabled\": loading || undefined,\n \"data-cuelume-press\": sound ? \"\" : undefined,\n \"data-cuelume-release\": sound ? \"\" : undefined,\n \"data-loading\": loading ? \"\" : undefined,\n \"data-glass-variant\": resolvedGlassVariant,\n \"data-slot\": \"button\",\n disabled: isDisabled,\n type: typeValue,\n };\n\n const element = useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(defaultProps, props),\n render,\n });\n\n // liquid-refract delegates the finish to the LiquidGlass wrapper, which\n // renders the SVG-displacement backdrop behind an unstyled button.\n if (isLiquidRefract) {\n return <LiquidGlass>{element}</LiquidGlass>;\n }\n\n return element;\n}\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Card({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ),\n \"data-slot\": \"card\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrame({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=card]:first:[--clip-top:1px]\",\n className,\n ),\n \"data-slot\": \"card-frame\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameHeader({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex grid auto-rows-min grid-rows-[auto_auto] flex-col items-start gap-x-4 px-6 py-4 has-data-[slot=card-frame-action]:grid-cols-[1fr_auto]\",\n className,\n ),\n \"data-slot\": \"card-frame-header\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameTitle({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"self-center font-semibold text-sm\", className),\n \"data-slot\": \"card-frame-title\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameDescription({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"self-center text-muted-foreground text-sm\", className),\n \"data-slot\": \"card-frame-description\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"col-start-2 nth-3:row-span-2 nth-3:row-start-1 inline-flex self-center justify-self-end\",\n className,\n ),\n \"data-slot\": \"card-frame-action\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameFooter({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"px-6 py-4\", className),\n \"data-slot\": \"card-frame-footer\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardHeader({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]\",\n className,\n ),\n \"data-slot\": \"card-header\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardTitle({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"font-heading font-semibold text-lg leading-none\", className),\n \"data-slot\": \"card-title\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardDescription({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"text-muted-foreground text-sm\", className),\n \"data-slot\": \"card-description\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"col-start-2 row-span-2 row-start-1 inline-flex self-start justify-self-end\",\n className,\n ),\n \"data-slot\": \"card-action\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardPanel({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0\",\n className,\n ),\n \"data-slot\": \"card-panel\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFooter({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"flex items-center p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pt-4\",\n className,\n ),\n \"data-slot\": \"card-footer\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport { CardPanel as CardContent };\n","/**\n * Interaction sound for the library, powered by cuelume (Web Audio synthesis,\n * zero runtime deps, SSR-safe).\n *\n * Components only emit inert `data-cuelume-*` attributes — nothing plays\n * until the consuming app opts in once:\n *\n * import { bindSounds } from \"@corpora/ui\"\n * bindSounds()\n *\n * The app owns preferences via setSoundEnabled / setSoundVolume.\n */\nimport { bind, play } from \"cuelume\";\nimport type { SoundName } from \"cuelume\";\n\nlet bound = false;\n\n/** Opt into interaction sound. Delegated and idempotent (see cuelume bind). */\nexport function bindSounds(root?: ParentNode): void {\n bound = true;\n bind(root);\n}\n\n/**\n * Imperative cue used by library components for keyboard-driven interactions\n * the data attributes can't cover (OTP typing, visibility toggles, …).\n * No-op until the app has opted in via bindSounds().\n */\nexport function playCue(name: SoundName, options?: { volume?: number }): void {\n if (bound) play(name, options);\n}\n\nexport {\n play as playSound,\n setEnabled as setSoundEnabled,\n setVolume as setSoundVolume,\n sounds,\n} from \"cuelume\";\nexport type { SoundName };\n","\"use client\";\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport type React from \"react\";\nimport { playCue } from \"@/lib/sound\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Checkbox({\n className,\n sound = true,\n onCheckedChange,\n ...props\n}: CheckboxPrimitive.Root.Props & {\n /** Play the cuelume toggle cue on check/uncheck. Silent until bindSounds(). */\n sound?: boolean;\n}): React.ReactElement {\n return (\n <CheckboxPrimitive.Root\n // Cued off the state change rather than data-cuelume-toggle: Base UI\n // renders the native input as a *sibling* of this root, so a click on an\n // associated <label> never bubbles through an element carrying the\n // attribute and would toggle silently. This fires once for box clicks,\n // label clicks and keyboard Space alike, and not for programmatic changes.\n onCheckedChange={(checked, eventDetails) => {\n if (sound) playCue(\"toggle\");\n onCheckedChange?.(checked, eventDetails);\n }}\n className={cn(\n \"relative inline-flex size-4.5 shrink-0 cursor-pointer items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none\",\n className,\n )}\n data-slot=\"checkbox\"\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className=\"absolute -inset-px flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground\"\n data-slot=\"checkbox-indicator\"\n render={(\n props: React.ComponentProps<\"span\">,\n state: CheckboxPrimitive.Indicator.State,\n ) => (\n <span {...props}>\n {state.indeterminate ? (\n <svg\n aria-hidden=\"true\"\n className=\"size-3.5 sm:size-3\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12h13.496\" />\n </svg>\n ) : (\n <svg\n aria-hidden=\"true\"\n className=\"size-3.5 sm:size-3\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n )}\n </span>\n )}\n />\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { CheckboxPrimitive };\n","\"use client\";\n\nimport { Field as FieldPrimitive } from \"@base-ui/react/field\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Field({\n className,\n ...props\n}: FieldPrimitive.Root.Props): React.ReactElement {\n return (\n <FieldPrimitive.Root\n className={cn(\"flex flex-col items-start gap-2\", className)}\n data-slot=\"field\"\n {...props}\n />\n );\n}\n\nexport function FieldLabel({\n className,\n ...props\n}: FieldPrimitive.Label.Props): React.ReactElement {\n return (\n <FieldPrimitive.Label\n className={cn(\n \"inline-flex cursor-pointer items-center gap-2 font-medium text-base/4 text-foreground data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:text-xs/3.5 ml-3\",\n className,\n )}\n data-slot=\"field-label\"\n {...props}\n />\n );\n}\n\nexport function FieldItem({\n className,\n ...props\n}: FieldPrimitive.Item.Props): React.ReactElement {\n return (\n <FieldPrimitive.Item\n className={cn(\"flex\", className)}\n data-slot=\"field-item\"\n {...props}\n />\n );\n}\n\nexport function FieldDescription({\n className,\n ...props\n}: FieldPrimitive.Description.Props): React.ReactElement {\n return (\n <FieldPrimitive.Description\n // Entrance morph when conditionally shown: height tweens from 0 via\n // interpolate-size (set on :root) plus a fade/blur rise. Removal is\n // unmount-instant; wrap in AnimatePresence when an exit is needed.\n className={cn(\n \"overflow-hidden text-muted-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none\",\n className,\n )}\n data-slot=\"field-description\"\n {...props}\n />\n );\n}\n\nexport function FieldError({\n className,\n ...props\n}: FieldPrimitive.Error.Props): React.ReactElement {\n return (\n <FieldPrimitive.Error\n className={cn(\n \"overflow-hidden text-destructive-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none\",\n className,\n )}\n data-slot=\"field-error\"\n {...props}\n />\n );\n}\n\nexport const FieldControl: typeof FieldPrimitive.Control =\n FieldPrimitive.Control;\nexport const FieldValidity: typeof FieldPrimitive.Validity =\n FieldPrimitive.Validity;\n\nexport { FieldPrimitive };\n","import type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Frame({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative flex flex-col rounded-2xl bg-muted/72 p-1\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n className,\n )}\n data-slot=\"frame\"\n {...props}\n />\n );\n}\n\nexport function FramePanel({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative rounded-xl border bg-background bg-clip-padding p-5 shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nexport function FrameHeader({\n className,\n ...props\n}: React.ComponentProps<\"header\">): React.ReactElement {\n return (\n <header\n className={cn(\"flex flex-col px-5 py-4\", className)}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nexport function FrameTitle({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nexport function FrameDescription({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nexport function FrameFooter({\n className,\n ...props\n}: React.ComponentProps<\"footer\">): React.ReactElement {\n return (\n <footer\n className={cn(\"px-5 py-4\", className)}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport { Input as InputPrimitive } from \"@base-ui/react/input\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type InputProps = Omit<\n InputPrimitive.Props & React.RefAttributes<HTMLInputElement>,\n \"size\"\n> & {\n size?: \"sm\" | \"default\" | \"lg\" | number;\n unstyled?: boolean;\n nativeInput?: boolean;\n};\n\nexport function Input({\n className,\n size = \"default\",\n unstyled = false,\n nativeInput = false,\n style,\n ...props\n}: InputProps): React.ReactElement {\n const inputClassName = cn(\n // The 5000000s background-color entry is the autofill-flash suppression\n // hack; height/line-height/padding tween size-prop changes.\n \"h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s,height_300ms_var(--ease-smooth-out),line-height_300ms_var(--ease-smooth-out),padding_300ms_var(--ease-smooth-out),font-size_300ms_var(--ease-smooth-out)] placeholder:text-muted-foreground/72 motion-reduce:[transition:background-color_5000000s_ease-in-out_0s] sm:h-7.5 sm:leading-7.5\",\n size === \"sm\" &&\n \"h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5\",\n size === \"lg\" && \"h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5\",\n props.type === \"search\" &&\n \"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none\",\n props.type === \"file\" &&\n \"text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm\",\n );\n\n return (\n <span\n className={\n cn(\n !unstyled &&\n \"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-[box-shadow,border-color] duration-150 ease-smooth-out has-aria-invalid:animate-input-shake motion-reduce:animate-none motion-reduce:transition-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ) || undefined\n }\n data-size={size}\n data-slot=\"input-control\"\n >\n {nativeInput ? (\n <input\n className={inputClassName}\n data-slot=\"input\"\n size={typeof size === \"number\" ? size : undefined}\n style={typeof style === \"function\" ? undefined : style}\n {...props}\n />\n ) : (\n <InputPrimitive\n className={inputClassName}\n data-slot=\"input\"\n size={typeof size === \"number\" ? size : undefined}\n style={style}\n {...props}\n />\n )}\n </span>\n );\n}\n\nexport { InputPrimitive };\n","\"use client\";\n\nimport { Field as FieldPrimitive } from \"@base-ui/react/field\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type TextareaProps = React.ComponentPropsWithoutRef<\"textarea\"> &\n React.RefAttributes<HTMLTextAreaElement> & {\n size?: \"sm\" | \"default\" | \"lg\" | number;\n unstyled?: boolean;\n };\n\nexport function Textarea({\n className,\n size = \"default\",\n unstyled = false,\n ref,\n ...props\n}: TextareaProps): React.ReactElement {\n return (\n <span\n className={\n cn(\n !unstyled &&\n \"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ) || undefined\n }\n data-size={size}\n data-slot=\"textarea-control\"\n >\n <FieldPrimitive.Control\n ref={ref}\n value={props.value}\n defaultValue={props.defaultValue}\n disabled={props.disabled}\n id={props.id}\n name={props.name}\n render={(defaultProps: React.ComponentProps<\"textarea\">) => (\n <textarea\n className={cn(\n \"field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5\",\n size === \"sm\" &&\n \"min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5\",\n size === \"lg\" &&\n \"min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5\",\n )}\n data-slot=\"textarea\"\n {...mergeProps(defaultProps, props)}\n />\n )}\n />\n </span>\n );\n}\n\nexport { FieldPrimitive };\n","\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Input, type InputProps } from \"@/components/ui/input\";\nimport { Textarea, type TextareaProps } from \"@/components/ui/textarea\";\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text select-none items-center justify-center gap-2 leading-none [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:-mx-0.5 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"inline-end\":\n \"order-last pe-[calc(--spacing(3)-1px)] has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"order-first ps-[calc(--spacing(3)-1px)] has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nexport function InputGroup({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-autofill:bg-foreground/4 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nexport function InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof inputGroupAddonVariants>): React.ReactElement {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e: React.MouseEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\n \"button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']\",\n );\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nexport function InputGroupText({\n className,\n ...props\n}: React.ComponentProps<\"span\">): React.ReactElement {\n return (\n <span\n className={cn(\n \"line-clamp-1 flex items-center gap-2 whitespace-nowrap text-muted-foreground leading-none in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function InputGroupInput({\n className,\n ...props\n}: InputProps): React.ReactElement {\n return <Input className={className} unstyled {...props} />;\n}\n\nexport function InputGroupTextarea({\n className,\n ...props\n}: TextareaProps): React.ReactElement {\n return <Textarea className={className} unstyled {...props} />;\n}\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Label({\n className,\n render,\n sound = false,\n ...props\n}: useRender.ComponentProps<\"label\"> & {\n /**\n * Emit the cuelume hover tick. Opt-in: a label is a click target for its\n * control, and that control already owns the interaction cue (Checkbox\n * plays `toggle` on check/uncheck), so hover-ticking here double-sounds.\n * Inert until the app calls bindSounds().\n */\n sound?: boolean;\n}): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"inline-flex cursor-pointer items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4\",\n className,\n ),\n \"data-cuelume-hover\": sound ? \"tick\" : undefined,\n \"data-slot\": \"label\",\n };\n\n return useRender({\n defaultTagName: \"label\",\n props: mergeProps<\"label\">(defaultProps, props),\n render,\n });\n}\n","\"use client\";\n\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\";\nimport { ChevronRightIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport const MenuCreateHandle: typeof MenuPrimitive.createHandle =\n MenuPrimitive.createHandle;\n\nexport const Menu: typeof MenuPrimitive.Root = MenuPrimitive.Root;\n\nexport const MenuPortal: typeof MenuPrimitive.Portal = MenuPrimitive.Portal;\n\nexport function MenuTrigger({\n className,\n children,\n ...props\n}: MenuPrimitive.Trigger.Props): React.ReactElement {\n return (\n <MenuPrimitive.Trigger\n className={className}\n data-slot=\"menu-trigger\"\n {...props}\n >\n {children}\n </MenuPrimitive.Trigger>\n );\n}\n\nexport function MenuPopup({\n children,\n className,\n sideOffset = 4,\n align = \"center\",\n alignOffset,\n side = \"bottom\",\n anchor,\n portalProps,\n ...props\n}: MenuPrimitive.Popup.Props & {\n align?: MenuPrimitive.Positioner.Props[\"align\"];\n sideOffset?: MenuPrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: MenuPrimitive.Positioner.Props[\"alignOffset\"];\n side?: MenuPrimitive.Positioner.Props[\"side\"];\n anchor?: MenuPrimitive.Positioner.Props[\"anchor\"];\n portalProps?: MenuPrimitive.Portal.Props;\n}): React.ReactElement {\n return (\n <MenuPortal {...portalProps}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"z-50\"\n data-slot=\"menu-positioner\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n className={cn(\n \"relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"menu-popup\"\n {...props}\n >\n <div className=\"max-h-(--available-height) w-full overflow-y-auto p-1\">\n {children}\n </div>\n </MenuPrimitive.Popup>\n </MenuPrimitive.Positioner>\n </MenuPortal>\n );\n}\n\nexport function MenuGroup(\n props: MenuPrimitive.Group.Props,\n): React.ReactElement {\n return <MenuPrimitive.Group data-slot=\"menu-group\" {...props} />;\n}\n\nexport function MenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: MenuPrimitive.Item.Props & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.Item\n className={cn(\n \"flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-item\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nexport function MenuLinkItem({\n className,\n inset,\n variant = \"default\",\n closeOnClick = true,\n ...props\n}: MenuPrimitive.LinkItem.Props & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.LinkItem\n className={cn(\n \"flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0\",\n className,\n )}\n closeOnClick={closeOnClick}\n data-inset={inset}\n data-slot=\"menu-link-item\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nexport function MenuCheckboxItem({\n className,\n children,\n checked,\n variant = \"default\",\n ...props\n}: MenuPrimitive.CheckboxItem.Props & {\n variant?: \"default\" | \"switch\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.CheckboxItem\n checked={checked}\n className={cn(\n \"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n variant === \"switch\"\n ? \"grid-cols-[1fr_auto] gap-4 pe-1.5\"\n : \"grid-cols-[.75rem_1fr] pe-4\",\n className,\n )}\n data-slot=\"menu-checkbox-item\"\n {...props}\n >\n {variant === \"switch\" ? (\n <>\n <span className=\"col-start-1\">{children}</span>\n <MenuPrimitive.CheckboxItemIndicator\n className=\"inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]\"\n keepMounted\n >\n <span className=\"pointer-events-none block aspect-square h-full in-[[data-slot=menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </>\n ) : (\n <>\n <MenuPrimitive.CheckboxItemIndicator className=\"col-start-1 -ms-0.5\">\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </MenuPrimitive.CheckboxItemIndicator>\n <span className=\"col-start-2\">{children}</span>\n </>\n )}\n </MenuPrimitive.CheckboxItem>\n );\n}\n\nexport function MenuRadioGroup(\n props: MenuPrimitive.RadioGroup.Props,\n): React.ReactElement {\n return <MenuPrimitive.RadioGroup data-slot=\"menu-radio-group\" {...props} />;\n}\n\nexport function MenuRadioItem({\n className,\n children,\n ...props\n}: MenuPrimitive.RadioItem.Props): React.ReactElement {\n return (\n <MenuPrimitive.RadioItem\n className={cn(\n \"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[.75rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"menu-radio-item\"\n {...props}\n >\n <MenuPrimitive.RadioItemIndicator className=\"col-start-1 -ms-0.5\">\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </MenuPrimitive.RadioItemIndicator>\n <span className=\"col-start-2\">{children}</span>\n </MenuPrimitive.RadioItem>\n );\n}\n\nexport function MenuGroupLabel({\n className,\n inset,\n ...props\n}: MenuPrimitive.GroupLabel.Props & {\n inset?: boolean;\n}): React.ReactElement {\n return (\n <MenuPrimitive.GroupLabel\n className={cn(\n \"px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-label\"\n {...props}\n />\n );\n}\n\nexport function MenuSeparator({\n className,\n ...props\n}: MenuPrimitive.Separator.Props): React.ReactElement {\n return (\n <MenuPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"menu-separator\"\n {...props}\n />\n );\n}\n\nexport function MenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"kbd\">): React.ReactElement {\n return (\n <kbd\n className={cn(\n \"ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest\",\n className,\n )}\n data-slot=\"menu-shortcut\"\n {...props}\n />\n );\n}\n\nexport function MenuSub(\n props: MenuPrimitive.SubmenuRoot.Props,\n): React.ReactElement {\n return <MenuPrimitive.SubmenuRoot data-slot=\"menu-sub\" {...props} />;\n}\n\nexport function MenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: MenuPrimitive.SubmenuTrigger.Props & {\n inset?: boolean;\n}): React.ReactElement {\n return (\n <MenuPrimitive.SubmenuTrigger\n className={cn(\n \"flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not(:last-child)]:-mx-0.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-sub-trigger\"\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ms-auto -me-0.5 opacity-80\" />\n </MenuPrimitive.SubmenuTrigger>\n );\n}\n\nexport function MenuSubPopup({\n className,\n sideOffset = 0,\n alignOffset,\n align = \"start\",\n ...props\n}: MenuPrimitive.Popup.Props & {\n align?: MenuPrimitive.Positioner.Props[\"align\"];\n sideOffset?: MenuPrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: MenuPrimitive.Positioner.Props[\"alignOffset\"];\n}): React.ReactElement {\n const defaultAlignOffset = align !== \"center\" ? -5 : undefined;\n\n return (\n <MenuPopup\n align={align}\n alignOffset={alignOffset ?? defaultAlignOffset}\n className={className}\n data-slot=\"menu-sub-content\"\n side=\"inline-end\"\n sideOffset={sideOffset}\n {...props}\n />\n );\n}\n\nexport {\n MenuPrimitive,\n MenuCreateHandle as DropdownMenuCreateHandle,\n Menu as DropdownMenu,\n MenuPortal as DropdownMenuPortal,\n MenuTrigger as DropdownMenuTrigger,\n MenuPopup as DropdownMenuContent,\n MenuGroup as DropdownMenuGroup,\n MenuItem as DropdownMenuItem,\n MenuCheckboxItem as DropdownMenuCheckboxItem,\n MenuRadioGroup as DropdownMenuRadioGroup,\n MenuRadioItem as DropdownMenuRadioItem,\n MenuGroupLabel as DropdownMenuLabel,\n MenuSeparator as DropdownMenuSeparator,\n MenuShortcut as DropdownMenuShortcut,\n MenuSub as DropdownMenuSub,\n MenuSubTrigger as DropdownMenuSubTrigger,\n MenuSubPopup as DropdownMenuSubContent,\n};\n","import { Separator as SeparatorPrimitive } from \"@base-ui/react/separator\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n ...props\n}: SeparatorPrimitive.Props) {\n return (\n <SeparatorPrimitive\n data-slot=\"separator\"\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Separator }\n","\"use client\";\n\nimport { OTPField as OTPFieldPrimitive } from \"@base-ui/react/otp-field\";\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { playCue } from \"@/lib/sound\";\nimport { Separator } from \"@/components/ui/separator\";\n\nexport function OTPField({\n className,\n size = \"default\",\n sound = true,\n onValueChange,\n ...props\n}: React.ComponentProps<typeof OTPFieldPrimitive.Root> & {\n size?: \"default\" | \"lg\";\n /** Play a tick cue per entered character. Inert until bindSounds(). */\n sound?: boolean;\n}): React.ReactElement {\n // Typing is keyboard-driven, so the cue is imperative (playCue is gated on\n // the app having called bindSounds). Tick only when characters are added.\n const lastLength = React.useRef(\n String(props.value ?? props.defaultValue ?? \"\").length,\n );\n\n const handleValueChange: NonNullable<typeof onValueChange> = (\n value,\n ...rest\n ) => {\n if (sound && value.length > lastLength.current) {\n playCue(\"tick\");\n }\n lastLength.current = value.length;\n onValueChange?.(value, ...rest);\n };\n\n return (\n <OTPFieldPrimitive.Root\n className={cn(\n \"flex items-center gap-2 has-disabled:opacity-64 has-disabled:**:data-[slot=otp-field-input]:shadow-none has-disabled:**:data-[slot=otp-field-input]:before:shadow-none!\",\n className,\n )}\n data-size={size}\n data-slot=\"otp-field\"\n onValueChange={handleValueChange}\n {...props}\n />\n );\n}\n\nexport function OTPFieldInput({\n className,\n ...props\n}: React.ComponentProps<typeof OTPFieldPrimitive.Input>): React.ReactElement {\n return (\n <OTPFieldPrimitive.Input\n className={cn(\n \"relative in-[[data-slot=otp-field][data-size=lg]]:size-10 size-9 min-w-0 rounded-lg border border-input bg-background not-dark:bg-clip-padding text-center in-[[data-slot=otp-field][data-size=lg]]:text-lg text-base text-foreground in-[[data-slot=otp-field][data-size=lg]]:leading-10 leading-9 shadow-xs/5 outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-focus-visible:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:z-10 focus-visible:border-ring focus-visible:shadow-none focus-visible:ring-[3px] focus-visible:ring-ring/24 aria-invalid:border-destructive/36 aria-invalid:shadow-none aria-invalid:focus-visible:border-destructive/64 aria-invalid:focus-visible:ring-destructive/16 sm:in-[[data-slot=otp-field][data-size=lg]]:size-9 sm:size-8 sm:in-[[data-slot=otp-field][data-size=lg]]:text-base sm:text-sm sm:in-[[data-slot=otp-field][data-size=lg]]:leading-9 sm:leading-8 dark:bg-input/32 dark:aria-invalid:focus-visible:ring-destructive/24 dark:not-focus-visible:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"otp-field-input\"\n spellCheck={false}\n {...props}\n />\n );\n}\n\nexport function OTPFieldSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>): React.ReactElement {\n return (\n <OTPFieldPrimitive.Separator\n render={\n <Separator\n className={cn(\n \"rounded-full bg-input data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:w-3\",\n className,\n )}\n orientation=\"horizontal\"\n {...props}\n />\n }\n />\n );\n}\n\nexport { OTPFieldPrimitive };\n","import type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]\",\n className,\n )}\n data-slot=\"skeleton\"\n {...props}\n />\n );\n}\n","import type { Transition, Variants } from \"motion/react\"\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n/** CSS string form of EASE_OUT for inline style transitions. */\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n/** Press feedback on buttons and other tappable surfaces. */\nexport const SPRING_PRESS = {\n type: \"spring\",\n stiffness: 500,\n damping: 30,\n mass: 0.6,\n} as const;\n\n/** Content swaps — label/icon slots trading places inside a control. */\nexport const SPRING_SWAP = {\n type: \"spring\",\n stiffness: 460,\n damping: 30,\n mass: 0.55,\n} as const;\n\n/** Overlay panel entrances — modals and sheets summoned by pointer. */\nexport const SPRING_PANEL = {\n type: \"spring\",\n stiffness: 420,\n damping: 40,\n mass: 0.5,\n} as const;\n\n/** Shared-layout glides — pills, indicators and panels morphing between positions. */\nexport const SPRING_LAYOUT = {\n type: \"spring\",\n stiffness: 360,\n damping: 32,\n mass: 0.6,\n} as const;\n\n/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). */\nexport const SPRING_MOUSE = {\n stiffness: 200,\n damping: 15,\n mass: 0.3,\n} as const;\n\n/** Dragged handles and fills (sliders) — critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. */\nexport const SPRING_GLIDE = {\n stiffness: 700,\n damping: 50,\n mass: 0.5,\n} as const;\n\n\n// This needs a softer layout spring than the app defaults, so the overflow group\n// stays visually attached to the toggle while entering and leaving.\nexport const SHELL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nexport const ICON_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(3px)\" },\n visible: {\n opacity: 1,\n filter: \"blur(0px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n exit: {\n opacity: 0,\n filter: \"blur(3px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n};\n","/** \"Jenny Hamilton\" → \"JH\", \"luna\" → \"L\". */\nexport function initialsFrom(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n if (parts.length === 0) return \"\"\n const first = parts[0]?.[0] ?? \"\"\n const last = parts.length > 1 ? (parts.at(-1)?.[0] ?? \"\") : \"\"\n return (first + last).toUpperCase()\n}\n\n/** Sampling grid for `measureRimTone`. 16² px is enough to average a rim. */\nconst TONE_SAMPLE_SIZE = 16\n/** Pixels this far (in radii) from the centre count as rim — the band the\n * bezel sits on. Matches the ring's mask, which fades in from ~78%. */\nconst TONE_RIM_RADIUS = 0.6\n\nconst toneCache = new Map<string, Promise<number | null>>()\n\n/**\n * Average perceived lightness, 0 (black) → 1 (white), of an image's outer\n * band — the pixels the bezel ring overlays — or `null` when it cannot be\n * measured: no DOM/canvas (SSR, test DOM), a decode failure, or a host\n * without CORS headers (the sample needs a CORS-clean image; the avatar's\n * own `<img>` is left untouched, so a non-CORS host still displays).\n * Results are memoised per `src`, so a room of the same face samples once.\n */\nexport function measureRimTone(src: string): Promise<number | null> {\n const cached = toneCache.get(src)\n if (cached) return cached\n const promise = new Promise<number | null>((resolve) => {\n if (typeof document === \"undefined\" || typeof Image === \"undefined\") {\n resolve(null)\n return\n }\n const image = new Image()\n image.crossOrigin = \"anonymous\"\n image.decoding = \"async\"\n image.onerror = () => resolve(null)\n image.onload = () => {\n try {\n const size = TONE_SAMPLE_SIZE\n const canvas = document.createElement(\"canvas\")\n canvas.width = size\n canvas.height = size\n const context = canvas.getContext(\"2d\", { willReadFrequently: true })\n if (!context) {\n resolve(null)\n return\n }\n context.drawImage(image, 0, 0, size, size)\n const { data } = context.getImageData(0, 0, size, size)\n const centre = (size - 1) / 2\n const rim = TONE_RIM_RADIUS * centre\n let sum = 0\n let count = 0\n for (let y = 0; y < size; y++) {\n for (let x = 0; x < size; x++) {\n const dx = x - centre\n const dy = y - centre\n if (dx * dx + dy * dy < rim * rim) continue\n const offset = (y * size + x) * 4\n const r = data[offset] ?? 0\n const g = data[offset + 1] ?? 0\n const b = data[offset + 2] ?? 0\n // Rec. 709 luma on the gamma-encoded channels: close enough to\n // perceived lightness for a \"light or dark?\" verdict.\n sum += (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255\n count++\n }\n }\n resolve(count === 0 ? null : sum / count)\n } catch {\n // A tainted canvas throws on getImageData.\n resolve(null)\n }\n }\n image.src = src\n })\n toneCache.set(src, promise)\n // Only a real reading is worth keeping — a failed sample (flaky network,\n // a host that gained CORS headers later) gets another go next mount.\n void promise.then((tone) => {\n if (tone === null) toneCache.delete(src)\n })\n return promise\n}\n\n/**\n * Bezel highlight/shadow alphas for an image whose rim lightness is `tone`\n * (0 → 1). Against a dark rim the white highlight is eased off (it glares)\n * and the black shadow pushed up (it has to darken mid-tones to register);\n * against a pale rim the reverse — the highlight can be full (it barely\n * shows) and the shadow is what carries the emboss, so it sits lighter.\n * Linear between; the end points are tuned by eye on a dark and a light\n * photo in both themes.\n */\nexport function bezelAlphasForTone(tone: number): { hi: number; lo: number } {\n const t = Math.min(1, Math.max(0, tone))\n return {\n hi: 0.7 + 0.3 * t,\n lo: 0.6 - 0.4 * t,\n }\n}\n","import { AvatarFallback } from \"@/components/ui/avatar\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport { initialsFrom } from \"./utils\"\n\nexport function Fallback({\n name,\n initials,\n loading,\n}: {\n name?: string\n initials?: string\n loading?: boolean\n}) {\n return (\n // Initials scale with the disc: 42% of the avatar's width (≈ text-xl on\n // size-12), resolved against the `@container` on the Avatar root.\n <AvatarFallback className=\"text-[42cqw]\">\n {loading ? (\n <Skeleton\n className=\"size-full rounded-full\"\n data-slot=\"avatar-skeleton\"\n />\n ) : (\n (initials ?? initialsFrom(name ?? \"\"))\n )}\n </AvatarFallback>\n )\n}\n","import { cn } from \"@/lib/utils\"\nimport type { UserPresence } from \"./type\"\n\n/**\n * Corner dot naming whether the person is reachable. Sits on the avatar\n * frame, outside the clipped circle, with a background-coloured ring so it\n * reads against any image. Colour is not the only signal: `offline` is a\n * hollow ring, `online` a filled dot, and the label is spelled out for AT.\n *\n * `lightAngle` (degrees clockwise from 12) lays a faint sheen across the dot\n * from that side — the same angle the avatar's bezel is lit from, so the two\n * highlights agree and the badge reads as a bead sitting in the same light.\n */\nexport function PresenceBadge({\n presence,\n lightAngle,\n className,\n}: {\n presence: UserPresence\n lightAngle?: number\n className?: string\n}) {\n const online = presence === \"online\"\n return (\n <span\n aria-label={online ? \"Online\" : \"Offline\"}\n className={cn(\n \"absolute right-0 bottom-0 box-content size-[22%] min-h-1.5 min-w-1.5 overflow-hidden rounded-full\",\n \"ring-2 ring-background transition-colors duration-150 ease-smooth-out\",\n online\n ? \"bg-emerald-500 dark:bg-emerald-400\"\n : \"border-2 border-muted-foreground/60 bg-background dark:border-muted-foreground/70\",\n className\n )}\n data-presence={presence}\n data-slot=\"user-avatar-presence\"\n role=\"img\"\n >\n {lightAngle !== undefined ? (\n // Highlight at 12 o'clock, fading out by the middle, rotated so it\n // faces the light. Rotation transitions; the gradient is static.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n \"bg-[linear-gradient(to_bottom,--theme(--color-white/55%),--theme(--color-white/12%)_38%,transparent_58%)]\",\n \"dark:bg-[linear-gradient(to_bottom,--theme(--color-white/40%),--theme(--color-white/8%)_38%,transparent_58%)]\",\n \"transition-transform duration-150 ease-smooth-out motion-reduce:transition-none\"\n )}\n data-slot=\"user-avatar-presence-sheen\"\n style={{ transform: `rotate(${lightAngle}deg)` }}\n />\n ) : null}\n </span>\n )\n}\n","/**\n * User avatar state — Jotai atom families keyed by an avatar id.\n *\n * Follows the tree's layout (`components/composed/tree/tree-atom.ts`): one\n * in-house `keyed()` family per field, write-only action atoms for every\n * mutation, a composed read-only state atom, and `removeUserAvatarInstance`\n * to drop an id from every family. Nothing here touches the DOM — the\n * pointer maths that feeds `bezelAngle` lives in `use-user-avatar.ts`.\n */\n\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport type {\n ImageStatus,\n UserAvatarConfig,\n UserAvatarInstanceId,\n UserAvatarState,\n UserPresence,\n} from \"./type\"\n\n/** Light from the top-left, the classic emboss, until a pointer moves. */\nexport const DEFAULT_BEZEL_ANGLE = 315\n\nconst DEFAULT_CONFIG: UserAvatarConfig = { controlsPresence: false }\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: UserAvatarInstanceId) => AtomType) & {\n remove: (id: UserAvatarInstanceId) => void\n}\n\nconst families: { remove: (id: UserAvatarInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: UserAvatarInstanceId) => AtomType) {\n const cache = new Map<UserAvatarInstanceId, AtomType>()\n const family = ((id: UserAvatarInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: UserAvatarInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: UserAvatarInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: UserAvatarInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\n/** `null` = no badge. */\nexport const userAvatarPresenceAtom = stateFamily<UserPresence | null>(\n \"presence\",\n null\n)\n\n/** Degrees clockwise from 12 o'clock — where the bezel highlight sits. */\nexport const userAvatarBezelAngleAtom = stateFamily<number>(\n \"bezelAngle\",\n DEFAULT_BEZEL_ANGLE\n)\n\nexport const userAvatarImageStatusAtom = stateFamily<ImageStatus>(\n \"imageStatus\",\n \"idle\"\n)\n\n/** Rim lightness of the loaded image, `null` until sampled (or unsampleable). */\nexport const userAvatarImageToneAtom = stateFamily<number | null>(\n \"imageTone\",\n null\n)\n\n/** @internal Which fields the mounted component controls from props. */\nexport const userAvatarConfigAtom = stateFamily<UserAvatarConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\nexport const userAvatarIsOnlineAtom = readFamily(\n \"isOnline\",\n (get, id) => get(userAvatarPresenceAtom(id)) === \"online\"\n)\n\n/** Whole-state read for callers that want the object; field atoms above are\n * cheaper for components that watch one thing. */\nexport const userAvatarStateAtom = readFamily<UserAvatarState>(\n \"state\",\n (get, id) => ({\n presence: get(userAvatarPresenceAtom(id)),\n bezelAngle: get(userAvatarBezelAngleAtom(id)),\n imageStatus: get(userAvatarImageStatusAtom(id)),\n imageTone: get(userAvatarImageToneAtom(id)),\n })\n)\n\n// ── actions ────────────────────────────────────────────────────────────────\n\n/** Inert while a `presence` prop controls the avatar — the prop is truth. */\nexport const setUserAvatarPresenceAtom = actionFamily<\n [presence: UserPresence | null]\n>(\"setPresence\", (get, set, id, presence) => {\n if (get(userAvatarConfigAtom(id)).controlsPresence) return\n set(userAvatarPresenceAtom(id), presence)\n})\n\n/** online ⇄ offline; a badge-less avatar comes online. */\nexport const toggleUserAvatarPresenceAtom = actionFamily<[]>(\n \"togglePresence\",\n (get, set, id) => {\n const next = get(userAvatarPresenceAtom(id)) === \"online\" ? \"offline\" : \"online\"\n set(setUserAvatarPresenceAtom(id), next)\n }\n)\n\n/** Stored as given — continuous, not wrapped into [0, 360): the rim is\n * rotated with a CSS transition, and an unwrapped angle is what lets a\n * 359° → 1° move take the short way round. Written on every pointer frame,\n * so it stays a bare set — no config gate, no side effects. */\nexport const setUserAvatarBezelAngleAtom = actionFamily<[angle: number]>(\n \"setBezelAngle\",\n (_get, set, id, angle) => {\n if (!Number.isFinite(angle)) return\n set(userAvatarBezelAngleAtom(id), angle)\n }\n)\n\n/** @internal Reported by the image element; drives the skeleton. */\nexport const setUserAvatarImageStatusAtom = actionFamily<[status: ImageStatus]>(\n \"setImageStatus\",\n (_get, set, id, status) => {\n set(userAvatarImageStatusAtom(id), status)\n }\n)\n\n/** @internal Written by the hook once the loaded image has been sampled;\n * cleared (null) when the image changes or goes away. Clamped to [0, 1]. */\nexport const setUserAvatarImageToneAtom = actionFamily<[tone: number | null]>(\n \"setImageTone\",\n (_get, set, id, tone) => {\n set(\n userAvatarImageToneAtom(id),\n tone === null || !Number.isFinite(tone) ? null : Math.min(1, Math.max(0, tone))\n )\n }\n)\n\n/** @internal Projection of the mounted component's controlled props. */\nexport const projectUserAvatarPropsAtom = actionFamily<\n [config: UserAvatarConfig, presence: UserPresence | null | undefined]\n>(\"projectProps\", (get, set, id, config, presence) => {\n const wasControlled = get(userAvatarConfigAtom(id)).controlsPresence\n set(userAvatarConfigAtom(id), config)\n if (config.controlsPresence) set(userAvatarPresenceAtom(id), presence ?? null)\n // Releasing control (`presence` prop → undefined) clears the badge rather\n // than leaving the last projected value stranded in the store — going\n // from \"online\" to no presence is a real transition for a user object.\n else if (wasControlled) set(userAvatarPresenceAtom(id), null)\n})\n\nexport const resetUserAvatarAtom = actionFamily<[]>(\n \"reset\",\n (_get, set, id) => {\n set(userAvatarPresenceAtom(id), null)\n set(userAvatarBezelAngleAtom(id), DEFAULT_BEZEL_ANGLE)\n set(userAvatarImageStatusAtom(id), \"idle\")\n set(userAvatarImageToneAtom(id), null)\n set(userAvatarConfigAtom(id), DEFAULT_CONFIG)\n }\n)\n\n/** Forget an avatar entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeUserAvatarInstance(id: UserAvatarInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport { useReducedMotion } from \"motion/react\"\n\nimport type {\n ImageStatus,\n UserAvatarConfig,\n UserAvatarInstanceId,\n UserPresence,\n} from \"./type\"\nimport {\n projectUserAvatarPropsAtom,\n removeUserAvatarInstance,\n setUserAvatarBezelAngleAtom,\n setUserAvatarImageStatusAtom,\n setUserAvatarImageToneAtom,\n userAvatarBezelAngleAtom,\n userAvatarImageStatusAtom,\n userAvatarImageToneAtom,\n userAvatarPresenceAtom,\n} from \"./user-avatar-atom\"\nimport { measureRimTone } from \"./utils\"\n\nexport interface UseUserAvatarOptions {\n avatarId?: UserAvatarInstanceId\n /** Controlled presence. `undefined` leaves the store in charge. */\n presence?: UserPresence\n /** Track the pointer for the bezel highlight. */\n bezel: boolean\n /** Only meaningful with an image — no image, no status to track. */\n hasImage: boolean\n /** The image URL, sampled for its rim lightness once it has loaded so the\n * bezel can pick alphas that read against it. Omit to skip sampling. */\n src?: string\n}\n\nexport interface UserAvatarBinding {\n avatarId: UserAvatarInstanceId\n presence: UserPresence | null\n bezelAngle: number\n imageStatus: ImageStatus\n /** Rim lightness of the loaded image, 0–1, or `null` while unknown. */\n imageTone: number | null\n /** Hand to the image's `onLoadingStatusChange`. Stable. */\n setImageStatus: (status: ImageStatus) => void\n /** Attach to the avatar root — the bezel is lit relative to its centre. */\n ref: React.RefObject<HTMLElement | null>\n}\n\n/** Below this the angle write is skipped: a rim highlight cannot show a\n * sub-degree change, and skipping keeps the pointer loop store-quiet. */\nconst ANGLE_EPSILON = 1.5\n\n/**\n * Binds one avatar to its slice of the store: projects the controlled\n * `presence` prop, tracks the image status, and — while `bezel` is on —\n * follows the pointer with a rAF-coalesced `pointermove` listener that turns\n * the pointer's bearing from the avatar's centre into `bezelAngle`.\n *\n * Unnamed avatars key off `useId` and are dropped from the store on unmount;\n * a named `avatarId` outlives its component so a presence set elsewhere\n * survives a remount.\n */\nexport function useUserAvatar(options: UseUserAvatarOptions): UserAvatarBinding {\n const { presence: presenceProp, bezel, hasImage, src } = options\n const generatedId = React.useId()\n const avatarId = options.avatarId ?? generatedId\n const controlsPresence = presenceProp !== undefined\n\n const config = React.useMemo<UserAvatarConfig>(\n () => ({ controlsPresence }),\n [controlsPresence]\n )\n\n const project = useSetAtom(projectUserAvatarPropsAtom(avatarId))\n const setBezelAngle = useSetAtom(setUserAvatarBezelAngleAtom(avatarId))\n const setImageStatus = useSetAtom(setUserAvatarImageStatusAtom(avatarId))\n const setImageTone = useSetAtom(setUserAvatarImageToneAtom(avatarId))\n\n // Layout effect: the projection must land before children read the store\n // in the same commit. Primitive deps, so no loop guard is needed here.\n React.useLayoutEffect(() => {\n project(config, presenceProp)\n }, [project, config, presenceProp])\n\n // A generated key belongs to this mount only; a given `avatarId` is the\n // app's handle and outlives it.\n React.useEffect(() => {\n if (options.avatarId !== undefined) return\n return () => removeUserAvatarInstance(avatarId)\n }, [options.avatarId, avatarId])\n\n const presence = useAtomValue(userAvatarPresenceAtom(avatarId))\n const bezelAngle = useAtomValue(userAvatarBezelAngleAtom(avatarId))\n const imageStatus = useAtomValue(userAvatarImageStatusAtom(avatarId))\n const imageTone = useAtomValue(userAvatarImageToneAtom(avatarId))\n\n const ref = React.useRef<HTMLElement | null>(null)\n const reduce = useReducedMotion()\n\n // Pointer → bearing. Coalesced to one write per animation frame, and only\n // when the angle moved enough to matter, so a room full of avatars is\n // still one cheap listener each and near-zero store traffic while idle.\n React.useEffect(() => {\n if (!bezel || reduce || typeof window === \"undefined\") return\n let frame = 0\n let last = Number.NaN\n let pointer: { x: number; y: number } | null = null\n\n const flush = () => {\n frame = 0\n const host = ref.current\n if (!host || !pointer) return\n const rect = host.getBoundingClientRect()\n if (rect.width === 0) return\n const dx = pointer.x - (rect.left + rect.width / 2)\n const dy = pointer.y - (rect.top + rect.height / 2)\n // atan2 measures from 3 o'clock anticlockwise-positive in screen\n // space; rotate so 0 is 12 o'clock and clockwise grows.\n const bearing = ((Math.atan2(dy, dx) * 180) / Math.PI + 90 + 360) % 360\n // Unwrap: step from the last value by the shortest arc, so the stored\n // angle is continuous and the rim never spins the long way round.\n let angle = bearing\n if (!Number.isNaN(last)) {\n let delta = bearing - (((last % 360) + 360) % 360)\n if (delta > 180) delta -= 360\n if (delta < -180) delta += 360\n if (Math.abs(delta) < ANGLE_EPSILON) return\n angle = last + delta\n }\n last = angle\n setBezelAngle(angle)\n }\n const onMove = (event: PointerEvent) => {\n pointer = { x: event.clientX, y: event.clientY }\n if (frame === 0) frame = window.requestAnimationFrame(flush)\n }\n\n window.addEventListener(\"pointermove\", onMove, { passive: true })\n return () => {\n window.removeEventListener(\"pointermove\", onMove)\n if (frame !== 0) window.cancelAnimationFrame(frame)\n }\n }, [bezel, reduce, setBezelAngle])\n\n // No image, no status: keep the store honest when `src` goes away.\n React.useEffect(() => {\n if (!hasImage) setImageStatus(\"idle\")\n }, [hasImage, setImageStatus])\n\n // Once the image is on screen, read how light its rim is so the bezel's\n // highlight and shadow can be weighted against it. Cleared whenever the\n // image changes or goes away — a stale tone from the previous photo would\n // light the new one wrong for a frame. Sampling is async (a second, CORS\n // clean decode of the same URL, memoised per src); the cancelled flag\n // keeps a slow sample from landing on a later src.\n React.useEffect(() => {\n setImageTone(null)\n if (!bezel || !hasImage || !src || imageStatus !== \"loaded\") return\n let cancelled = false\n void measureRimTone(src).then((tone) => {\n if (!cancelled) setImageTone(tone)\n })\n return () => {\n cancelled = true\n }\n }, [bezel, hasImage, src, imageStatus, setImageTone])\n\n return {\n avatarId,\n presence,\n bezelAngle,\n imageStatus,\n imageTone,\n setImageStatus,\n ref,\n }\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { Avatar, AvatarImage } from \"@/components/ui/avatar\"\nimport { cn } from \"@/lib/utils\"\nimport { Fallback } from \"./fallback\"\nimport { PresenceBadge } from \"./presence-badge\"\nimport type { UserAvatarProps } from \"./type\"\nimport { useUserAvatar } from \"./use-user-avatar\"\nimport { bezelAlphasForTone } from \"./utils\"\n\n/**\n * Identity avatar: an image when one is given, initials otherwise, with an\n * optional presence badge and a pointer-lit bezel.\n *\n * A passed `src` is assumed to be remote, so the slot holds a skeleton until\n * the image resolves rather than flashing initials that are about to be\n * replaced. A failed load settles on the initials.\n *\n * State (presence, bezel angle, image status) lives in Jotai atoms keyed by\n * `avatarId` — name the avatar and `useUserAvatarActions(id).setPresence()`\n * flips its badge from anywhere under `ExegiaProvider`.\n */\n/** The rim (and the badge sheen) trail the pointer's bearing slightly rather\n * than pointing dead at it — a touch of lag reads as weight. */\nconst BEZEL_DAMPING = 0.8\n\nexport function UserAvatar({\n src,\n name = \"\",\n initials,\n alt,\n loading: loadingProp,\n presence: presenceProp,\n bezel = true,\n avatarId,\n className,\n style,\n ...props\n}: UserAvatarProps): React.ReactElement {\n const hasImage = src !== undefined\n const avatar = useUserAvatar({\n avatarId,\n presence: presenceProp,\n bezel,\n hasImage,\n src,\n })\n const { presence, bezelAngle, imageStatus, imageTone, setImageStatus, ref } =\n avatar\n\n const loading =\n loadingProp ??\n (hasImage && (imageStatus === \"idle\" || imageStatus === \"loading\"))\n // A photo is actually on screen — not merely requested. A broken or\n // still-loading `src` shows initials/skeleton and should be treated as\n // the flat disc it is.\n const showsImage = hasImage && loadingProp !== true && imageStatus === \"loaded\"\n // With a photo on screen and its rim sampled, the bezel's alphas follow the\n // photo rather than the theme: the ring sits on the image, not the page.\n const bezelAlphas =\n showsImage && imageTone !== null ? bezelAlphasForTone(imageTone) : null\n\n return (\n // The frame is what the badge and bezel hang off: the Avatar root clips\n // to its circle, and the badge has to sit on the rim, half outside it.\n // Sizing classes still target the Avatar — the frame shrink-wraps it.\n <span\n className=\"relative inline-flex shrink-0 rounded-full\"\n data-slot=\"user-avatar-frame\"\n ref={ref as React.RefObject<HTMLSpanElement>}\n >\n <Avatar\n className={cn(\n // `@container` lets the fallback size its initials in cqw — a\n // fraction of whatever `size-*` the caller put on this element —\n // instead of a fixed text step. `text-xl` stays as the fallback for\n // engines without container units.\n \"@container size-8 border-1 border-white bg-neutral-800! text-xl dark:border-neutral-900\",\n // The emboss itself: an inset drop toward the light's opposite side\n // is what the ring below is rotated against.\n bezel &&\n \"shadow-[inset_0_3px_3px_--theme(--color-white/80%),inset_0_-1px_2px_--theme(--color-black/15%)] dark:shadow-[inset_0_1px_1px_--theme(--color-white/5%),inset_0_-8px_2px_--theme(--color-black/20%)]\",\n className\n )}\n data-avatar-id={avatar.avatarId}\n data-bezel={bezel ? \"\" : undefined}\n data-loading={loading || undefined}\n data-presence={presence ?? undefined}\n data-slot=\"user-avatar\"\n style={style}\n {...props}\n >\n {/* Held back while forced-loading: a loaded image would hide the\n fallback the skeleton lives in. */}\n {!hasImage || loadingProp === true ? null : (\n <AvatarImage\n alt={alt ?? name}\n onLoadingStatusChange={setImageStatus}\n src={src}\n />\n )}\n <Fallback name={name} initials={initials} loading={loading} />\n </Avatar>\n {presence === \"online\" ? (\n // The badge's green \"reflected\" onto the disc: a static radial wash\n // anchored at the badge corner that fades inward, so the dot reads\n // as a light source sitting on the avatar rather than a sticker on\n // it. Does not move with the bezel — it belongs to the badge, not\n // the pointer. Sits above the image, below the bezel and the badge.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n // One gradient, four knobs: colour, peak alpha, mid alpha, reach.\n // Light mode is quieter than dark (a green wash on a pale disc\n // reads as a stain, on a dark one as a glow), and an initials\n // disc — flat, no photo to sit on — takes a smaller, fainter\n // pool than an image does.\n \"[--reflect:--theme(--color-emerald-500)] dark:[--reflect:--theme(--color-emerald-400)]\",\n showsImage\n ? \"[--reflect-peak:30%] [--reflect-mid:12%] [--reflect-reach:56%] dark:[--reflect-peak:40%] dark:[--reflect-mid:16%] dark:[--reflect-reach:60%]\"\n : \"[--reflect-peak:16%] [--reflect-mid:6%] [--reflect-reach:40%] dark:[--reflect-peak:26%] dark:[--reflect-mid:9%] dark:[--reflect-reach:46%]\",\n \"bg-[radial-gradient(circle_at_88%_88%,color-mix(in_oklab,var(--reflect)_var(--reflect-peak),transparent)_0%,color-mix(in_oklab,var(--reflect)_var(--reflect-mid),transparent)_22%,transparent_var(--reflect-reach))]\",\n \"transition-opacity duration-150 ease-smooth-out\"\n )}\n data-image={showsImage ? \"\" : undefined}\n data-slot=\"user-avatar-reflection\"\n />\n ) : null}\n {bezel ? (\n // A conic highlight → shadow sweep, masked to a thin rim and rotated\n // so the highlight faces the pointer. Rotation (not the gradient\n // angle) is what moves, because `transform` transitions and a\n // gradient stop does not. The highlight is white and the shadow\n // black at alphas `--bezel-hi-a` / `--bezel-lo-a`: light and dark\n // pick their own defaults (a white rim glares on a dark page), and a\n // sampled photo overrides both inline so the ring is weighted against\n // the image it actually sits on — scaled by `--bezel-hi-k`, because\n // the rim borders the page as much as the photo and the same white\n // that lifts a dark portrait off a light page glares on a dark one.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n \"[--bezel-hi-a:1] [--bezel-lo-a:0.2] dark:[--bezel-hi-a:0.18] dark:[--bezel-lo-a:0.4]\",\n \"[--bezel-hi-k:1] dark:[--bezel-hi-k:0.55]\",\n \"[--bezel-hi:color-mix(in_oklab,white_calc(var(--bezel-hi-a)*100%),transparent)]\",\n \"[--bezel-lo:color-mix(in_oklab,black_calc(var(--bezel-lo-a)*100%),transparent)]\",\n // Starts at 6 o'clock: shadow there, highlight peaking at 12 (50%),\n // symmetric either side — so rotate(angle) puts the highlight at\n // exactly `bezelAngle` clockwise from 12.\n \"bg-[conic-gradient(from_180deg,var(--bezel-lo)_0%,transparent_24%,transparent_28%,var(--bezel-hi)_50%,transparent_72%,transparent_76%,var(--bezel-lo)_100%)]\",\n // Rim width is a share of the radius, not a px count, so the\n // bezel reads the same at size-8 and size-16: solid over the outer\n // 8%, feathering in over the 14% inside that.\n \"[mask-image:radial-gradient(farthest-side,transparent_78%,#000_92%)]\",\n \"mix-blend-normal transition-transform duration-150 ease-smooth-out motion-reduce:transition-none\"\n )}\n data-slot=\"user-avatar-bezel\"\n data-tone={imageTone === null ? undefined : imageTone.toFixed(2)}\n style={{\n transform: `rotate(${bezelAngle * BEZEL_DAMPING}deg)`,\n ...(bezelAlphas\n ? {\n \"--bezel-hi-a\": `calc(${bezelAlphas.hi.toFixed(2)} * var(--bezel-hi-k))`,\n \"--bezel-lo-a\": bezelAlphas.lo.toFixed(2),\n }\n : null),\n }}\n />\n ) : null}\n {presence ? (\n <PresenceBadge\n lightAngle={bezel ? bezelAngle * BEZEL_DAMPING : undefined}\n presence={presence}\n />\n ) : null}\n </span>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport type {\n UserAvatarActions,\n UserAvatarInstanceId,\n UserAvatarState,\n} from \"./type\"\nimport {\n resetUserAvatarAtom,\n setUserAvatarBezelAngleAtom,\n setUserAvatarPresenceAtom,\n toggleUserAvatarPresenceAtom,\n userAvatarStateAtom,\n} from \"./user-avatar-atom\"\n\n/**\n * Read the avatar registered under `avatarId` from anywhere below\n * `ExegiaProvider` — no props, no ref, no provider of its own.\n *\n * ```tsx\n * const { presence } = useUserAvatarState(\"me\")\n * ```\n *\n * Returns the whole state object, so the caller re-renders on any change —\n * including every bezel frame while a pointer moves. A component that only\n * cares about presence should subscribe to that atom instead:\n * `useAtomValue(userAvatarPresenceAtom(\"me\"))`.\n */\nexport function useUserAvatarState(\n avatarId: UserAvatarInstanceId\n): UserAvatarState {\n return useAtomValue(userAvatarStateAtom(avatarId))\n}\n\n/**\n * Write-only handles onto the avatar registered under `avatarId`. Nothing\n * here subscribes, so a presence indicator elsewhere in the app can flip\n * the badge without re-rendering when the avatar changes.\n *\n * ```tsx\n * const { setPresence } = useUserAvatarActions(\"me\")\n * socket.on(\"presence\", (p) => setPresence(p))\n * ```\n */\nexport function useUserAvatarActions(\n avatarId: UserAvatarInstanceId\n): UserAvatarActions {\n const setPresence = useSetAtom(setUserAvatarPresenceAtom(avatarId))\n const togglePresence = useSetAtom(toggleUserAvatarPresenceAtom(avatarId))\n const setBezelAngle = useSetAtom(setUserAvatarBezelAngleAtom(avatarId))\n const reset = useSetAtom(resetUserAvatarAtom(avatarId))\n\n return React.useMemo(\n () => ({ setPresence, togglePresence, setBezelAngle, reset }),\n [setPresence, togglePresence, setBezelAngle, reset]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport type { Variants } from \"motion/react\"\n\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils\"\nimport { initialsFrom } from \"@/components/user-avatar\"\n\n/** `full` shows mark + wordmark; `mark` folds the wordmark away — an icon\n * rail, a favicon-sized corner. */\nexport type LogoVariant = \"full\" | \"mark\"\n\nexport interface LogoProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n /**\n * Brand name. Labels the logo for AT (and the link, when `href` renders\n * one), drives the default wordmark, and the monogram tile when no mark\n * is given.\n */\n name: string\n /** Custom mark — an inline SVG sized to fill its box. Wins over `src`. */\n mark?: React.ReactNode\n /** Image URL for the mark. Decorative — `name` labels the logo. */\n src?: string\n /** Wordmark content. Defaults to `name`. */\n wordmark?: React.ReactNode\n /** `full` (default) or `mark` — the wordmark folds away, animated. */\n variant?: LogoVariant\n /** Renders the logo as a link — the usual \"mark goes home\" affordance. */\n href?: string\n}\n\n/** Wordmark fold/unfold — the same envelope the profile card's identity\n * lines use, so a logo and a profile card folding in the same rail move as\n * one. Kept local: composed components do not reach into blocks. Expressed\n * as named variants for consistency with the profile card's fold envelope —\n * house style for multi-property fold states, not a motion requirement. */\nconst WORDMARK_VARIANTS: Variants = {\n open: {\n width: \"auto\",\n opacity: 1,\n x: 0,\n transition: { duration: 0.2, delay: 0.08, ease: EASE_OUT },\n },\n folded: {\n width: 0,\n opacity: 0,\n x: -4,\n transition: { duration: 0.12, ease: EASE_OUT },\n },\n}\n\nconst WORDMARK_VARIANTS_REDUCED: Variants = {\n open: { width: \"auto\", opacity: 1, x: 0, transition: { duration: 0.16, ease: EASE_OUT } },\n folded: { width: 0, opacity: 0, x: 0, transition: { duration: 0.16, ease: EASE_OUT } },\n}\n\n/**\n * Brand lockup: a mark beside a wordmark. The mark is whatever the brand\n * has — an SVG (`mark`), an image (`src`), or, given neither, a monogram\n * tile derived from `name`. `variant=\"mark\"` folds the wordmark away with\n * the same motion a collapsing rail uses, so the lockup can sit in one and\n * follow its fold. With `href` the whole lockup is a link named by `name`.\n *\n * Sizing rides on the mark: it defaults to `size-8`; restyle via\n * `[&_[data-slot=logo-mark]]:size-*` or wrap in a text-size context for the\n * wordmark, which inherits.\n */\nexport function Logo({\n name,\n mark,\n src,\n wordmark,\n variant = \"full\",\n href,\n className,\n ...props\n}: LogoProps): React.ReactElement {\n const reduce = useReducedMotion()\n const folded = variant === \"mark\"\n\n const markNode = mark ?? (\n src !== undefined ? (\n // Decorative: the root's `name` (visible wordmark or aria-label)\n // already names the brand.\n <img alt=\"\" className=\"size-full object-contain\" src={src} />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"flex size-full items-center justify-center rounded-lg bg-foreground font-semibold text-background text-[45cqw]\"\n data-slot=\"logo-monogram\"\n >\n {initialsFrom(name)}\n </span>\n )\n )\n\n const content = (\n <>\n <span\n className=\"size-8 shrink-0 @container [&_svg]:size-full\"\n data-slot=\"logo-mark\"\n >\n {markNode}\n </span>\n <motion.span\n animate={folded ? \"folded\" : \"open\"}\n variants={reduce ? WORDMARK_VARIANTS_REDUCED : WORDMARK_VARIANTS}\n // Folded, the wordmark is gone for AT too — the root's label names\n // the brand on its own.\n aria-hidden={folded || undefined}\n className={cn(\n \"min-w-0 overflow-hidden font-semibold whitespace-nowrap tracking-tight\",\n folded && \"pointer-events-none\",\n // 0px wide while folded, but the flex gap before it would still\n // offset the mark — pull it back by that gap.\n folded && \"-ml-2\"\n )}\n data-slot=\"logo-wordmark\"\n initial={false}\n >\n {wordmark ?? name}\n </motion.span>\n </>\n )\n\n const rootClassName = cn(\n \"inline-flex shrink-0 items-center gap-2 text-foreground\",\n className\n )\n\n return href !== undefined ? (\n <a\n // Always labelled: the folded state hides the wordmark, and a link\n // must not lose its name mid-animation.\n aria-label={name}\n className={rootClassName}\n data-slot=\"logo\"\n data-variant={variant}\n href={href}\n {...props}\n >\n {content}\n </a>\n ) : (\n <span\n aria-label={folded ? name : undefined}\n className={rootClassName}\n data-slot=\"logo\"\n data-variant={variant}\n role={folded ? \"img\" : undefined}\n {...props}\n >\n {content}\n </span>\n )\n}\n","\"use client\";\n\nimport { CheckIcon, EyeIcon, EyeOffIcon, XIcon } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from \"@/components/ui/input-group\";\nimport { playCue } from \"@/lib/sound\";\nimport { cn } from \"@/lib/utils\";\n\n// transitions.dev motion scale\nconst EASE = [0.22, 1, 0.36, 1] as const;\n\nexport const passwordRequirements = [\n { regex: /.{8,}/, text: \"At least 8 characters\" },\n { regex: /[0-9]/, text: \"At least 1 number\" },\n { regex: /[a-z]/, text: \"At least 1 lowercase letter\" },\n { regex: /[A-Z]/, text: \"At least 1 uppercase letter\" },\n] as const;\n\nexport function getPasswordStrength(password: string): number {\n return passwordRequirements.filter((req) => req.regex.test(password)).length;\n}\n\nconst STRENGTH_COLORS = [\n \"bg-border\",\n \"bg-red-500\",\n \"bg-orange-500\",\n \"bg-amber-500\",\n \"bg-emerald-500\",\n] as const;\n\nexport interface PasswordInputProps\n extends Omit<React.ComponentProps<typeof InputGroupInput>, \"type\" | \"size\"> {\n /** Render the eye toggle button. */\n visibilityToggle?: boolean;\n /** Render the animated strength meter and requirement checklist. */\n showStrength?: boolean;\n /** Play reveal/hide cues on the visibility toggle. Inert until bindSounds(). */\n sound?: boolean;\n}\n\n/**\n * Password field with visibility toggle and optional strength meter.\n * Composition of InputGroup + Button (coss particles p-input-9 and\n * p-input-group-26).\n */\nexport function PasswordInput({\n visibilityToggle = true,\n showStrength = false,\n sound = true,\n className,\n value: valueProp,\n defaultValue,\n onChange,\n ...props\n}: PasswordInputProps) {\n const [visible, setVisible] = React.useState(false);\n const [uncontrolled, setUncontrolled] = React.useState(\n String(defaultValue ?? \"\"),\n );\n const value = valueProp !== undefined ? String(valueProp) : uncontrolled;\n const score = getPasswordStrength(value);\n\n return (\n <div className={cn(\"flex w-full flex-col gap-3\", className)}>\n <InputGroup>\n <InputGroupInput\n placeholder=\"Enter your password\"\n {...props}\n type={visible ? \"text\" : \"password\"}\n value={value}\n onChange={(event) => {\n setUncontrolled(event.target.value);\n onChange?.(event);\n }}\n />\n {visibilityToggle && (\n <InputGroupAddon align=\"inline-end\">\n <Button\n aria-label={visible ? \"Hide password\" : \"Show password\"}\n onClick={() => {\n // Semantic cues from the cuelume palette: bloom = reveal,\n // droplet = dismiss. Press/release stays off to avoid layering.\n if (sound) playCue(visible ? \"droplet\" : \"bloom\");\n setVisible((v) => !v);\n }}\n size=\"icon-xs\"\n variant=\"ghost\"\n sound={false}\n >\n <AnimatePresence mode=\"wait\" initial={false}>\n <motion.span\n key={visible ? \"off\" : \"on\"}\n className=\"inline-flex\"\n initial={{ opacity: 0, scale: 0.8, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n exit={{ opacity: 0, scale: 0.8, filter: \"blur(2px)\" }}\n transition={{ duration: 0.15, ease: EASE }}\n >\n {visible ? (\n <EyeOffIcon aria-hidden=\"true\" />\n ) : (\n <EyeIcon aria-hidden=\"true\" />\n )}\n </motion.span>\n </AnimatePresence>\n </Button>\n </InputGroupAddon>\n )}\n </InputGroup>\n\n <AnimatePresence initial={false}>\n {showStrength && (\n <motion.div\n className=\"flex flex-col gap-2 overflow-hidden\"\n initial={{ height: 0, opacity: 0 }}\n animate={{ height: \"auto\", opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n transition={{ duration: 0.25, ease: EASE }}\n >\n <div\n aria-label=\"Password strength\"\n aria-valuemax={4}\n aria-valuemin={0}\n aria-valuenow={score}\n className=\"h-1 w-full overflow-hidden rounded-full bg-border\"\n role=\"progressbar\"\n >\n <motion.div\n className={cn(\"h-full rounded-full\", STRENGTH_COLORS[score])}\n animate={{ width: `${(score / 4) * 100}%` }}\n transition={{ duration: 0.4, ease: EASE }}\n />\n </div>\n <ul\n aria-label=\"Password requirements\"\n className=\"flex flex-col gap-1\"\n >\n {passwordRequirements.map((req) => {\n const met = req.regex.test(value);\n return (\n <li className=\"flex items-center gap-2 text-xs\" key={req.text}>\n {met ? (\n <CheckIcon\n aria-hidden=\"true\"\n className=\"size-3.5 text-emerald-500\"\n />\n ) : (\n <XIcon\n aria-hidden=\"true\"\n className=\"size-3.5 text-muted-foreground/80\"\n />\n )}\n <span\n className={\n met ? \"text-emerald-600\" : \"text-muted-foreground\"\n }\n >\n {req.text}\n <span className=\"sr-only\">\n {met ? \" - met\" : \" - not met\"}\n </span>\n </span>\n </li>\n );\n })}\n </ul>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n","\"use client\"\n\nimport {\n RiAppleFill,\n RiGithubFill,\n RiGoogleFill,\n RiTwitterXFill,\n} from \"@remixicon/react\"\nimport type * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nexport type SocialProvider = \"google\" | \"apple\" | \"github\" | \"x\"\n\n/** Google's four-color \"G\" — the only provider whose mark isn't monochrome. */\nfunction GoogleColorIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" {...props}>\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.76h3.56c2.09-1.92 3.28-4.74 3.28-8.09Z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.56-2.76c-.99.66-2.25 1.05-3.72 1.05-2.86 0-5.28-1.93-6.15-4.53H2.18v2.85A11 11 0 0 0 12 23Z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.85 14.1A6.6 6.6 0 0 1 5.5 12c0-.73.13-1.44.35-2.1V7.05H2.18a11 11 0 0 0 0 9.9l3.67-2.85Z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15A11 11 0 0 0 2.18 7.05L5.85 9.9C6.72 7.3 9.14 5.38 12 5.38Z\"\n />\n </svg>\n )\n}\n\n/**\n * Label + brand mark per provider, shared with the auth blocks. `Icon` is the\n * monochrome mark that inherits the current text color; `BrandIcon` +\n * `brandClassName` render it in the provider's own colors.\n */\nexport const SOCIAL_PROVIDERS: Record<\n SocialProvider,\n {\n label: string\n Icon: React.ComponentType<{ className?: string }>\n BrandIcon: React.ComponentType<{ className?: string }>\n brandClassName: string\n }\n> = {\n google: {\n label: \"Google\",\n Icon: RiGoogleFill,\n BrandIcon: GoogleColorIcon,\n brandClassName: \"\",\n },\n apple: {\n label: \"Apple\",\n Icon: RiAppleFill,\n BrandIcon: RiAppleFill,\n brandClassName: \"text-foreground\",\n },\n github: {\n label: \"GitHub\",\n Icon: RiGithubFill,\n BrandIcon: RiGithubFill,\n brandClassName: \"text-foreground\",\n },\n x: {\n label: \"X\",\n Icon: RiTwitterXFill,\n BrandIcon: RiTwitterXFill,\n brandClassName: \"text-foreground\",\n },\n}\n\nconst ACTION_LABELS = {\n login: \"Login with\",\n signup: \"Sign up with\",\n continue: \"Continue with\",\n} as const\n\nexport interface SocialProvidersProps {\n providers?: SocialProvider[]\n /** Verb used in the stacked layout labels. */\n action?: keyof typeof ACTION_LABELS\n /** \"stack\" = full-width labeled buttons; \"row\" = icon-only buttons. */\n layout?: \"stack\" | \"row\"\n /** Shows the matching button in its loading state and disables the rest. */\n loadingProvider?: SocialProvider | null\n disabled?: boolean\n onSelect?: (provider: SocialProvider) => void\n className?: string\n}\n\n/** Social auth buttons (coss particle p-button-38). UI only — wire onSelect. */\nexport function SocialProviders({\n providers = [\"google\", \"apple\", \"github\"],\n action = \"continue\",\n layout = \"stack\",\n loadingProvider = null,\n disabled = false,\n onSelect,\n className,\n}: SocialProvidersProps) {\n const row = layout === \"row\"\n\n return (\n <div\n className={cn(\n \"flex w-full gap-2\",\n row ? \"flex-row justify-center\" : \"flex-col\",\n className\n )}\n >\n {providers.map((provider) => {\n const { label, Icon } = SOCIAL_PROVIDERS[provider]\n return (\n <Button\n key={provider}\n variant=\"outline\"\n size={row ? \"icon\" : \"default\"}\n className={row ? undefined : \"w-full\"}\n aria-label={`${ACTION_LABELS[action]} ${label}`}\n loading={loadingProvider === provider}\n disabled={\n disabled ||\n (loadingProvider !== null && loadingProvider !== provider)\n }\n onClick={() => onSelect?.(provider)}\n >\n <Icon aria-hidden=\"true\" />\n {!row && (\n <span className=\"flex-1\">\n {ACTION_LABELS[action]} {label}\n </span>\n )}\n </Button>\n )\n })}\n </div>\n )\n}\n","\"use client\"\n\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction TooltipProvider({\n delay = 0,\n ...props\n}: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delay={delay}\n {...props}\n />\n )\n}\n\nfunction Tooltip({ ...props }: TooltipPrimitive.Root.Props) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n side = \"top\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <TooltipPrimitive.Popup\n data-slot=\"tooltip-content\"\n className={cn(\n \"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5\" />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport type { TreeContextValue } from \"./type\"\n\nexport const TreeContext = React.createContext<TreeContextValue | null>(null)\n\nexport function useTreeContext(): TreeContextValue {\n const context = React.useContext(TreeContext)\n if (!context) throw new Error(\"Tree rows must render inside <Tree>.\")\n return context\n}\n","import type { Transition, Variants } from \"motion/react\"\n\n/** `--ease-smooth-out` as a motion/react easing tuple. */\nexport const TREE_EASE = [0.22, 1, 0.36, 1] as const\n\n/** Branch open — `--duration-fast` territory (accordion open). */\nexport const TREE_OPEN_DURATION = 0.25\n\n/** Branch close — quicker than open, per open/close asymmetry. */\nexport const TREE_CLOSE_DURATION = 0.15\n\n/** Chevron flip and label fades. */\nexport const TREE_MICRO_DURATION = 0.15\n\n/** Sidebar rail label reveal/hide when `collapsed` flips. */\nexport const TREE_COLLAPSE_DURATION = 0.2\n\n/** The collapsed rail's width in px — one `h-10 rounded-xl` icon row, edge\n * to edge. Kept in sync with the `w-10` resting class the rail falls back to\n * before its expanded width has been measured. */\nexport const RAIL_COLLAPSED_WIDTH = 40\n\n/** Rail label text fade — starts as the width growth is finishing, so the\n * label never reads as clipped mid-grow. */\nexport const TREE_LABEL_REVEAL_DELAY = 0.01\n\n/** A branch's children group: grows open with a soft stagger, folds shut\n * faster. Height rides layout (\"auto\"), paint fades. */\nexport const TREE_BRANCH_VARIANTS: Variants = {\n closed: { height: 0, opacity: 0 },\n open: {\n height: \"auto\",\n opacity: 1,\n transition: {\n duration: TREE_OPEN_DURATION,\n ease: TREE_EASE,\n staggerChildren: 0.03,\n },\n },\n}\n\n/** Branch close — a plain target, NOT the \"closed\" variant label: a\n * labeled exit orchestrates every variant child and AnimatePresence then\n * waits on the whole subtree before unmounting. */\nexport const TREE_BRANCH_EXIT = {\n height: 0,\n opacity: 0,\n transition: { duration: TREE_CLOSE_DURATION, ease: TREE_EASE },\n}\n\n/** One row inside an opening branch — a short blurred rise. */\nexport const TREE_ROW_VARIANTS: Variants = {\n closed: { opacity: 0, x: -4 },\n open: { opacity: 1, x: 0 },\n}\n\nexport const TREE_MICRO_TRANSITION: Transition = {\n duration: TREE_MICRO_DURATION,\n ease: TREE_EASE,\n}\n","import type { TreeNode } from \"./type\"\n\n/** Depth-0 nodes read as sections only when the data actually nests three\n * levels — a two-level tree keeps its top level as plain link rows. */\nexport function hasThreeLevels(items: readonly TreeNode[]): boolean {\n return items.some((node) =>\n node.children?.some((child) => (child.children?.length ?? 0) > 0)\n )\n}\n\n/** Ids of every ancestor of `id` (nearest last); empty when absent. */\nexport function ancestorIdsOf(\n items: readonly TreeNode[],\n id: string\n): string[] {\n const walk = (nodes: readonly TreeNode[], trail: string[]): string[] | null => {\n for (const node of nodes) {\n if (node.id === id) return trail\n if (node.children) {\n const found = walk(node.children, [...trail, node.id])\n if (found) return found\n }\n }\n return null\n }\n return walk(items, []) ?? []\n}\n\n/** Ids that start expanded: `defaultOpen` nodes plus every ancestor of the\n * active entry, so the current location is never folded away. */\nexport function initialExpandedIds(\n items: readonly TreeNode[],\n activeId?: string\n): Set<string> {\n const expanded = new Set<string>()\n const walk = (nodes: readonly TreeNode[]) => {\n for (const node of nodes) {\n if (node.defaultOpen) expanded.add(node.id)\n if (node.children) walk(node.children)\n }\n }\n walk(items)\n if (activeId !== undefined)\n for (const id of ancestorIdsOf(items, activeId)) expanded.add(id)\n return expanded\n}\n\n/** Ids of every node that can hold children — the set `expandAll` opens.\n * In `files` an empty `children: []` still counts (it is a folder). */\nexport function expandableIdsOf(\n items: readonly TreeNode[],\n filesVariant = false\n): string[] {\n const ids: string[] = []\n const walk = (nodes: readonly TreeNode[]) => {\n for (const node of nodes) {\n const branch = filesVariant\n ? node.children !== undefined\n : (node.children?.length ?? 0) > 0\n if (branch) ids.push(node.id)\n if (node.children) walk(node.children)\n }\n }\n walk(items)\n return ids\n}\n\n/** Immutably relabel `id`. Returns the same array reference when absent. */\nexport function renameNode(\n items: readonly TreeNode[],\n id: string,\n label: string\n): TreeNode[] {\n return items.map((node) => {\n if (node.id === id) return { ...node, label }\n return node.children\n ? { ...node, children: renameNode(node.children, id, label) }\n : node\n })\n}\n\n/** Whether `candidateId` is `id` itself or nests anywhere under it — the\n * guard that keeps a folder from being dropped into its own subtree. */\nexport function containsNode(\n items: readonly TreeNode[],\n id: string,\n candidateId: string\n): boolean {\n if (id === candidateId) return true\n const root = findNode(items, id)\n if (!root?.children) return false\n return findNode(root.children, candidateId) !== null\n}\n\nexport function findNode(\n items: readonly TreeNode[],\n id: string\n): TreeNode | null {\n for (const node of items) {\n if (node.id === id) return node\n if (node.children) {\n const found = findNode(node.children, id)\n if (found) return found\n }\n }\n return null\n}\n\n/** Parent id (`null` at root) and index of `id` among its siblings. */\nexport function locateNode(\n items: readonly TreeNode[],\n id: string\n): { parentId: string | null; index: number } | null {\n const walk = (\n nodes: readonly TreeNode[],\n parentId: string | null\n ): { parentId: string | null; index: number } | null => {\n for (const [index, node] of nodes.entries()) {\n if (node.id === id) return { parentId, index }\n if (node.children) {\n const found = walk(node.children, node.id)\n if (found) return found\n }\n }\n return null\n }\n return walk(items, null)\n}\n\n/** Immutably lift `id` out of the tree and reinsert it under `parentId`\n * (`null` = root) at `index` — the standard `onMove` reducer, exported so\n * consumers don't each rebuild it. `index` addresses the sibling list\n * *after* the node has been lifted out. */\nexport function moveNode(\n items: readonly TreeNode[],\n id: string,\n parentId: string | null,\n index: number\n): TreeNode[] {\n // Dropping into the node's own subtree would orphan it — refuse.\n if (parentId !== null && containsNode(items, id, parentId)) return [...items]\n let moved: TreeNode | null = null\n const strip = (nodes: readonly TreeNode[]): TreeNode[] =>\n nodes.flatMap((node) => {\n if (node.id === id) {\n moved = node\n return []\n }\n return node.children\n ? [{ ...node, children: strip(node.children) }]\n : [node]\n })\n const stripped = strip(items)\n if (!moved) return [...items]\n const captured = moved as TreeNode\n\n if (parentId === null) {\n const next = [...stripped]\n next.splice(Math.min(index, next.length), 0, captured)\n return next\n }\n const insert = (nodes: readonly TreeNode[]): TreeNode[] =>\n nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])]\n children.splice(Math.min(index, children.length), 0, captured)\n return { ...node, children }\n }\n return node.children ? { ...node, children: insert(node.children) } : node\n })\n return insert(stripped)\n}\n","/**\n * Per-instance Jotai state for `Tree`.\n *\n * Every atom is a module-level family keyed by a tree id, so one\n * `ExegiaProvider` at the app root is enough: many trees coexist in one store\n * without a provider each, and any component can drive a tree by id without\n * holding its controller.\n *\n * Controlled props stay authoritative. `useTree` projects them into these\n * atoms on every commit so the action atoms and remote readers work off\n * current data — a one-way projection, not a second source of truth. The\n * write gates below (`controlsItems`, `controlsActiveId`, `controlsCollapsed`)\n * are what keep the store from overwriting a prop.\n */\nimport { atom } from \"jotai\"\nimport type { Atom, Getter, Setter } from \"jotai\"\n\nimport { playCue } from \"@/lib/sound\"\nimport type {\n TreeConfig,\n TreeDropPosition,\n TreeDropTarget,\n TreeHandlers,\n TreeInstanceId,\n TreeNode,\n TreeSeed,\n TreeState,\n TreeVariant,\n} from \"./type\"\nimport {\n ancestorIdsOf,\n expandableIdsOf,\n findNode,\n hasThreeLevels,\n initialExpandedIds,\n moveNode,\n renameNode,\n} from \"./utils\"\n\nconst NO_ITEMS: TreeNode[] = []\nconst NO_IDS: ReadonlySet<string> = new Set<string>()\nconst NO_HANDLERS: TreeHandlers = {}\n\n/** What a tree reads as before `useTree` publishes its options. */\nexport const DEFAULT_TREE_CONFIG: TreeConfig = {\n variant: \"navigation\",\n sound: true,\n controlsItems: false,\n controlsActiveId: false,\n controlsCollapsed: false,\n managesItems: true,\n hasRenameHandler: false,\n hasMoveHandler: false,\n}\n\nconst DEFAULT_TREE_SEED: TreeSeed = { items: NO_ITEMS, collapsed: false }\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: TreeInstanceId) => AtomType) & {\n remove: (id: TreeInstanceId) => void\n}\n\n/** Every family, so `removeTreeInstance` can drop an id from all of them. */\nconst families: { remove: (id: TreeInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: TreeInstanceId) => AtomType) {\n const cache = new Map<TreeInstanceId, AtomType>()\n const family = ((id: TreeInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: TreeInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: TreeInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (get: Getter, set: Setter, id: TreeInstanceId, ...args: Args) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\n/**\n * A per-node derived atom, keyed by tree and then node id.\n *\n * This is where Jotai earns its place: a row subscribed to\n * `treeNodeExpandedAtom(treeId, node.id)` re-renders when *its* branch opens,\n * and stays put when a sibling's does. Reading the whole controller through\n * context instead re-rendered every row in the tree on every toggle.\n *\n * The outer family registers for cleanup, so `removeTreeInstance` drops all\n * of a tree's node atoms with it.\n */\nfunction nodeFamily<Value>(\n name: string,\n read: (get: Getter, id: TreeInstanceId, nodeId: string) => Value\n) {\n const outer = keyed((id: TreeInstanceId) => {\n const inner = new Map<string, Atom<Value>>()\n return (nodeId: string) => {\n let instance = inner.get(nodeId)\n if (instance === undefined) {\n instance = atom((get) => read(get, id, nodeId))\n instance.debugLabel = `tree/${id}/${name}/${nodeId}`\n inner.set(nodeId, instance)\n }\n return instance\n }\n })\n return (id: TreeInstanceId, nodeId: string) => outer(id)(nodeId)\n}\n\n// ── state ──────────────────────────────────────────────────────────────────\n\n/** @internal */\nexport const treeConfigAtom = stateFamily<TreeConfig>(\n \"config\",\n DEFAULT_TREE_CONFIG\n)\n/** @internal Refreshed every commit; nothing subscribes, so it is free. */\nexport const treeHandlersAtom = stateFamily<TreeHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\nconst treeSeedAtom = stateFamily<TreeSeed>(\"seed\", DEFAULT_TREE_SEED)\nconst treeInitializedAtom = stateFamily<boolean>(\"initialized\", false)\n\n/** The tree's current data — hook-owned, or the projection of a controlled\n * `items` prop. */\nexport const treeItemsAtom = stateFamily<TreeNode[]>(\"items\", NO_ITEMS)\nexport const treeActiveIdAtom = stateFamily<string | undefined>(\n \"activeId\",\n undefined\n)\nexport const treeExpandedIdsAtom = stateFamily<ReadonlySet<string>>(\n \"expandedIds\",\n NO_IDS\n)\n/** Raw rail fold. Read `treeCollapsedAtom` for the variant-masked value. */\nexport const treeRailCollapsedAtom = stateFamily<boolean>(\n \"railCollapsed\",\n false\n)\nexport const treeRenamingIdAtom = stateFamily<string | null>(\"renamingId\", null)\nexport const treeDraggedIdAtom = stateFamily<string | null>(\"draggedId\", null)\nexport const treeDropTargetAtom = stateFamily<TreeDropTarget | null>(\n \"dropTarget\",\n null\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** @internal The only items atom `useTree` may subscribe to: empty while a\n * controlled `items` prop owns the data, so the projection write never feeds\n * back into the render that produced it. An inline `items={[…]}` array is a\n * new reference every render, and a subscribed round-trip would loop. */\nexport const treeOwnedItemsAtom = readFamily(\"ownedItems\", (get, id) =>\n get(treeConfigAtom(id)).controlsItems ? NO_ITEMS : get(treeItemsAtom(id))\n)\n\n/** Rail folded to icons — always `false` outside `sidebar`. */\nexport const treeCollapsedAtom = readFamily(\"collapsed\", (get, id) =>\n get(treeConfigAtom(id)).variant === \"sidebar\"\n ? get(treeRailCollapsedAtom(id))\n : false\n)\n\nexport const treeSectionedAtom = readFamily(\n \"sectioned\",\n (get, id) =>\n get(treeConfigAtom(id)).variant === \"navigation\" &&\n hasThreeLevels(get(treeItemsAtom(id)))\n)\n\nexport const treeSectionIdsAtom = readFamily(\"sectionIds\", (get, id) =>\n get(treeSectionedAtom(id))\n ? get(treeItemsAtom(id)).map((node) => node.id)\n : []\n)\n\nexport const treeCanRenameAtom = readFamily(\"canRename\", (get, id) => {\n const config = get(treeConfigAtom(id))\n return (\n config.variant === \"files\" &&\n (config.hasRenameHandler || config.managesItems)\n )\n})\n\nexport const treeCanMoveAtom = readFamily(\"canMove\", (get, id) => {\n const config = get(treeConfigAtom(id))\n return (\n config.variant === \"files\" && (config.hasMoveHandler || config.managesItems)\n )\n})\n\nexport const treeVariantAtom = readFamily(\n \"variant\",\n (get, id) => get(treeConfigAtom(id)).variant\n)\n\nexport const treeSoundAtom = readFamily(\n \"sound\",\n (get, id) => get(treeConfigAtom(id)).sound\n)\n\n/** Whether this one node's branch is open. */\nexport const treeNodeExpandedAtom = nodeFamily(\"expanded\", (get, id, nodeId) =>\n get(treeExpandedIdsAtom(id)).has(nodeId)\n)\n\n/** Whether this one node is the current entry. */\nexport const treeNodeActiveAtom = nodeFamily(\n \"active\",\n (get, id, nodeId) => get(treeActiveIdAtom(id)) === nodeId\n)\n\n/** Whether this one node is in rename mode. */\nexport const treeNodeRenamingAtom = nodeFamily(\n \"renaming\",\n (get, id, nodeId) => get(treeRenamingIdAtom(id)) === nodeId\n)\n\n/** Whether this one node is the row in flight. */\nexport const treeNodeDraggingAtom = nodeFamily(\n \"dragging\",\n (get, id, nodeId) => get(treeDraggedIdAtom(id)) === nodeId\n)\n\n/** Where a drop on this one node would land, `null` when it is not hovered. */\nexport const treeNodeDropAtom = nodeFamily<TreeDropPosition | null>(\n \"drop\",\n (get, id, nodeId) => {\n const target = get(treeDropTargetAtom(id))\n return target?.id === nodeId ? target.position : null\n }\n)\n\n/** The whole state of one tree. Components reading a single field should\n * subscribe to that field's atom instead — this one changes on every edit. */\nexport const treeStateAtom = readFamily<TreeState>(\"state\", (get, id) => ({\n variant: get(treeConfigAtom(id)).variant,\n items: get(treeItemsAtom(id)),\n activeId: get(treeActiveIdAtom(id)),\n expandedIds: get(treeExpandedIdsAtom(id)),\n collapsed: get(treeCollapsedAtom(id)),\n renamingId: get(treeRenamingIdAtom(id)),\n sectioned: get(treeSectionedAtom(id)),\n sectionIds: get(treeSectionIdsAtom(id)),\n canRename: get(treeCanRenameAtom(id)),\n canMove: get(treeCanMoveAtom(id)),\n draggedId: get(treeDraggedIdAtom(id)),\n dropTarget: get(treeDropTargetAtom(id)),\n}))\n\n// ── shared write helpers ───────────────────────────────────────────────────\n\nfunction cue(get: Getter, id: TreeInstanceId): void {\n if (get(treeConfigAtom(id)).sound) playCue(\"toggle\")\n}\n\nfunction commitExpanded(\n get: Getter,\n set: Setter,\n id: TreeInstanceId,\n next: Set<string>\n): void {\n set(treeExpandedIdsAtom(id), next)\n get(treeHandlersAtom(id)).onExpandedChange?.([...next])\n}\n\n/** The atom only when the hook owns the data; the callback always. */\nfunction commitItems(\n get: Getter,\n set: Setter,\n id: TreeInstanceId,\n next: TreeNode[]\n): void {\n if (!get(treeConfigAtom(id)).controlsItems) set(treeItemsAtom(id), next)\n get(treeHandlersAtom(id)).onItemsChange?.(next)\n}\n\n/** `null` when every ancestor of `nodeId` is already open. */\nfunction withAncestors(\n get: Getter,\n id: TreeInstanceId,\n nodeId: string\n): Set<string> | null {\n const ancestors = ancestorIdsOf(get(treeItemsAtom(id)), nodeId)\n const expanded = get(treeExpandedIdsAtom(id))\n if (!ancestors.some((ancestor) => !expanded.has(ancestor))) return null\n return new Set([...expanded, ...ancestors])\n}\n\nfunction seedInstance(\n set: Setter,\n id: TreeInstanceId,\n seed: TreeSeed,\n variant: TreeVariant\n): void {\n set(treeItemsAtom(id), seed.items)\n set(treeActiveIdAtom(id), seed.activeId)\n set(treeRailCollapsedAtom(id), seed.collapsed)\n set(treeRenamingIdAtom(id), null)\n set(treeDraggedIdAtom(id), null)\n set(treeDropTargetAtom(id), null)\n const expanded = seed.expandedIds\n ? new Set(seed.expandedIds)\n : initialExpandedIds(seed.items, seed.activeId)\n // Section names default open — they are headings over their run of items,\n // not drawers; `defaultOpen: false` still starts one closed.\n if (\n !seed.expandedIds &&\n variant === \"navigation\" &&\n hasThreeLevels(seed.items)\n )\n for (const node of seed.items)\n if (node.defaultOpen !== false) expanded.add(node.id)\n set(treeExpandedIdsAtom(id), expanded)\n}\n\n// ── expansion ──────────────────────────────────────────────────────────────\n\nexport const expandTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"expand\",\n (get, set, id, nodeId) => {\n const expanded = get(treeExpandedIdsAtom(id))\n if (expanded.has(nodeId)) return\n commitExpanded(get, set, id, new Set([...expanded, nodeId]))\n cue(get, id)\n }\n)\n\nexport const collapseTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"collapse\",\n (get, set, id, nodeId) => {\n const expanded = get(treeExpandedIdsAtom(id))\n if (!expanded.has(nodeId)) return\n const next = new Set(expanded)\n next.delete(nodeId)\n commitExpanded(get, set, id, next)\n cue(get, id)\n }\n)\n\nexport const toggleTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"toggleExpanded\",\n (get, set, id, nodeId) => {\n const next = new Set(get(treeExpandedIdsAtom(id)))\n if (next.has(nodeId)) next.delete(nodeId)\n else next.add(nodeId)\n commitExpanded(get, set, id, next)\n cue(get, id)\n }\n)\n\nexport const expandAllTreeNodesAtom = actionFamily<[]>(\n \"expandAll\",\n (get, set, id) => {\n const filesVariant = get(treeConfigAtom(id)).variant === \"files\"\n const ids = expandableIdsOf(get(treeItemsAtom(id)), filesVariant)\n commitExpanded(get, set, id, new Set(ids))\n }\n)\n\nexport const collapseAllTreeNodesAtom = actionFamily<[]>(\n \"collapseAll\",\n (get, set, id) => {\n commitExpanded(get, set, id, new Set())\n }\n)\n\n/** Open every ancestor of `nodeId` without touching the rest of the tree. */\nexport const revealTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"reveal\",\n (get, set, id, nodeId) => {\n const next = withAncestors(get, id, nodeId)\n if (next) commitExpanded(get, set, id, next)\n }\n)\n\n/** @internal The same, silent. `useTree` runs it whenever the active id\n * changes so a nested entry is never folded away — the hook has never\n * reported that implicit reveal through `onExpandedChange`. */\nexport const revealTreeAncestorsAtom = actionFamily<[nodeId: string]>(\n \"revealAncestors\",\n (get, set, id, nodeId) => {\n const next = withAncestors(get, id, nodeId)\n if (next) set(treeExpandedIdsAtom(id), next)\n }\n)\n\n// ── rail ───────────────────────────────────────────────────────────────────\n\nexport const setTreeCollapsedAtom = actionFamily<[collapsed: boolean]>(\n \"setCollapsed\",\n (get, set, id, collapsed) => {\n if (!get(treeConfigAtom(id)).controlsCollapsed)\n set(treeRailCollapsedAtom(id), collapsed)\n get(treeHandlersAtom(id)).onCollapsedChange?.(collapsed)\n cue(get, id)\n }\n)\n\nexport const toggleTreeCollapsedAtom = actionFamily<[]>(\n \"toggleCollapsed\",\n (get, set, id) => {\n set(setTreeCollapsedAtom(id), !get(treeCollapsedAtom(id)))\n }\n)\n\n// ── selection ──────────────────────────────────────────────────────────────\n\n/** Runs the node's own `onSelect` first, then `onNavigate` — the order a row\n * press follows. Disabled and unknown nodes are inert. */\nexport const selectTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"select\",\n (get, set, id, nodeId) => {\n const node = findNode(get(treeItemsAtom(id)), nodeId)\n if (!node || node.disabled) return\n if (!get(treeConfigAtom(id)).controlsActiveId)\n set(treeActiveIdAtom(id), nodeId)\n node.onSelect?.()\n get(treeHandlersAtom(id)).onNavigate?.(node)\n }\n)\n\n// ── rename ─────────────────────────────────────────────────────────────────\n\nexport const startTreeRenameAtom = actionFamily<[nodeId: string]>(\n \"startRename\",\n (get, set, id, nodeId) => {\n // An id from elsewhere (a stale selection, another tree) would arm rename\n // mode against a row that never renders.\n if (!get(treeCanRenameAtom(id))) return\n if (!findNode(get(treeItemsAtom(id)), nodeId)) return\n set(treeRenamingIdAtom(id), nodeId)\n }\n)\n\nexport const cancelTreeRenameAtom = actionFamily<[]>(\n \"cancelRename\",\n (_get, set, id) => {\n set(treeRenamingIdAtom(id), null)\n }\n)\n\n/** Commit a rename and leave rename mode. Blank or unchanged labels are\n * dropped. */\nexport const renameTreeNodeAtom = actionFamily<[nodeId: string, label: string]>(\n \"rename\",\n (get, set, id, nodeId, label) => {\n set(treeRenamingIdAtom(id), null)\n const next = label.trim()\n if (!get(treeCanRenameAtom(id)) || !next) return\n const items = get(treeItemsAtom(id))\n const node = findNode(items, nodeId)\n if (!node || node.label === next) return\n get(treeHandlersAtom(id)).onRename?.(nodeId, next)\n if (get(treeConfigAtom(id)).managesItems)\n commitItems(get, set, id, renameNode(items, nodeId, next))\n }\n)\n\n// ── data ───────────────────────────────────────────────────────────────────\n\nexport const moveTreeNodeAtom = actionFamily<\n [nodeId: string, parentId: string | null, index: number]\n>(\"move\", (get, set, id, nodeId, parentId, index) => {\n if (!get(treeCanMoveAtom(id))) return\n get(treeHandlersAtom(id)).onMove?.(nodeId, parentId, index)\n if (get(treeConfigAtom(id)).managesItems)\n commitItems(\n get,\n set,\n id,\n moveNode(get(treeItemsAtom(id)), nodeId, parentId, index)\n )\n})\n\n/** Replace the data. Reports through `onItemsChange`; writes the atom only\n * when no controlled `items` prop owns it. */\nexport const setTreeItemsAtom = actionFamily<[items: TreeNode[]]>(\n \"setItems\",\n (get, set, id, items) => {\n commitItems(get, set, id, items)\n }\n)\n\n// ── drag state ─────────────────────────────────────────────────────────────\n\nexport const endTreeDragAtom = actionFamily<[]>(\"endDrag\", (_get, set, id) => {\n set(treeDraggedIdAtom(id), null)\n set(treeDropTargetAtom(id), null)\n})\n\n// ── lifecycle ──────────────────────────────────────────────────────────────\n\n/** @internal Publish the latest options; seed the instance once. */\nexport const mountTreeAtom = actionFamily<[config: TreeConfig, seed: TreeSeed]>(\n \"mount\",\n (get, set, id, config, seed) => {\n set(treeConfigAtom(id), config)\n if (get(treeInitializedAtom(id))) return\n set(treeInitializedAtom(id), true)\n set(treeSeedAtom(id), seed)\n seedInstance(set, id, seed, config.variant)\n }\n)\n\n/** @internal */\nexport const setTreeHandlersAtom = actionFamily<[handlers: TreeHandlers]>(\n \"setHandlers\",\n (_get, set, id, handlers) => {\n set(treeHandlersAtom(id), handlers)\n }\n)\n\n/** @internal One-way projections of controlled props — no callbacks fire. */\nexport const projectTreeItemsAtom = actionFamily<[items: TreeNode[]]>(\n \"projectItems\",\n (_get, set, id, items) => {\n set(treeItemsAtom(id), items)\n }\n)\n\n/** @internal */\nexport const projectTreeActiveIdAtom = actionFamily<\n [activeId: string | undefined]\n>(\"projectActiveId\", (_get, set, id, activeId) => {\n set(treeActiveIdAtom(id), activeId)\n})\n\n/** @internal */\nexport const projectTreeCollapsedAtom = actionFamily<[collapsed: boolean]>(\n \"projectCollapsed\",\n (_get, set, id, collapsed) => {\n set(treeRailCollapsedAtom(id), collapsed)\n }\n)\n\n/** Back to the values the instance mounted with. */\nexport const resetTreeAtom = actionFamily<[]>(\"reset\", (get, set, id) => {\n seedInstance(set, id, get(treeSeedAtom(id)), get(treeConfigAtom(id)).variant)\n})\n\n/** Drop every atom for `id`. `useTree` calls this on unmount for trees it\n * keyed itself; an explicit `treeId` outlives its component, so a rail's fold\n * survives a route change. */\nexport function removeTreeInstance(id: TreeInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport { LucideChevronLeft, LucideChevronRight } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\"\nimport {\n TREE_BRANCH_EXIT,\n TREE_BRANCH_VARIANTS,\n TREE_COLLAPSE_DURATION,\n TREE_LABEL_REVEAL_DELAY,\n TREE_MICRO_TRANSITION,\n TREE_ROW_VARIANTS,\n} from \"./constants\"\nimport {\n cancelTreeRenameAtom,\n renameTreeNodeAtom,\n selectTreeNodeAtom,\n startTreeRenameAtom,\n toggleTreeNodeAtom,\n treeCanRenameAtom,\n treeCollapsedAtom,\n treeNodeActiveAtom,\n treeNodeDraggingAtom,\n treeNodeDropAtom,\n treeNodeExpandedAtom,\n treeNodeRenamingAtom,\n treeSectionedAtom,\n treeSoundAtom,\n treeVariantAtom,\n} from \"./tree-atom\"\nimport { useTreeContext } from \"./tree-context\"\nimport type { TreeNode } from \"./type\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { Button } from \"@/components/ui/button\"\n\n/** How a row behaves, resolved from variant + depth + shape. */\ntype RowKind =\n | \"section\" // navigation depth 0 with 3-level data — heading, toggles\n | \"toggle\" // expands/collapses on row press (nav parents, files folders)\n | \"link\" // navigates; may still carry a chevron that toggles separately\nexport interface TreeRowProps {\n node: TreeNode\n depth: number\n}\n\nfunction rowKindOf(\n node: TreeNode,\n depth: number,\n variant: string,\n sectioned: boolean\n): RowKind {\n if (variant === \"sidebar\") return \"link\"\n const branch =\n variant === \"files\" ? node.children !== undefined : !!node.children?.length\n if (!branch) return \"link\"\n if (variant === \"navigation\")\n return sectioned && depth === 0 ? \"section\" : \"toggle\"\n // toc parents navigate — their chevron is a separate toggle.\n return variant === \"toc\" ? \"link\" : \"toggle\"\n}\n\nfunction TreeRowImpl({ node, depth }: TreeRowProps): React.ReactElement {\n const { treeId, renderTrailing, dnd } = useTreeContext()\n const reduce = useReducedMotion()\n\n // One subscription per field, per node. A row re-renders when its own\n // branch, selection, rename or drag state changes and sits still while a\n // sibling's does — reading the whole controller off context instead\n // re-rendered every row in the tree on every toggle.\n const variant = useAtomValue(treeVariantAtom(treeId))\n const sectioned = useAtomValue(treeSectionedAtom(treeId))\n const collapsed = useAtomValue(treeCollapsedAtom(treeId))\n const canRename = useAtomValue(treeCanRenameAtom(treeId))\n const sound = useAtomValue(treeSoundAtom(treeId))\n const open = useAtomValue(treeNodeExpandedAtom(treeId, node.id))\n const active = useAtomValue(treeNodeActiveAtom(treeId, node.id))\n const renaming = useAtomValue(treeNodeRenamingAtom(treeId, node.id))\n const dragging = useAtomValue(treeNodeDraggingAtom(treeId, node.id))\n const drop = useAtomValue(treeNodeDropAtom(treeId, node.id))\n\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n\n const kind = rowKindOf(node, depth, variant, sectioned)\n\n // The sidebar rail is single-level by contract — nested children are\n // ignored rather than rendered somewhere misleading.\n const children = variant === \"sidebar\" ? [] : (node.children ?? [])\n const canExpand =\n kind !== \"link\" || (variant === \"toc\" && children.length > 0)\n\n const files = variant === \"files\"\n\n // toc rows below the route level are in-page anchors: they scroll to the\n // heading sharing their id (an explicit `#hash` href wins). Rows are\n // buttons, so the anchor default is reproduced by setting location.hash\n // after `select` — the same order the old <a> gave (handlers first, then\n // the browser's jump), with the same :target/history semantics.\n const anchorHash =\n variant === \"toc\" && kind === \"link\" && !node.disabled\n ? node.href?.startsWith(\"#\")\n ? node.href\n : depth > 0 && !node.href\n ? `#${node.id}`\n : undefined\n : undefined\n\n function handlePress(event: React.MouseEvent) {\n if (node.disabled) {\n event.preventDefault()\n return\n }\n if (kind === \"link\") {\n select(node.id)\n if (anchorHash !== undefined && typeof window !== \"undefined\") {\n window.location.hash = anchorHash\n }\n return\n }\n toggleExpanded(node.id)\n }\n\n function handleStartRename(event: React.MouseEvent) {\n if (!canRename || node.disabled) return\n event.preventDefault()\n startRename(node.id)\n }\n\n const label = renaming ? (\n <input\n autoFocus\n className={cn(\n \"h-5 min-w-0 flex-1 rounded-sm border-none bg-transparent px-1\",\n \"text-[length:inherit] text-foreground outline-none focus-visible:ring-0\"\n )}\n data-slot=\"tree-rename-input\"\n defaultValue={node.label}\n onBlur={(event) => rename(node.id, event.currentTarget.value)}\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === \"Enter\") rename(node.id, event.currentTarget.value)\n if (event.key === \"Escape\") cancelRename()\n }}\n />\n ) : variant === \"sidebar\" ? (\n // The rail label folds away with the rail instead of unmounting rows.\n <AnimatePresence initial={false} mode=\"wait\">\n <motion.span\n initial={{ width: 0, opacity: 0, x: -8 }}\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? -8 : 0,\n display: collapsed ? \"none\" : \"flex\",\n transition: reduce\n ? { duration: 0 }\n : {\n width: {\n delay: TREE_LABEL_REVEAL_DELAY,\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n opacity: {\n delay: TREE_LABEL_REVEAL_DELAY,\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n x: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n },\n }}\n exit={{\n width: 0,\n opacity: 0,\n display: \"none\",\n x: -8,\n transition: reduce\n ? { duration: 0 }\n : {\n display: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeOut\",\n },\n width: {\n duration: TREE_COLLAPSE_DURATION * 3,\n ease: EASE_OUT,\n },\n opacity: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeOut\",\n },\n x: {\n duration: TREE_COLLAPSE_DURATION * 3,\n ease: EASE_OUT,\n },\n },\n }}\n className={cn(\"min-w-0 overflow-clip whitespace-nowrap\")}\n data-slot=\"tree-row-label\"\n >\n {node.label}\n </motion.span>\n </AnimatePresence>\n ) : (\n <span\n className=\"min-w-0 flex-1 truncate\"\n onDoubleClick={canRename ? handleStartRename : undefined}\n >\n {node.label}\n </span>\n )\n\n const chevron = canExpand ? (\n <motion.span\n animate={{ rotate: open ? (variant === \"navigation\" ? -90 : 90) : 0 }}\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center text-muted-foreground/70\"\n transition={reduce ? { duration: 0 } : TREE_MICRO_TRANSITION}\n >\n {variant === \"sidebar\" && (\n <LucideChevronLeft className=\"size-3.5 stroke-3\" />\n )}\n {variant === \"toc\" && (\n <LucideChevronRight className=\"size-3.5 stroke-3\" />\n )}\n {variant === \"navigation\" && (\n <LucideChevronLeft className=\"size-3.5 stroke-3\" />\n )}\n </motion.span>\n ) : null\n\n // The trailing slot is consumer-rendered and usually holds buttons, so it\n // cannot live inside the row — every row is itself a <button>, and a\n // button nesting a button is invalid HTML. It sits beside the row\n // instead, overlaid like the toc toggle.\n const showTrailing = files && !!renderTrailing && !renaming\n\n const rowClassName = cn(\n \"group/row relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2\",\n \"text-left text-muted-foreground transition-colors duration-150 outline-none\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n files ? \"h-7 text-[0.8125rem]\" : \"h-8 text-sm\",\n node.disabled && \"pointer-events-none opacity-50\",\n active && \"bg-accent font-medium text-accent-foreground\",\n dragging && \"opacity-50\",\n drop === \"inside\" && \"bg-accent/60 ring-1 ring-primary/50 ring-inset\",\n variant === \"sidebar\" && collapsed && \"justify-center px-0\",\n // Room for the overlay expand toggle on toc parent rows.\n variant === \"toc\" && kind === \"link\" && children.length > 0 && \"pr-7\",\n // …and for the overlay trailing actions on files rows. Sized for one\n // icon button plus its inset; a wider slot clips the truncated label,\n // which is why the prop is documented as row actions, not free content.\n showTrailing && \"pr-9\"\n )\n\n const rowInteractionProps = {\n \"data-slot\": \"tree-row\" as const,\n \"data-id\": node.id,\n \"data-branch\": canExpand ? \"\" : undefined,\n \"data-expanded\": canExpand && open ? \"\" : undefined,\n \"data-active\": active ? \"\" : undefined,\n \"data-cuelume-press\": sound ? \"\" : undefined,\n draggable: dnd.enabled && !renaming ? true : undefined,\n onDragStart: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDragStart(event, node.id)\n : undefined,\n onDragOver: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDragOver(event, node)\n : undefined,\n onDragLeave: dnd.enabled ? dnd.onRowDragLeave : undefined,\n onDrop: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDrop(event, node)\n : undefined,\n onDragEnd: dnd.enabled ? dnd.onRowDragEnd : undefined,\n }\n\n const content = (\n <>\n {kind !== \"section\" && files && chevron}\n {kind !== \"section\" && node.icon && (\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center [&>svg]:size-4\",\n active && \"text-accent-foreground\"\n )}\n >\n {node.icon}\n </span>\n )}\n {label}\n {node.badge !== undefined && !(variant === \"sidebar\" && collapsed) && (\n <span className=\"ml-auto shrink-0 text-xs text-muted-foreground/80\">\n {node.badge}\n </span>\n )}\n {/* nav toggle chevrons trail like the sidebar block; files lead;\n toc link rows get a separate overlay toggle instead. */}\n {kind === \"toggle\" && !files && (\n <span\n className={cn(\n node.badge === undefined ? \"ml-auto\" : \"ml-1\",\n \"flex shrink-0\"\n )}\n >\n {chevron}\n </span>\n )}\n </>\n )\n\n let row: React.ReactElement\n if (kind === \"section\") {\n row = (\n <button\n {...rowInteractionProps}\n aria-expanded={open}\n className={cn(\n \"group/row flex w-full cursor-pointer items-center gap-1 rounded-md px-2 py-1\",\n \"text-xs font-medium tracking-wide text-muted-foreground/80 uppercase\",\n \"transition-colors duration-150 outline-none hover:text-foreground\",\n \"focus-visible:ring-0 focus-visible:ring-ring\"\n )}\n onClick={handlePress}\n type=\"button\"\n >\n <span className=\"truncate\">{node.label}</span>\n {chevron}\n </button>\n )\n } else {\n // Every non-section row is the shared Button — link rows included. An\n // `href` no longer renders an anchor: navigation runs through\n // `selectTreeNodeAtom` (onSelect → onNavigate), and the consumer routes\n // from the node it receives. `sound` is forwarded so Button's own\n // press/release cues follow the tree's setting rather than its default.\n row = (\n <Button\n {...rowInteractionProps}\n variant={variant === \"sidebar\" && active ? \"secondary\" : \"ghost\"}\n aria-current={active ? \"page\" : undefined}\n aria-expanded={kind === \"toggle\" ? open : undefined}\n aria-label={variant === \"sidebar\" && collapsed ? node.label : undefined}\n className={cn(\n \"transform cursor-pointer! justify-start transition-transform ease-smooth-out\",\n variant === \"sidebar\" && collapsed ? \"h-10! rounded-xl!\" : undefined,\n rowClassName\n )}\n disabled={node.disabled}\n onClick={handlePress}\n sound={sound}\n >\n {content}\n </Button>\n )\n }\n\n // A collapsed rail row is icon-only — a tooltip names it on hover/focus.\n // Expanded, the visible label already does, so the tooltip is disabled\n // rather than unmounted: swapping the wrapper in and out with `collapsed`\n // would remount the row and cut the label's fold animation short.\n if (variant === \"sidebar\") {\n row = (\n <Tooltip disabled={!collapsed || node.disabled}>\n <TooltipTrigger render={row} />\n <TooltipContent side=\"right\">{node.label}</TooltipContent>\n </Tooltip>\n )\n }\n\n // toc parents navigate on the row itself, so their chevron lives beside\n // the row as its own toggle.\n const tocToggle =\n variant === \"toc\" && kind === \"link\" && children.length > 0 ? (\n <button\n aria-expanded={open}\n aria-label={`${open ? \"Collapse\" : \"Expand\"} ${node.label}`}\n className={cn(\n \"absolute top-1/2 right-1 flex size-5 -translate-y-1/2 cursor-pointer items-center\",\n \"justify-center rounded-sm text-muted-foreground/70 outline-none\",\n \"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n )}\n onClick={(event) => {\n event.stopPropagation()\n toggleExpanded(node.id)\n }}\n type=\"button\"\n >\n {chevron}\n </button>\n ) : null\n\n // Revealed by hovering/focusing anywhere in the row wrapper — the row and\n // the actions are siblings now, so the trigger group lives on the wrapper.\n const trailing = showTrailing ? (\n <span\n className={cn(\n \"absolute top-1/2 right-1 flex -translate-y-1/2 items-center\",\n \"opacity-0 transition-opacity duration-150\",\n \"group-focus-within/row-actions:opacity-100 group-hover/row-actions:opacity-100\",\n node.disabled && \"pointer-events-none opacity-50\"\n )}\n data-slot=\"tree-trailing\"\n >\n {renderTrailing?.(node)}\n </span>\n ) : null\n\n const branchClassName =\n kind === \"section\"\n ? \"flex flex-col gap-0.5 overflow-clip\"\n : cn(\n \"flex flex-col overflow-clip border-l border-border\",\n files ? \"mt-0.5 ml-3 gap-px pl-1.5\" : \"mt-1 ml-4 gap-0.5 pl-2.5\"\n )\n\n return (\n <motion.li\n aria-expanded={canExpand ? open : undefined}\n aria-level={depth + 1}\n aria-selected={active || undefined}\n className=\"relative flex min-w-0 flex-col\"\n data-slot=\"tree-item\"\n role=\"treeitem\"\n variants={reduce ? undefined : TREE_ROW_VARIANTS}\n >\n {drop === \"before\" && <TreeDropLine side=\"top\" />}\n <div className={cn(\"relative\", showTrailing && \"group/row-actions\")}>\n {row}\n {tocToggle}\n {trailing}\n </div>\n {canExpand && children.length > 0 && (\n <AnimatePresence initial={false}>\n {open && (\n <motion.ul\n animate={reduce ? { opacity: 1 } : \"open\"}\n className={branchClassName}\n exit={reduce ? { opacity: 0 } : TREE_BRANCH_EXIT}\n initial={reduce ? { opacity: 0 } : \"closed\"}\n key=\"branch\"\n role=\"group\"\n transition={reduce ? { duration: 0.12 } : undefined}\n variants={reduce ? undefined : TREE_BRANCH_VARIANTS}\n >\n {children.map((child) => (\n <TreeRow depth={depth + 1} key={child.id} node={child} />\n ))}\n </motion.ul>\n )}\n </AnimatePresence>\n )}\n {drop === \"after\" && <TreeDropLine side=\"bottom\" />}\n </motion.li>\n )\n}\n\n/** Rows are memoized so a re-render of the root — a rail measurement, a new\n * `renderTrailing` — does not walk the whole tree. Each row's own state\n * reaches it through its atoms instead. */\nexport const TreeRow = React.memo(TreeRowImpl)\nTreeRow.displayName = \"TreeRow\"\n\n/** Insertion indicator above or below a row while a drag hovers it. */\nfunction TreeDropLine({ side }: { side: \"top\" | \"bottom\" }) {\n return (\n <span\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-1 z-10 h-0.5 rounded-full bg-primary\",\n side === \"top\" ? \"top-0 -translate-y-1/2\" : \"bottom-0 translate-y-1/2\"\n )}\n data-slot=\"tree-drop-indicator\"\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom, useStore } from \"jotai\"\n\nimport {\n endTreeDragAtom,\n moveTreeNodeAtom,\n treeCanMoveAtom,\n treeDraggedIdAtom,\n treeDropTargetAtom,\n treeItemsAtom,\n} from \"./tree-atom\"\nimport type {\n TreeDndContextValue,\n TreeDndHandlers,\n TreeDropPosition,\n TreeInstanceId,\n TreeNode,\n} from \"./type\"\nimport { containsNode, findNode, locateNode } from \"./utils\"\n\n/** How far into a folder row the pointer must sit (from either edge) to read\n * as \"inside\" rather than \"before\"/\"after\". */\nconst EDGE_RATIO = 0.25\n\n/**\n * The drag handlers for the `files` variant, stable for the life of the tree.\n *\n * Nothing here subscribes to drag state: items, the dragged id and the drop\n * target are read out of the store when a handler runs. That is what lets\n * every row share one handler object without re-rendering when a drag moves —\n * and it keeps `useTree` from subscribing to data it also projects from\n * props, which would loop on an inline `items` array.\n *\n * Inert unless the tree `canMove`. `dataTransfer` is set for interop but\n * never read, so the flow also works where the store is unavailable (tests,\n * some webviews).\n */\nexport function useTreeDndHandlers(treeId: TreeInstanceId): TreeDndHandlers {\n const store = useStore()\n const enabled = useAtomValue(treeCanMoveAtom(treeId))\n const setDraggedId = useSetAtom(treeDraggedIdAtom(treeId))\n const setDropTarget = useSetAtom(treeDropTargetAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const reset = useSetAtom(endTreeDragAtom(treeId))\n\n const readItems = React.useCallback(\n () => store.get(treeItemsAtom(treeId)),\n [store, treeId]\n )\n const readDraggedId = React.useCallback(\n () => store.get(treeDraggedIdAtom(treeId)),\n [store, treeId]\n )\n const readDropTarget = React.useCallback(\n () => store.get(treeDropTargetAtom(treeId)),\n [store, treeId]\n )\n\n const onRowDragStart = React.useCallback(\n (event: React.DragEvent, id: string) => {\n if (!enabled) return\n event.stopPropagation()\n setDraggedId(id)\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = \"move\"\n event.dataTransfer.setData(\"text/plain\", id)\n }\n },\n [enabled, setDraggedId]\n )\n\n const onRowDragOver = React.useCallback(\n (event: React.DragEvent, node: TreeNode) => {\n const draggedId = readDraggedId()\n if (!enabled || draggedId === null) return\n // A node never drops onto itself or into its own subtree.\n if (containsNode(readItems(), draggedId, node.id)) return\n event.preventDefault()\n event.stopPropagation()\n if (event.dataTransfer) event.dataTransfer.dropEffect = \"move\"\n\n const rect = event.currentTarget.getBoundingClientRect()\n const ratio =\n rect.height > 0 ? (event.clientY - rect.top) / rect.height : 0.5\n // Any node carrying a children array is a folder — an empty one still\n // accepts drops \"inside\".\n const folder = node.children !== undefined\n const position: TreeDropPosition = folder\n ? ratio < EDGE_RATIO\n ? \"before\"\n : ratio > 1 - EDGE_RATIO\n ? \"after\"\n : \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\"\n setDropTarget((prev) =>\n prev?.id === node.id && prev.position === position\n ? prev\n : { id: node.id, position }\n )\n },\n [enabled, readDraggedId, readItems, setDropTarget]\n )\n\n const onRowDragLeave = React.useCallback(\n (event: React.DragEvent) => {\n // Leaving for a child of the same row still counts as hovering it.\n const next = event.relatedTarget as Node | null\n if (next && event.currentTarget.contains(next)) return\n setDropTarget(null)\n },\n [setDropTarget]\n )\n\n const onRowDrop = React.useCallback(\n (event: React.DragEvent, node: TreeNode) => {\n if (!enabled) return\n event.preventDefault()\n event.stopPropagation()\n const draggedId = readDraggedId()\n const target = readDropTarget()\n if (draggedId === null || target === null || target.id !== node.id) {\n reset()\n return\n }\n const items = readItems()\n\n if (target.position === \"inside\") {\n // Append at the end of the folder, sized without the dragged node (it\n // may already live there).\n const children = node.children ?? []\n const index = children.filter((child) => child.id !== draggedId).length\n move(draggedId, node.id, index)\n } else {\n const location = locateNode(items, node.id)\n if (location) {\n const siblings = (\n location.parentId === null\n ? items\n : (findNode(items, location.parentId)?.children ?? [])\n ).filter((sibling) => sibling.id !== draggedId)\n const at = siblings.findIndex((sibling) => sibling.id === node.id)\n const index = target.position === \"after\" ? at + 1 : at\n move(draggedId, location.parentId, index)\n }\n }\n reset()\n },\n [enabled, move, readDraggedId, readDropTarget, readItems, reset]\n )\n\n return React.useMemo(\n () => ({\n enabled,\n onRowDragStart,\n onRowDragOver,\n onRowDragLeave,\n onRowDrop,\n onRowDragEnd: reset,\n }),\n [enabled, onRowDragStart, onRowDragOver, onRowDragLeave, onRowDrop, reset]\n )\n}\n\n/** The handlers plus live drag state, for `TreeController.dnd`. Rows take the\n * handlers alone and read the state per node instead. */\nexport function useTreeDnd(treeId: TreeInstanceId): TreeDndContextValue {\n const handlers = useTreeDndHandlers(treeId)\n const draggedId = useAtomValue(treeDraggedIdAtom(treeId))\n const dropTarget = useAtomValue(treeDropTargetAtom(treeId))\n\n return React.useMemo(\n () => ({ ...handlers, draggedId, dropTarget }),\n [handlers, draggedId, dropTarget]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n cancelTreeRenameAtom,\n collapseAllTreeNodesAtom,\n collapseTreeNodeAtom,\n expandAllTreeNodesAtom,\n expandTreeNodeAtom,\n mountTreeAtom,\n moveTreeNodeAtom,\n projectTreeActiveIdAtom,\n projectTreeCollapsedAtom,\n projectTreeItemsAtom,\n removeTreeInstance,\n renameTreeNodeAtom,\n resetTreeAtom,\n revealTreeAncestorsAtom,\n revealTreeNodeAtom,\n selectTreeNodeAtom,\n setTreeCollapsedAtom,\n setTreeHandlersAtom,\n startTreeRenameAtom,\n toggleTreeCollapsedAtom,\n toggleTreeNodeAtom,\n treeActiveIdAtom,\n treeCanMoveAtom,\n treeCanRenameAtom,\n treeCollapsedAtom,\n treeExpandedIdsAtom,\n treeOwnedItemsAtom,\n treeRenamingIdAtom,\n} from \"./tree-atom\"\nimport type {\n TreeConfig,\n TreeController,\n TreeHandlers,\n TreeSeed,\n UseTreeOptions,\n} from \"./type\"\nimport { useTreeDnd } from \"./use-tree-dnd\"\nimport { findNode, hasThreeLevels } from \"./utils\"\n\n/**\n * The tree's headless controller — every behaviour the component exposes,\n * callable from outside it: expand/collapse (a node, a section, the whole\n * tree), fold the `sidebar` rail, select a node, rename, reorder.\n *\n * Each piece of state is controlled-or-uncontrolled in the usual React\n * shape: pass `items`/`activeId`/`collapsed` to own it yourself, or\n * `defaultItems`/`defaultActiveId`/`defaultCollapsed` to let the hook. When\n * the hook owns `items` (or you pass `onItemsChange`), `rename` and `move`\n * apply the edit to the data themselves — otherwise they only report it\n * through `onRename`/`onMove` and you reduce the tree yourself.\n *\n * ```tsx\n * const tree = useTree({ variant: \"files\", defaultItems: files })\n * <Tree tree={tree} />\n * <Button onClick={tree.collapseAll}>Collapse all</Button>\n * ```\n *\n * State lives in Jotai atoms keyed by `treeId`, so anything under\n * `ExegiaProvider` can drive this tree without the controller — name it and\n * reach for `useTreeState(treeId)` / `useTreeActions(treeId)` elsewhere.\n */\nexport function useTree(options: UseTreeOptions): TreeController {\n const {\n variant,\n onNavigate,\n onRename,\n onMove,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n sound = true,\n } = options\n\n // A generated key isolates unnamed trees from each other; an explicit\n // `treeId` is the app's handle on this one.\n const generatedId = React.useId()\n const treeId = options.treeId ?? generatedId\n\n const controlsItems = options.items !== undefined\n const controlsActiveId = options.activeId !== undefined\n const controlsCollapsed = options.collapsed !== undefined\n // The hook may only rewrite the data when it owns it, or when the consumer\n // asked for the next tree through `onItemsChange`.\n const managesItems = !controlsItems || onItemsChange !== undefined\n const hasRenameHandler = onRename !== undefined\n const hasMoveHandler = onMove !== undefined\n\n // Primitives only, so this object is stable and the store write below runs\n // once per real change rather than once per render.\n const config = React.useMemo<TreeConfig>(\n () => ({\n variant,\n sound,\n controlsItems,\n controlsActiveId,\n controlsCollapsed,\n managesItems,\n hasRenameHandler,\n hasMoveHandler,\n }),\n [\n variant,\n sound,\n controlsItems,\n controlsActiveId,\n controlsCollapsed,\n managesItems,\n hasRenameHandler,\n hasMoveHandler,\n ]\n )\n\n const handlers = React.useMemo<TreeHandlers>(\n () => ({\n onNavigate,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n onRename,\n onMove,\n }),\n [\n onNavigate,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n onRename,\n onMove,\n ]\n )\n\n // Read once: the `default*` options describe the mount, not every render.\n const [seed] = React.useState<TreeSeed>(() => ({\n items: options.items ?? options.defaultItems ?? [],\n activeId: options.activeId ?? options.defaultActiveId,\n collapsed: options.collapsed ?? options.defaultCollapsed ?? false,\n expandedIds: options.defaultExpandedIds\n ? [...options.defaultExpandedIds]\n : undefined,\n }))\n\n const mount = useSetAtom(mountTreeAtom(treeId))\n const publishHandlers = useSetAtom(setTreeHandlersAtom(treeId))\n const projectItems = useSetAtom(projectTreeItemsAtom(treeId))\n const projectActiveId = useSetAtom(projectTreeActiveIdAtom(treeId))\n const projectCollapsed = useSetAtom(projectTreeCollapsedAtom(treeId))\n const revealAncestors = useSetAtom(revealTreeAncestorsAtom(treeId))\n\n // Handlers first — they must be in the store before any action can fire.\n // Rewritten every commit; no read atom depends on them, so nobody\n // re-renders for it.\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n\n // Before paint, so a seeded branch never paints closed for a frame.\n React.useLayoutEffect(() => {\n mount(config, seed)\n }, [mount, config, seed])\n\n // Controlled props stay the source of truth; the store carries a projection\n // so the action atoms and remote readers see current data.\n React.useLayoutEffect(() => {\n if (options.items !== undefined) projectItems(options.items)\n }, [options.items, projectItems])\n\n React.useLayoutEffect(() => {\n if (options.activeId !== undefined) projectActiveId(options.activeId)\n }, [options.activeId, projectActiveId])\n\n React.useLayoutEffect(() => {\n if (options.collapsed !== undefined) projectCollapsed(options.collapsed)\n }, [options.collapsed, projectCollapsed])\n\n // A tree the hook keyed is scrap once its component goes. An explicit\n // `treeId` is the app's key and outlives the mount.\n React.useEffect(() => {\n if (options.treeId !== undefined) return\n return () => removeTreeInstance(treeId)\n }, [treeId, options.treeId])\n\n // Never `treeItemsAtom` — see the note on `treeOwnedItemsAtom`.\n const ownedItems = useAtomValue(treeOwnedItemsAtom(treeId))\n const items = options.items ?? ownedItems\n const activeId = useAtomValue(treeActiveIdAtom(treeId))\n const expandedIds = useAtomValue(treeExpandedIdsAtom(treeId))\n const collapsed = useAtomValue(treeCollapsedAtom(treeId))\n const renamingId = useAtomValue(treeRenamingIdAtom(treeId))\n const canRename = useAtomValue(treeCanRenameAtom(treeId))\n const canMove = useAtomValue(treeCanMoveAtom(treeId))\n\n // Navigating into a nested entry from elsewhere reveals its ancestors, even\n // ones the reader had collapsed. In a layout effect, so the branch is open\n // before the frame paints.\n const lastActiveId = React.useRef(activeId)\n React.useLayoutEffect(() => {\n if (lastActiveId.current === activeId) return\n lastActiveId.current = activeId\n if (activeId !== undefined) revealAncestors(activeId)\n }, [activeId, revealAncestors])\n\n const sectioned = React.useMemo(\n () => variant === \"navigation\" && hasThreeLevels(items),\n [variant, items]\n )\n const sectionIds = React.useMemo(\n () => (sectioned ? items.map((node) => node.id) : []),\n [items, sectioned]\n )\n const getNode = React.useCallback(\n (id: string) => findNode(items, id),\n [items]\n )\n const isExpanded = React.useCallback(\n (id: string) => expandedIds.has(id),\n [expandedIds]\n )\n\n // `useSetAtom` setters are already stable — no useCallback needed.\n const expand = useSetAtom(expandTreeNodeAtom(treeId))\n const collapse = useSetAtom(collapseTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const expandAll = useSetAtom(expandAllTreeNodesAtom(treeId))\n const collapseAll = useSetAtom(collapseAllTreeNodesAtom(treeId))\n const reveal = useSetAtom(revealTreeNodeAtom(treeId))\n const setCollapsed = useSetAtom(setTreeCollapsedAtom(treeId))\n const toggleCollapsed = useSetAtom(toggleTreeCollapsedAtom(treeId))\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const reset = useSetAtom(resetTreeAtom(treeId))\n\n const dnd = useTreeDnd(treeId)\n\n return React.useMemo<TreeController>(\n () => ({\n treeId,\n variant,\n items,\n sectioned,\n sectionIds,\n sound,\n getNode,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n collapsed,\n setCollapsed,\n toggleCollapsed,\n activeId,\n select,\n canRename,\n renamingId,\n startRename,\n cancelRename,\n rename,\n canMove,\n move,\n reset,\n dnd,\n }),\n [\n treeId,\n variant,\n items,\n sectioned,\n sectionIds,\n sound,\n getNode,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n collapsed,\n setCollapsed,\n toggleCollapsed,\n activeId,\n select,\n canRename,\n renamingId,\n startRename,\n cancelRename,\n rename,\n canMove,\n move,\n reset,\n dnd,\n ]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { TooltipProvider } from \"@/components/ui/tooltip\"\nimport { TreeContext } from \"./tree-context\"\nimport { TreeRow } from \"./tree-node\"\nimport type {\n TreeContextValue,\n TreeController,\n TreeDataProps,\n TreeNode,\n TreeProps,\n} from \"./type\"\nimport {\n RAIL_COLLAPSED_WIDTH,\n TREE_COLLAPSE_DURATION,\n TREE_EASE,\n} from \"./constants\"\nimport { useTree } from \"./use-tree\"\nimport { useTreeDndHandlers } from \"./use-tree-dnd\"\nimport { motion, useReducedMotion } from \"motion/react\"\n\nconst DEFAULT_LABELS: Record<TreeController[\"variant\"], string> = {\n navigation: \"Main\",\n toc: \"On this page\",\n sidebar: \"Main\",\n files: \"Files\",\n}\n\n/**\n * A nested item tree with four shapes: `navigation` (app nav — 3-level\n * data promotes the top level to collapsible section names), `toc`\n * (routes on top, in-page `#` anchors at the leaves), `sidebar` (a\n * single-level rail that collapses to icons) and `files` (a compact file\n * explorer with rename, drag-and-drop and trailing row actions).\n *\n * Two ways to drive it. Data-driven like the sidebar block: pass `items`,\n * wire `onNavigate` into your router. Or hold a `useTree` controller and\n * pass it as `tree` — same rendering, but expand, collapse, select, rename\n * and reorder are then callable from anywhere in your app.\n *\n * Branches expand with a soft height morph and row stagger; the rail's\n * labels fold away when `collapsed` flips. Arrow keys walk visible rows,\n * expand and collapse; F2 renames in `files`.\n */\nexport function Tree(props: TreeProps): React.ReactElement {\n // Two components rather than one: hooks may not be called conditionally,\n // and the controller form has no props to build a fallback controller\n // from. Nobody switches a tree between the two forms at runtime.\n return props.tree ? (\n <TreeView\n ariaLabel={props.ariaLabel}\n className={props.className}\n renderTrailing={props.renderTrailing}\n tree={props.tree}\n />\n ) : (\n <UncontrolledTree {...props} />\n )\n}\n\n/** The props form: builds its own controller and renders through it. */\nfunction UncontrolledTree(props: TreeDataProps): React.ReactElement {\n const {\n variant,\n items,\n activeId,\n onNavigate,\n sound = true,\n ariaLabel,\n className,\n } = props\n const tree = useTree({\n treeId: props.treeId,\n variant,\n items,\n activeId,\n onNavigate,\n sound,\n collapsed: variant === \"sidebar\" ? (props.collapsed ?? false) : undefined,\n onMove: variant === \"files\" ? props.onMove : undefined,\n onRename: variant === \"files\" ? props.onRename : undefined,\n })\n return (\n <TreeView\n ariaLabel={ariaLabel}\n className={className}\n renderTrailing={variant === \"files\" ? props.renderTrailing : undefined}\n tree={tree}\n />\n )\n}\n\ninterface TreeViewProps {\n tree: TreeController\n ariaLabel?: string\n className?: string\n renderTrailing?: (node: TreeNode) => React.ReactNode\n}\n\n/** Rendering only — every piece of state and behaviour lives on `tree`. */\nfunction TreeView({\n tree,\n ariaLabel,\n className,\n renderTrailing,\n}: TreeViewProps): React.ReactElement {\n const { variant, items, sectioned, collapsed } = tree\n const rootRef = React.useRef<HTMLUListElement>(null)\n const reduce = useReducedMotion()\n\n // The rail animates between two px widths, so the expanded one has to be\n // measured off the container. Watched rather than read once: the rail is\n // as wide as whatever holds it, which can change on resize.\n //\n // A container with no width of its own sizes to the list — so it shrinks\n // around the 40px rail once collapsed and follows the list mid-tween. Both\n // would feed the list's own width back in as its target and pin it. So:\n // no observing while collapsed (the last expanded width stands), and each\n // sample is taken with the list's inline width cleared, so the classes'\n // resting width — not the tween — is what the container is holding.\n const railRef = React.useRef<HTMLElement>(null)\n const [railWidth, setRailWidth] = React.useState<number | null>(null)\n React.useLayoutEffect(() => {\n const container = railRef.current\n const list = rootRef.current\n if (variant !== \"sidebar\" || collapsed || !container || !list) return\n const measure = () => {\n const inline = list.style.width\n list.style.width = \"\"\n const width = container.clientWidth\n list.style.width = inline\n setRailWidth(width)\n }\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(container)\n return () => observer.disconnect()\n }, [variant, collapsed])\n\n // Until the measurement lands the className carries the width, so the\n // rail is never wrong — just not animated on its very first frame.\n const railTarget =\n variant === \"sidebar\" && railWidth !== null\n ? { width: collapsed ? RAIL_COLLAPSED_WIDTH : railWidth }\n : undefined\n\n // Roving over the DOM rather than a parallel model: collapsed branches\n // unmount, so a row query is exactly the visible set in order.\n function handleKeyDown(event: React.KeyboardEvent) {\n const row = (event.target as HTMLElement).closest<HTMLElement>(\n '[data-slot=\"tree-row\"]'\n )\n const root = rootRef.current\n if (!row || !root) return\n const rows = Array.from(\n root.querySelectorAll<HTMLElement>('[data-slot=\"tree-row\"]')\n )\n const index = rows.indexOf(row)\n if (index < 0) return\n const id = row.getAttribute(\"data-id\")\n const branch = row.hasAttribute(\"data-branch\")\n const open = row.hasAttribute(\"data-expanded\")\n\n const focusRow = (target: HTMLElement | undefined) => {\n if (!target) return\n event.preventDefault()\n target.focus()\n }\n\n switch (event.key) {\n case \"ArrowDown\":\n focusRow(rows[index + 1])\n break\n case \"ArrowUp\":\n focusRow(rows[index - 1])\n break\n case \"Home\":\n focusRow(rows[0])\n break\n case \"End\":\n focusRow(rows[rows.length - 1])\n break\n case \"ArrowRight\":\n if (branch && !open && id) {\n event.preventDefault()\n tree.expand(id)\n } else if (open) {\n focusRow(rows[index + 1])\n }\n break\n case \"ArrowLeft\":\n if (open && id) {\n event.preventDefault()\n tree.collapse(id)\n } else {\n focusRow(\n row\n .closest(\"li\")\n ?.parentElement?.closest(\"li\")\n ?.querySelector<HTMLElement>('[data-slot=\"tree-row\"]') ??\n undefined\n )\n }\n break\n case \"F2\":\n if (id && tree.canRename) {\n event.preventDefault()\n tree.startRename(id)\n }\n break\n }\n }\n\n // Rows take the tree's id and the stable drag handlers, never the\n // controller — so this value keeps its identity and a toggle re-renders only\n // the rows whose own atoms changed.\n const dnd = useTreeDndHandlers(tree.treeId)\n const context = React.useMemo<TreeContextValue>(\n () => ({ treeId: tree.treeId, renderTrailing, dnd }),\n [tree.treeId, renderTrailing, dnd]\n )\n\n const label = ariaLabel ?? DEFAULT_LABELS[variant]\n let rendered = (\n <motion.ul\n aria-label={label}\n className={cn(\n \"flex h-full min-w-0 flex-col\",\n // Resting widths, and the fallback until the rail is measured. The\n // motion target below overrides these with an inline width.\n collapsed ? \"w-10 gap-y-2!\" : \"w-full\",\n variant === \"files\" ? \"gap-px\" : sectioned ? \"gap-3\" : \"gap-0.5\"\n )}\n // Both endpoints must be px: motion cannot interpolate a number\n // against \"100%\", and animating 40 -> \"100%\" pinned the inline width\n // at 40px, so the rail collapsed once and never reopened. The\n // expanded target is the rail's own measured width.\n initial={false}\n animate={railTarget}\n transition={\n reduce\n ? { duration: 0 }\n : { duration: TREE_COLLAPSE_DURATION, ease: TREE_EASE }\n }\n data-collapsed={collapsed ? \"\" : undefined}\n data-slot=\"tree\"\n data-variant={variant}\n onKeyDown={handleKeyDown}\n ref={rootRef}\n role=\"tree\"\n >\n {items.map((node) => (\n <TreeRow depth={0} key={node.id} node={node} />\n ))}\n </motion.ul>\n )\n\n // The collapsed rail's rows carry tooltips — one provider groups their\n // open state and drops the hover delay across the rail. Mounted for the\n // expanded rail too: toggling the wrapper with `collapsed` would remount\n // every row and skip the label fold animation.\n if (variant === \"sidebar\")\n rendered = <TooltipProvider>{rendered}</TooltipProvider>\n\n return (\n <TreeContext.Provider value={context}>\n {variant === \"files\" ? (\n <div className={cn(\"min-w-0\", className)} data-slot=\"tree-root\">\n {rendered}\n </div>\n ) : (\n <nav\n aria-label={label}\n className={cn(\"flex h-full min-w-0 justify-center\", className)}\n data-slot=\"tree-root\"\n ref={railRef}\n >\n {rendered}\n </nav>\n )}\n </TreeContext.Provider>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n cancelTreeRenameAtom,\n collapseAllTreeNodesAtom,\n collapseTreeNodeAtom,\n expandAllTreeNodesAtom,\n expandTreeNodeAtom,\n moveTreeNodeAtom,\n renameTreeNodeAtom,\n resetTreeAtom,\n revealTreeNodeAtom,\n selectTreeNodeAtom,\n setTreeCollapsedAtom,\n setTreeItemsAtom,\n startTreeRenameAtom,\n toggleTreeCollapsedAtom,\n toggleTreeNodeAtom,\n treeStateAtom,\n} from \"./tree-atom\"\nimport type { TreeActions, TreeInstanceId, TreeState } from \"./type\"\n\n/**\n * Read the tree registered under `treeId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { collapsed, activeId } = useTreeState(\"app-nav\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(treeCollapsedAtom(\"app-nav\"))`.\n */\nexport function useTreeState(treeId: TreeInstanceId): TreeState {\n return useAtomValue(treeStateAtom(treeId))\n}\n\n/**\n * Drive the tree registered under `treeId` from anywhere. Writes only — the\n * caller never re-renders when the tree changes, so this is what a command\n * palette, a keyboard shortcut or a route guard should reach for.\n *\n * ```tsx\n * const nav = useTreeActions(\"app-nav\")\n * <Button onClick={nav.collapseAll}>Collapse all</Button>\n * ```\n */\nexport function useTreeActions(treeId: TreeInstanceId): TreeActions {\n const expand = useSetAtom(expandTreeNodeAtom(treeId))\n const collapse = useSetAtom(collapseTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const expandAll = useSetAtom(expandAllTreeNodesAtom(treeId))\n const collapseAll = useSetAtom(collapseAllTreeNodesAtom(treeId))\n const reveal = useSetAtom(revealTreeNodeAtom(treeId))\n const setCollapsed = useSetAtom(setTreeCollapsedAtom(treeId))\n const toggleCollapsed = useSetAtom(toggleTreeCollapsedAtom(treeId))\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const setItems = useSetAtom(setTreeItemsAtom(treeId))\n const reset = useSetAtom(resetTreeAtom(treeId))\n\n return React.useMemo(\n () => ({\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n setCollapsed,\n toggleCollapsed,\n select,\n startRename,\n cancelRename,\n rename,\n move,\n setItems,\n reset,\n }),\n [\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n setCollapsed,\n toggleCollapsed,\n select,\n startRename,\n cancelRename,\n rename,\n move,\n setItems,\n reset,\n ]\n )\n}\n","/**\n * Brand accents for the auth blocks.\n *\n * An accent is a set of custom properties set on the AuthCard root plus one\n * class string applied to the card's primary action. Splitting it this way\n * keeps the accent inheritable — anything else inside the card can opt into\n * `var(--auth-accent)` without the shell knowing about it.\n */\n\n/** Brand accents available to the auth blocks. */\nexport type AuthAccent = \"corpora\" | \"exegia\";\n\n/**\n * Custom properties an accent contributes, set on the AuthCard root.\n *\n * The gradient lives in `--auth-accent-image` because `background-color` can't\n * hold one; `--auth-accent` sits underneath as the solid that paints wherever\n * the image is `none`. Foregrounds are fixed rather than themed — the accent\n * itself is a constant, so its contrast pair has to be too (white on the\n * corpora yellow fails badly).\n */\nexport const authAccentVars: Record<AuthAccent, Record<string, string>> = {\n corpora: {\n \"--auth-accent\": \"#E8B124\",\n \"--auth-accent-image\": \"none\",\n \"--auth-accent-foreground\": \"oklch(0.145 0 0)\",\n },\n exegia: {\n \"--auth-accent\": \"#3B0080\",\n \"--auth-accent-image\":\n \"linear-gradient(44deg in oklab, rgba(29,0,202,0.66) 3%, #3B0080 37%, rgba(36,0,72,0.86) 98%)\",\n \"--auth-accent-foreground\": \"oklch(0.985 0 0)\",\n },\n};\n\n/**\n * Applied to the primary action inside an accented AuthCard, after the button\n * cva output so tailwind-merge lets it win over `bg-primary`. The hover and\n * pressed background entries are required: `hover:bg-primary/90` lives in a\n * different modifier group from `bg-*` and would otherwise survive and repaint\n * the button on hover.\n *\n * Hover uses `brightness` rather than a background tween because the button's\n * `transition-property` list is shared with its press/size animations — adding\n * `filter` to it means restating the whole list and its per-property\n * durations. The trade is an instant hover change instead of a 150ms one.\n */\nexport const authAccentActionStyles =\n \"border-transparent bg-[var(--auth-accent)] bg-[image:var(--auth-accent-image)] text-[var(--auth-accent-foreground)] shadow-none hover:bg-[var(--auth-accent)] hover:brightness-110 data-pressed:bg-[var(--auth-accent)] data-pressed:brightness-110 *:data-[slot=button-loading-indicator]:text-[var(--auth-accent-foreground)]\";\n","\"use client\";\n\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\";\nimport { Frame, FrameFooter } from \"@/components/ui/frame\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { type AuthAccent, authAccentVars } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\n\n/** transitions.dev motion scale, shared by all auth blocks. */\nexport const EASE = [0.22, 1, 0.36, 1] as const;\n\nexport type AuthStatus = \"idle\" | \"loading\" | \"success\" | \"error\";\n\n/**\n * Frame shell shared by the auth blocks (coss particle p-card-8): a raised\n * Card inside a muted Frame, with the footer in the frame strip below the\n * card. Wraps content in a MotionConfig that honors prefers-reduced-motion\n * and layout-animates height changes so step swaps morph instead of jumping.\n */\nexport function AuthCard({\n title,\n description,\n children,\n footer,\n className,\n logo,\n accent,\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the card's primary action. Omit to keep `bg-primary`. */\n accent?: AuthAccent;\n}) {\n return (\n <MotionConfig reducedMotion=\"user\">\n <Frame\n className={cn(\"w-full max-w-sm\", className)}\n data-accent={accent}\n style={\n accent ? (authAccentVars[accent] as React.CSSProperties) : undefined\n }\n >\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col\"\n >\n <Card>\n <CardHeader>\n {logo && (\n // Sized like the button's icon rule: a bare img/svg gets a\n // default height, an explicitly sized one keeps its own.\n <div\n className=\"mb-1.5 flex items-center [&_img:not([class*='h-'])]:h-8 [&_img]:w-auto [&_svg:not([class*='size-'])]:size-8\"\n data-slot=\"auth-logo\"\n >\n {logo}\n </div>\n )}\n <CardTitle>{title}</CardTitle>\n {description && <CardDescription>{description}</CardDescription>}\n </CardHeader>\n <CardPanel className=\"overflow-hidden\">{children}</CardPanel>\n </Card>\n {footer && (\n <FrameFooter className=\"text-center text-sm text-muted-foreground\">\n {footer}\n </FrameFooter>\n )}\n </motion.div>\n </Frame>\n </MotionConfig>\n );\n}\n\n/** Cross-morphs between steps (form → success, …) keyed by `step`. */\nexport function MorphStep({\n step,\n children,\n className,\n}: {\n step: string;\n children: React.ReactNode;\n className?: string;\n}) {\n return (\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.div\n key={step}\n className={className}\n initial={{ opacity: 0, y: 8, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={{ opacity: 0, y: -8, filter: \"blur(2px)\" }}\n transition={{ duration: 0.25, ease: EASE }}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n );\n}\n\n/**\n * Progressive-disclosure wrapper: collapses/expands a step as `show` flips.\n *\n * `overflow-hidden` is only worn while the height is in flight — leaving it on\n * would clip the focus ring of any full-width control inside (the ring sits\n * 3px outside the input's border box, so the left/right edges would be cut).\n */\nexport function Reveal({\n show,\n children,\n className,\n}: {\n show: boolean;\n children: React.ReactNode;\n className?: string;\n}) {\n // Reset during render (not in an effect) when `show` flips, matching\n // useCountdown below.\n const [state, setState] = React.useState({ show, settled: show });\n if (state.show !== show) setState({ show, settled: false });\n\n return (\n <AnimatePresence initial={false}>\n {show && (\n <motion.div\n className={cn(!state.settled && \"overflow-hidden\", className)}\n initial={{ height: 0, opacity: 0, y: -4, filter: \"blur(2px)\" }}\n animate={{ height: \"auto\", opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={{ height: 0, opacity: 0, y: -4, filter: \"blur(2px)\" }}\n transition={{ duration: 0.25, ease: EASE }}\n onAnimationComplete={() =>\n setState((current) => ({ ...current, settled: true }))\n }\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n/** Inline error message that shakes each time `message` changes. */\nexport function AuthError({ message }: { message: string | null }) {\n return (\n <AnimatePresence initial={false}>\n {message && (\n <motion.p\n key={message}\n role=\"alert\"\n className=\"text-sm text-destructive-foreground\"\n initial={{ opacity: 0, height: 0 }}\n animate={{\n opacity: 1,\n height: \"auto\",\n x: [0, -6, 6, -4, 4, 0],\n }}\n exit={{ opacity: 0, height: 0 }}\n transition={{\n duration: 0.25,\n ease: EASE,\n x: { duration: 0.4, ease: \"easeInOut\" },\n }}\n >\n {message}\n </motion.p>\n )}\n </AnimatePresence>\n );\n}\n\n/** Success panel with a stroke-drawn check. */\nexport function AuthSuccess({\n title,\n description,\n children,\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children?: React.ReactNode;\n}) {\n return (\n <div className=\"flex flex-col items-center gap-3 py-4 text-center\">\n <motion.span\n className=\"flex size-12 items-center justify-center rounded-full bg-emerald-500/12 text-emerald-600\"\n initial={{ scale: 0.6, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n transition={{ duration: 0.4, ease: EASE }}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n className=\"size-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <motion.path\n d=\"M4 12.5l5 5L20 6.5\"\n initial={{ pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{ duration: 0.4, delay: 0.15, ease: EASE }}\n />\n </svg>\n </motion.span>\n <div className=\"flex flex-col gap-1\">\n <p className=\"font-medium\">{title}</p>\n {description && (\n <p className=\"text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n {children}\n </div>\n );\n}\n\n/** \"Or continue with\" style divider. */\nexport function AuthSeparator({ label = \"Or\" }: { label?: string }) {\n return (\n <div className=\"flex items-center gap-3\">\n <Separator className=\"flex-1\" />\n <span className=\"text-xs text-muted-foreground uppercase\">{label}</span>\n <Separator className=\"flex-1\" />\n </div>\n );\n}\n\n/** Countdown for resend links; restarts when `restartKey` changes. */\nexport function useCountdown(seconds: number, restartKey: number) {\n const [state, setState] = React.useState({ restartKey, seconds, remaining: seconds });\n\n // Reset during render (not in an effect) when the inputs change.\n if (state.restartKey !== restartKey || state.seconds !== seconds) {\n setState({ restartKey, seconds, remaining: seconds });\n }\n\n React.useEffect(() => {\n if (seconds <= 0) return;\n const interval = window.setInterval(() => {\n setState((current) =>\n current.remaining <= 0\n ? current\n : { ...current, remaining: current.remaining - 1 },\n );\n }, 1000);\n return () => window.clearInterval(interval);\n }, [seconds, restartKey]);\n\n return state.remaining;\n}\n","\"use client\";\n\nimport { MailIcon, SmartphoneIcon } from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { OTPField, OTPFieldInput } from \"@/components/ui/otp-field\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n EASE,\n MorphStep,\n useCountdown,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface CodeAuthBlockProps {\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /** Where the code was sent; drives copy and icon. */\n channel?: \"email\" | \"sms\";\n /** Masked destination shown in the description, e.g. \"y•••@example.com\". */\n destination?: string;\n length?: number;\n /** Submit automatically once all digits are entered. */\n autoSubmit?: boolean;\n /** Seconds before \"Resend code\" becomes available. 0 disables the wait. */\n resendSeconds?: number;\n /** Reject (or throw) to show the error shake and clear the code. */\n onVerify?: (code: string) => Promise<void> | void;\n onResend?: () => Promise<void> | void;\n onBack?: () => void;\n}\n\nexport function CodeAuthBlock({\n channel = \"email\",\n logo,\n accent,\n destination,\n length = 6,\n autoSubmit = true,\n resendSeconds = 30,\n onVerify,\n onResend,\n onBack,\n}: CodeAuthBlockProps) {\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [code, setCode] = React.useState(\"\");\n const [resendCount, setResendCount] = React.useState(0);\n const remaining = useCountdown(resendSeconds, resendCount);\n\n const ChannelIcon = channel === \"sms\" ? SmartphoneIcon : MailIcon;\n const channelLabel = channel === \"sms\" ? \"phone\" : \"email\";\n\n const verify = React.useCallback(\n async (value: string) => {\n setError(null);\n setStatus(\"loading\");\n try {\n await onVerify?.(value);\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setCode(\"\");\n setError(cause instanceof Error ? cause.message : \"Invalid code.\");\n }\n },\n [onVerify],\n );\n\n function handleChange(value: string) {\n setCode(value);\n if (error) setError(null);\n if (autoSubmit && value.length === length && status === \"idle\") {\n void verify(value);\n }\n }\n\n async function handleResend() {\n setResendCount((count) => count + 1);\n setCode(\"\");\n setError(null);\n await onResend?.();\n }\n\n return (\n <AuthCard\n title=\"Enter verification code\"\n logo={logo}\n accent={accent}\n description={\n <span className=\"inline-flex items-center gap-1.5\">\n <ChannelIcon className=\"size-3.5 shrink-0\" />\n <span>\n We sent a {length}-digit code to your {channelLabel}\n {destination ? (\n <>\n {\" \"}\n <span className=\"font-medium text-foreground\">\n {destination}\n </span>\n </>\n ) : null}\n .\n </span>\n </span>\n }\n footer={\n status !== \"success\" && (\n <Button variant=\"link\" onClick={onBack}>\n Use a different {channelLabel}\n </Button>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Verified\"\n description=\"Your identity has been confirmed.\"\n />\n ) : (\n <div className=\"flex flex-col items-center gap-4\">\n <motion.div\n // Shake the whole field on error; keying by message replays it.\n key={error ?? \"steady\"}\n animate={error ? { x: [0, -8, 8, -5, 5, 0] } : { x: 0 }}\n transition={{ duration: 0.4, ease: \"easeInOut\" }}\n >\n <OTPField\n length={length}\n value={code}\n onValueChange={handleChange}\n disabled={status === \"loading\"}\n >\n {Array.from({ length }, (_, index) => (\n <OTPFieldInput\n key={`slot-${index}`}\n aria-invalid={error ? true : undefined}\n aria-label={`Digit ${index + 1} of ${length}`}\n />\n ))}\n </OTPField>\n </motion.div>\n <AuthError message={error} />\n {!autoSubmit && (\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n loading={status === \"loading\"}\n disabled={code.length !== length}\n onClick={() => void verify(code)}\n >\n Verify\n </Button>\n )}\n <motion.p\n layout\n transition={{ duration: 0.25, ease: EASE }}\n className=\"text-center text-sm text-muted-foreground\"\n >\n {remaining > 0 ? (\n <>\n Resend code in{\" \"}\n <span className=\"font-medium tabular-nums text-foreground\">\n {remaining}s\n </span>\n </>\n ) : (\n <Button\n variant=\"link\"\n disabled={status === \"loading\"}\n onClick={() => void handleResend()}\n >\n Resend code\n </Button>\n )}\n </motion.p>\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport { ArrowLeftIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface ForgotPasswordBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n onSubmit?: (data: { email: string }) => Promise<void> | void;\n onBackToLogin?: () => void;\n}\n\nexport function ForgotPasswordBlock({\n title = \"Reset your password\",\n logo,\n accent,\n description = \"Enter your email and we will send you a reset link\",\n onSubmit,\n onBackToLogin,\n}: ForgotPasswordBlockProps) {\n const emailId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [email, setEmail] = React.useState(\"\");\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({ email });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to send reset link.\",\n );\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n <Button\n variant=\"link\"\n className=\"gap-1\"\n onClick={onBackToLogin}\n >\n <ArrowLeftIcon className=\"size-3.5\" />\n Back to login\n </Button>\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Check your inbox\"\n description={\n <>\n We sent a password reset link to{\" \"}\n <span className=\"font-medium text-foreground\">{email}</span>.\n </>\n }\n >\n <Button\n variant=\"link\"\n className=\"text-xs sm:text-xs\"\n onClick={() => setStatus(\"idle\")}\n >\n Use a different email\n </Button>\n </AuthSuccess>\n ) : (\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n name=\"email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={status === \"loading\"}\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n />\n </Field>\n <AuthError message={error} />\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n >\n Send reset link\n </Button>\n </form>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { PasswordInput } from \"@/components/composed/password-input\";\nimport {\n SocialProviders,\n type SocialProvider,\n} from \"@/components/composed/social-providers\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSeparator,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface LoginBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /** Social providers to offer; empty array hides the social section. */\n providers?: SocialProvider[];\n showRememberMe?: boolean;\n showForgotPassword?: boolean;\n /** Reject (or throw) to show the error state with the error's message. */\n onSubmit?: (data: {\n email: string;\n password: string;\n remember: boolean;\n }) => Promise<void> | void;\n onProviderSelect?: (provider: SocialProvider) => Promise<void> | void;\n onForgotPassword?: () => void;\n onSignup?: () => void;\n}\n\nexport function LoginBlock({\n title = \"Login to your account\",\n description = \"Enter your email and password to login\",\n logo,\n accent,\n providers = [\"google\", \"apple\", \"github\"],\n showRememberMe = true,\n showForgotPassword = true,\n onSubmit,\n onProviderSelect,\n onForgotPassword,\n onSignup,\n}: LoginBlockProps) {\n const emailId = React.useId();\n const rememberId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [loadingProvider, setLoadingProvider] =\n React.useState<SocialProvider | null>(null);\n const [remember, setRemember] = React.useState(false);\n const [email, setEmail] = React.useState(\"\");\n const [emailValid, setEmailValid] = React.useState(false);\n const [password, setPassword] = React.useState(\"\");\n\n const busy = status === \"loading\" || loadingProvider !== null;\n\n // Progressive disclosure: each step unlocks the next. The password field is\n // gated on the email input's own constraint validation (required + type\n // email), the submit button on the password being non-empty — a login form\n // verifies a credential rather than enforcing policy, so strength rules here\n // would lock out anyone whose password predates them. The submit gate\n // re-checks emailValid so a stale password (typed, then the email was edited\n // back into an invalid state) can't leave the button on its own.\n const passwordValid = password.trim().length > 0;\n const canSubmit = emailValid && passwordValid;\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n // Enter in any field submits the form even while the button is hidden.\n if (!canSubmit) return;\n const form = new FormData(event.currentTarget);\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({\n email: String(form.get(\"email\") ?? \"\"),\n password: String(form.get(\"password\") ?? \"\"),\n remember,\n });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(cause instanceof Error ? cause.message : \"Unable to login.\");\n }\n }\n\n async function handleProvider(provider: SocialProvider) {\n setError(null);\n setLoadingProvider(provider);\n try {\n await onProviderSelect?.(provider);\n setStatus(\"success\");\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to login.\",\n );\n } finally {\n setLoadingProvider(null);\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n status !== \"success\" && (\n <>\n Don&apos;t have an account?{\" \"}\n <Button variant=\"link\" onClick={onSignup}>\n Sign up\n </Button>\n </>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Welcome back\"\n description=\"You are now logged in.\"\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n aria-label=\"Email\"\n name=\"email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={busy}\n value={email}\n onChange={(event) => {\n setEmail(event.currentTarget.value);\n setEmailValid(event.currentTarget.validity.valid);\n }}\n />\n </Field>\n <Reveal show={emailValid}>\n <Field name=\"password\">\n <FieldLabel htmlFor=\"password\">Password</FieldLabel>\n <PasswordInput\n id=\"password\"\n name=\"password\"\n autoComplete=\"current-password\"\n required\n disabled={busy}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n {showForgotPassword && (\n // self-end: Field root is items-start, so this aligns the\n // link with the input's trailing edge. sm:text-xs is\n // required — the cva's sm:text-sm survives tailwind-merge\n // and would otherwise win at the breakpoint.\n <Button\n variant=\"link\"\n type=\"button\"\n className=\"self-end font-normal text-muted-foreground text-xs hover:text-foreground sm:text-xs\"\n onClick={onForgotPassword}\n >\n Forgot password?\n </Button>\n )}\n </Field>\n </Reveal>\n {showRememberMe && (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={rememberId}\n checked={remember}\n onCheckedChange={(checked) => setRemember(checked)}\n disabled={busy}\n />\n <Label htmlFor={rememberId} className=\"font-normal\">\n Remember me\n </Label>\n </div>\n )}\n <AuthError message={error} />\n <Reveal show={canSubmit}>\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n disabled={busy}\n >\n Login\n </Button>\n </Reveal>\n </form>\n {providers.length > 0 && (\n // The social providers retire once the email path is filled in\n // and valid — the user has committed to a path, so the\n // alternatives are just noise. They come back if a field is\n // invalidated again. gap-4 on the wrapper reproduces the spacing\n // the two children had as direct flex items of the column above.\n <Reveal show={!canSubmit} className=\"flex flex-col gap-4\">\n <AuthSeparator label=\"Or continue with\" />\n <SocialProviders\n providers={providers}\n action=\"login\"\n loadingProvider={loadingProvider}\n disabled={status === \"loading\"}\n onSelect={handleProvider}\n />\n </Reveal>\n )}\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldError, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { cn } from \"@/lib/utils\";\nimport type {\n OnboardingFieldConfig,\n OnboardingStepConfig,\n OnboardingValue,\n} from \"../onboarding-block\";\n\nexport interface ProfileStepProps {\n step: OnboardingStepConfig;\n /** Seed values, so drafts survive back/forward navigation. */\n values: Record<string, OnboardingValue>;\n submitting?: boolean;\n submitLabel: string;\n onSubmit: (values: Record<string, OnboardingValue>) => void | Promise<void>;\n onBack?: () => void;\n /** Reports every edit so the flow can restore drafts across navigation. */\n onDraftChange?: (name: string, value: OnboardingValue) => void;\n}\n\nfunction initialValue(\n field: OnboardingFieldConfig,\n saved: OnboardingValue | undefined,\n): OnboardingValue {\n if (field.kind === \"checkbox\") return typeof saved === \"boolean\" ? saved : false;\n return typeof saved === \"string\" ? saved : \"\";\n}\n\n/** Built-in validation, mirroring the declared `FieldConfig` contract. */\nfunction validateField(\n field: OnboardingFieldConfig,\n value: OnboardingValue,\n): string | null {\n const required = field.required === true;\n\n if (field.kind === \"checkbox\") {\n if (required && value !== true) return `${field.label} is required`;\n return null;\n }\n\n const text = typeof value === \"string\" ? value.trim() : \"\";\n if (required && text.length === 0) return `${field.label} is required`;\n\n if (field.kind === \"url\" && text.length > 0) {\n try {\n new URL(text);\n } catch {\n return \"Enter a valid URL\";\n }\n }\n\n if (field.kind === \"select\" && text.length > 0) {\n const allowed = field.options.map((option) => option.value);\n if (!allowed.includes(text)) {\n return `Choose a valid option for ${field.label}`;\n }\n }\n\n return field.validate?.(text) ?? null;\n}\n\n/**\n * Renders one declared profile step: `OnboardingFieldConfig[]` → labeled\n * controls, validated locally before anything is handed to `onSubmit`. Mounted\n * keyed by `step.id` so drafts re-seed per step.\n */\nexport function ProfileStep({\n step,\n values,\n submitting = false,\n submitLabel,\n onSubmit,\n onBack,\n onDraftChange,\n}: ProfileStepProps) {\n const idPrefix = React.useId();\n const [draft, setDraft] = React.useState<Record<string, OnboardingValue>>(\n () =>\n Object.fromEntries(\n step.fields.map((field) => [\n field.name,\n initialValue(field, values[field.name]),\n ]),\n ),\n );\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n\n function setValue(name: string, value: OnboardingValue) {\n setDraft((current) => ({ ...current, [name]: value }));\n onDraftChange?.(name, value);\n // Clear a field's error as soon as it is edited; re-validation happens on\n // the next submit rather than on every keystroke.\n setErrors((current) =>\n current[name] ? { ...current, [name]: \"\" } : current,\n );\n }\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (submitting) return;\n\n const next: Record<string, string> = {};\n for (const field of step.fields) {\n const message = validateField(field, draft[field.name]);\n if (message) next[field.name] = message;\n }\n if (Object.keys(next).length > 0) {\n setErrors(next);\n return;\n }\n setErrors({});\n\n const submitted: Record<string, OnboardingValue> = {};\n for (const field of step.fields) {\n const value = draft[field.name];\n submitted[field.name] = typeof value === \"string\" ? value.trim() : value;\n }\n await onSubmit(submitted);\n }\n\n return (\n <form className=\"flex flex-col gap-4\" noValidate onSubmit={handleSubmit}>\n {step.fields.map((field) => {\n const error = errors[field.name] || undefined;\n const controlId = `${idPrefix}-${field.name}`;\n const value = draft[field.name];\n\n if (field.kind === \"checkbox\") {\n return (\n <Field\n key={field.name}\n name={field.name}\n invalid={Boolean(error)}\n className=\"gap-1.5\"\n >\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={controlId}\n checked={value === true}\n disabled={submitting}\n onCheckedChange={(checked) => setValue(field.name, checked)}\n />\n <Label htmlFor={controlId} className=\"font-normal\">\n {field.label}\n </Label>\n </div>\n {error && <FieldError match>{error}</FieldError>}\n </Field>\n );\n }\n\n return (\n <Field key={field.name} name={field.name} invalid={Boolean(error)}>\n <FieldLabel htmlFor={controlId}>{field.label}</FieldLabel>\n {field.kind === \"textarea\" ? (\n <Textarea\n id={controlId}\n aria-invalid={error ? true : undefined}\n disabled={submitting}\n placeholder={field.placeholder}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n />\n ) : field.kind === \"select\" ? (\n // No select atom exists in the library yet; a native control\n // styled to match Input keeps the flow self-contained without\n // inventing one here.\n <select\n id={controlId}\n aria-invalid={error ? true : undefined}\n className={cn(\n \"h-8.5 w-full rounded-lg border border-input bg-background px-[calc(--spacing(3)-1px)] text-base text-foreground shadow-xs/5 outline-none transition-[box-shadow,border-color] duration-150 ease-smooth-out focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/24 disabled:opacity-64 aria-invalid:border-destructive/36 sm:h-7.5 sm:text-sm dark:bg-input/32\",\n )}\n disabled={submitting}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n >\n <option value=\"\">{field.placeholder ?? \"Choose an option\"}</option>\n {field.options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n ) : (\n <Input\n id={controlId}\n aria-invalid={error ? true : undefined}\n disabled={submitting}\n placeholder={field.placeholder}\n type={field.kind === \"url\" ? \"url\" : \"text\"}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n />\n )}\n {error && <FieldError match>{error}</FieldError>}\n </Field>\n );\n })}\n\n <div className=\"flex gap-2\">\n {onBack && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={submitting}\n onClick={onBack}\n >\n Back\n </Button>\n )}\n <Button className=\"flex-1\" type=\"submit\" loading={submitting}>\n {submitLabel}\n </Button>\n </div>\n </form>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport type { AuthAccent } from \"@/lib/auth-accent\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n type AuthStatus,\n} from \"./auth-shell\";\nimport { ProfileStep } from \"./onboarding/profile-step\";\n\n/** Value a single onboarding field can hold. */\nexport type OnboardingValue = string | boolean;\n\nexport interface OnboardingSelectOption {\n value: string;\n label: string;\n}\n\ninterface OnboardingFieldBase {\n /** Key the value is collected under; unique within the flow. */\n name: string;\n label: string;\n /** Required fields gate the step's advance. */\n required?: boolean;\n placeholder?: string;\n /** Extra validation; return a message to reject, `null` to accept. */\n validate?: (value: string) => string | null;\n}\n\nexport interface OnboardingTextField extends OnboardingFieldBase {\n kind: \"text\" | \"textarea\" | \"url\";\n}\n\nexport interface OnboardingCheckboxField extends OnboardingFieldBase {\n kind: \"checkbox\";\n}\n\nexport interface OnboardingSelectField extends OnboardingFieldBase {\n kind: \"select\";\n options: OnboardingSelectOption[];\n}\n\n/** Discriminated on `kind`. */\nexport type OnboardingFieldConfig =\n | OnboardingTextField\n | OnboardingCheckboxField\n | OnboardingSelectField;\n\nexport interface OnboardingStepConfig {\n /** Unique within the flow and stable across releases. */\n id: string;\n title: string;\n description?: string;\n fields: OnboardingFieldConfig[];\n}\n\n/** Default configuration: a single required display-name step. */\nexport const DEFAULT_ONBOARDING_STEPS: OnboardingStepConfig[] = [\n {\n id: \"profile\",\n title: \"Your profile\",\n fields: [\n { kind: \"text\", name: \"display_name\", label: \"Display name\", required: true },\n ],\n },\n];\n\nexport interface OnboardingBlockProps {\n /** Declared profile steps. */\n steps?: OnboardingStepConfig[];\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /**\n * Fires per step as it is submitted. Reject (or throw) to keep the user on\n * the step and show the error.\n */\n onStepSubmit?: (\n stepId: string,\n values: Record<string, OnboardingValue>,\n ) => Promise<void> | void;\n /** Fires once, after the final step is accepted, with the merged profile. */\n onComplete?: (profile: Record<string, OnboardingValue>) => Promise<void> | void;\n /** Shows a brief success screen once onboarding completes. */\n showCompleteScreen?: boolean;\n className?: string;\n}\n\n/**\n * Multi-step profile onboarding: a declared `steps` config renders as\n * progress-tracked forms with back/forward navigation, per-step submission and\n * a single completion signal. Drafts survive back-navigation, and the step\n * heading takes focus on advance so a screen reader announces where the flow\n * moved.\n *\n * Account creation and email confirmation are separate blocks (`SignupBlock`,\n * `CodeAuthBlock`) — this one picks up once the account exists.\n */\nexport function OnboardingBlock({\n steps = DEFAULT_ONBOARDING_STEPS,\n logo,\n accent,\n onStepSubmit,\n onComplete,\n showCompleteScreen = true,\n className,\n}: OnboardingBlockProps) {\n const headingRef = React.useRef<HTMLHeadingElement>(null);\n // Unsubmitted per-step drafts. Accumulated in a ref so a keystroke does not\n // re-render the whole flow, then published to state at each navigation —\n // the only moment the seed values are actually read.\n const draftsRef = React.useRef<\n Record<string, Record<string, OnboardingValue>>\n >({});\n const [drafts, setDrafts] = React.useState<\n Record<string, Record<string, OnboardingValue>>\n >({});\n\n const [index, setIndex] = React.useState(0);\n const [values, setValues] = React.useState<Record<string, OnboardingValue>>(\n {},\n );\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n\n const done = status === \"success\";\n const step = steps[index];\n const last = index >= steps.length - 1;\n\n // Focus the step heading on advance; on error the alert carries the message\n // and stealing focus would talk over it.\n React.useEffect(() => {\n if (error) return;\n headingRef.current?.focus();\n }, [index, done, error]);\n\n async function handleStepSubmit(stepValues: Record<string, OnboardingValue>) {\n if (!step) return;\n const merged = { ...values, ...stepValues };\n setError(null);\n setStatus(\"loading\");\n try {\n await onStepSubmit?.(step.id, stepValues);\n if (last) await onComplete?.(merged);\n setValues(merged);\n delete draftsRef.current[step.id];\n setDrafts({ ...draftsRef.current });\n setStatus(last ? \"success\" : \"idle\");\n if (!last) setIndex((current) => current + 1);\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to save your profile.\",\n );\n }\n }\n\n if (done && !showCompleteScreen) return null;\n\n const heading = done ? \"You're all set\" : (step?.title ?? \"Your profile\");\n\n return (\n <AuthCard\n title={heading}\n description={done ? undefined : step?.description}\n logo={logo}\n accent={accent}\n className={className}\n >\n <MorphStep step={done ? \"done\" : `step-${index}`}>\n {done ? (\n <AuthSuccess\n title=\"Profile saved\"\n description=\"Your account is ready and your profile has been saved.\"\n />\n ) : step ? (\n <div className=\"flex flex-col gap-4\">\n <nav aria-label=\"Onboarding progress\">\n <ol className=\"flex flex-wrap gap-x-3 gap-y-1 text-xs\">\n {steps.map((item, itemIndex) => (\n <li\n key={item.id}\n aria-current={itemIndex === index ? \"step\" : undefined}\n className={cn(\n \"text-muted-foreground\",\n itemIndex === index && \"font-medium text-foreground\",\n )}\n >\n {item.title}\n {itemIndex < index && (\n <span className=\"sr-only\"> (completed)</span>\n )}\n </li>\n ))}\n </ol>\n </nav>\n\n {/* The AuthCard title is the visible heading; this one exists to\n take focus on advance without duplicating it on screen. */}\n <h3 ref={headingRef} tabIndex={-1} className=\"sr-only\">\n {step.title}\n </h3>\n\n <AuthError message={error} />\n\n <ProfileStep\n key={step.id}\n step={step}\n values={{ ...values, ...drafts[step.id] }}\n submitting={status === \"loading\"}\n submitLabel={last ? \"Finish\" : \"Continue\"}\n onBack={\n index > 0\n ? () => {\n setError(null);\n setDrafts({ ...draftsRef.current });\n setIndex((current) => current - 1);\n }\n : undefined\n }\n onDraftChange={(name, value) => {\n draftsRef.current[step.id] = {\n ...draftsRef.current[step.id],\n [name]: value,\n };\n }}\n onSubmit={handleStepSubmit}\n />\n </div>\n ) : null}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n PasswordInput,\n getPasswordStrength,\n passwordRequirements,\n} from \"@/components/composed/password-input\";\nimport {\n SocialProviders,\n type SocialProvider,\n} from \"@/components/composed/social-providers\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSeparator,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface SignupBlockProps {\n title?: string;\n description?: string;\n /**\n * Replaces the built-in \"terms\" link inside the consent label — pass your\n * own dialog trigger to render it inline instead of wiring `onTerms`.\n */\n termsComponent?: React.ReactNode;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit keeping the default primary. */\n accent?: AuthAccent;\n providers?: SocialProvider[];\n showNameField?: boolean;\n /** Require the term checkbox before submitting. */\n showTerms?: boolean;\n /**\n * Controls the term checkbox. Pass it with `onTermsCheckedChange` when\n * something outside the block has to tick the box — an \"I agree\" action in\n * your own terms dialog, say. Omit letting the block own the state.\n */\n termsChecked?: boolean;\n /** Starting state of the term checkbox while it is uncontrolled. */\n defaultTermsChecked?: boolean;\n /** Fires on every change, controlled or not. */\n onTermsCheckedChange?: (checked: boolean) => void;\n /** Block submission until every password requirement is met. */\n enforceStrongPassword?: boolean;\n onSubmit?: (data: {\n name: string;\n email: string;\n password: string;\n }) => Promise<void> | void;\n onProviderSelect?: (provider: SocialProvider) => Promise<void> | void;\n onLogin?: () => void;\n onTerms?: () => void;\n}\n\nexport function SignupBlock({\n title = \"Create your account\",\n description = \"Start exploring manuscripts in minutes\",\n logo,\n accent,\n providers = [\"google\", \"apple\", \"github\"],\n showNameField = true,\n showTerms = true,\n termsChecked,\n defaultTermsChecked = false,\n onTermsCheckedChange,\n enforceStrongPassword = true,\n onSubmit,\n termsComponent,\n onProviderSelect,\n onLogin,\n onTerms,\n}: SignupBlockProps) {\n const nameId = React.useId();\n const emailId = React.useId();\n const passwordId = React.useId();\n const termsId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [loadingProvider, setLoadingProvider] =\n React.useState<SocialProvider | null>(null);\n const [password, setPassword] = React.useState(\"\");\n // Controlled when `termsChecked` is passed, uncontrolled otherwise. The\n // internal state is kept either way, so a block that switches between the\n // two mid-life does not lose the box, and the callback fires in both modes.\n const [uncontrolledTerms, setUncontrolledTerms] =\n React.useState(defaultTermsChecked);\n const terms = termsChecked ?? uncontrolledTerms;\n\n function handleTermsChange(checked: boolean) {\n if (termsChecked === undefined) setUncontrolledTerms(checked);\n onTermsCheckedChange?.(checked);\n }\n // Tracked from each input's own constraint validation rather than a regex.\n // The values stay uncontrolled — only validity is needed, and the form reads\n // values from FormData on submit.\n const [emailValid, setEmailValid] = React.useState(false);\n const [nameValid, setNameValid] = React.useState(false);\n\n const busy = status === \"loading\" || loadingProvider !== null;\n const strongEnough =\n !enforceStrongPassword ||\n getPasswordStrength(password) === passwordRequirements.length;\n\n // The social providers retire once the email path is filled in and valid —\n // the user has committed to a path, so the alternatives are just noise. It\n // comes back if they invalidate a field again.\n const passwordValid = password.trim().length > 0 && strongEnough;\n const emailPathComplete =\n (!showNameField || nameValid) && emailValid && passwordValid;\n\n async function handleSubmit(event: React.SubmitEvent<HTMLFormElement>) {\n event.preventDefault();\n setError(null);\n if (!strongEnough) {\n setError(\"Please meet all password requirements.\");\n return;\n }\n if (showTerms && !terms) {\n setError(\"Please accept the terms to continue.\");\n return;\n }\n const form = new FormData(event.currentTarget);\n setStatus(\"loading\");\n try {\n await onSubmit?.({\n name: String(form.get(\"name\") ?? \"\"),\n email: String(form.get(\"email\") ?? \"\"),\n password,\n });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to create account.\",\n );\n }\n }\n\n async function handleProvider(provider: SocialProvider) {\n setError(null);\n setLoadingProvider(provider);\n try {\n await onProviderSelect?.(provider);\n setStatus(\"success\");\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to create account.\",\n );\n } finally {\n setLoadingProvider(null);\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n status !== \"success\" && (\n <>\n Already have an account?{\" \"}\n <Button variant=\"link\" onClick={onLogin}>\n Login\n </Button>\n </>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Account created\"\n description=\"Check your inbox to confirm your email address.\"\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n {providers.length > 0 && (\n // gap-4 on the wrapper reproduces the spacing the two children\n // had as direct flex items of the column above.\n <Reveal show={!emailPathComplete} className=\"flex flex-col gap-4\">\n <SocialProviders\n providers={providers}\n action=\"signup\"\n loadingProvider={loadingProvider}\n disabled={status === \"loading\"}\n onSelect={handleProvider}\n />\n <AuthSeparator label=\"Or with email\" />\n </Reveal>\n )}\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n {showNameField && (\n <Field name=\"name\">\n <FieldLabel htmlFor={nameId}>Name</FieldLabel>\n <Input\n aria-label=\"Name\"\n id={nameId}\n name=\"name\"\n autoComplete=\"name\"\n placeholder=\"Your name\"\n required\n disabled={busy}\n onChange={(event) =>\n setNameValid(event.currentTarget.validity.valid)\n }\n />\n </Field>\n )}\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n name=\"email\"\n type=\"email\"\n aria-label=\"Email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={busy}\n onChange={(event) =>\n setEmailValid(event.currentTarget.validity.valid)\n }\n />\n </Field>\n <Reveal show={emailValid}>\n <Field name=\"password\">\n <FieldLabel htmlFor={passwordId}>Password</FieldLabel>\n <PasswordInput\n id={passwordId}\n name=\"password\"\n aria-label=\"Password\"\n autoComplete=\"new-password\"\n placeholder=\"Create a password\"\n showStrength\n required\n disabled={busy}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n </Field>\n </Reveal>\n {showTerms && (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={termsId}\n checked={terms}\n onCheckedChange={(checked) =>\n handleTermsChange(checked === true)\n }\n disabled={busy}\n />\n <Label htmlFor={termsId} className=\"font-normal\">\n I agree to the{\" \"}\n {termsComponent ?? (\n <Button variant=\"link\" type=\"button\" onClick={onTerms}>\n terms\n </Button>\n )}\n </Label>\n </div>\n )}\n <AuthError message={error} />\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n disabled={busy}\n >\n Create account\n </Button>\n </form>\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n getPasswordStrength,\n PasswordInput,\n} from \"@/components/composed/password-input\";\nimport { Button } from \"@/components/ui/button\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface UpdatePasswordBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /**\n * Minimum strength (0-4, as scored by `getPasswordStrength`) the new\n * password must reach before the confirm field is revealed. 0 disables the\n * gate.\n */\n minStrength?: number;\n /** Reject (or throw) to show the error state with the error's message. */\n onSubmit?: (data: { password: string }) => Promise<void> | void;\n onDone?: () => void;\n}\n\n/**\n * Password change form for an already-authenticated user: a strength-metered\n * new password gates the confirm field, which in turn gates the submit\n * button. Mismatch is caught client-side; everything else comes back as a\n * rejection from `onSubmit`.\n */\nexport function UpdatePasswordBlock({\n title = \"Update your password\",\n description = \"Choose a new password for your account\",\n logo,\n accent,\n minStrength = 4,\n onSubmit,\n onDone,\n}: UpdatePasswordBlockProps) {\n const passwordId = React.useId();\n const confirmId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPassword, setConfirmPassword] = React.useState(\"\");\n\n // Progressive disclosure, matching the signup block: the confirm field\n // appears once the new password clears the policy, the submit button once\n // the two match.\n const strongEnough = getPasswordStrength(password) >= minStrength;\n const matches = confirmPassword.length > 0 && confirmPassword === password;\n const canSubmit = strongEnough && matches;\n\n // Only flag a mismatch once the confirmation has diverged — while it is\n // still a prefix of the new password the user is simply mid-keystroke, and\n // nagging on every character would shake the field the whole way through.\n const mismatch =\n confirmPassword.length > 0 && !password.startsWith(confirmPassword);\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n // Enter in any field submits the form even while the button is hidden.\n if (!canSubmit) return;\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({ password });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to update password.\",\n );\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Password updated\"\n description=\"Your password has been changed successfully.\"\n >\n {onDone && (\n <Button variant=\"link\" onClick={onDone}>\n Continue\n </Button>\n )}\n </AuthSuccess>\n ) : (\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"password\">\n <FieldLabel htmlFor={passwordId}>New password</FieldLabel>\n <PasswordInput\n id={passwordId}\n name=\"password\"\n autoComplete=\"new-password\"\n required\n showStrength\n disabled={status === \"loading\"}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n </Field>\n <Reveal show={strongEnough}>\n <Field name=\"confirmPassword\">\n <FieldLabel htmlFor={confirmId}>Confirm new password</FieldLabel>\n <PasswordInput\n id={confirmId}\n name=\"confirmPassword\"\n autoComplete=\"new-password\"\n required\n disabled={status === \"loading\"}\n value={confirmPassword}\n onChange={(event) => setConfirmPassword(event.target.value)}\n />\n </Field>\n </Reveal>\n <AuthError\n message={error ?? (mismatch ? \"Passwords do not match.\" : null)}\n />\n <Reveal show={canSubmit}>\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n >\n Update password\n </Button>\n </Reveal>\n </form>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","/**\n * Session state for the auth blocks — singleton atoms, deliberately NOT a\n * family.\n *\n * A session is one-per-store: one signed-in user per app (per\n * `ExegiaProvider` store; SSR isolation comes from passing a fresh store).\n * Instance keying is for multi-instance components; a family here would\n * imply several concurrent users and be a lie.\n *\n * Import direction: this module is the LEAF — it imports nothing from\n * `auth-flow-atom.ts`. The flow module imports `signInAtom` from here (for\n * `completeAuthFlowAtom`) and defines the composite `endAuthSessionAtom`\n * that pairs `signOutAtom` with a flow reset. `signOutAtom` below clears the\n * session only.\n */\nimport { atom } from \"jotai\"\n\nimport type {\n AuthSessionState,\n AuthSessionStatus,\n AuthUser,\n} from \"./auth-state-type\"\n\n// ── primitives ───────────────────────────────────────────────────────────\n\n/** `\"unknown\"` until the app restores or rejects a session at boot. */\nexport const authSessionStatusAtom = atom<AuthSessionStatus>(\"unknown\")\nauthSessionStatusAtom.debugLabel = \"auth-session/status\"\n\nexport const authUserAtom = atom<AuthUser | null>(null)\nauthUserAtom.debugLabel = \"auth-session/user\"\n\n// ── derived ──────────────────────────────────────────────────────────────\n\nexport const isAuthenticatedAtom = atom(\n (get) => get(authSessionStatusAtom) === \"authenticated\"\n)\nisAuthenticatedAtom.debugLabel = \"auth-session/isAuthenticated\"\n\nexport const authSessionStateAtom = atom<AuthSessionState>((get) => ({\n status: get(authSessionStatusAtom),\n user: get(authUserAtom),\n}))\nauthSessionStateAtom.debugLabel = \"auth-session/state\"\n\n// ── actions ──────────────────────────────────────────────────────────────\n\nexport const signInAtom = atom(null, (_get, set, user: AuthUser) => {\n set(authUserAtom, user)\n set(authSessionStatusAtom, \"authenticated\")\n})\nsignInAtom.debugLabel = \"auth-session/signIn\"\n\nexport const updateAuthUserAtom = atom(\n null,\n (get, set, patch: Partial<AuthUser>) => {\n const user = get(authUserAtom)\n // No-op when signed out: there is no user to merge into, and inventing\n // one from a partial patch would fabricate an identity.\n if (user === null) return\n set(authUserAtom, { ...user, ...patch })\n }\n)\nupdateAuthUserAtom.debugLabel = \"auth-session/updateUser\"\n\n/** What an app calls at boot when session restore fails. */\nexport const markUnauthenticatedAtom = atom(null, (_get, set) => {\n set(authSessionStatusAtom, \"unauthenticated\")\n set(authUserAtom, null)\n})\nmarkUnauthenticatedAtom.debugLabel = \"auth-session/markUnauthenticated\"\n\n/**\n * Clears the session only. Most consumers want `endAuthSessionAtom` from\n * `auth-flow-atom.ts` instead, which also returns the default flow to the\n * login step — the hooks expose that one as `signOut`.\n */\nexport const signOutAtom = atom(null, (_get, set) => {\n set(authUserAtom, null)\n set(authSessionStatusAtom, \"unauthenticated\")\n})\nsignOutAtom.debugLabel = \"auth-session/signOut\"\n","/**\n * Per-instance Jotai state for the auth flow — which auth block the app is\n * showing, the identifier in flight, and the attempt status.\n *\n * Every atom is a module-level family keyed by a flow id, so one\n * `ExegiaProvider` at the app root is enough: a modal login and a full-page\n * login can coexist in one store, and any component can drive a flow by id\n * without holding a controller. Most apps have one flow and use\n * `DEFAULT_AUTH_FLOW_ID`.\n *\n * This is a coordination layer only. The auth blocks keep passwords, codes\n * and field values in local `useState` on purpose — never store those here.\n *\n * Import direction: `auth-session-atom.ts` is the LEAF. This module imports\n * `signInAtom` from it (`completeAuthFlowAtom` signs the session in) and\n * defines the composite `endAuthSessionAtom`; the session module never\n * imports from here.\n */\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport { signInAtom, signOutAtom } from \"./auth-session-atom\"\nimport type { AuthStatus } from \"./auth-shell\"\nimport type {\n AuthFlowChannel,\n AuthFlowId,\n AuthFlowState,\n AuthFlowStep,\n AuthUser,\n BeginAuthVerificationOptions,\n} from \"./auth-state-type\"\n\nexport const DEFAULT_AUTH_FLOW_ID: AuthFlowId = \"default\"\n\n/**\n * A string-keyed atom family (same in-house shape as `tree-atom.ts`:\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove`). Dropping a key lets the store's\n * WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: AuthFlowId) => AtomType) & {\n remove: (id: AuthFlowId) => void\n}\n\n/** Every family, so `removeAuthFlowInstance` can drop an id from all. */\nconst families: { remove: (id: AuthFlowId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: AuthFlowId) => AtomType) {\n const cache = new Map<AuthFlowId, AtomType>()\n const family = ((id: AuthFlowId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: AuthFlowId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: AuthFlowId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (get: Getter, set: Setter, id: AuthFlowId, ...args: Args) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\n// ── masking ──────────────────────────────────────────────────────────────\n\n/**\n * Mask an identifier for display. Email → first character of the local part\n * plus `\"•••\"`, domain intact (`\"y•••@example.com\"`; a 1-char local part\n * still gets `\"y•••@…\"`). Non-email (sms) → `\"•••\"` + last 4 characters;\n * fewer than 4 characters masks everything as `\"•••\"`.\n */\nexport function maskAuthIdentifier(identifier: string): string {\n const at = identifier.indexOf(\"@\")\n if (at > 0) return `${identifier[0]}•••${identifier.slice(at)}`\n // At 4 characters or fewer, \"keep the last 4\" would reveal the whole\n // identifier while implying redaction — mask everything instead.\n if (identifier.length <= 4) return \"•••\"\n return `•••${identifier.slice(-4)}`\n}\n\n// ── primitives ───────────────────────────────────────────────────────────\n\nexport const authFlowStepAtom = stateFamily<AuthFlowStep>(\"step\", \"login\")\n\n/** An email or phone number in flight — never a password or a code. */\nexport const authFlowIdentifierAtom = stateFamily<string | null>(\n \"identifier\",\n null\n)\n\nexport const authFlowChannelAtom = stateFamily<AuthFlowChannel>(\n \"channel\",\n \"email\"\n)\n\nexport const authFlowStatusAtom = stateFamily<AuthStatus>(\"status\", \"idle\")\n\nexport const authFlowErrorAtom = stateFamily<string | null>(\"error\", null)\n\n// ── derived ──────────────────────────────────────────────────────────────\n\n/** `identifier` masked for display, `null` while nothing is in flight. */\nexport const authFlowMaskedIdentifierAtom = readFamily<string | null>(\n \"maskedIdentifier\",\n (get, id) => {\n const identifier = get(authFlowIdentifierAtom(id))\n return identifier === null ? null : maskAuthIdentifier(identifier)\n }\n)\n\nexport const authFlowStateAtom = readFamily<AuthFlowState>(\n \"state\",\n (get, id) => ({\n step: get(authFlowStepAtom(id)),\n identifier: get(authFlowIdentifierAtom(id)),\n maskedIdentifier: get(authFlowMaskedIdentifierAtom(id)),\n channel: get(authFlowChannelAtom(id)),\n status: get(authFlowStatusAtom(id)),\n error: get(authFlowErrorAtom(id)),\n })\n)\n\n// ── actions ──────────────────────────────────────────────────────────────\n\n/** Show a step with a clean slate (`\"idle\"`, no error). Keeps the\n * identifier so \"back to verify\" flows don't lose the destination. */\nexport const goToAuthStepAtom = actionFamily<[step: AuthFlowStep]>(\n \"goToStep\",\n (_get, set, id, step) => {\n set(authFlowStepAtom(id), step)\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\n/** Record the identifier in flight and move to the verification step. */\nexport const beginAuthVerificationAtom = actionFamily<\n [options: BeginAuthVerificationOptions]\n>(\n \"beginVerification\",\n (_get, set, id, { identifier, channel = \"email\", step = \"verify-code\" }) => {\n set(authFlowIdentifierAtom(id), identifier)\n set(authFlowChannelAtom(id), channel)\n set(authFlowStepAtom(id), step)\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\n/** Mark the flow `\"loading\"` while an async attempt is in flight. */\nexport const beginAuthAttemptAtom = actionFamily<[]>(\n \"beginAttempt\",\n (_get, set, id) => {\n set(authFlowStatusAtom(id), \"loading\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\nexport const failAuthFlowAtom = actionFamily<[message: string]>(\n \"fail\",\n (_get, set, id, message) => {\n set(authFlowStatusAtom(id), \"error\")\n set(authFlowErrorAtom(id), message)\n }\n)\n\n/** Mark the flow `\"success\"` and land on the success step. When `user` is\n * given, also sign the session in — one atomic write for the whole\n * \"verification passed\" transition. */\nexport const completeAuthFlowAtom = actionFamily<[user?: AuthUser]>(\n \"complete\",\n (_get, set, id, user) => {\n set(authFlowStatusAtom(id), \"success\")\n set(authFlowErrorAtom(id), null)\n set(authFlowStepAtom(id), \"success\")\n if (user) set(signInAtom, user)\n }\n)\n\n/** Back to the initial values (login step, no identifier, `\"email\"`,\n * `\"idle\"`, no error). */\nexport const resetAuthFlowAtom = actionFamily<[]>(\"reset\", (_get, set, id) => {\n set(authFlowStepAtom(id), \"login\")\n set(authFlowIdentifierAtom(id), null)\n set(authFlowChannelAtom(id), \"email\")\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n})\n\n/**\n * Sign out and return the default flow to the login step — the one to wire\n * to a logout button. `useAuthSessionActions().signOut` is this atom;\n * `signOutAtom` in `auth-session-atom.ts` clears the session only.\n */\nexport const endAuthSessionAtom = atom(null, (_get, set) => {\n set(signOutAtom)\n set(resetAuthFlowAtom(DEFAULT_AUTH_FLOW_ID))\n})\nendAuthSessionAtom.debugLabel = \"auth-flow/endAuthSession\"\n\n/** Drop every atom for `id`. Call on teardown of an explicit flow id; the\n * default flow usually just gets `resetAuthFlowAtom`. */\nexport function removeAuthFlowInstance(id: AuthFlowId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n DEFAULT_AUTH_FLOW_ID,\n authFlowStateAtom,\n beginAuthAttemptAtom,\n beginAuthVerificationAtom,\n completeAuthFlowAtom,\n endAuthSessionAtom,\n failAuthFlowAtom,\n goToAuthStepAtom,\n resetAuthFlowAtom,\n} from \"./auth-flow-atom\"\nimport {\n authSessionStateAtom,\n isAuthenticatedAtom,\n markUnauthenticatedAtom,\n signInAtom,\n updateAuthUserAtom,\n} from \"./auth-session-atom\"\nimport type {\n AuthFlowActions,\n AuthFlowId,\n AuthFlowState,\n AuthSessionActions,\n AuthSessionState,\n} from \"./auth-state-type\"\n\n/**\n * Read the auth flow registered under `flowId` from anywhere below\n * `ExegiaProvider`. Pairs with `useAuthFlowActions` to wire the auth blocks\n * into one flow — the blocks keep passwords and codes in local state, the\n * flow tracks which block shows and what identifier is in flight:\n *\n * ```tsx\n * const flow = useAuthFlow()\n * const { beginVerification, complete, fail } = useAuthFlowActions()\n *\n * {flow.step === \"login\" && (\n * <LoginBlock\n * onSubmit={async ({ email }) => {\n * await api.requestCode(email)\n * beginVerification({ identifier: email })\n * }}\n * />\n * )}\n * {flow.step === \"verify-code\" && (\n * <CodeAuthBlock\n * destination={flow.maskedIdentifier ?? undefined}\n * onVerify={async (code) => complete(await api.verify(code))}\n * />\n * )}\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(authFlowStepAtom(flowId))`.\n */\nexport function useAuthFlow(\n flowId: AuthFlowId = DEFAULT_AUTH_FLOW_ID\n): AuthFlowState {\n return useAtomValue(authFlowStateAtom(flowId))\n}\n\n/**\n * Drive the auth flow registered under `flowId` from anywhere. Writes only —\n * the caller never re-renders when the flow changes. See `useAuthFlow` for\n * the intended wiring; a block's submit handler typically runs\n * `beginAttempt()` → the API call → `complete(user)` or `fail(message)`.\n */\nexport function useAuthFlowActions(\n flowId: AuthFlowId = DEFAULT_AUTH_FLOW_ID\n): AuthFlowActions {\n const goToStep = useSetAtom(goToAuthStepAtom(flowId))\n const beginVerification = useSetAtom(beginAuthVerificationAtom(flowId))\n const beginAttempt = useSetAtom(beginAuthAttemptAtom(flowId))\n const fail = useSetAtom(failAuthFlowAtom(flowId))\n const complete = useSetAtom(completeAuthFlowAtom(flowId))\n const reset = useSetAtom(resetAuthFlowAtom(flowId))\n\n return React.useMemo(\n () => ({\n goToStep,\n beginVerification,\n beginAttempt,\n fail,\n complete,\n reset,\n }),\n [goToStep, beginVerification, beginAttempt, fail, complete, reset]\n )\n}\n\n/**\n * Read the session: `status` (`\"unknown\"` until the app restores or rejects\n * a session at boot), the signed-in `user`, and derived `isAuthenticated`.\n */\nexport function useAuthSession(): AuthSessionState & {\n isAuthenticated: boolean\n} {\n const state = useAtomValue(authSessionStateAtom)\n const isAuthenticated = useAtomValue(isAuthenticatedAtom)\n return React.useMemo(\n () => ({ ...state, isAuthenticated }),\n [state, isAuthenticated]\n )\n}\n\n/**\n * Drive the session. Writes only. `signOut` is the composite\n * `endAuthSessionAtom`: it clears the session AND returns the default flow\n * to the login step — the one to wire to a logout button.\n */\nexport function useAuthSessionActions(): AuthSessionActions {\n const signIn = useSetAtom(signInAtom)\n const updateUser = useSetAtom(updateAuthUserAtom)\n const markUnauthenticated = useSetAtom(markUnauthenticatedAtom)\n const signOut = useSetAtom(endAuthSessionAtom)\n\n return React.useMemo(\n () => ({ signIn, updateUser, markUnauthenticated, signOut }),\n [signIn, updateUser, markUnauthenticated, signOut]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { MotionConfig } from \"motion/react\"\n\nimport type { SocialProvider } from \"@/components/composed/social-providers\"\nimport type { AuthAccent } from \"@/lib/auth-accent\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthCard, AuthSuccess, MorphStep } from \"./auth-shell\"\nimport { CodeAuthBlock, type CodeAuthBlockProps } from \"./code-auth-block\"\nimport {\n ForgotPasswordBlock,\n type ForgotPasswordBlockProps,\n} from \"./forgot-password-block\"\nimport { LoginBlock, type LoginBlockProps } from \"./login-block\"\nimport {\n OnboardingBlock,\n type OnboardingBlockProps,\n type OnboardingStepConfig,\n type OnboardingValue,\n} from \"./onboarding-block\"\nimport { SignupBlock, type SignupBlockProps } from \"./signup-block\"\nimport {\n UpdatePasswordBlock,\n type UpdatePasswordBlockProps,\n} from \"./update-password-block\"\nimport type {\n AuthFlowId,\n AuthFlowState,\n AuthFlowStep,\n AuthUser,\n BeginAuthVerificationOptions,\n} from \"./auth-state-type\"\nimport { useAuthFlow, useAuthFlowActions } from \"./use-auth-state\"\n\n/**\n * Where the flow goes after a step callback resolves. Returned from every\n * `AuthFlowBlock` handler:\n *\n * - `{ user }` — the attempt signed someone in: mark the flow complete AND\n * sign the session in (one atomic write, `completeAuthFlowAtom`).\n * - `{ verify }` — a code went out: record the identifier and move to the\n * verification step (`beginAuthVerificationAtom`).\n * - `{ step }` — plain navigation with a clean slate (`goToAuthStepAtom`).\n * - `void` — stay put; the block renders its own success state.\n *\n * Rejections are NOT handled here — they propagate back into the block,\n * which owns its transient error/shake state (see `react/CLAUDE.md`,\n * \"Third implementation: auth\").\n */\nexport type AuthFlowDirective =\n | { user: AuthUser }\n | { verify: BeginAuthVerificationOptions }\n | { step: AuthFlowStep }\n | void\n\nexport type AuthFlowHandler<Data = void> = (\n data: Data\n) => Promise<AuthFlowDirective> | AuthFlowDirective\n\n/** Per-step prop overrides, merged over the orchestrator's wiring — spread\n * last, so an app can restyle a block or unhook a default navigation link\n * (`{ login: { onSignup: undefined } }` removes the sign-up hand-off). */\nexport interface AuthFlowStepOverrides {\n login?: Partial<LoginBlockProps>\n signup?: Partial<SignupBlockProps>\n \"verify-code\"?: Partial<CodeAuthBlockProps>\n \"forgot-password\"?: Partial<ForgotPasswordBlockProps>\n \"update-password\"?: Partial<UpdatePasswordBlockProps>\n onboarding?: Partial<OnboardingBlockProps>\n}\n\nexport interface AuthFlowBlockProps {\n /** Which flow instance to orchestrate. The default flow unless a re-auth\n * modal or a second surface needs its own. */\n flowId?: AuthFlowId\n /** Brand mark handed to every step's card. */\n logo?: React.ReactNode\n /** Brand accent handed to every step's card. */\n accent?: AuthAccent\n /** Social providers offered on the login and signup steps. */\n providers?: SocialProvider[]\n /** The login attempt. Resolve with a directive; reject to show the error\n * in the block. */\n onLogin?: AuthFlowHandler<{\n email: string\n password: string\n remember: boolean\n }>\n /** The signup attempt. */\n onSignup?: AuthFlowHandler<{ name: string; email: string; password: string }>\n /** A social provider chosen on the login or signup step. */\n onProviderSelect?: AuthFlowHandler<SocialProvider>\n /** The forgot-password request. Resolving without a directive stays on the\n * step (the block shows its own \"link sent\" state). */\n onRequestReset?: AuthFlowHandler<{ email: string }>\n /** The code entered on the verification step. */\n onVerifyCode?: AuthFlowHandler<string>\n /** \"Resend code\" on the verification step. */\n onResendCode?: AuthFlowHandler\n /** The update-password submit. */\n onUpdatePassword?: AuthFlowHandler<{ password: string }>\n /** Onboarding finished, with the merged profile. */\n onOnboardingComplete?: AuthFlowHandler<Record<string, OnboardingValue>>\n /** Declared onboarding steps, handed to `OnboardingBlock`. */\n onboardingSteps?: OnboardingStepConfig[]\n /** Per-step prop overrides, merged over the orchestrator's wiring. */\n steps?: AuthFlowStepOverrides\n /** Replace any step's UI entirely; return `undefined` to keep the default\n * for that step. Receives the flow state for destination copy etc. */\n renderStep?: (\n step: AuthFlowStep,\n flow: AuthFlowState\n ) => React.ReactNode | undefined\n /** Replaces the whole default success card. */\n success?: React.ReactNode\n /** Card title of the default success step. */\n successTitle?: string\n /** Body under the default success step's \"You're signed in\" check. */\n successDescription?: string\n className?: string\n}\n\n/**\n * Renders the right auth block for the flow's current step with the store\n * wiring built in — the switchboard every host app was hand-rolling around\n * `useAuthFlow`. Navigation links between steps (login ↔ signup, forgot\n * password, back from verification) are pre-wired to `goToStep`; each\n * submit-shaped prop awaits your handler and applies the returned\n * {@link AuthFlowDirective}.\n *\n * The blocks themselves stay untouched: passwords, codes and field drafts\n * live in their local state, and a rejected handler renders as the block's\n * own error — the orchestrator never mirrors transients into the store.\n * Needs `ExegiaProvider` above it, like every stateful block.\n *\n * ```tsx\n * <AuthFlowBlock\n * onLogin={async ({ email, password }) => {\n * const outcome = await api.signIn(email, password)\n * return outcome.mfa ? { verify: { identifier: email } } : { user: outcome.user }\n * }}\n * onVerifyCode={async (code) => ({ user: await api.verify(code) })}\n * />\n * ```\n */\nexport function AuthFlowBlock({\n flowId,\n logo,\n accent,\n providers,\n onLogin,\n onSignup,\n onProviderSelect,\n onRequestReset,\n onVerifyCode,\n onResendCode,\n onUpdatePassword,\n onOnboardingComplete,\n onboardingSteps,\n steps,\n renderStep,\n success,\n successTitle = \"Welcome\",\n successDescription,\n className,\n}: AuthFlowBlockProps): React.ReactElement {\n const flow = useAuthFlow(flowId)\n const { goToStep, beginVerification, complete } = useAuthFlowActions(flowId)\n\n const apply = React.useCallback(\n (directive: AuthFlowDirective) => {\n if (!directive) return\n if (\"user\" in directive) complete(directive.user)\n else if (\"verify\" in directive) beginVerification(directive.verify)\n else goToStep(directive.step)\n },\n [complete, beginVerification, goToStep]\n )\n\n /** Wrap a handler so its directive lands in the store. Errors propagate —\n * the block owns the error rendering. Absent handlers stay absent, so a\n * block keeps its \"no handler\" affordances (hidden buttons etc.). */\n function run<Data>(handler: AuthFlowHandler<Data> | undefined) {\n if (!handler) return undefined\n return async (data: Data) => {\n apply(await handler(data))\n }\n }\n\n const content = ((): React.ReactNode => {\n const custom = renderStep?.(flow.step, flow)\n if (custom !== undefined) return custom\n\n switch (flow.step) {\n case \"login\":\n return (\n <LoginBlock\n logo={logo}\n accent={accent}\n providers={providers}\n onSubmit={run(onLogin)}\n onProviderSelect={run(onProviderSelect)}\n onForgotPassword={() => goToStep(\"forgot-password\")}\n onSignup={() => goToStep(\"signup\")}\n {...steps?.login}\n />\n )\n case \"signup\":\n return (\n <SignupBlock\n logo={logo}\n accent={accent}\n providers={providers}\n onSubmit={run(onSignup)}\n onProviderSelect={run(onProviderSelect)}\n onLogin={() => goToStep(\"login\")}\n {...steps?.signup}\n />\n )\n case \"verify-code\":\n return (\n <CodeAuthBlock\n logo={logo}\n accent={accent}\n channel={flow.channel}\n destination={flow.maskedIdentifier ?? undefined}\n onVerify={run(onVerifyCode)}\n onResend={run(onResendCode)}\n onBack={() => goToStep(\"login\")}\n {...steps?.[\"verify-code\"]}\n />\n )\n case \"forgot-password\":\n return (\n <ForgotPasswordBlock\n logo={logo}\n accent={accent}\n onSubmit={run(onRequestReset)}\n onBackToLogin={() => goToStep(\"login\")}\n {...steps?.[\"forgot-password\"]}\n />\n )\n case \"update-password\":\n return (\n <UpdatePasswordBlock\n logo={logo}\n accent={accent}\n onSubmit={run(onUpdatePassword)}\n onDone={() => goToStep(\"login\")}\n {...steps?.[\"update-password\"]}\n />\n )\n case \"onboarding\":\n return (\n <OnboardingBlock\n logo={logo}\n accent={accent}\n steps={onboardingSteps}\n onComplete={run(onOnboardingComplete)}\n // The flow's success step is the completion screen — showing the\n // block's own too would stack two checkmarks.\n showCompleteScreen={false}\n {...steps?.onboarding}\n />\n )\n case \"success\":\n return (\n success ?? (\n // Header names the moment, the check screen names the outcome —\n // the same split the onboarding block's completion screen uses.\n <AuthCard title={successTitle} logo={logo} accent={accent}>\n <AuthSuccess\n title=\"You're signed in\"\n description={successDescription}\n />\n </AuthCard>\n )\n )\n }\n })()\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <div\n className={cn(\"flex w-full justify-center\", className)}\n data-slot=\"auth-flow\"\n data-step={flow.step}\n >\n <MorphStep step={flow.step} className=\"flex w-full justify-center\">\n {content}\n </MorphStep>\n </div>\n </MotionConfig>\n )\n}\n","\"use client\"\n\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport {\n SOCIAL_PROVIDERS,\n type SocialProvider,\n} from \"@/components/composed/social-providers\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthError, EASE } from \"./auth-shell\"\n\n/** One sign-in identity attached to the account. */\nexport interface LinkedIdentity {\n id: string\n provider: SocialProvider\n /** Account address shown under the provider name, when known. */\n email?: string | null\n}\n\nexport interface LinkedAccountsBlockProps {\n title?: string\n description?: string\n /** Identities already attached to the account. */\n identities?: LinkedIdentity[]\n /** Providers offered as connect candidates; connected ones are filtered out. */\n providers?: SocialProvider[]\n /** Shows the loading row instead of the list. */\n loading?: boolean\n /**\n * The account can also sign in through a method that has no row in this\n * list — an email/password credential, say. Lifts the last-method guard,\n * which otherwise refuses to disconnect the final listed identity.\n */\n hasOtherSignInMethods?: boolean\n /** Reject (or throw) to show the inline error. */\n onLink?: (provider: SocialProvider) => Promise<void> | void\n onUnlink?: (id: string) => Promise<void> | void\n className?: string\n}\n\nconst LAST_METHOD_EXPLANATION =\n \"This is your only way to sign in, so it can't be disconnected.\"\n\n/**\n * Settings panel for the sign-in identities attached to an account: lists the\n * connected ones, offers connect buttons for the rest, and guards the last\n * remaining method from being disconnected — the guard is a disabled button\n * plus an explanation rather than an error after the fact.\n */\nexport function LinkedAccountsBlock({\n title = \"Connected accounts\",\n description = \"Manage the accounts you can use to sign in.\",\n identities = [],\n providers = [\"google\", \"apple\", \"github\"],\n loading = false,\n hasOtherSignInMethods = false,\n onLink,\n onUnlink,\n className,\n}: LinkedAccountsBlockProps) {\n const noteId = React.useId()\n const [error, setError] = React.useState<string | null>(null)\n const [linking, setLinking] = React.useState<SocialProvider | null>(null)\n const [unlinking, setUnlinking] = React.useState<string | null>(null)\n\n const connected = new Set(identities.map((identity) => identity.provider))\n const connectable = providers.filter((provider) => !connected.has(provider))\n const busy = linking !== null || unlinking !== null\n // The backend rule, enforced here so we never fire a request that would\n // remove the account's only way in. An off-list method (a password) keeps\n // the account reachable, so it lifts the guard.\n const lastMethod = !hasOtherSignInMethods && identities.length <= 1\n\n async function connect(provider: SocialProvider) {\n if (busy) return\n setError(null)\n setLinking(provider)\n try {\n await onLink?.(provider)\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to connect account.\"\n )\n } finally {\n setLinking(null)\n }\n }\n\n async function disconnect(id: string) {\n if (busy || lastMethod) return\n setError(null)\n setUnlinking(id)\n try {\n await onUnlink?.(id)\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to disconnect account.\"\n )\n } finally {\n setUnlinking(null)\n }\n }\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <Card className={cn(\"w-full\", className)} data-slot=\"auth-block\">\n <CardHeader>\n <CardTitle>{title}</CardTitle>\n <CardDescription>{description}</CardDescription>\n </CardHeader>\n <CardPanel>\n {loading ? (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner className=\"size-4\" />\n Loading connected accounts…\n </div>\n ) : (\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col gap-3\"\n >\n <AuthError message={error} />\n\n {identities.length > 0 ? (\n <ul\n aria-label=\"Connected accounts\"\n className=\"flex flex-col gap-2\"\n >\n <AnimatePresence initial={false}>\n {identities.map((identity, index) => {\n const { label, BrandIcon, brandClassName } =\n SOCIAL_PROVIDERS[identity.provider]\n return (\n <motion.li\n key={identity.id}\n layout\n className=\"flex items-center justify-between gap-3 rounded-lg border px-3 py-2\"\n initial={{ opacity: 0, y: -4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n // 40ms per row, capped so a long identity list never\n // leaves the last row arriving noticeably late.\n transition={{\n duration: 0.25,\n ease: EASE,\n delay: Math.min(index, 5) * 0.04,\n }}\n >\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <BrandIcon\n aria-hidden=\"true\"\n className={cn(\"size-4\", brandClassName)}\n />\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"text-sm font-medium\">\n {label}\n </span>\n {identity.email && (\n <span className=\"truncate text-xs text-muted-foreground\">\n {identity.email}\n </span>\n )}\n </div>\n </div>\n <Button\n aria-describedby={lastMethod ? noteId : undefined}\n aria-label={`Disconnect ${label}`}\n size=\"sm\"\n type=\"button\"\n variant=\"destructive-outline\"\n disabled={busy || lastMethod}\n loading={unlinking === identity.id}\n onClick={() => void disconnect(identity.id)}\n >\n Disconnect\n </Button>\n </motion.li>\n )\n })}\n </AnimatePresence>\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n No sign-in methods connected yet.\n </p>\n )}\n\n {lastMethod && identities.length > 0 && (\n <p className=\"text-xs text-muted-foreground\" id={noteId}>\n {LAST_METHOD_EXPLANATION}\n </p>\n )}\n\n {connectable.map((provider) => {\n const { label, BrandIcon, brandClassName } =\n SOCIAL_PROVIDERS[provider]\n return (\n <Button\n key={provider}\n className=\"w-full\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n loading={linking === provider}\n onClick={() => void connect(provider)}\n >\n <BrandIcon aria-hidden=\"true\" className={brandClassName} />\n <span className=\"flex-1\">Connect {label}</span>\n </Button>\n )\n })}\n </motion.div>\n )}\n </CardPanel>\n </Card>\n </MotionConfig>\n )\n}\n","\"use client\"\n\nimport { KeyRoundIcon } from \"lucide-react\"\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Field, FieldError, FieldLabel } from \"@/components/ui/field\"\nimport { Input } from \"@/components/ui/input\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthError, EASE, Reveal } from \"./auth-shell\"\n\n/** One registered passkey, as rendered by {@link PasskeyManagerBlock}. */\nexport interface PasskeyRecord {\n id: string\n /** Server-derived name; falls back to \"Passkey\" when absent. */\n name?: string | null\n /** ISO timestamps. Unparseable values are simply not shown. */\n createdAt?: string | null\n lastUsedAt?: string | null\n}\n\nexport interface PasskeyManagerBlockProps {\n title?: string\n description?: string\n /** The account's passkeys, newest first. */\n passkeys?: PasskeyRecord[]\n /** Whether this device can register passkeys at all. */\n available?: boolean\n /** Shows the loading row instead of the list. */\n loading?: boolean\n /**\n * Reject (or throw) to show the error. Resolving with `{ cancelled: true }`\n * returns silently to idle — a dismissed OS prompt is not a failure.\n */\n onRegister?: () => Promise<{ cancelled?: boolean } | void> | void\n onRename?: (id: string, name: string) => Promise<void> | void\n onDelete?: (id: string) => Promise<void> | void\n className?: string\n}\n\nconst NAME_MAX = 120\n\nconst LAST_PASSKEY_WARNING =\n \"This is your last passkey. After deleting it you won't be able to sign in with a passkey until you register a new one.\"\n\nfunction formatDate(iso: string | null | undefined): string | null {\n if (!iso) return null\n const date = new Date(iso)\n return Number.isNaN(date.getTime()) ? null : date.toLocaleDateString()\n}\n\n/**\n * Settings panel for the passkeys on an account: register, inline rename with\n * field-level validation, and delete behind an explicit confirmation. Deleting\n * the last passkey is allowed — it is the account's passkey method that goes\n * away, not its only way in — so the confirmation carries a warning instead of\n * a block.\n */\nexport function PasskeyManagerBlock({\n title = \"Passkeys\",\n description = \"Sign in without a password using your device's biometrics or security key.\",\n passkeys = [],\n available = true,\n loading = false,\n onRegister,\n onRename,\n onDelete,\n className,\n}: PasskeyManagerBlockProps) {\n const [error, setError] = React.useState<string | null>(null)\n const [busy, setBusy] = React.useState(false)\n const [registering, setRegistering] = React.useState(false)\n const [renamingId, setRenamingId] = React.useState<string | null>(null)\n const [renameValue, setRenameValue] = React.useState(\"\")\n const [renameError, setRenameError] = React.useState<string | null>(null)\n const [confirmingId, setConfirmingId] = React.useState<string | null>(null)\n\n const lastPasskey = passkeys.length === 1\n\n async function run(action: () => Promise<unknown> | unknown) {\n if (busy) return { ok: false } as const\n setError(null)\n setBusy(true)\n try {\n const result = await action()\n return { ok: true, result } as const\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : \"Something went wrong.\")\n return { ok: false } as const\n } finally {\n setBusy(false)\n }\n }\n\n async function handleRegister() {\n setRegistering(true)\n await run(() => onRegister?.())\n setRegistering(false)\n }\n\n function startRename(passkey: PasskeyRecord) {\n setConfirmingId(null)\n setRenamingId(passkey.id)\n setRenameValue(passkey.name ?? \"\")\n setRenameError(null)\n }\n\n async function submitRename(id: string) {\n const name = renameValue.trim()\n if (name.length < 1 || name.length > NAME_MAX) {\n setRenameError(`Name must be between 1 and ${NAME_MAX} characters.`)\n return\n }\n const outcome = await run(() => onRename?.(id, name))\n if (!outcome.ok) return\n setRenamingId(null)\n setRenameError(null)\n }\n\n async function confirmDelete(id: string) {\n const outcome = await run(() => onDelete?.(id))\n setConfirmingId(null)\n if (!outcome.ok) return\n if (renamingId === id) setRenamingId(null)\n }\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <Card className={cn(\"w-full\", className)} data-slot=\"auth-block\">\n <CardHeader>\n <CardTitle>{title}</CardTitle>\n <CardDescription>{description}</CardDescription>\n </CardHeader>\n <CardPanel>\n {!available ? (\n <p className=\"text-sm text-muted-foreground\">\n Passkeys aren&apos;t available on this device. You can manage them\n from a device that supports passkeys.\n </p>\n ) : loading ? (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner className=\"size-4\" />\n Loading passkeys…\n </div>\n ) : (\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col gap-3\"\n >\n <AuthError message={error} />\n\n {passkeys.length > 0 ? (\n <ul aria-label=\"Passkeys\" className=\"flex flex-col gap-2\">\n <AnimatePresence initial={false}>\n {passkeys.map((passkey, index) => {\n const name = passkey.name ?? \"Passkey\"\n const created = formatDate(passkey.createdAt)\n const lastUsed = formatDate(passkey.lastUsedAt)\n return (\n <motion.li\n key={passkey.id}\n layout\n className=\"flex flex-col gap-2 rounded-lg border px-3 py-2\"\n initial={{ opacity: 0, y: -4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n // 40ms per row, capped so a long list never leaves\n // the last row arriving noticeably late.\n transition={{\n duration: 0.25,\n ease: EASE,\n delay: Math.min(index, 5) * 0.04,\n }}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <span\n aria-hidden=\"true\"\n className=\"grid size-8 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground\"\n >\n <KeyRoundIcon className=\"size-4\" />\n </span>\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"truncate text-sm font-medium\">\n {name}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {created ? `Added ${created}` : null}\n {created && lastUsed ? \" · \" : null}\n {lastUsed ? `Last used ${lastUsed}` : null}\n </span>\n </div>\n </div>\n <div className=\"flex shrink-0 gap-2\">\n <Button\n aria-label={`Rename ${name}`}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n onClick={() => startRename(passkey)}\n >\n Rename\n </Button>\n <Button\n aria-label={`Delete ${name}`}\n size=\"sm\"\n type=\"button\"\n variant=\"destructive-outline\"\n disabled={busy}\n onClick={() => {\n setRenamingId(null)\n setConfirmingId(passkey.id)\n }}\n >\n Delete\n </Button>\n </div>\n </div>\n\n <Reveal show={renamingId === passkey.id}>\n <form\n className=\"flex items-start gap-2 pt-1\"\n onSubmit={(event) => {\n event.preventDefault()\n void submitRename(passkey.id)\n }}\n >\n <Field\n className=\"min-w-0 grow\"\n invalid={Boolean(renameError)}\n >\n <FieldLabel className=\"sr-only\">\n Passkey name\n </FieldLabel>\n <Input\n aria-label=\"Passkey name\"\n aria-invalid={renameError ? true : undefined}\n autoFocus\n disabled={busy}\n maxLength={NAME_MAX + 1}\n value={renameValue}\n onChange={(event) =>\n setRenameValue(event.target.value)\n }\n />\n {renameError && (\n <FieldError match>{renameError}</FieldError>\n )}\n </Field>\n <Button size=\"sm\" type=\"submit\" loading={busy}>\n Save\n </Button>\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setRenamingId(null)}\n >\n Cancel\n </Button>\n </form>\n </Reveal>\n\n <Reveal show={confirmingId === passkey.id}>\n <div\n className=\"flex flex-col gap-2 rounded-lg bg-muted/50 p-2\"\n role=\"alertdialog\"\n aria-label={`Confirm deleting ${name}`}\n >\n <p className=\"text-sm\">\n Delete this passkey? It can no longer be used to\n sign in.\n </p>\n {lastPasskey && (\n <p className=\"text-xs text-destructive-foreground\">\n {LAST_PASSKEY_WARNING}\n </p>\n )}\n <div className=\"flex gap-2\">\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"destructive\"\n loading={busy}\n onClick={() => void confirmDelete(passkey.id)}\n >\n Delete passkey\n </Button>\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setConfirmingId(null)}\n >\n Keep it\n </Button>\n </div>\n </div>\n </Reveal>\n </motion.li>\n )\n })}\n </AnimatePresence>\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n No passkeys registered yet. Add one to sign in without a\n password.\n </p>\n )}\n\n <Button\n className=\"w-full\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n loading={registering}\n onClick={() => void handleRegister()}\n >\n Add a passkey\n </Button>\n </motion.div>\n )}\n </CardPanel>\n </Card>\n </MotionConfig>\n )\n}\n","\"use client\";\n\nimport { FingerprintIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { AuthError, Reveal } from \"./auth-shell\";\n\nexport interface PasskeySignInBlockProps {\n /**\n * Whether this device can use passkeys. `false` renders nothing at all —\n * a passkey button that is guaranteed to fail is worse than no button.\n */\n available?: boolean;\n /** Button label. */\n label?: string;\n /**\n * Reject (or throw) to show the inline error. Resolving with\n * `{ cancelled: true }` returns silently to idle — a dismissed OS prompt is\n * not a failure and must not surface an error.\n */\n onSignIn?: () => Promise<{ cancelled?: boolean } | void> | void;\n /** Hint shown under an error, pointing at the remaining sign-in methods. */\n fallbackHint?: React.ReactNode;\n className?: string;\n}\n\n/**\n * Passkey sign-in entry point — a single button plus its error state, sized\n * to drop into a login card next to the password form rather than to stand on\n * its own. Renders `null` while passkeys are unavailable.\n */\nexport function PasskeySignInBlock({\n available = true,\n label = \"Sign in with a passkey\",\n onSignIn,\n fallbackHint = \"You can still sign in with your other methods below.\",\n className,\n}: PasskeySignInBlockProps) {\n const [error, setError] = React.useState<string | null>(null);\n const [loading, setLoading] = React.useState(false);\n\n if (!available) return null;\n\n async function handleClick() {\n if (loading) return;\n setError(null);\n setLoading(true);\n try {\n await onSignIn?.();\n } catch (cause) {\n setError(\n cause instanceof Error\n ? cause.message\n : \"Unable to sign in with a passkey.\",\n );\n } finally {\n setLoading(false);\n }\n }\n\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <Button\n variant=\"outline\"\n className=\"w-full\"\n type=\"button\"\n loading={loading}\n onClick={() => void handleClick()}\n >\n <FingerprintIcon aria-hidden=\"true\" />\n <span className=\"flex-1\">{label}</span>\n </Button>\n <AuthError message={error} />\n <Reveal show={Boolean(error) && Boolean(fallbackHint)}>\n <p className=\"text-xs text-muted-foreground\">{fallbackHint}</p>\n </Reveal>\n </div>\n );\n}\n","import { EASE_OUT } from \"@/lib/ease.ts\"\nimport type { FlatResource, SidebarResource, SidebarResourceDropPosition, SidebarResourceMove } from \"./type.ts\"\n\nexport const ROW_REVEAL = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const\n\nexport function canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\"\n}\n\nexport function flattenResources(\n items: SidebarResource[],\n expanded: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId }\n if (!item.children?.length || !expanded.has(item.id)) return [row]\n return [\n row,\n ...flattenResources(item.children, expanded, depth + 1, item.id),\n ]\n })\n}\n\nexport function findResource(\n items: SidebarResource[],\n id: string\n): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item\n const child = item.children ? findResource(item.children, id) : undefined\n if (child) return child\n }\n}\n\n\n/** Ids of every ancestor of `id` (nearest last); empty when absent. */\nexport function ancestorIdsOf(\n items: SidebarResource[],\n id: string\n): string[] {\n const walk = (nodes: SidebarResource[], trail: string[]): string[] | null => {\n for (const node of nodes) {\n if (node.id === id) return trail\n if (node.children) {\n const found = walk(node.children, [...trail, node.id])\n if (found) return found\n }\n }\n return null\n }\n return walk(items, []) ?? []\n}\n\n/** Ids of every row that can hold children and has some — the set\n * `expandAll` opens. */\nexport function expandableIdsOf(items: SidebarResource[]): string[] {\n return items.flatMap((item) =>\n item.children?.length && canContain(item)\n ? [item.id, ...expandableIdsOf(item.children)]\n : []\n )\n}\n\nexport function containsResource(item: SidebarResource, id: string): boolean {\n return (\n item.id === id ||\n item.children?.some((child) => containsResource(child, id)) === true\n );\n}\n\nexport function removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nexport function insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nexport function moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (\n move.position === \"inside\" &&\n (!target || target.disabled || !canContain(target))\n )\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(\n removed.items,\n removed.removed,\n move.targetId,\n move.position,\n );\n}\n\nexport function renameResource(\n items: SidebarResource[],\n id: string,\n label: string,\n): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children\n ? renameResource(item.children, id, label)\n : undefined,\n }));\n}\n","/**\n * Per-instance Jotai state for the AI sidebar.\n *\n * Every atom is a module-level family keyed by a sidebar id, so one\n * `ExegiaProvider` at the app root is enough: many sidebars coexist in one\n * store without a provider each, and any component can drive a sidebar by id\n * without holding its controller.\n *\n * Controlled props stay authoritative. `useAISidebar` projects them into\n * these atoms on every commit so the action atoms and remote readers work off\n * current data — a one-way projection, not a second source of truth. The\n * write gates below (`controlsItems`, `controlsActiveId`,\n * `controlsExpandedIds`) are what keep the store from overwriting a prop.\n *\n * DOM nodes are deliberately absent: the roving-focus ref map belongs to the\n * block that renders the rows, not to the store.\n */\nimport { atom } from \"jotai\";\nimport type { Atom, Getter, Setter } from \"jotai\";\n\nimport type {\n AISidebarConfig,\n AISidebarHandlers,\n AISidebarInstanceId,\n AISidebarSeed,\n AISidebarState,\n DropTarget,\n FlatResource,\n SidebarResource,\n SidebarResourceDropPosition,\n SidebarResourceMove,\n} from \"./type.ts\";\nimport {\n ancestorIdsOf,\n expandableIdsOf,\n findResource,\n flattenResources,\n moveResource,\n renameResource,\n} from \"./utils.ts\";\n\nconst NO_ITEMS: SidebarResource[] = [];\nconst NO_ROWS: FlatResource[] = [];\nconst NO_IDS: ReadonlySet<string> = new Set<string>();\nconst NO_HANDLERS: AISidebarHandlers = {};\n\n/** What a sidebar reads as before `useAISidebar` publishes its options. */\nexport const DEFAULT_AI_SIDEBAR_CONFIG: AISidebarConfig = {\n controlsItems: false,\n controlsActiveId: false,\n controlsExpandedIds: false,\n};\n\nconst DEFAULT_AI_SIDEBAR_SEED: AISidebarSeed = {\n items: NO_ITEMS,\n activeId: null,\n focusedId: null,\n expandedIds: [],\n};\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: AISidebarInstanceId) => AtomType) & {\n remove: (id: AISidebarInstanceId) => void;\n};\n\n/** Every family, so `removeAISidebarInstance` can drop an id from all. */\nconst families: { remove: (id: AISidebarInstanceId) => void }[] = [];\n\nfunction keyed<AtomType>(create: (id: AISidebarInstanceId) => AtomType) {\n const cache = new Map<AISidebarInstanceId, AtomType>();\n const family = ((id: AISidebarInstanceId) => {\n let instance = cache.get(id);\n if (instance === undefined) {\n instance = create(id);\n cache.set(id, instance);\n }\n return instance;\n }) as Family<AtomType>;\n family.remove = (id: AISidebarInstanceId) => {\n cache.delete(id);\n };\n families.push(family);\n return family;\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue);\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: AISidebarInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id));\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\nfunction actionFamily<Args extends unknown[], Result = void>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n ...args: Args\n ) => Result\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n );\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\n/**\n * A per-row derived atom, keyed by sidebar and then row id.\n *\n * This is where Jotai earns its place: a row subscribed to\n * `aiSidebarRowExpandedAtom(sidebarId, row.item.id)` re-renders when *its*\n * branch opens and stays put when a sibling's does. Reading the whole\n * controller through props instead re-rendered every row on every hover.\n *\n * The outer family registers for cleanup, so `removeAISidebarInstance` drops\n * all of a sidebar's row atoms with it.\n */\nfunction rowFamily<Value>(\n name: string,\n read: (get: Getter, id: AISidebarInstanceId, rowId: string) => Value\n) {\n const outer = keyed((id: AISidebarInstanceId) => {\n const inner = new Map<string, Atom<Value>>();\n return (rowId: string) => {\n let instance = inner.get(rowId);\n if (instance === undefined) {\n instance = atom((get) => read(get, id, rowId));\n instance.debugLabel = `ai-sidebar/${id}/${name}/${rowId}`;\n inner.set(rowId, instance);\n }\n return instance;\n };\n });\n return (id: AISidebarInstanceId, rowId: string) => outer(id)(rowId);\n}\n\n// ── state ──────────────────────────────────────────────────────────────────\n\n/** @internal */\nexport const aiSidebarConfigAtom = stateFamily<AISidebarConfig>(\n \"config\",\n DEFAULT_AI_SIDEBAR_CONFIG\n);\n/** @internal Refreshed every commit; nothing subscribes, so it is free. */\nexport const aiSidebarHandlersAtom = stateFamily<AISidebarHandlers>(\n \"handlers\",\n NO_HANDLERS\n);\nconst aiSidebarSeedAtom = stateFamily<AISidebarSeed>(\n \"seed\",\n DEFAULT_AI_SIDEBAR_SEED\n);\nconst aiSidebarInitializedAtom = stateFamily<boolean>(\"initialized\", false);\n\n/** The sidebar's current data — hook-owned, or the projection of a\n * controlled `items` prop. */\nexport const aiSidebarItemsAtom = stateFamily<SidebarResource[]>(\n \"items\",\n NO_ITEMS\n);\n/** @internal The hook-owned selection. `select` writes it only while no\n * `activeId` prop owns the selection — read `aiSidebarActiveIdAtom` for the\n * value the sidebar actually renders. */\nexport const aiSidebarOwnActiveIdAtom = stateFamily<string | null>(\n \"ownActiveId\",\n null\n);\n/** @internal Projection of a controlled `activeId` prop; `undefined` while\n * the selection is hook-owned. */\nexport const aiSidebarControlledActiveIdAtom = stateFamily<\n string | null | undefined\n>(\"controlledActiveId\", undefined);\n/** Open rows — hook-owned, or the projection of a controlled `expandedIds`\n * prop. */\nexport const aiSidebarExpandedIdsAtom = stateFamily<ReadonlySet<string>>(\n \"expandedIds\",\n NO_IDS\n);\n/** Roving-focus target. DOM focus is moved by the block, which owns the row\n * refs; this is only which row is tabbable. */\nexport const aiSidebarFocusedIdAtom = stateFamily<string | null>(\n \"focusedId\",\n null\n);\nexport const aiSidebarDraggingIdAtom = stateFamily<string | null>(\n \"draggingId\",\n null\n);\nexport const aiSidebarDropTargetAtom = stateFamily<DropTarget | null>(\n \"dropTarget\",\n null\n);\nexport const aiSidebarMenuOpenIdAtom = stateFamily<string | null>(\n \"menuOpenId\",\n null\n);\nexport const aiSidebarRenamingIdAtom = stateFamily<string | null>(\n \"renamingId\",\n null\n);\nexport const aiSidebarHoveredIdAtom = stateFamily<string | null>(\n \"hoveredId\",\n null\n);\n/** Live-region text for the last move or rename outcome. */\nexport const aiSidebarAnnouncementAtom = stateFamily<string>(\n \"announcement\",\n \"\"\n);\n/** A move is in flight. Read synchronously by `moveAISidebarRowAtom` before\n * it starts another — the store needs no ref to see its own latest write. */\nexport const aiSidebarMovePendingAtom = stateFamily<boolean>(\n \"movePending\",\n false\n);\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** @internal The only items atom `useAISidebar` may subscribe to: empty\n * while a controlled `items` prop owns the data, so the projection write\n * never feeds back into the render that produced it. An inline `items={[…]}`\n * array is a new reference every render, and a subscribed round-trip would\n * loop. */\nexport const aiSidebarOwnedItemsAtom = readFamily(\"ownedItems\", (get, id) =>\n get(aiSidebarConfigAtom(id)).controlsItems\n ? NO_ITEMS\n : get(aiSidebarItemsAtom(id))\n);\n\n/** @internal The same guard for `expandedIds`, which is controllable here\n * and arrives as an array — just as unstable an identity as `items`. */\nexport const aiSidebarOwnedExpandedIdsAtom = readFamily(\n \"ownedExpandedIds\",\n (get, id) =>\n get(aiSidebarConfigAtom(id)).controlsExpandedIds\n ? NO_IDS\n : get(aiSidebarExpandedIdsAtom(id))\n);\n\n/** The selected row: the controlled `activeId` when there is one, the\n * hook-owned selection otherwise. Kept as two atoms because a controlled\n * `activeId` of `null` falls through to the hook-owned value — the block has\n * always read `activeId ?? internalActiveId`. */\nexport const aiSidebarActiveIdAtom = readFamily(\n \"activeId\",\n (get, id) =>\n get(aiSidebarControlledActiveIdAtom(id)) ??\n get(aiSidebarOwnActiveIdAtom(id))\n);\n\n/** Visible rows in order, each with its depth and parent id. */\nexport const aiSidebarFlatAtom = readFamily(\"flat\", (get, id) => {\n const items = get(aiSidebarItemsAtom(id));\n if (items.length === 0) return NO_ROWS;\n return flattenResources(items, get(aiSidebarExpandedIdsAtom(id)));\n});\n\n/** Some row is hovered and no drag is running — mounts the pill wrapper. */\nexport const aiSidebarHoverActiveAtom = readFamily(\n \"hoverActive\",\n (get, id) =>\n get(aiSidebarHoveredIdAtom(id)) !== null &&\n get(aiSidebarDraggingIdAtom(id)) === null\n);\n\n/** Whether this one row is the current selection. */\nexport const aiSidebarRowSelectedAtom = rowFamily(\n \"rowSelected\",\n (get, id, rowId) => get(aiSidebarActiveIdAtom(id)) === rowId\n);\n\n/** Whether this one row is open. */\nexport const aiSidebarRowExpandedAtom = rowFamily(\n \"rowExpanded\",\n (get, id, rowId) => get(aiSidebarExpandedIdsAtom(id)).has(rowId)\n);\n\n/** Whether this one row is the roving-focus target. */\nexport const aiSidebarRowFocusedAtom = rowFamily(\n \"rowFocused\",\n (get, id, rowId) => get(aiSidebarFocusedIdAtom(id)) === rowId\n);\n\n/** Whether this one row is in rename mode. */\nexport const aiSidebarRowRenamingAtom = rowFamily(\n \"rowRenaming\",\n (get, id, rowId) => get(aiSidebarRenamingIdAtom(id)) === rowId\n);\n\n/** Whether this one row's action menu is open. */\nexport const aiSidebarRowMenuOpenAtom = rowFamily(\n \"rowMenuOpen\",\n (get, id, rowId) => get(aiSidebarMenuOpenIdAtom(id)) === rowId\n);\n\n/** Whether this one row is the row in flight. */\nexport const aiSidebarRowDraggingAtom = rowFamily(\n \"rowDragging\",\n (get, id, rowId) => get(aiSidebarDraggingIdAtom(id)) === rowId\n);\n\n/** Where a drop on this one row would land, `null` when it is not hovered\n * by a drag. */\nexport const aiSidebarRowDropAtom =\n rowFamily<SidebarResourceDropPosition | null>(\"rowDrop\", (get, id, rowId) => {\n const target = get(aiSidebarDropTargetAtom(id));\n return target?.id === rowId ? target.position : null;\n });\n\n/** Whether this one row owns the sliding hover pill. */\nexport const aiSidebarRowHoveredAtom = rowFamily(\n \"rowHovered\",\n (get, id, rowId) =>\n get(aiSidebarHoveredIdAtom(id)) === rowId &&\n get(aiSidebarDraggingIdAtom(id)) === null\n);\n\n/** The whole state of one sidebar. Components reading a single field should\n * subscribe to that field's atom instead — this one changes on every edit. */\nexport const aiSidebarStateAtom = readFamily<AISidebarState>(\n \"state\",\n (get, id) => ({\n items: get(aiSidebarItemsAtom(id)),\n flat: get(aiSidebarFlatAtom(id)),\n selectedId: get(aiSidebarActiveIdAtom(id)),\n expandedIds: get(aiSidebarExpandedIdsAtom(id)),\n focusedId: get(aiSidebarFocusedIdAtom(id)),\n renamingId: get(aiSidebarRenamingIdAtom(id)),\n menuOpenId: get(aiSidebarMenuOpenIdAtom(id)),\n draggingId: get(aiSidebarDraggingIdAtom(id)),\n dropTarget: get(aiSidebarDropTargetAtom(id)),\n hoveredId: get(aiSidebarHoveredIdAtom(id)),\n movePending: get(aiSidebarMovePendingAtom(id)),\n announcement: get(aiSidebarAnnouncementAtom(id)),\n })\n);\n\n// ── shared write helpers ───────────────────────────────────────────────────\n\n/** The atom only when the hook owns the data; the callback always. */\nfunction commitItems(\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n next: SidebarResource[]\n): void {\n if (!get(aiSidebarConfigAtom(id)).controlsItems)\n set(aiSidebarItemsAtom(id), next);\n get(aiSidebarHandlersAtom(id)).onItemsChange?.(next);\n}\n\nfunction commitExpanded(\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n next: Set<string>\n): void {\n if (!get(aiSidebarConfigAtom(id)).controlsExpandedIds)\n set(aiSidebarExpandedIdsAtom(id), next);\n get(aiSidebarHandlersAtom(id)).onExpandedChange?.([...next]);\n}\n\nfunction seedInstance(\n set: Setter,\n id: AISidebarInstanceId,\n seed: AISidebarSeed\n): void {\n set(aiSidebarItemsAtom(id), seed.items);\n set(aiSidebarOwnActiveIdAtom(id), seed.activeId);\n set(aiSidebarFocusedIdAtom(id), seed.focusedId);\n set(aiSidebarExpandedIdsAtom(id), new Set(seed.expandedIds));\n set(aiSidebarRenamingIdAtom(id), null);\n set(aiSidebarMenuOpenIdAtom(id), null);\n set(aiSidebarDraggingIdAtom(id), null);\n set(aiSidebarDropTargetAtom(id), null);\n set(aiSidebarHoveredIdAtom(id), null);\n set(aiSidebarAnnouncementAtom(id), \"\");\n set(aiSidebarMovePendingAtom(id), false);\n}\n\n// ── expansion ──────────────────────────────────────────────────────────────\n\nexport const expandAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"expand\",\n (get, set, id, rowId) => {\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (expanded.has(rowId)) return;\n commitExpanded(get, set, id, new Set(expanded).add(rowId));\n }\n);\n\nexport const collapseAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"collapse\",\n (get, set, id, rowId) => {\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (!expanded.has(rowId)) return;\n const next = new Set(expanded);\n next.delete(rowId);\n commitExpanded(get, set, id, next);\n }\n);\n\nexport const toggleAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"toggleExpanded\",\n (get, set, id, rowId) => {\n const next = new Set(get(aiSidebarExpandedIdsAtom(id)));\n if (next.has(rowId)) next.delete(rowId);\n else next.add(rowId);\n commitExpanded(get, set, id, next);\n }\n);\n\nexport const expandAllAISidebarRowsAtom = actionFamily<[]>(\n \"expandAll\",\n (get, set, id) => {\n commitExpanded(\n get,\n set,\n id,\n new Set(expandableIdsOf(get(aiSidebarItemsAtom(id))))\n );\n }\n);\n\nexport const collapseAllAISidebarRowsAtom = actionFamily<[]>(\n \"collapseAll\",\n (get, set, id) => {\n commitExpanded(get, set, id, new Set());\n }\n);\n\n/** Open every ancestor of `rowId` without touching the rest of the tree. */\nexport const revealAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"reveal\",\n (get, set, id, rowId) => {\n const ancestors = ancestorIdsOf(get(aiSidebarItemsAtom(id)), rowId);\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (!ancestors.some((ancestor) => !expanded.has(ancestor))) return;\n commitExpanded(get, set, id, new Set([...expanded, ...ancestors]));\n }\n);\n\n// ── selection and focus ────────────────────────────────────────────────────\n\nexport const selectAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"select\",\n (get, set, id, rowId) => {\n if (!get(aiSidebarConfigAtom(id)).controlsActiveId)\n set(aiSidebarOwnActiveIdAtom(id), rowId);\n get(aiSidebarHandlersAtom(id)).onActiveChange?.(rowId);\n }\n);\n\n/** The store half of `focus`: which row is tabbable. Moving DOM focus is the\n * block's job — it owns the row refs. */\nexport const focusAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"focus\",\n (_get, set, id, rowId) => {\n set(aiSidebarFocusedIdAtom(id), rowId);\n }\n);\n\n/** @internal Keeps the roving target on a row that still renders: a focused\n * row that folds away hands focus to the first visible row instead of\n * pointing at nothing. `useAISidebar` runs it after every projection. */\nexport const normalizeAISidebarFocusAtom = actionFamily<[]>(\n \"normalizeFocus\",\n (get, set, id) => {\n const flat = get(aiSidebarFlatAtom(id));\n const focusedId = get(aiSidebarFocusedIdAtom(id));\n if (focusedId !== null && flat.some((row) => row.item.id === focusedId))\n return;\n const first = flat[0]?.item.id ?? null;\n if (focusedId !== first) set(aiSidebarFocusedIdAtom(id), first);\n }\n);\n\n// ── rename ─────────────────────────────────────────────────────────────────\n\nexport const startAISidebarRenameAtom = actionFamily<[rowId: string]>(\n \"startRename\",\n (get, set, id, rowId) => {\n // An id from elsewhere (a stale selection, another sidebar) would arm\n // rename mode against a row that never renders.\n if (!findResource(get(aiSidebarItemsAtom(id)), rowId)) return;\n set(aiSidebarRenamingIdAtom(id), rowId);\n }\n);\n\nexport const cancelAISidebarRenameAtom = actionFamily<[]>(\n \"cancelRename\",\n (_get, set, id) => {\n set(aiSidebarRenamingIdAtom(id), null);\n }\n);\n\n/** Commit a rename and leave rename mode. Applied optimistically and rolled\n * back if `onRename` rejects. Blank and unchanged labels are dropped. */\nexport const renameAISidebarRowAtom = actionFamily<\n [rowId: string, label: string]\n>(\"rename\", (get, set, id, rowId, label) => {\n const trimmed = label.trim();\n set(aiSidebarRenamingIdAtom(id), null);\n const before = get(aiSidebarItemsAtom(id));\n const item = findResource(before, rowId);\n if (!item || !trimmed || trimmed === item.label) return;\n commitItems(get, set, id, renameResource(before, rowId, trimmed));\n void Promise.resolve(\n get(aiSidebarHandlersAtom(id)).onRename?.(item, trimmed)\n ).catch(() => {\n commitItems(get, set, id, before);\n set(\n aiSidebarAnnouncementAtom(id),\n `Rename failed. ${item.label} was restored.`\n );\n });\n});\n\n// ── menu ───────────────────────────────────────────────────────────────────\n\nexport const openAISidebarMenuAtom = actionFamily<[rowId: string]>(\n \"openMenu\",\n (get, set, id, rowId) => {\n if (!findResource(get(aiSidebarItemsAtom(id)), rowId)) return;\n set(aiSidebarMenuOpenIdAtom(id), rowId);\n }\n);\n\n/** Closes the menu and hands the roving target back to the row that owned\n * it, then returns that id so the block can move DOM focus there — otherwise\n * focus falls back to the body and the keyboard user loses their place. */\nexport const closeAISidebarMenuAtom = actionFamily<[], string | null>(\n \"closeMenu\",\n (get, set, id) => {\n const current = get(aiSidebarMenuOpenIdAtom(id));\n set(aiSidebarMenuOpenIdAtom(id), null);\n if (current) set(aiSidebarFocusedIdAtom(id), current);\n return current;\n }\n);\n\n// ── data ───────────────────────────────────────────────────────────────────\n\n/**\n * Reorder, applied optimistically and rolled back if `onMove` rejects.\n *\n * The pending flag is read straight back out of the store, which is why this\n * needs no ref to guard overlapping moves the way React state did: the write\n * is visible to the next call immediately, not after a commit.\n */\nexport const moveAISidebarRowAtom = actionFamily<\n [move: SidebarResourceMove],\n Promise<void>\n>(\"move\", async (get, set, id, move) => {\n if (get(aiSidebarMovePendingAtom(id))) {\n set(aiSidebarAnnouncementAtom(id), \"Wait for the current move to finish.\");\n return;\n }\n const before = get(aiSidebarItemsAtom(id));\n const next = moveResource(before, move);\n if (!next || next === before) return;\n\n set(aiSidebarMovePendingAtom(id), true);\n commitItems(get, set, id, next);\n set(aiSidebarDropTargetAtom(id), null);\n set(aiSidebarDraggingIdAtom(id), null);\n const moved = findResource(before, move.itemId);\n const target = move.targetId ? findResource(before, move.targetId) : null;\n set(\n aiSidebarAnnouncementAtom(id),\n target\n ? `Moved ${moved?.label ?? \"item\"} ${move.position} ${target.label}.`\n : `Moved ${moved?.label ?? \"item\"} to the top level.`\n );\n\n try {\n await get(aiSidebarHandlersAtom(id)).onMove?.(move);\n } catch (error) {\n commitItems(get, set, id, before);\n set(\n aiSidebarAnnouncementAtom(id),\n `Move failed. ${moved?.label ?? \"Item\"} was restored.`\n );\n get(aiSidebarHandlersAtom(id)).onMoveError?.(error, move);\n } finally {\n set(aiSidebarMovePendingAtom(id), false);\n }\n});\n\n/** Replace the data. Reports through `onItemsChange`; writes the atom only\n * when no controlled `items` prop owns it. */\nexport const setAISidebarItemsAtom = actionFamily<[items: SidebarResource[]]>(\n \"setItems\",\n (get, set, id, items) => {\n commitItems(get, set, id, items);\n }\n);\n\n// ── hover and drag state ───────────────────────────────────────────────────\n\nexport const setAISidebarHoveredAtom = actionFamily<\n [rowId: string, hovered: boolean]\n>(\"setHovered\", (get, set, id, rowId, hovered) => {\n const current = get(aiSidebarHoveredIdAtom(id));\n const next = hovered ? rowId : current === rowId ? null : current;\n if (next !== current) set(aiSidebarHoveredIdAtom(id), next);\n});\n\nexport const clearAISidebarHoverAtom = actionFamily<[]>(\n \"clearHover\",\n (_get, set, id) => {\n set(aiSidebarHoveredIdAtom(id), null);\n }\n);\n\nexport const endAISidebarDragAtom = actionFamily<[]>(\n \"endDrag\",\n (_get, set, id) => {\n set(aiSidebarDraggingIdAtom(id), null);\n set(aiSidebarDropTargetAtom(id), null);\n }\n);\n\n// ── lifecycle ──────────────────────────────────────────────────────────────\n\n/** @internal Publish the latest options; seed the instance once. */\nexport const mountAISidebarAtom = actionFamily<\n [config: AISidebarConfig, seed: AISidebarSeed]\n>(\"mount\", (get, set, id, config, seed) => {\n set(aiSidebarConfigAtom(id), config);\n if (get(aiSidebarInitializedAtom(id))) return;\n set(aiSidebarInitializedAtom(id), true);\n set(aiSidebarSeedAtom(id), seed);\n seedInstance(set, id, seed);\n});\n\n/** @internal */\nexport const setAISidebarHandlersAtom = actionFamily<\n [handlers: AISidebarHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(aiSidebarHandlersAtom(id), handlers);\n});\n\n/** @internal One-way projections of controlled props — no callbacks fire. */\nexport const projectAISidebarItemsAtom = actionFamily<\n [items: SidebarResource[]]\n>(\"projectItems\", (_get, set, id, items) => {\n set(aiSidebarItemsAtom(id), items);\n});\n\n/** @internal */\nexport const projectAISidebarActiveIdAtom = actionFamily<\n [activeId: string | null]\n>(\"projectActiveId\", (_get, set, id, activeId) => {\n set(aiSidebarControlledActiveIdAtom(id), activeId);\n});\n\n/** @internal */\nexport const projectAISidebarExpandedIdsAtom = actionFamily<\n [expandedIds: string[]]\n>(\"projectExpandedIds\", (_get, set, id, expandedIds) => {\n set(aiSidebarExpandedIdsAtom(id), new Set(expandedIds));\n});\n\n/** Back to the values the instance mounted with. */\nexport const resetAISidebarAtom = actionFamily<[]>(\"reset\", (get, set, id) => {\n seedInstance(set, id, get(aiSidebarSeedAtom(id)));\n});\n\n/** Drop every atom for `id`. `useAISidebar` calls this on unmount for\n * sidebars it keyed itself; an explicit `sidebarId` outlives its component,\n * so an app-named sidebar keeps its open rows across a route change. */\nexport function removeAISidebarInstance(id: AISidebarInstanceId): void {\n for (const family of families) family.remove(id);\n}\n","\"use client\";\n\nimport {\n type DragEvent,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useAtomValue, useSetAtom, useStore } from \"jotai\";\n\nimport {\n aiSidebarAnnouncementAtom,\n aiSidebarDraggingIdAtom,\n aiSidebarDropTargetAtom,\n aiSidebarExpandedIdsAtom,\n aiSidebarFlatAtom,\n aiSidebarFocusedIdAtom,\n aiSidebarHoveredIdAtom,\n aiSidebarItemsAtom,\n aiSidebarMenuOpenIdAtom,\n aiSidebarMovePendingAtom,\n aiSidebarOwnActiveIdAtom,\n aiSidebarOwnedExpandedIdsAtom,\n aiSidebarOwnedItemsAtom,\n aiSidebarRenamingIdAtom,\n cancelAISidebarRenameAtom,\n clearAISidebarHoverAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n endAISidebarDragAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n mountAISidebarAtom,\n moveAISidebarRowAtom,\n normalizeAISidebarFocusAtom,\n openAISidebarMenuAtom,\n projectAISidebarActiveIdAtom,\n projectAISidebarExpandedIdsAtom,\n projectAISidebarItemsAtom,\n removeAISidebarInstance,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarHandlersAtom,\n setAISidebarHoveredAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\";\nimport type {\n AISidebarConfig,\n AISidebarController,\n AISidebarHandlers,\n AISidebarSeed,\n FlatResource,\n UseAISidebarOptions,\n} from \"./type.ts\";\nimport {\n canContain,\n containsResource,\n findResource,\n flattenResources,\n} from \"./utils.ts\";\n\nexport type { UseAISidebarOptions };\n\n/**\n * The AI sidebar's headless controller — every behaviour the block\n * performs, callable from outside it: select, expand/collapse (one row,\n * every row, or just the ancestors of one), move focus, rename, open a\n * row's action menu, reorder.\n *\n * `items`, `activeId` and `expandedIds` are each controlled when passed\n * and hook-owned via their `default*` twin otherwise. Reorder and rename\n * are applied to the data optimistically and rolled back if\n * `onMove`/`onRename` rejects, so a consumer never reduces the tree\n * itself — `moveResource` and `renameResource` are exported for the ones\n * who keep their data elsewhere.\n *\n * ```tsx\n * const sidebar = useAISidebar({ defaultItems: resources })\n * <AISidebar controller={sidebar} />\n * <Button onClick={sidebar.collapseAll}>Collapse all</Button>\n * ```\n *\n * State lives in Jotai atoms keyed by `sidebarId`, so anything under\n * `ExegiaProvider` can drive this sidebar without the controller — name it\n * and reach for `useAISidebarState(sidebarId)` /\n * `useAISidebarActions(sidebarId)` elsewhere.\n */\nexport function useAISidebar(\n options: UseAISidebarOptions\n): AISidebarController {\n const {\n items,\n defaultItems = [],\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n activeId,\n defaultActiveId = null,\n onActiveChange,\n onExpandedChange,\n } = options;\n\n // A generated key isolates unnamed sidebars from each other; an explicit\n // `sidebarId` is the app's handle on this one.\n const generatedId = useId();\n const sidebarId = options.sidebarId ?? generatedId;\n const store = useStore();\n const hoverLayoutId = useId();\n\n const controlledExpandedIds = options.expandedIds;\n const controlsItems = items !== undefined;\n const controlsActiveId = activeId !== undefined;\n const controlsExpandedIds = controlledExpandedIds !== undefined;\n\n // Primitives only, so this object is stable and the store write below runs\n // once per real change rather than once per render.\n const config = useMemo<AISidebarConfig>(\n () => ({ controlsItems, controlsActiveId, controlsExpandedIds }),\n [controlsActiveId, controlsExpandedIds, controlsItems]\n );\n\n const handlers = useMemo<AISidebarHandlers>(\n () => ({\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n onActiveChange,\n onExpandedChange,\n }),\n [\n onActiveChange,\n onExpandedChange,\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n ]\n );\n\n // Read once: the `default*` options describe the mount, not every render.\n const [seed] = useState<AISidebarSeed>(() => ({\n items: items ?? defaultItems,\n activeId: defaultActiveId,\n focusedId: activeId ?? defaultActiveId,\n expandedIds: [\n ...(controlledExpandedIds ?? options.defaultExpandedIds ?? []),\n ],\n }));\n\n const mount = useSetAtom(mountAISidebarAtom(sidebarId));\n const publishHandlers = useSetAtom(setAISidebarHandlersAtom(sidebarId));\n const projectItems = useSetAtom(projectAISidebarItemsAtom(sidebarId));\n const projectActiveId = useSetAtom(projectAISidebarActiveIdAtom(sidebarId));\n const projectExpandedIds = useSetAtom(\n projectAISidebarExpandedIdsAtom(sidebarId)\n );\n const normalizeFocus = useSetAtom(normalizeAISidebarFocusAtom(sidebarId));\n\n // Handlers first — they must be in the store before any action can fire.\n // Rewritten every commit; no read atom depends on them, so nobody\n // re-renders for it.\n useLayoutEffect(() => {\n publishHandlers(handlers);\n }, [handlers, publishHandlers]);\n\n // Before paint, so a seeded row never paints closed for a frame.\n useLayoutEffect(() => {\n mount(config, seed);\n }, [config, mount, seed]);\n\n // Controlled props stay the source of truth; the store carries a projection\n // so the action atoms and remote readers see current data.\n useLayoutEffect(() => {\n if (items !== undefined) projectItems(items);\n }, [items, projectItems]);\n\n useLayoutEffect(() => {\n if (activeId !== undefined) projectActiveId(activeId);\n }, [activeId, projectActiveId]);\n\n useLayoutEffect(() => {\n if (controlledExpandedIds !== undefined)\n projectExpandedIds(controlledExpandedIds);\n }, [controlledExpandedIds, projectExpandedIds]);\n\n // A sidebar the hook keyed is scrap once its component goes. An explicit\n // `sidebarId` is the app's key and outlives the mount.\n useEffect(() => {\n if (options.sidebarId !== undefined) return;\n return () => removeAISidebarInstance(sidebarId);\n }, [options.sidebarId, sidebarId]);\n\n // Never `aiSidebarItemsAtom` — see the note on `aiSidebarOwnedItemsAtom`.\n const ownedItems = useAtomValue(aiSidebarOwnedItemsAtom(sidebarId));\n const renderedItems = items ?? ownedItems;\n // `activeId ?? own` rather than the projected atom: a controlled `activeId`\n // of `null` has always fallen through to the hook-owned selection.\n const ownActiveId = useAtomValue(aiSidebarOwnActiveIdAtom(sidebarId));\n const selectedId = activeId ?? ownActiveId;\n const ownExpandedIds = useAtomValue(aiSidebarOwnedExpandedIdsAtom(sidebarId));\n const expandedIds = useMemo(\n () =>\n controlledExpandedIds ? new Set(controlledExpandedIds) : ownExpandedIds,\n [controlledExpandedIds, ownExpandedIds]\n );\n const focusedId = useAtomValue(aiSidebarFocusedIdAtom(sidebarId));\n const renamingId = useAtomValue(aiSidebarRenamingIdAtom(sidebarId));\n const menuOpenId = useAtomValue(aiSidebarMenuOpenIdAtom(sidebarId));\n const draggingId = useAtomValue(aiSidebarDraggingIdAtom(sidebarId));\n const dropTarget = useAtomValue(aiSidebarDropTargetAtom(sidebarId));\n const hoveredId = useAtomValue(aiSidebarHoveredIdAtom(sidebarId));\n const announcement = useAtomValue(aiSidebarAnnouncementAtom(sidebarId));\n const movePending = useAtomValue(aiSidebarMovePendingAtom(sidebarId));\n\n const flat = useMemo(\n () => flattenResources(renderedItems, expandedIds),\n [expandedIds, renderedItems]\n );\n\n // The roving target must name a row that still renders: one that folds away\n // hands focus to the first visible row instead of pointing at nothing. Last\n // of the layout effects, so it reads the projections this commit wrote.\n useLayoutEffect(() => {\n normalizeFocus();\n }, [flat, focusedId, normalizeFocus]);\n\n useEffect(() => {\n if (!menuOpenId) return;\n const frame = requestAnimationFrame(() => {\n const menus = Array.from(\n document.querySelectorAll<HTMLElement>(\"[data-sidebar-resource-menu]\")\n );\n menus\n .find((menu) => menu.dataset.sidebarResourceMenu === menuOpenId)\n ?.querySelector<HTMLElement>(\"button, a[href]\")\n ?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [menuOpenId]);\n\n const getItem = useCallback(\n (id: string) => findResource(renderedItems, id),\n [renderedItems]\n );\n\n const isExpanded = useCallback(\n (id: string) => expandedIds.has(id),\n [expandedIds]\n );\n\n // `useSetAtom` setters are already stable — no useCallback needed.\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId));\n const expand = useSetAtom(expandAISidebarRowAtom(sidebarId));\n const collapse = useSetAtom(collapseAISidebarRowAtom(sidebarId));\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId));\n const expandAll = useSetAtom(expandAllAISidebarRowsAtom(sidebarId));\n const collapseAll = useSetAtom(collapseAllAISidebarRowsAtom(sidebarId));\n const reveal = useSetAtom(revealAISidebarRowAtom(sidebarId));\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId));\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId));\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId));\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId));\n const closeMenuInStore = useSetAtom(closeAISidebarMenuAtom(sidebarId));\n const move = useSetAtom(moveAISidebarRowAtom(sidebarId));\n const reset = useSetAtom(resetAISidebarAtom(sidebarId));\n const setFocusedRow = useSetAtom(focusAISidebarRowAtom(sidebarId));\n const onRowHover = useSetAtom(setAISidebarHoveredAtom(sidebarId));\n const clearHover = useSetAtom(clearAISidebarHoverAtom(sidebarId));\n const onRowDragEnd = useSetAtom(endAISidebarDragAtom(sidebarId));\n const setDraggingId = useSetAtom(aiSidebarDraggingIdAtom(sidebarId));\n const setDropTarget = useSetAtom(aiSidebarDropTargetAtom(sidebarId));\n\n // The one piece of row state that cannot live in the store: these are DOM\n // nodes. The block owns them, and every DOM focus move goes through here.\n const rowRefs = useRef(new Map<string, HTMLDivElement>());\n\n const setRowRef = useCallback((id: string, node: HTMLDivElement | null) => {\n if (node) rowRefs.current.set(id, node);\n else rowRefs.current.delete(id);\n }, []);\n\n const focusRow = useCallback((id: string) => {\n requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const focus = useCallback(\n (id: string) => {\n setFocusedRow(id);\n focusRow(id);\n },\n [focusRow, setFocusedRow]\n );\n\n // Closing returns focus to the row that owned the menu — otherwise focus\n // falls back to the body and the keyboard user loses their place. The atom\n // hands back the id it closed so only the DOM half happens here.\n const closeMenu = useCallback(() => {\n const closed = closeMenuInStore();\n if (closed) focusRow(closed);\n }, [closeMenuInStore, focusRow]);\n\n // Roving nav reads the visible rows out of the store when a key lands\n // rather than closing over them, so one stable handler serves every row.\n const readFlat = useCallback(\n () => store.get(aiSidebarFlatAtom(sidebarId)),\n [sidebarId, store]\n );\n\n const onRowKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>, row: FlatResource) => {\n const flatRows = readFlat();\n const expanded = store.get(aiSidebarExpandedIdsAtom(sidebarId));\n const index = flatRows.findIndex(({ item }) => item.id === row.item.id);\n const previous = flatRows[index - 1];\n const next = flatRows[index + 1];\n const moveModifier = event.altKey && event.shiftKey;\n\n if (event.key === \"ArrowDown\" && !moveModifier && next) {\n event.preventDefault();\n focus(next.item.id);\n return;\n }\n if (event.key === \"ArrowUp\" && !moveModifier && previous) {\n event.preventDefault();\n focus(previous.item.id);\n return;\n }\n if (event.key === \"Home\" && flatRows[0]) {\n event.preventDefault();\n focus(flatRows[0].item.id);\n return;\n }\n if (event.key === \"End\" && flatRows.at(-1)) {\n event.preventDefault();\n focus(flatRows.at(-1)?.item.id ?? row.item.id);\n return;\n }\n\n if (row.item.disabled) {\n if (event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n focus(row.parentId);\n } else if (\n moveModifier ||\n [\"ArrowRight\", \"Enter\", \" \", \"F2\", \"ContextMenu\"].includes(\n event.key\n ) ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n }\n return;\n }\n\n if (moveModifier && event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"before\",\n });\n return;\n }\n if (moveModifier && event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: next.item.id,\n position: \"after\",\n });\n return;\n }\n if (\n moveModifier &&\n event.key === \"ArrowRight\" &&\n previous &&\n canContain(previous.item)\n ) {\n event.preventDefault();\n expand(previous.item.id);\n void move({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"inside\",\n });\n return;\n }\n if (moveModifier && event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: row.parentId,\n position: \"after\",\n });\n return;\n }\n\n if (event.key === \"ArrowRight\" && canContain(row.item)) {\n event.preventDefault();\n if (!expanded.has(row.item.id)) expand(row.item.id);\n else if (next?.parentId === row.item.id) focus(next.item.id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (expanded.has(row.item.id)) collapse(row.item.id);\n else if (row.parentId) focus(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (canContain(row.item)) toggleExpanded(row.item.id);\n else select(row.item.id);\n } else if (event.key === \"F2\") {\n event.preventDefault();\n startRename(row.item.id);\n } else if (\n event.key === \"ContextMenu\" ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n openMenu(row.item.id);\n }\n },\n [\n collapse,\n expand,\n focus,\n move,\n openMenu,\n readFlat,\n select,\n sidebarId,\n startRename,\n store,\n toggleExpanded,\n ]\n );\n\n // The drag handlers read drag state out of the store when they run instead\n // of closing over it. That is what keeps them stable for the life of the\n // sidebar, so every row can share one set without re-rendering on a drag.\n const onRootDragOver = useCallback(\n (event: DragEvent<HTMLDivElement>) => {\n if (\n !store.get(aiSidebarDraggingIdAtom(sidebarId)) ||\n event.target !== event.currentTarget\n )\n return;\n event.preventDefault();\n setDropTarget({ id: null, position: \"after\" });\n },\n [setDropTarget, sidebarId, store]\n );\n\n const onDrop = useCallback(\n (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n const dragging = store.get(aiSidebarDraggingIdAtom(sidebarId));\n const target = store.get(aiSidebarDropTargetAtom(sidebarId));\n if (dragging && target) {\n void move({\n itemId: dragging,\n targetId: target.id,\n position: target.position,\n });\n }\n },\n [move, sidebarId, store]\n );\n\n const onRowDragStart = useCallback(\n (event: DragEvent<HTMLDivElement>, id: string) => {\n setDraggingId(id);\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/plain\", id);\n },\n [setDraggingId]\n );\n\n const onRowDragOver = useCallback(\n (event: DragEvent<HTMLDivElement>, targetRow: FlatResource) => {\n const dragging = store.get(aiSidebarDraggingIdAtom(sidebarId));\n if (!dragging || dragging === targetRow.item.id) return;\n const source = findResource(\n store.get(aiSidebarItemsAtom(sidebarId)),\n dragging\n );\n if (source && containsResource(source, targetRow.item.id)) return;\n event.preventDefault();\n event.stopPropagation();\n const rect = event.currentTarget.getBoundingClientRect();\n const ratio = (event.clientY - rect.top) / rect.height;\n const position =\n !targetRow.item.disabled &&\n canContain(targetRow.item) &&\n ratio >= 0.25 &&\n ratio <= 0.75\n ? \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\";\n setDropTarget({ id: targetRow.item.id, position });\n },\n [setDropTarget, sidebarId, store]\n );\n\n const dnd = useMemo(\n () => ({\n draggingId,\n dropTarget,\n onRootDragOver,\n onDrop,\n onRowDragStart,\n onRowDragEnd,\n onRowDragOver,\n }),\n [\n draggingId,\n dropTarget,\n onRootDragOver,\n onDrop,\n onRowDragStart,\n onRowDragEnd,\n onRowDragOver,\n ]\n );\n\n const hover = useMemo(\n () => ({\n hoveredId,\n layoutId: hoverLayoutId,\n onRowHover,\n clear: clearHover,\n }),\n [clearHover, hoverLayoutId, hoveredId, onRowHover]\n );\n\n return useMemo<AISidebarController>(\n () => ({\n sidebarId,\n items: renderedItems,\n flat,\n getItem,\n selectedId,\n select,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focusedId,\n focus,\n renamingId,\n startRename,\n cancelRename,\n rename,\n menuOpenId,\n openMenu,\n closeMenu,\n move,\n movePending,\n announcement,\n reset,\n dnd,\n hover,\n onRowKeyDown,\n setRowRef,\n }),\n [\n sidebarId,\n renderedItems,\n flat,\n getItem,\n selectedId,\n select,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focusedId,\n focus,\n renamingId,\n startRename,\n cancelRename,\n rename,\n menuOpenId,\n openMenu,\n closeMenu,\n move,\n movePending,\n announcement,\n reset,\n dnd,\n hover,\n onRowKeyDown,\n setRowRef,\n ]\n );\n}\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\nimport type { AISidebarContextValue } from \"./type.ts\";\n\nexport const AISidebarContext = createContext<AISidebarContextValue | null>(\n null\n);\n\nexport function useAISidebarContext(): AISidebarContextValue {\n const context = useContext(AISidebarContext);\n if (!context) throw new Error(\"Sidebar rows must render inside <AISidebar>.\");\n return context;\n}\n","import type { SidebarResource } from \"./type.ts\"\nimport { Bookmark, FileText, Folder, FolderOpen } from \"lucide-react\"\n\nexport function SidebarIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText\n return <Icon className=\"size-4\" />\n}\n","import { motion, useReducedMotion } from \"motion/react\"\nimport { useEffect, useRef, useState } from \"react\"\nimport { ROW_REVEAL } from \"./utils.ts\"\n\nexport function MarqueeLabel({\n active,\n children,\n}: {\n active: boolean\n children: string\n}) {\n const reduce = useReducedMotion() ?? false\n const viewportRef = useRef<HTMLSpanElement>(null)\n const labelRef = useRef<HTMLSpanElement>(null)\n const [distance, setDistance] = useState(0)\n\n useEffect(() => {\n const measure = () => {\n const viewport = viewportRef.current\n const label = labelRef.current\n if (!viewport || !label) return\n setDistance(\n label.scrollWidth > viewport.clientWidth ? label.scrollWidth + 24 : 0\n )\n }\n measure()\n const observer = new ResizeObserver(measure)\n if (viewportRef.current) observer.observe(viewportRef.current)\n if (labelRef.current) observer.observe(labelRef.current)\n return () => observer.disconnect()\n }, [])\n\n const running = active && distance > 0 && !reduce\n\n return (\n <span\n ref={viewportRef}\n className=\"relative block min-w-0 flex-1 overflow-hidden\"\n >\n <motion.span\n className=\"flex w-max items-center gap-6 whitespace-nowrap\"\n animate={{ x: running ? [0, -distance] : 0 }}\n transition={\n running\n ? {\n duration: Math.max(2.4, distance / 34),\n ease: \"linear\",\n repeat: Number.POSITIVE_INFINITY,\n repeatDelay: 2,\n }\n : ROW_REVEAL\n }\n >\n <span ref={labelRef}>{children}</span>\n {running ? <span aria-hidden=\"true\">{children}</span> : null}\n </motion.span>\n </span>\n )\n}\n","\"use client\";\n\nimport {\n type MutableRefObject,\n useCallback,\n useLayoutEffect,\n useState,\n} from \"react\";\n\nexport type PortalLayout = {\n trigger: {\n left: number;\n top: number;\n width: number;\n height: number;\n };\n content: {\n width: number;\n height: number;\n };\n};\n\nfunction sameLayout(a: PortalLayout | null, b: PortalLayout) {\n return (\n a?.trigger.left === b.trigger.left &&\n a.trigger.top === b.trigger.top &&\n a.trigger.width === b.trigger.width &&\n a.trigger.height === b.trigger.height &&\n a.content.width === b.content.width &&\n a.content.height === b.content.height\n );\n}\n\n/** Measures a trigger and portalled panel in viewport coordinates. */\nexport function usePopoverPortalPosition<\n TriggerElement extends HTMLElement,\n ContentElement extends HTMLElement,\n>(\n triggerRef: MutableRefObject<TriggerElement | null>,\n contentRef: MutableRefObject<ContentElement | null>,\n active: boolean,\n) {\n const [layout, setLayout] = useState<PortalLayout | null>(null);\n\n const update = useCallback(() => {\n const trigger = triggerRef.current;\n const content = contentRef.current;\n if (!trigger || !content) return;\n\n const rect = trigger.getBoundingClientRect();\n const next: PortalLayout = {\n trigger: {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n },\n content: {\n width: content.offsetWidth,\n height: content.offsetHeight,\n },\n };\n setLayout((current) => (sameLayout(current, next) ? current : next));\n }, [contentRef, triggerRef]);\n\n useLayoutEffect(() => {\n update();\n if (!active) return;\n\n const trigger = triggerRef.current;\n const content = contentRef.current;\n const observer = new ResizeObserver(update);\n if (trigger) observer.observe(trigger);\n if (content) observer.observe(content);\n\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n return () => {\n observer.disconnect();\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n };\n }, [active, contentRef, triggerRef, update]);\n\n return layout;\n}\n","\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { usePopoverPortalPosition } from \"@/components/motion/popover-position\";\nimport { EASE_OUT, SPRING_PANEL } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"end\";\n\ntype MorphContextValue = {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n triggerId: string;\n contentId: string;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n setContentRef: (node: HTMLDivElement | null) => void;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n};\n\nconst MorphContext = createContext<MorphContextValue | null>(null);\n\nfunction useMorphContext(component: string) {\n const ctx = useContext(MorphContext);\n if (!ctx) throw new Error(`${component} must be used within <MorphPopover>`);\n return ctx;\n}\n\nexport interface MorphPopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A popover whose panel morphs open from the trigger corner: it's laid out at\n * full size but clipped to the corner nearest the trigger, then unclips as one\n * piece. Closes on outside pointer / Escape. Controlled or uncontrolled.\n */\nexport function MorphPopover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n className,\n}: MorphPopoverProps) {\n const baseId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setOpen(false);\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (\n rootRef.current &&\n !rootRef.current.contains(target) &&\n !contentRef.current?.contains(target)\n )\n setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, setOpen]);\n\n const ctx = useMemo<MorphContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n triggerId: `${baseId}-trigger`,\n contentId: `${baseId}-content`,\n triggerRef,\n setContentRef: (node) => {\n contentRef.current = node;\n },\n contentRef,\n }),\n [open, setOpen, toggle, baseId],\n );\n\n return (\n <MorphContext.Provider value={ctx}>\n <div ref={rootRef} className={cn(\"relative inline-flex\", className)}>\n {children}\n </div>\n </MorphContext.Provider>\n );\n}\n\nexport interface MorphPopoverTriggerProps {\n children: ReactElement;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\n/** Wraps a single element, toggling the popover on click. */\nexport function MorphPopoverTrigger({ children }: MorphPopoverTriggerProps) {\n const ctx = useMorphContext(\"MorphPopoverTrigger\");\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child.props.onClick as\n | ((e: unknown) => void)\n | undefined;\n const childRef = (child.props as { ref?: Ref<HTMLElement> }).ref;\n\n return cloneElement(child, {\n id: ctx.triggerId,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n onClick: (e: unknown) => {\n childOnClick?.(e);\n ctx.toggle();\n },\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n });\n}\n\nconst originFor = (side: Side, align: Align) =>\n `${side === \"bottom\" ? \"top\" : \"bottom\"} ${align === \"end\" ? \"right\" : \"left\"}`;\n\n// A clip that hides everything but the corner nearest the trigger, so the\n// panel appears to grow out of it. inset(top right bottom left).\nfunction clipHidden(side: Side, align: Align, radius: number) {\n const top = side === \"bottom\" ? \"0%\" : \"92%\";\n const bottom = side === \"bottom\" ? \"92%\" : \"0%\";\n const right = align === \"end\" ? \"0%\" : \"92%\";\n const left = align === \"end\" ? \"92%\" : \"0%\";\n return `inset(${top} ${right} ${bottom} ${left} round ${radius}px)`;\n}\nconst clipShown = (radius: number) => `inset(0% 0% 0% 0% round ${radius}px)`;\n\n// Preserve the original spring character on the wrapper, but tween the complex\n// clip-path so it cannot snap when the spring resolves its final distance.\nconst MORPH_CLIP_TRANSITION = { duration: 0.32, ease: EASE_OUT } as const;\n\nexport interface MorphPopoverContentProps {\n children: ReactNode;\n side?: Side;\n align?: Align;\n /** Gap between trigger and panel, in px. Default 8. */\n sideOffset?: number;\n /** Panel corner radius, in px. Default 16. */\n radius?: number;\n className?: string;\n}\n\nexport function MorphPopoverContent({\n children,\n side = \"bottom\",\n align = \"end\",\n sideOffset = 8,\n radius = 16,\n className,\n}: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const { contentId, setContentRef, triggerId } = ctx;\n const reduce = useReducedMotion() ?? false;\n const [portalReady, setPortalReady] = useState(false);\n const layout = usePopoverPortalPosition(\n ctx.triggerRef,\n ctx.contentRef,\n portalReady && ctx.open,\n );\n\n useEffect(() => setPortalReady(true), []);\n const left = layout\n ? align === \"end\"\n ? layout.trigger.left + layout.trigger.width - layout.content.width\n : layout.trigger.left\n : 0;\n const top = layout\n ? side === \"bottom\"\n ? layout.trigger.top + layout.trigger.height + sideOffset\n : layout.trigger.top - layout.content.height - sideOffset\n : 0;\n\n // Both directions travel between the exact same hidden/show states. Exit\n // targets \"hidden\" directly instead of introducing separate choreography.\n const wrap = reduce\n ? undefined\n : {\n hidden: { opacity: 0, scale: 0.96, transition: SPRING_PANEL },\n show: { opacity: 1, scale: 1, transition: SPRING_PANEL },\n };\n const clip = reduce\n ? undefined\n : {\n hidden: {\n clipPath: clipHidden(side, align, radius),\n transition: MORPH_CLIP_TRANSITION,\n },\n show: {\n clipPath: clipShown(radius),\n transition: MORPH_CLIP_TRANSITION,\n },\n };\n\n // Keep the server and first client render identical, then mount the portal.\n if (!portalReady) return null;\n\n return createPortal(\n <AnimatePresence>\n {ctx.open ? (\n <motion.div\n data-morph-popover-portal=\"\"\n // Wrapper carries the shadow as a drop-shadow filter, which hugs the\n // clipped shape below (box-shadow would just get clipped away).\n variants={wrap}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"show\"}\n exit={reduce ? { opacity: 0 } : \"hidden\"}\n transition={reduce ? { duration: 0.12 } : undefined}\n style={{\n left,\n top,\n visibility: layout ? \"visible\" : \"hidden\",\n transformOrigin: originFor(side, align),\n }}\n className=\"fixed z-[9999] [filter:drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]\"\n >\n <motion.div\n ref={setContentRef}\n id={contentId}\n role=\"dialog\"\n aria-labelledby={triggerId}\n variants={clip}\n style={{ borderRadius: radius }}\n className={cn(\n \"overflow-hidden border border-border bg-background\",\n className,\n )}\n >\n {children}\n </motion.div>\n </motion.div>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n","\"use client\"\n\nimport {\n cloneElement,\n memo,\n useCallback,\n useEffect,\n useRef,\n useState,\n type MouseEvent,\n} from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport type { ResourceRowProps } from \"./type\"\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\"\nimport { ChevronRight, MoreHorizontal, Pencil } from \"lucide-react\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils.ts\"\nimport {\n aiSidebarHoverActiveAtom,\n aiSidebarRowDraggingAtom,\n aiSidebarRowDropAtom,\n aiSidebarRowExpandedAtom,\n aiSidebarRowFocusedAtom,\n aiSidebarRowHoveredAtom,\n aiSidebarRowMenuOpenAtom,\n aiSidebarRowRenamingAtom,\n aiSidebarRowSelectedAtom,\n cancelAISidebarRenameAtom,\n focusAISidebarRowAtom,\n openAISidebarMenuAtom,\n renameAISidebarRowAtom,\n selectAISidebarRowAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\"\nimport { useAISidebarContext } from \"./sidebar-context.ts\"\nimport { canContain } from \"./utils\"\nimport { SidebarIcon } from \"./sidebar-icon\"\nimport { MarqueeLabel } from \"./marquee-label\"\nimport {\n MorphPopover,\n MorphPopoverContent,\n MorphPopoverTrigger,\n} from \"@/components/motion/popover-morph.tsx\"\nimport { Button } from \"@/components/ui/button\"\n\n// Same choreography as SharedLayoutBg: the wrapper only fades/blurs out when\n// the pointer leaves the whole tree; a row-to-row move exits instantly so the\n// layoutId pill slides instead of crossfading.\nconst pillVariants: Variants = {\n initial: { opacity: 0, filter: \"blur(6px)\" },\n animate: { opacity: 1, filter: \"blur(0px)\" },\n exit: (hoverActive: boolean) =>\n !hoverActive ? { opacity: 0, filter: \"blur(6px)\" } : {},\n}\n\nconst reducedPillVariants: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: (hoverActive: boolean) => (!hoverActive ? { opacity: 0 } : {}),\n}\n\nfunction ResourceRowImpl({ row }: ResourceRowProps) {\n const {\n sidebarId,\n hoverLayoutId,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n setRowRef,\n onRowKeyDown,\n onRowHover,\n closeMenu,\n dnd,\n } = useAISidebarContext()\n const reduce = useReducedMotion() ?? false\n\n // One subscription per field, per row. A row re-renders when its own\n // selection, expansion, focus, rename, menu, drag or hover state changes\n // and sits still while a sibling's does — reading the controller off\n // context instead re-rendered every row on every change.\n const active = useAtomValue(aiSidebarRowSelectedAtom(sidebarId, row.item.id))\n const expanded = useAtomValue(\n aiSidebarRowExpandedAtom(sidebarId, row.item.id)\n )\n const focused = useAtomValue(aiSidebarRowFocusedAtom(sidebarId, row.item.id))\n const renaming = useAtomValue(\n aiSidebarRowRenamingAtom(sidebarId, row.item.id)\n )\n const menuOpen = useAtomValue(\n aiSidebarRowMenuOpenAtom(sidebarId, row.item.id)\n )\n const isDragging = useAtomValue(\n aiSidebarRowDraggingAtom(sidebarId, row.item.id)\n )\n const dropPosition = useAtomValue(\n aiSidebarRowDropAtom(sidebarId, row.item.id)\n )\n const hoverActive = useAtomValue(aiSidebarHoverActiveAtom(sidebarId))\n const hoverPill =\n useAtomValue(aiSidebarRowHoveredAtom(sidebarId, row.item.id)) &&\n !row.item.disabled\n\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId))\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId))\n const setFocusedRow = useSetAtom(focusAISidebarRowAtom(sidebarId))\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId))\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId))\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId))\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId))\n\n const onMenuOpenChange = useCallback(\n (open: boolean) => {\n if (open) openMenu(row.item.id)\n else closeMenu()\n },\n [closeMenu, openMenu, row.item.id]\n )\n\n const setRef = useCallback(\n (node: HTMLDivElement | null) => setRowRef(row.item.id, node),\n [row.item.id, setRowRef]\n )\n\n const [hovered, setHovered] = useState(false)\n const inputRef = useRef<HTMLInputElement>(null)\n const skipRenameBlurRef = useRef(false)\n const draggedRef = useRef(false)\n const [draft, setDraft] = useState(row.item.label)\n const acceptsChildren = canContain(row.item)\n\n useEffect(() => {\n if (!renaming) return\n skipRenameBlurRef.current = false\n // setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n inputRef.current?.select()\n })\n }, [renaming, row.item.label])\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false)\n startRename(row.item.id)\n },\n }) ?? (\n <button\n type=\"button\"\n onClick={() => {\n onMenuOpenChange(false)\n startRename(row.item.id)\n }}\n className=\"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-foreground transition-colors outline-none hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Pencil aria-hidden=\"true\" className=\"size-3.5\" />\n Rename\n </button>\n )\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={() => setFocusedRow(row.item.id)}\n onKeyDown={(event) => onRowKeyDown(event, row)}\n onClick={(event) => {\n if (\n event.defaultPrevented ||\n draggedRef.current ||\n renaming ||\n row.item.disabled\n )\n return\n if (acceptsChildren) toggleExpanded(row.item.id)\n else select(row.item.id)\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return\n event.preventDefault()\n startRename(row.item.id)\n }}\n onMouseEnter={() => {\n setHovered(true)\n onRowHover(row.item.id, true)\n }}\n onMouseLeave={() => {\n setHovered(false)\n onRowHover(row.item.id, false)\n }}\n onDragStartCapture={(event) => {\n draggedRef.current = true\n dnd.onRowDragStart(event, row.item.id)\n }}\n onDragEndCapture={() => {\n dnd.onRowDragEnd()\n requestAnimationFrame(() => {\n draggedRef.current = false\n })\n }}\n onDragOver={(event) => dnd.onRowDragOver(event, row)}\n onDrop={dnd.onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-md pr-3 text-sm outline-none\",\n \"text-muted-foreground transition-[color,background-color,scale] duration-150 ease-smooth-out hover:text-foreground motion-reduce:transition-none\",\n !row.item.disabled &&\n !renaming &&\n \"active:scale-97 motion-reduce:active:scale-100\",\n // Fallback for standalone rows that render without the shared pill.\n hoverLayoutId === undefined && \"hover:bg-muted\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45\",\n \"data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary\",\n \"data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary\",\n !acceptsChildren &&\n active &&\n \"bg-primary/10 text-primary dark:bg-primary/25 dark:text-primary-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\"\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n {hoverLayoutId ? (\n <AnimatePresence custom={hoverActive}>\n {hoverActive ? (\n <motion.span\n aria-hidden=\"true\"\n variants={reduce ? reducedPillVariants : pillVariants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n custom={hoverActive}\n className=\"pointer-events-none absolute inset-0\"\n >\n {hoverPill ? (\n <motion.span\n layoutId={hoverLayoutId}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"block h-full w-full rounded-md bg-foreground/8 dark:bg-muted/50\"\n />\n ) : null}\n </motion.span>\n ) : null}\n </AnimatePresence>\n ) : null}\n <span\n aria-hidden=\"true\"\n className=\"relative grid size-5 shrink-0 place-items-center\"\n >\n {renderIcon?.(row.item) ?? SidebarIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={`Rename ${row.item.label}`}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) rename(row.item.id, draft)\n }}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true\n rename(row.item.id, draft)\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true\n cancelRename()\n }\n }}\n className=\"relative h-7 min-w-0 flex-1 text-sm text-foreground outline-none focus-visible:ring-0 focus-visible:ring-ring\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>\n {row.item.label}\n </MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <MorphPopoverTrigger>\n {(() => {\n const custom = renderActionsTrigger?.(row.item)\n if (custom) {\n // A row click selects/toggles — the trigger must not bubble.\n const customOnClick = (\n custom.props as {\n onClick?: (event: MouseEvent<HTMLElement>) => void\n }\n ).onClick\n return cloneElement(custom, {\n draggable: false,\n onClick: (event: MouseEvent<HTMLElement>) => {\n event.stopPropagation()\n customOnClick?.(event)\n },\n } as Partial<unknown>)\n }\n return (\n <Button\n draggable={false}\n tabIndex={-1}\n variant=\"link\"\n aria-label={`Actions for ${row.item.label}`}\n onClick={(event) => event.stopPropagation()}\n className=\"relative grid size-7 shrink-0 place-items-center rounded-lg opacity-0 transition-opacity duration-150 ease-smooth-out outline-none group-hover/resource:opacity-80 group-hover/resource:delay-150 group-data-[menu-open=true]/resource:opacity-100 hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none\"\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\" />\n </Button>\n )\n })()}\n </MorphPopoverTrigger>\n <MorphPopoverContent\n side=\"bottom\"\n align=\"end\"\n sideOffset={8}\n radius={12}\n className=\"w-40 p-1.5\"\n >\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n\n {row.depth === 0 &&\n acceptsChildren &&\n (row.item.children?.length ?? 0) > 0 ? (\n <ChevronRight\n aria-hidden=\"true\"\n className={cn(\n \"relative size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ease-smooth-out motion-reduce:transition-none\",\n expanded && \"rotate-90\"\n )}\n />\n ) : null}\n </motion.div>\n )\n}\n\n/** `flat` is rebuilt whenever expansion changes, so its `FlatResource`\n * wrappers are fresh objects even for rows nothing happened to. The\n * comparator looks through the wrapper at what a row actually renders from —\n * its item (stable unless the data changed), depth and parent — so a sibling\n * opening does not walk every row. Each row's own state reaches it through\n * its atoms instead. */\nfunction sameRow(prev: ResourceRowProps, next: ResourceRowProps): boolean {\n return (\n prev.row.item === next.row.item &&\n prev.row.depth === next.row.depth &&\n prev.row.parentId === next.row.parentId\n )\n}\n\nexport const ResourceRow = memo(ResourceRowImpl, sameRow)\nResourceRow.displayName = \"ResourceRow\"\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { AnimatePresence } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport type {\n AISidebarComponentProps,\n AISidebarContextValue,\n AISidebarController,\n AISidebarProps,\n AISidebarViewProps,\n FlatResource,\n} from \"./type\"\nimport { useAISidebar } from \"./use-ai-sidebar\"\nimport { AISidebarContext } from \"./sidebar-context\"\nimport { ResourceRow } from \"./sidebar-row\"\n\n/**\n * Resource tree for the app rail: nested rows with drag-and-drop reorder,\n * inline rename, per-row action menus and full keyboard navigation.\n *\n * Two ways to drive it. Pass the data and handlers as props and the block\n * owns its state, or hold a `useAISidebar` controller and pass it as\n * `controller` — the same rendering, but select, expand, rename, reorder\n * and menu state are then callable from anywhere in your app.\n */\nexport function AISidebar(props: AISidebarComponentProps) {\n // Two components rather than one: hooks may not be called conditionally,\n // and the controller form has no options to build a fallback controller\n // from. Nobody switches a sidebar between the two forms at runtime.\n return props.controller ? (\n <AISidebarView {...viewProps(props)} controller={props.controller} />\n ) : (\n <UncontrolledAISidebar {...props} />\n )\n}\n\n/** The props form: builds its own controller and renders through it. */\nfunction UncontrolledAISidebar(props: AISidebarProps) {\n const {\n renderIcon: _icon,\n renderMenu: _menu,\n renderActionsTrigger: _trigger,\n ariaLabel: _label,\n className: _className,\n controller: _controller,\n ...options\n } = props\n const controller = useAISidebar(options)\n return <AISidebarView {...viewProps(props)} controller={controller} />\n}\n\nfunction viewProps(props: AISidebarComponentProps): AISidebarViewProps {\n return {\n renderIcon: props.renderIcon,\n renderMenu: props.renderMenu,\n renderActionsTrigger: props.renderActionsTrigger,\n ariaLabel: props.ariaLabel,\n className: props.className,\n }\n}\n\n/** Rendering only — every piece of state lives on the controller. */\nfunction AISidebarView({\n controller,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n ariaLabel = \"Resources\",\n className,\n}: AISidebarViewProps & { controller: AISidebarController }) {\n const { dnd, hover } = controller\n const { draggingId, dropTarget } = dnd\n\n // Rows take the sidebar's id and the stable handlers, never the controller\n // — so this value keeps its identity and a hover or a toggle re-renders\n // only the rows whose own atoms changed. Deps name each function because\n // `dnd` itself carries live drag state and changes identity with it.\n const context = useMemo<AISidebarContextValue>(\n () => ({\n sidebarId: controller.sidebarId,\n hoverLayoutId: hover.layoutId,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n setRowRef: controller.setRowRef,\n onRowKeyDown: controller.onRowKeyDown,\n onRowHover: hover.onRowHover,\n closeMenu: controller.closeMenu,\n dnd: {\n onDrop: dnd.onDrop,\n onRowDragStart: dnd.onRowDragStart,\n onRowDragEnd: dnd.onRowDragEnd,\n onRowDragOver: dnd.onRowDragOver,\n },\n }),\n [\n controller.sidebarId,\n controller.setRowRef,\n controller.onRowKeyDown,\n controller.closeMenu,\n hover.layoutId,\n hover.onRowHover,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n dnd.onDrop,\n dnd.onRowDragStart,\n dnd.onRowDragEnd,\n dnd.onRowDragOver,\n ]\n )\n\n return (\n <AISidebarContext.Provider value={context}>\n <div\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n onDragOver={dnd.onRootDragOver}\n onDrop={dnd.onDrop}\n onMouseLeave={hover.clear}\n className={cn(\n \"relative min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden\",\n draggingId && \"pb-9 select-none\",\n className\n )}\n >\n <AnimatePresence initial={false}>\n {controller.flat.map((row: FlatResource) => (\n <ResourceRow key={row.item.id} row={row} />\n ))}\n </AnimatePresence>\n\n {draggingId && (\n <div\n aria-hidden=\"true\"\n data-active={dropTarget?.id === null || undefined}\n className=\"absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-md border border-dashed border-border text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground\"\n >\n Move to top level\n </div>\n )}\n </div>\n <span className=\"sr-only\" aria-live=\"polite\">\n {controller.announcement}\n </span>\n </AISidebarContext.Provider>\n )\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useAtomValue, useSetAtom } from \"jotai\";\n\nimport {\n aiSidebarStateAtom,\n cancelAISidebarRenameAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n moveAISidebarRowAtom,\n openAISidebarMenuAtom,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarItemsAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\";\nimport type {\n AISidebarActions,\n AISidebarInstanceId,\n AISidebarState,\n} from \"./type.ts\";\n\n/**\n * Read the sidebar registered under `sidebarId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { selectedId, movePending } = useAISidebarState(\"app-resources\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(aiSidebarActiveIdAtom(\"app-resources\"))`.\n */\nexport function useAISidebarState(\n sidebarId: AISidebarInstanceId\n): AISidebarState {\n return useAtomValue(aiSidebarStateAtom(sidebarId));\n}\n\n/**\n * Drive the sidebar registered under `sidebarId` from anywhere. Writes only —\n * the caller never re-renders when the sidebar changes, so this is what a\n * command palette, a keyboard shortcut or a route guard should reach for.\n *\n * `focus` and `closeMenu` move the store's roving target; DOM focus follows\n * only for callers that hold the controller, because the row refs live in\n * the block rather than the store.\n *\n * ```tsx\n * const resources = useAISidebarActions(\"app-resources\")\n * <Button onClick={resources.collapseAll}>Collapse all</Button>\n * ```\n */\nexport function useAISidebarActions(\n sidebarId: AISidebarInstanceId\n): AISidebarActions {\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId));\n const expand = useSetAtom(expandAISidebarRowAtom(sidebarId));\n const collapse = useSetAtom(collapseAISidebarRowAtom(sidebarId));\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId));\n const expandAll = useSetAtom(expandAllAISidebarRowsAtom(sidebarId));\n const collapseAll = useSetAtom(collapseAllAISidebarRowsAtom(sidebarId));\n const reveal = useSetAtom(revealAISidebarRowAtom(sidebarId));\n const focus = useSetAtom(focusAISidebarRowAtom(sidebarId));\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId));\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId));\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId));\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId));\n const closeMenuInStore = useSetAtom(closeAISidebarMenuAtom(sidebarId));\n const move = useSetAtom(moveAISidebarRowAtom(sidebarId));\n const setItems = useSetAtom(setAISidebarItemsAtom(sidebarId));\n const reset = useSetAtom(resetAISidebarAtom(sidebarId));\n\n return useMemo(\n () => ({\n select,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focus,\n startRename,\n cancelRename,\n rename,\n openMenu,\n // The atom returns the id it closed so the block can move DOM focus;\n // remote callers have no refs, so the return value is dropped here.\n closeMenu: () => void closeMenuInStore(),\n move,\n setItems,\n reset,\n }),\n [\n select,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focus,\n startRename,\n cancelRename,\n rename,\n openMenu,\n closeMenuInStore,\n move,\n setItems,\n reset,\n ]\n );\n}\n","import { AISidebar } from \"./ai-sidebar\"\nimport { MarqueeLabel } from \"./marquee-label.tsx\"\nimport { ResourceRow } from \"./sidebar-row.tsx\"\nimport { SidebarIcon } from \"./sidebar-icon.tsx\"\nexport { useAISidebar, type UseAISidebarOptions } from \"./use-ai-sidebar.ts\"\nexport {\n useAISidebarActions,\n useAISidebarState,\n} from \"./use-ai-sidebar-state.ts\"\nexport type * from \"./type.ts\"\n// The public atom surface. `@internal` atoms (config, handlers, mount, the\n// projections, the owned-* loop guards) stay unexported on purpose —\n// `export *` would make every internal a breaking-change surface for\n// consumer apps.\nexport {\n aiSidebarActiveIdAtom,\n aiSidebarAnnouncementAtom,\n aiSidebarDraggingIdAtom,\n aiSidebarDropTargetAtom,\n aiSidebarExpandedIdsAtom,\n aiSidebarFlatAtom,\n aiSidebarFocusedIdAtom,\n aiSidebarHoverActiveAtom,\n aiSidebarHoveredIdAtom,\n aiSidebarItemsAtom,\n aiSidebarMenuOpenIdAtom,\n aiSidebarMovePendingAtom,\n aiSidebarRenamingIdAtom,\n aiSidebarRowDraggingAtom,\n aiSidebarRowDropAtom,\n aiSidebarRowExpandedAtom,\n aiSidebarRowFocusedAtom,\n aiSidebarRowHoveredAtom,\n aiSidebarRowMenuOpenAtom,\n aiSidebarRowRenamingAtom,\n aiSidebarRowSelectedAtom,\n aiSidebarStateAtom,\n cancelAISidebarRenameAtom,\n clearAISidebarHoverAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n endAISidebarDragAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n moveAISidebarRowAtom,\n openAISidebarMenuAtom,\n removeAISidebarInstance,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarHoveredAtom,\n setAISidebarItemsAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\"\n\nexport { AISidebar, MarqueeLabel, ResourceRow, SidebarIcon }\n\nexport const Sidebar = {\n Wrapper: AISidebar,\n MarqueeLabel,\n Row: ResourceRow,\n Icon: SidebarIcon,\n}\n","export const TITLE_BAR_HEIGHT = 48\n// The desktop rail settles at a hard zero-width boundary. Keep the spring\n// critically damped so it cannot overshoot, pause against that boundary, and\n// then snap back during the final frame.\nimport { EASE_OUT, EASE_DRAWER } from \"@/lib/ease.ts\"\nimport type { Variants } from \"motion/react\"\nimport { createContext, useContext, useSyncExternalStore } from \"react\"\nimport type {\n AnimatedSidebarContextValue,\n AnimatedSidebarPanelContextValue,\n} from \"./type\"\n\nexport const SIDEBAR_MORPH_TRANSITION = {\n type: \"spring\",\n stiffness: 380,\n damping: 35,\n mass: 0.75,\n} as const\n\nexport const LABEL_ENTER_TRANSITION = {\n duration: 0.2,\n delay: 0.08,\n ease: EASE_OUT,\n} as const\n\nexport const LABEL_EXIT_TRANSITION = {\n duration: 0.12,\n ease: EASE_OUT,\n} as const\n\nexport const PANEL_TRANSITION = {\n duration: 0.36,\n ease: EASE_DRAWER,\n} as const\n\nexport const REDUCED_TRANSITION = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const\n\nconst SUBMENU_TRANSITION = {\n duration: 0.18,\n ease: EASE_OUT,\n} as const\n\nexport const SUBMENU_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n clipPath: \"inset(0 0 100% 0 round 8px)\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n staggerChildren: 0.025,\n staggerDirection: -1,\n },\n },\n open: {\n opacity: 1,\n clipPath: \"inset(0 0 0% 0 round 8px)\",\n transition: {\n duration: 0.2,\n delayChildren: 0.035,\n ease: EASE_OUT,\n staggerChildren: 0.045,\n },\n },\n}\n\nexport const SUBMENU_ITEM_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n y: -6,\n filter: \"blur(3px)\",\n },\n open: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: SUBMENU_TRANSITION,\n },\n}\n\nexport const FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\nexport const MOBILE_QUERY = \"(max-width: 767px)\"\nexport const SIDEBAR_KEYBOARD_SHORTCUT = \"b\"\n\n/**\n * The shell's layout contract, in px. Every entry lands on the provider's\n * wrapper as a CSS variable, so a consumer overrides a column by restyling it\n * rather than by passing a prop:\n *\n * | variable | column |\n * | ---------------------- | ----------------------------------------- |\n * | `--sidebar-width` | left rail, expanded |\n * | `--sidebar-width-icon` | left rail, folded to icons |\n * | `--panel-width` | secondary panel: its floor AND its default |\n * | `--inset-min-width` | the body's floor |\n *\n * These are only the defaults. Every measurement resolves the live variable,\n * so an override wins over the value written here.\n */\nexport const SHELL_WIDTHS = {\n \"--sidebar-width\": \"256px\",\n \"--sidebar-width-icon\": \"56px\",\n \"--sidebar-width-mobile\": \"18rem\",\n \"--panel-width\": \"320px\",\n \"--inset-min-width\": \"360px\",\n} as const\n\n/** The expanded width of a panel docked to `side`: the secondary panel opens\n * at `--panel-width`, the primary rail at `--sidebar-width`. */\nexport function expandedWidthVar(side: \"left\" | \"right\") {\n return side === \"right\" ? \"var(--panel-width)\" : \"var(--sidebar-width)\"\n}\n\n/** Resolve a CSS length — `var()` included — to px inside `host`'s cascade.\n * Custom properties inherit, so a throwaway probe mounted in `host` reads the\n * very `--sidebar-width` the shell lays out with, including a value a\n * consumer overrode on the provider. Returns 0 when `host` has no layout\n * (server render, `display: none`), so callers must fail open on 0 rather\n * than treat it as a real measurement. */\nexport function resolveLength(host: HTMLElement, value: string) {\n const probe = document.createElement(\"div\")\n probe.style.cssText = `position:absolute;visibility:hidden;pointer-events:none;width:${value}`\n host.appendChild(probe)\n const px = probe.getBoundingClientRect().width\n probe.remove()\n return px\n}\n\nexport const AnimatedSidebarContext =\n createContext<AnimatedSidebarContextValue | null>(null)\n\nexport const AnimatedSidebarPanelContext =\n createContext<AnimatedSidebarPanelContextValue | null>(null)\n\nexport function useAnimatedSidebar() {\n const context = useContext(AnimatedSidebarContext)\n if (!context) {\n throw new Error(\n \"useAnimatedSidebar must be used inside AnimatedPanelProvider.\"\n )\n }\n return context\n}\n\nfunction subscribeToMobileQuery(callback: () => void) {\n const query = window.matchMedia(MOBILE_QUERY)\n query.addEventListener(\"change\", callback)\n return () => query.removeEventListener(\"change\", callback)\n}\n\nexport function getMobileSnapshot() {\n return window.matchMedia(MOBILE_QUERY).matches\n}\n\nexport function getServerMobileSnapshot() {\n return false\n}\n\nexport function useIsMobile() {\n return useSyncExternalStore(\n subscribeToMobileQuery,\n getMobileSnapshot,\n getServerMobileSnapshot\n )\n}\n\nexport function useAnimatedSidebarPanel() {\n const context = useContext(AnimatedSidebarPanelContext)\n if (!context) {\n throw new Error(\"Animated Sidebar parts must be used inside AnimatedPanel.\")\n }\n return context\n}\n","\"use client\"\n// beui.dev/components/motion/animated-sidebar\n\nimport { motion, type PanInfo } from \"motion/react\"\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n} from \"react\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils\"\nimport type { AnimatedSidebarProps } from \"./type\"\nimport {\n AnimatedSidebarPanelContext,\n expandedWidthVar,\n SIDEBAR_MORPH_TRANSITION,\n PANEL_TRANSITION,\n REDUCED_TRANSITION,\n useAnimatedSidebar,\n} from \"./utils\"\n\n/** How far one arrow key moves the panel edge (shift = coarse step). */\nconst RESIZE_STEP = 16\nconst RESIZE_STEP_COARSE = 64\n\nexport function AnimatedPanel({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"icon\",\n ariaLabel = \"Sidebar\",\n children,\n className,\n panelClassName,\n style,\n ref,\n ...props\n}: AnimatedSidebarProps) {\n const context = useAnimatedSidebar()\n const { bounds, panelWidth, resetPanelWidth, resizePanel } = context.fit\n const sideOpen = context.open[side]\n const collapsed = collapsible !== \"none\" && !sideOpen\n const offcanvas = collapsed && collapsible === \"offcanvas\"\n\n // Only the expanded secondary panel is resizable: the rail is pinned to its\n // own columns, and a collapsed panel has no edge left to grab.\n const resizable =\n side === \"right\" && collapsible === \"offcanvas\" && !collapsed\n\n const resizeStartRef = useRef(0)\n const [resizing, setResizing] = useState(false)\n\n const baseWidth = offcanvas\n ? 0\n : collapsed\n ? \"var(--sidebar-width-icon)\"\n : expandedWidthVar(side)\n // The secondary panel's width is shell state, not panel state: the shell\n // measured it, re-clamps it when the room changes, and hands back the same\n // width after a collapse. Everything else rides the CSS variables, which\n // also covers the server render, where nothing has been measured yet.\n const width = resizable && panelWidth !== null ? panelWidth : baseWidth\n\n const setPanelRef = useCallback(\n (node: HTMLElement | null) => {\n if (typeof ref === \"function\") ref(node)\n else if (ref) ref.current = node\n },\n [ref]\n )\n\n const handleResizeStart = useCallback(() => {\n resizeStartRef.current = panelWidth ?? bounds.min\n setResizing(true)\n }, [bounds.min, panelWidth])\n\n const handleResize = useCallback(\n (_event: PointerEvent, info: PanInfo) => {\n // The handle rides the panel's inner edge, so the panel grows as the\n // pointer travels left. `offset` is measured from the pointer-down\n // point, so the edge tracks it 1:1 instead of accumulating rounding.\n resizePanel(resizeStartRef.current - info.offset.x)\n },\n [resizePanel]\n )\n\n const handleResizeEnd = useCallback(() => setResizing(false), [])\n\n const handleResizeKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const direction =\n event.key === \"ArrowLeft\" ? 1 : event.key === \"ArrowRight\" ? -1 : 0\n if (!direction) return\n\n event.preventDefault()\n const step = event.shiftKey ? RESIZE_STEP_COARSE : RESIZE_STEP\n resizePanel((panelWidth ?? bounds.min) + direction * step)\n },\n [bounds.min, panelWidth, resizePanel]\n )\n\n // The pointer leaves the 2px handle the moment the drag starts, so the\n // cursor and the text selection have to be held on the document instead.\n useEffect(() => {\n if (!resizing) return\n\n const { body } = document\n const previousCursor = body.style.cursor\n const previousUserSelect = body.style.userSelect\n body.style.cursor = \"col-resize\"\n body.style.userSelect = \"none\"\n\n return () => {\n body.style.cursor = previousCursor\n body.style.userSelect = previousUserSelect\n }\n }, [resizing])\n\n // A secondary panel exists only while the viewport can carry it beside the\n // rail and the body at their own floors. Below that there is nothing to dock\n // into, so the panel stands down rather than squeezing the content column —\n // and its trigger stands down with it.\n if (side === \"right\" && !context.fit.fits) return null\n\n if (context.isMobile) return <div>TODO: Create Mobile nav experience</div>\n\n return (\n <motion.aside\n {...props}\n ref={setPanelRef}\n initial={false}\n aria-label={ariaLabel}\n data-slot=\"sidebar\"\n data-state={collapsed ? \"collapsed\" : \"expanded\"}\n data-collapsible={collapsible}\n data-variant={variant}\n data-side={side}\n data-resizing={resizing ? \"\" : undefined}\n animate={{\n width,\n // Swallow the shell's gap-x-2 column gap while off canvas so the\n // shell edge keeps a constant spacing-2 inset whether the panel is\n // open (gap + panel + margin) or collapsed (gap + this).\n ...(side === \"right\"\n ? { marginLeft: offcanvas ? \"-0.5rem\" : \"0rem\" }\n : { marginRight: offcanvas ? \"-0.5rem\" : \"0rem\" }),\n }}\n // A drag has to land on the frame it happened — the morph spring would\n // trail the pointer and keep settling after the handle is released.\n transition={\n resizing || context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION\n }\n style={style}\n className={cn(\n \"group/sidebar relative hidden h-full shrink-0 will-change-[width] md:block\",\n \"peer flex!\",\n side === \"right\" && \"order-last\",\n className\n )}\n >\n {resizable && (\n // The handle occupies the shell's gap-x-2 column gap. It must stay\n // outside the clipping mask below or the gap would never receive\n // hover — clipping cuts hit-testing, not just painting.\n <motion.div\n role=\"separator\"\n aria-label={`Resize ${ariaLabel}`}\n aria-orientation=\"vertical\"\n tabIndex={0}\n className=\"absolute inset-y-0 -left-2 z-10 w-2 cursor-col-resize touch-none\"\n initial=\"idle\"\n // Hover alone would drop the glow the instant the drag leaves the\n // handle, so the gesture pins it open for the whole drag.\n animate={resizing ? \"hover\" : \"idle\"}\n whileHover=\"hover\"\n whileFocus=\"hover\"\n onPanStart={handleResizeStart}\n onPan={handleResize}\n onPanEnd={handleResizeEnd}\n onKeyDown={handleResizeKeyDown}\n // The usual escape hatch out of a width you dragged to.\n onDoubleClick={resetPanelWidth}\n >\n <motion.div\n variants={{ idle: { scaleY: 0 }, hover: { scaleY: 1 } }}\n transition={\n context.reduce\n ? { duration: 0 }\n : { duration: 0.2, ease: EASE_OUT }\n }\n className=\"h-full w-full bg-radial/decreasing from-amber-300/70 to-amber-500/0 to-40%\"\n />\n </motion.div>\n )}\n {/* The aside's own width animation is the whole layout story: the\n inner panel just fills it and fades, so it is masked to the aside's\n box here instead of clipping the aside itself — the aside must stay\n unclipped for the gap handle above to be hoverable. */}\n <div className={\"contents\"}>\n <motion.div\n initial={false}\n animate={{ opacity: offcanvas ? 0 : 1 }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n className={cn(\n \"sticky top-0 flex w-full flex-col overflow-hidden\",\n // Pin the right panel to the aside's trailing edge so the aside's\n // width animation expands the panel out of it instead of\n // revealing a detached strip.\n side === \"right\" && \"ml-auto\",\n\n // Panels fill the shell's container, not the viewport — the shell\n // owns its own scrolling, so a bounded host (docs demo, split\n // view) must bound the panels too. Full-page apps size the shell\n // itself (e.g., h-svh). The bottom gap comes from the shell\n // container's padding, so panels only carry their top offset.\n variant === \"floating\" && \"mx-2 mt-2 h-[calc(100%-0.5rem)]\",\n variant === \"inset\" && \"mt-2 h-[calc(100%-0.5rem)]\",\n\n panelClassName\n )}\n >\n <AnimatedSidebarPanelContext.Provider\n value={{ collapsed, collapsible, side }}\n >\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </div>\n </motion.aside>\n )\n}\n","/**\n * The shell's layout arithmetic, as plain functions over px.\n *\n * Nothing here touches React or the DOM. This module IS the contract of who\n * gets which column, which keeps the rule unit-testable on its own and lets\n * the shell-fit atoms (`shellFitFitsAtom`, `shellFitPanelWidthAtom`) call it\n * without restating it: `useShellFit` only supplies the measurements.\n */\n\n/** The px the shell lays itself out with. Every field is measured from a CSS\n * variable (see `SHELL_WIDTHS`), never hard-coded, so a consumer's override\n * flows straight through the rule. */\nexport interface ShellMetrics {\n /** What the left rail occupies right now — its expanded width, its icon\n * width, or 0 when there is no rail at all (or it is off canvas). */\n rail: number\n /** The floor the body refuses to go below. */\n insetMin: number\n /** The secondary panel's floor, which is also the width it opens at. */\n panelMin: number\n /** The viewport all three columns share. */\n viewport: number\n /** px the shell's own frame eats before any column gets a share: its\n * padding, plus the gap between columns.\n *\n * Deliberately absent from `fitsPanel` — that rule is stated against the raw\n * viewport — but subtracted from the resize ceiling, where ignoring it lets\n * a full-width drag push the row past the shell by exactly this much. */\n chrome: number\n}\n\n/** px the shell needs before a secondary panel can exist: the rail as it\n * stands, plus the body and the panel at their own floors. */\nexport function requiredWidth({ rail, insetMin, panelMin }: ShellMetrics) {\n return rail + insetMin + panelMin\n}\n\n/**\n * Whether the shell can hold a secondary panel at all. Strictly `<`: a shell\n * that fits its columns exactly has no room left to give one.\n *\n * An unmeasurable shell fails open. A server render, a `display: none` host\n * or a test environment with no layout engine all report 0, and a panel must\n * never disappear over a reading the layout could not produce.\n */\nexport function fitsPanel(metrics: ShellMetrics) {\n if (metrics.viewport <= 0 || metrics.panelMin <= 0) return true\n return requiredWidth(metrics) < metrics.viewport\n}\n\n/** How wide the secondary panel may be: never under its own floor, never past\n * the slack the body holds above its floor. `max` never drops below `min`, so\n * a shell that does not fit reports a degenerate range instead of an inverted\n * one — `fitsPanel` is what hides the panel, not a negative bound. */\nexport function panelBounds(metrics: ShellMetrics) {\n const { chrome, insetMin, panelMin, rail, viewport } = metrics\n return {\n min: panelMin,\n max: Math.max(panelMin, viewport - chrome - rail - insetMin),\n }\n}\n\nexport function clampPanelWidth(width: number, metrics: ShellMetrics) {\n const { min, max } = panelBounds(metrics)\n return Math.min(Math.max(width, min), max)\n}\n\n/** Resizes fire per pointer move and per resize event, most of them landing\n * on the same numbers — comparing fields keeps those from re-rendering the\n * whole shell. */\nexport function metricsEqual(a: ShellMetrics, b: ShellMetrics) {\n return (\n a.rail === b.rail &&\n a.insetMin === b.insetMin &&\n a.panelMin === b.panelMin &&\n a.viewport === b.viewport &&\n a.chrome === b.chrome\n )\n}\n","/**\n * Per-instance Jotai state for the shell's layout fit.\n *\n * Every atom is a module-level family keyed by a shell id, so one\n * `ExegiaProvider` at the app root is enough: several shells coexist in one\n * store without a provider each, and a title bar, a command palette or a\n * layout test can drive one by id without holding its controller.\n *\n * Unlike the tree, this feature has no controlled props — the shell measures\n * itself, nobody hands it a viewport. So, like `blocks/auth`'s coordination\n * layer, there is no config atom, no projection and no owned-* loop guard.\n * `useShellFit` is the only writer of `metrics`, and that write is silent by\n * design: a resize is not an event an app subscribed to.\n *\n * The rule itself lives in `shell-metrics.ts` and is called from here, so the\n * arithmetic has one home whether it is read through a hook or a store.\n */\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport {\n clampPanelWidth,\n fitsPanel,\n metricsEqual,\n panelBounds,\n type ShellMetrics,\n} from \"./shell-metrics\"\nimport type {\n ShellFitInstanceId,\n ShellFitPanelBounds,\n ShellFitSeed,\n ShellFitState,\n} from \"./type\"\n\n/** An unmeasured shell. Zeroes read as \"no layout yet\", which the rule fails\n * open on rather than hiding a panel over a reading it never took. */\nconst NO_METRICS: ShellMetrics = {\n rail: 0,\n insetMin: 0,\n panelMin: 0,\n viewport: 0,\n chrome: 0,\n}\n\n/** A panel that mounts at `--panel-width`. */\nconst DEFAULT_SHELL_FIT_SEED: ShellFitSeed = { panelWidth: null }\n\nconst NO_BOUNDS: ShellFitPanelBounds = { min: 0, max: 0 }\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: ShellFitInstanceId) => AtomType) & {\n remove: (id: ShellFitInstanceId) => void\n}\n\n/** Every family, so `removeShellFitInstance` can drop an id from all of them. */\nconst families: { remove: (id: ShellFitInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ShellFitInstanceId) => AtomType) {\n const cache = new Map<ShellFitInstanceId, AtomType>()\n const family = ((id: ShellFitInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ShellFitInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ShellFitInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ShellFitInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\n/** The shell's own measurement of its columns. `useShellFit` is the only\n * writer; read `shellFitMeasuredAtom` to get it with the \"no layout yet\" case\n * already resolved. */\nexport const shellFitMetricsAtom = stateFamily<ShellMetrics>(\n \"metrics\",\n NO_METRICS\n)\n\n/** The width the user dragged to, before clamping — null while the panel sits\n * at `--panel-width`. Read `shellFitPanelWidthAtom` for the width the panel\n * actually renders at: clamping on read is what lets a narrowing viewport\n * pull the panel down without forgetting the width they asked for. */\nexport const shellFitRequestedWidthAtom = stateFamily<number | null>(\n \"requestedWidth\",\n null\n)\n\nconst shellFitSeedAtom = stateFamily<ShellFitSeed>(\n \"seed\",\n DEFAULT_SHELL_FIT_SEED\n)\nconst shellFitInitializedAtom = stateFamily<boolean>(\"initialized\", false)\n\n/** The metrics, or null when the shell has no layout to report — a server\n * render, a `display: none` host, a test with no layout engine. A zero is not\n * a width, and treating it as one would pin the panel to nothing. */\nexport const shellFitMeasuredAtom = readFamily<ShellMetrics | null>(\n \"measured\",\n (get, id) => {\n const metrics = get(shellFitMetricsAtom(id))\n return metrics.panelMin > 0 ? metrics : null\n }\n)\n\n/** Whether the shell can hold a secondary panel at all. */\nexport const shellFitFitsAtom = readFamily(\"fits\", (get, id) =>\n fitsPanel(get(shellFitMetricsAtom(id)))\n)\n\n/** The range a resize may land in. */\nexport const shellFitPanelBoundsAtom = readFamily<ShellFitPanelBounds>(\n \"panelBounds\",\n (get, id) => {\n const measured = get(shellFitMeasuredAtom(id))\n return measured ? panelBounds(measured) : NO_BOUNDS\n }\n)\n\n/** The width the secondary panel renders at, or null before the first\n * measurement, where the caller falls back to `--panel-width`. */\nexport const shellFitPanelWidthAtom = readFamily<number | null>(\n \"panelWidth\",\n (get, id) => {\n const measured = get(shellFitMeasuredAtom(id))\n if (!measured) return null\n const requested = get(shellFitRequestedWidthAtom(id))\n return clampPanelWidth(requested ?? measured.panelMin, measured)\n }\n)\n\n/** The whole fit of one shell. This changes on every measurement, so a\n * component that reads one field should subscribe to that field's atom\n * instead: `useAtomValue(shellFitFitsAtom(\"app-shell\"))`. */\nexport const shellFitStateAtom = readFamily<ShellFitState>(\n \"state\",\n (get, id) => ({\n metrics: get(shellFitMeasuredAtom(id)),\n fits: get(shellFitFitsAtom(id)),\n panelWidth: get(shellFitPanelWidthAtom(id)),\n bounds: get(shellFitPanelBoundsAtom(id)),\n })\n)\n\n/** @internal The measurement's way in. Silent, and inert when the numbers did\n * not move — a resize event that changes nothing must not re-render a shell. */\nexport const measureShellFitAtom = actionFamily<[metrics: ShellMetrics]>(\n \"measure\",\n (get, set, id, metrics) => {\n if (metricsEqual(get(shellFitMetricsAtom(id)), metrics)) return\n set(shellFitMetricsAtom(id), metrics)\n }\n)\n\n/** Resize the secondary panel. Clamped on the way in, so a drag past the\n * gutter parks at the bound instead of banking travel it has to give back —\n * and a caller with no idea how wide the shell is can still ask for 900. */\nexport const resizeShellPanelAtom = actionFamily<[width: number]>(\n \"resizePanel\",\n (get, set, id, width) => {\n const measured = get(shellFitMeasuredAtom(id))\n set(\n shellFitRequestedWidthAtom(id),\n measured ? clampPanelWidth(width, measured) : width\n )\n }\n)\n\n/** Back to the width the shell mounted with — `defaultPanelWidth`, or\n * `--panel-width` when there was none. */\nexport const resetShellPanelWidthAtom = actionFamily<[]>(\n \"resetPanelWidth\",\n (get, set, id) => {\n set(shellFitRequestedWidthAtom(id), get(shellFitSeedAtom(id)).panelWidth)\n }\n)\n\n/** @internal Seed the instance once. A seed describes the mount, not every\n * render, so a `defaultPanelWidth` that arrives later never overwrites a\n * width the user dragged to. */\nexport const mountShellFitAtom = actionFamily<[seed: ShellFitSeed]>(\n \"mount\",\n (get, set, id, seed) => {\n if (get(shellFitInitializedAtom(id))) return\n set(shellFitInitializedAtom(id), true)\n set(shellFitSeedAtom(id), seed)\n set(shellFitRequestedWidthAtom(id), seed.panelWidth)\n }\n)\n\n/** Drop every atom for `id`. `useShellFit` calls this on unmount for shells it\n * keyed itself; an explicit `shellId` is the app's key and outlives its\n * component, so a resized panel survives a route change. */\nexport function removeShellFitInstance(id: ShellFitInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport { useIsomorphicLayoutEffect } from \"motion/react\"\n\nimport {\n measureShellFitAtom,\n mountShellFitAtom,\n removeShellFitInstance,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitStateAtom,\n} from \"./shell-fit-atom\"\nimport { fitsPanel, type ShellMetrics } from \"./shell-metrics\"\nimport type {\n ShellFitController,\n ShellFitSeed,\n UseShellFitOptions,\n} from \"./type\"\nimport { resolveLength } from \"./utils\"\n\n/** Read the shell's columns out of the DOM. The widths come from CSS\n * variables; the rail's share comes from its own state, not its box, so a\n * fold counts the moment React commits it rather than a frame later when the\n * width animation has moved. */\nfunction readMetrics(host: HTMLElement, railOpen: boolean): ShellMetrics {\n // Whether a shell has a rail at all is the caller's composition, so it is\n // read off the DOM rather than tracked in state.\n const rail = host.querySelector<HTMLElement>(\n '[data-slot=\"sidebar\"][data-side=\"left\"]'\n )\n const collapsible = rail?.dataset.collapsible\n\n const frame = getComputedStyle(host)\n const gap = Number.parseFloat(frame.columnGap) || 0\n\n return {\n rail: !rail\n ? 0\n : railOpen || collapsible === \"none\"\n ? resolveLength(host, \"var(--sidebar-width)\")\n : collapsible === \"offcanvas\"\n ? 0\n : resolveLength(host, \"var(--sidebar-width-icon)\"),\n insetMin: resolveLength(host, \"var(--inset-min-width)\"),\n panelMin: resolveLength(host, \"var(--panel-width)\"),\n viewport: window.innerWidth,\n chrome:\n (Number.parseFloat(frame.paddingLeft) || 0) +\n (Number.parseFloat(frame.paddingRight) || 0) +\n gap * Math.max(0, host.children.length - 1),\n }\n}\n\n/**\n * Measures the shell and decides what the secondary panel may do: whether it\n * exists at all, and how wide it may be dragged.\n *\n * The three things that move the answer are all observed here — the viewport\n * (`resize`), the rail's fold (`railOpen`, a render input) and the user's own\n * drag (`resizePanel`) — so no caller has to re-derive it. The measurement is\n * the only thing this hook keeps to itself: the numbers land in the shell-fit\n * atoms keyed by `shellId`, so anything under `ExegiaProvider` can read the\n * verdict (`useShellFitState`) or move the panel (`useShellFitActions`)\n * without holding this controller.\n */\nexport function useShellFit({\n shellId: explicitId,\n hostRef,\n railOpen,\n defaultPanelWidth,\n onUnfit,\n}: UseShellFitOptions): ShellFitController {\n // A generated key isolates unnamed shells from each other; an explicit\n // `shellId` is the app's handle on this one.\n const generatedId = useId()\n const shellId = explicitId ?? generatedId\n\n // Read once: `defaultPanelWidth` describes the mount, not every render.\n const [seed] = useState<ShellFitSeed>(() => ({\n panelWidth: defaultPanelWidth ?? null,\n }))\n\n const mount = useSetAtom(mountShellFitAtom(shellId))\n const measure = useSetAtom(measureShellFitAtom(shellId))\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n const resetPanelWidth = useSetAtom(resetShellPanelWidthAtom(shellId))\n\n // Before paint, and before the first measurement below, so a seeded width\n // is in the store by the time the panel first reads its width.\n useIsomorphicLayoutEffect(() => {\n mount(seed)\n }, [mount, seed])\n\n // The listener below is bound once per fold, so the callback rides a ref\n // rather than rebinding it whenever a consumer passes a fresh arrow.\n const onUnfitRef = useRef(onUnfit)\n useIsomorphicLayoutEffect(() => {\n onUnfitRef.current = onUnfit\n })\n\n useIsomorphicLayoutEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n const takeMeasurement = () => {\n const next = readMetrics(host, railOpen)\n measure(next)\n if (!fitsPanel(next)) onUnfitRef.current?.()\n }\n\n // Measured before paint so a shell that cannot hold the panel never\n // flashes one, and re-measured on every fold because the rail's column is\n // part of the room the panel needs.\n takeMeasurement()\n window.addEventListener(\"resize\", takeMeasurement)\n return () => window.removeEventListener(\"resize\", takeMeasurement)\n }, [hostRef, railOpen, measure])\n\n // A shell the hook keyed is scrap once its component goes. An explicit\n // `shellId` is the app's key and outlives the mount — that is what lets a\n // dragged width survive a route change.\n useEffect(() => {\n if (explicitId !== undefined) return\n return () => removeShellFitInstance(shellId)\n }, [shellId, explicitId])\n\n const state = useAtomValue(shellFitStateAtom(shellId))\n\n return useMemo<ShellFitController>(\n () => ({ shellId, ...state, resizePanel, resetPanelWidth }),\n [shellId, state, resizePanel, resetPanelWidth]\n )\n}\n","import { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\"\nimport { useIsomorphicLayoutEffect, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils.ts\"\nimport type { AnimatedSidebarProviderProps, SidebarSide } from \"./type\"\nimport { useShellFit } from \"./use-shell-fit\"\nimport {\n AnimatedSidebarContext,\n SHELL_WIDTHS,\n SIDEBAR_KEYBOARD_SHORTCUT,\n useIsMobile,\n} from \"./utils\"\n\nexport function AnimatedPanelProvider({\n children,\n shellId,\n defaultPanelWidth,\n open,\n defaultOpen,\n onOpenChange,\n openMobile,\n defaultOpenMobile,\n onOpenMobileChange,\n onNarrowChange,\n className,\n style,\n ...props\n}: AnimatedSidebarProviderProps) {\n const [internalOpen, setInternalOpen] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpen?.left ?? true,\n right: defaultOpen?.right ?? false,\n }))\n const [internalOpenMobile, setInternalOpenMobile] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpenMobile?.left ?? false,\n right: defaultOpenMobile?.right ?? false,\n }))\n const isMobile = useIsMobile()\n const reduce = useReducedMotion() ?? false\n const generatedId = useId()\n const leftTriggerRef = useRef<HTMLButtonElement>(null)\n const rightTriggerRef = useRef<HTMLButtonElement>(null)\n const wrapperRef = useRef<HTMLDivElement>(null)\n // The narrow gate below is consulted by the setters, but the verdict comes\n // from `useShellFit` further down — which needs those very setters to retire\n // the panel. A ref unwinds the cycle: a setter only ever runs from an event,\n // by which time the layout effect has published the current verdict.\n const fitsRef = useRef(true)\n\n // Per-side controlled/uncontrolled merge — a side is controlled exactly\n // when its key is present on the controlled record.\n const controlledLeft = open?.left\n const controlledRight = open?.right\n const controlledMobileLeft = openMobile?.left\n const controlledMobileRight = openMobile?.right\n\n const openState = useMemo<Record<SidebarSide, boolean>>(\n () => ({\n left: controlledLeft ?? internalOpen.left,\n right: controlledRight ?? internalOpen.right,\n }),\n [controlledLeft, controlledRight, internalOpen]\n )\n const openMobileState = useMemo<Record<SidebarSide, boolean>>(\n () => ({\n left: controlledMobileLeft ?? internalOpenMobile.left,\n right: controlledMobileRight ?? internalOpenMobile.right,\n }),\n [controlledMobileLeft, controlledMobileRight, internalOpenMobile]\n )\n\n // The right panel is not on screen while the shell is too narrow to hold\n // it, so opening it would only ever surface later as a panel nobody asked\n // for. Closing always goes through — that is how state left over from a\n // wider viewport clears.\n const setOpen = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && !fitsRef.current) return\n\n const controlled = side === \"left\" ? controlledLeft : controlledRight\n if (controlled === undefined) {\n setInternalOpen((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n }\n onOpenChange?.(nextOpen, side)\n },\n [controlledLeft, controlledRight, onOpenChange]\n )\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && !fitsRef.current) return\n\n const controlled =\n side === \"left\" ? controlledMobileLeft : controlledMobileRight\n if (controlled === undefined) {\n setInternalOpenMobile((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n }\n onOpenMobileChange?.(nextOpen, side)\n },\n [controlledMobileLeft, controlledMobileRight, onOpenMobileChange]\n )\n\n const toggleSidebar = useCallback(\n (side: SidebarSide) => {\n if (isMobile) setOpenMobile(!openMobileState[side], side)\n else setOpen(!openState[side], side)\n },\n [isMobile, openMobileState, openState, setOpen, setOpenMobile]\n )\n\n const triggerRefs = useMemo(\n () => ({ left: leftTriggerRef, right: rightTriggerRef }),\n []\n )\n\n // A measurement that lands on \"no room\" retires the right panel's open\n // state instead of parking it: a panel that survived the crossing would\n // spring back the moment the viewport widened, long after the user asked\n // for it. Closing is the one write the narrow gate lets through, and the\n // guards keep a repeated verdict from re-reporting a panel already shut.\n //\n // It rides a ref so `useShellFit` can call the latest one from a listener\n // it bound once, and it is a layout effect declared FIRST so the ref is\n // filled before that listener takes its opening measurement.\n const retireRightPanelRef = useRef<() => void>(() => {})\n useIsomorphicLayoutEffect(() => {\n retireRightPanelRef.current = () => {\n if (openState.right) setOpen(false, \"right\")\n if (openMobileState.right) setOpenMobile(false, \"right\")\n }\n })\n const retireRightPanel = useCallback(() => retireRightPanelRef.current(), [])\n\n // Everything about the shell's columns — whether a secondary panel fits,\n // how wide it is, how far it may be dragged — lives in this one hook, and\n // in the shell-fit atoms it writes to under `shellId`. The rail's fold is an\n // input because its column is part of the room the panel needs.\n const fit = useShellFit({\n shellId,\n hostRef: wrapperRef,\n railOpen: openState.left,\n defaultPanelWidth,\n onUnfit: retireRightPanel,\n })\n const isNarrow = !fit.fits\n useIsomorphicLayoutEffect(() => {\n fitsRef.current = fit.fits\n })\n\n // The verdict has to travel up to whoever renders the provider —\n // useShellPanels, a title bar — since context only flows down. The\n // listener above is bound once, so the callback rides a ref rather than\n // rebinding it whenever a consumer passes a fresh arrow.\n const onNarrowChangeRef = useRef(onNarrowChange)\n useEffect(() => {\n onNarrowChangeRef.current = onNarrowChange\n })\n\n // Only real crossings are news: a resize that leaves the verdict alone is\n // silent, and so is the mount default the consumer already holds.\n const reportedNarrowRef = useRef(false)\n useEffect(() => {\n if (reportedNarrowRef.current === isNarrow) return\n reportedNarrowRef.current = isNarrow\n onNarrowChangeRef.current?.(isNarrow)\n }, [isNarrow])\n\n useEffect(() => {\n const handleShortcut = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault()\n toggleSidebar(\"left\")\n }\n }\n\n window.addEventListener(\"keydown\", handleShortcut)\n return () => window.removeEventListener(\"keydown\", handleShortcut)\n }, [toggleSidebar])\n\n return (\n <AnimatedSidebarContext.Provider\n value={{\n isMobile,\n fit,\n layoutId: `${generatedId}-active`,\n open: openState,\n openMobile: openMobileState,\n reduce,\n setOpen,\n setOpenMobile,\n toggleSidebar,\n triggerRefs,\n }}\n >\n <div\n {...props}\n ref={wrapperRef}\n data-slot=\"sidebar-wrapper\"\n data-narrow={isNarrow ? \"\" : undefined}\n data-state-left={openState.left ? \"expanded\" : \"collapsed\"}\n data-state-right={openState.right ? \"expanded\" : \"collapsed\"}\n style={{ ...SHELL_WIDTHS, ...style }}\n className={cn(\n \"group/sidebar-wrapper flex w-full min-w-0 gap-x-2\",\n className\n )}\n >\n {children}\n </div>\n </AnimatedSidebarContext.Provider>\n )\n}\n","import { forwardRef } from \"react\"\nimport { Button } from \"@/components/ui/button\"\nimport { useAnimatedSidebar } from \"./utils\"\nimport type { AnimatedSidebarTriggerProps } from \"./type\"\n\nexport const AnimatedPanelTrigger = forwardRef<\n HTMLButtonElement,\n AnimatedSidebarTriggerProps\n>(function AnimatedSidebarTrigger(\n { onClick, side = \"left\", type = \"button\", ...props },\n forwardedRef\n) {\n const context = useAnimatedSidebar()\n const expanded = context.isMobile\n ? context.openMobile[side]\n : context.open[side]\n const triggerRef = context.triggerRefs[side]\n\n // The right panel drops out of a viewport too narrow to hold it, so its\n // toggle would otherwise sit in the header driving nothing.\n if (side === \"right\" && !context.fit.fits) return null\n\n return (\n <Button\n {...props}\n ref={(node) => {\n triggerRef.current = node\n if (typeof forwardedRef === \"function\") forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }}\n type={type}\n variant=\"ghost\"\n size=\"icon-xl\"\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n aria-expanded={expanded}\n data-slot=\"sidebar-trigger\"\n data-side={side}\n data-state={expanded ? \"expanded\" : \"collapsed\"}\n onClick={(event) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n context.toggleSidebar(side)\n }}\n />\n )\n})\n","import { forwardRef } from \"react\"\nimport { motion } from \"motion/react\"\nimport { cn } from \"@/lib/utils.ts\"\nimport type { AnimatedSidebarInsetProps } from \"./type\"\n\nexport const AnimatedPanelInset = forwardRef<\n HTMLElement,\n AnimatedSidebarInsetProps\n>(function AnimatedSidebarInset({ className, ...props }, forwardedRef) {\n return (\n <motion.main\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-inset\"\n className={cn(\n // The body takes every column the panels leave (flex-1 = width 100%)\n // but never yields past its own floor: a resized panel may only take\n // the slack above --inset-min-width, and the shell drops the secondary\n // panel entirely once even that no longer fits.\n \"relative flex min-w-(--inset-min-width) flex-1 flex-col bg-neutral-50 dark:bg-neutral-900\",\n \"outline-offset-0.5 overflow-hidden border-t-3 border-white outline-neutral-100 dark:border-neutral-800 dark:inset-ring-black\",\n \"rounded-lg shadow-md shadow-neutral-200 dark:shadow-neutral-950\",\n className\n )}\n />\n )\n})\n","\"use client\"\n\nimport { MotionIcon } from \"motion-icons-react\"\nimport * as React from \"react\"\n\nimport { AnimatedPanel } from \"./animated-panel.tsx\"\nimport { cn } from \"@/lib/utils\"\nimport type { ShellLayoutProps, ShellPanelControlProps } from \"./type\"\nimport { TITLE_BAR_HEIGHT } from \"./utils\"\nimport type { ClassNameValue } from \"tailwind-merge\"\nimport { AnimatedPanelProvider } from \"./animated-panel-provider.tsx\"\nimport { AnimatedPanelTrigger } from \"./animated-panel-trigger.tsx\"\nimport { AnimatedPanelInset } from \"./animated-panel-inset.tsx\"\n\nexport function ShellLayout({\n children,\n variant = \"desktop\",\n panels,\n className,\n header,\n defaultOpen,\n ...panelControlProps\n}: ShellLayoutProps): React.ReactElement {\n const background: ClassNameValue = `bg-linear-to-tr/increasing from-neutral-200 via-neutral-100 to-stone-200 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950`\n\n // Each panel seeds its own side's initial state (`defaultOpen ?? open`);\n // an explicit `defaultOpen` record — usually from useShellPanels — wins\n // per side.\n const initialOpen: ShellPanelControlProps[\"defaultOpen\"] = {\n ...(panels?.left && {\n left: panels.left.defaultOpen ?? true,\n }),\n ...(panels?.right && {\n right: panels.right.defaultOpen ?? false,\n }),\n ...defaultOpen,\n }\n\n return (\n <AnimatedPanelProvider\n {...panelControlProps}\n defaultOpen={initialOpen}\n className={cn(\n \"relative h-full min-h-0 px-2 pb-2\",\n variant === \"web\" && \"pt-2\",\n className,\n background\n )}\n style={{\n paddingTop: variant === \"desktop\" ? TITLE_BAR_HEIGHT : 0,\n }}\n >\n {panels?.left?.component && (\n <AnimatedPanel\n ariaLabel=\"Primary navigation\"\n collapsible=\"icon\"\n role=\"navigation\"\n variant=\"inset\"\n >\n {panels?.left?.component}\n </AnimatedPanel>\n )}\n\n <AnimatedPanelInset>\n <header className=\"flex h-12 flex-row! items-center justify-between gap-2 border-b px-2\">\n {panels?.left?.component && (\n <div className=\"flex min-w-0 shrink-0 items-center justify-start gap-2\">\n <AnimatedPanelTrigger side=\"left\">\n <MotionIcon name=\"PanelLeft\" size={24} animation=\"press\" />\n </AnimatedPanelTrigger>\n </div>\n )}\n {header && (\n <div className=\"flex w-full flex-1 items-center\">{header}</div>\n )}\n {panels?.right?.component && (\n <div className=\"flex w-full shrink items-center justify-end gap-2\">\n <AnimatedPanelTrigger aria-label=\"Toggle panel\" side=\"right\">\n <MotionIcon\n className=\"opacity-70\"\n name=\"PanelRight\"\n size={24}\n />\n </AnimatedPanelTrigger>\n </div>\n )}\n </header>\n <div className=\"min-h-24 flex-1 overflow-auto\">{children}</div>\n </AnimatedPanelInset>\n\n {panels?.right?.component && (\n <AnimatedPanel\n ariaLabel={panels.right.name ?? \"Secondary panel\"}\n // Below md the panel is portal led over the page, so it carries the\n // surface itself; the desktop rail keeps it on the inner panel.\n className={cn(\n \"bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900\",\n \"outline-offset-0.5 border-t-3 border-white outline-neutral-100 dark:inset-ring-black\",\n \"rounded-lg shadow-md shadow-neutral-200 dark:shadow-neutral-950\"\n )}\n collapsible=\"offcanvas\"\n role=\"complementary\"\n side=\"right\"\n variant=\"inset\"\n >\n {panels.right.component}\n </AnimatedPanel>\n )}\n </AnimatedPanelProvider>\n )\n}\n","\"use client\"\n\nimport { useCallback, useEffect, useId, useMemo, useState } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n removeShellFitInstance,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitPanelWidthAtom,\n} from \"./shell-fit-atom\"\nimport type {\n ShellPanelControlProps,\n ShellPanelControls,\n SidebarSide,\n UseShellPanelsOptions,\n} from \"./type\"\n\n/**\n * Owns the open/close state of the shell's panels, keyed by side, and\n * reports every change through a single `onPanelChange(open, side)`\n * callback. Spread the returned `providerProps` onto ShellLayout; the\n * setters and `toggle` are for UI that lives outside the shell (title-bar\n * buttons, command palette, shortcuts).\n *\n * The way back down is the store: `providerProps` carries a `shellId`, the\n * shell files its measurement under it, and this hook reads `isNarrow` and\n * `panelWidth` straight out of those atoms — so outside UI stands down with\n * the panel instead of measuring `--sidebar-width` a second time. Name the\n * `shellId` and any component below `ExegiaProvider` can do the same with\n * `useShellFitState(shellId)`.\n *\n * Call it under the same `ExegiaProvider` as the shell it drives (or under\n * none at all, on both sides): mounted above the provider it would read\n * Jotai's default store while the shell writes to the provider's.\n */\nexport function useShellPanels({\n shellId: explicitId,\n defaultOpen,\n defaultOpenMobile,\n defaultPanelWidth,\n onPanelChange,\n}: UseShellPanelsOptions = {}): ShellPanelControls {\n // The hook, not the provider, keys the shell: it renders above the provider\n // and has to read the same atoms the provider writes. Whoever generates the\n // key drops it — the provider treats a passed-in id as the app's and leaves\n // it alone on unmount.\n const generatedId = useId()\n const shellId = explicitId ?? generatedId\n useEffect(() => {\n if (explicitId !== undefined) return\n return () => removeShellFitInstance(shellId)\n }, [shellId, explicitId])\n\n const [open, setOpenState] = useState<Record<SidebarSide, boolean>>(() => ({\n left: defaultOpen?.left ?? true,\n right: defaultOpen?.right ?? false,\n }))\n const [openMobile, setOpenMobileState] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpenMobile?.left ?? false,\n right: defaultOpenMobile?.right ?? false,\n }))\n\n // Reads false until the shell has measured itself — an unmeasured shell\n // fails open, so nothing out here stands down over a reading that has not\n // happened yet.\n const fits = useAtomValue(shellFitFitsAtom(shellId))\n const isNarrow = !fits\n const panelWidth = useAtomValue(shellFitPanelWidthAtom(shellId))\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n\n // The shell drops the right panel when the viewport cannot hold it, so\n // opening it from out here would only surface later as a panel nobody\n // asked for. Closing always goes through — that is how state left over\n // from a wider viewport clears.\n const setOpen = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && isNarrow) return\n\n setOpenState((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n onPanelChange?.(nextOpen, side)\n },\n [isNarrow, onPanelChange]\n )\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && isNarrow) return\n\n setOpenMobileState((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n onPanelChange?.(nextOpen, side)\n },\n [isNarrow, onPanelChange]\n )\n\n const toggle = useCallback(\n (side: SidebarSide) => setOpen(!open[side], side),\n [open, setOpen]\n )\n\n const providerProps = useMemo<ShellPanelControlProps>(\n () => ({\n shellId,\n defaultPanelWidth,\n open,\n onOpenChange: setOpen,\n openMobile,\n onOpenMobileChange: setOpenMobile,\n }),\n [shellId, defaultPanelWidth, open, openMobile, setOpen, setOpenMobile]\n )\n\n return {\n shellId,\n isNarrow,\n panelWidth,\n resizePanel,\n open,\n openMobile,\n setOpen,\n setOpenMobile,\n toggle,\n providerProps,\n }\n}\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitStateAtom,\n} from \"./shell-fit-atom\"\nimport type { ShellFitActions, ShellFitInstanceId, ShellFitState } from \"./type\"\n\n/**\n * Read the fit of the shell registered under `shellId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { fits, panelWidth } = useShellFitState(\"app-shell\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on every\n * measurement. A component that reads one field should subscribe to that\n * field's atom instead: `useAtomValue(shellFitFitsAtom(\"app-shell\"))`.\n */\nexport function useShellFitState(shellId: ShellFitInstanceId): ShellFitState {\n return useAtomValue(shellFitStateAtom(shellId))\n}\n\n/**\n * Drive the secondary panel of the shell registered under `shellId` from\n * anywhere. Writes only — the caller never re-renders when the shell moves,\n * so this is what a command palette or a keyboard shortcut should reach for.\n *\n * ```tsx\n * const shell = useShellFitActions(\"app-shell\")\n * <Button onClick={() => shell.resizePanel(480)}>Wide inspector</Button>\n * ```\n */\nexport function useShellFitActions(\n shellId: ShellFitInstanceId\n): ShellFitActions {\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n const resetPanelWidth = useSetAtom(resetShellPanelWidthAtom(shellId))\n\n return useMemo(\n () => ({ resizePanel, resetPanelWidth }),\n [resizePanel, resetPanelWidth]\n )\n}\n","/** Icon-rail width in px (the rail sits directly on the desktop backdrop). */\nexport const SCAFFOLD_SIDEBAR_WIDTH = 64\n\n/** Inspector drawer width in px. */\nexport const SCAFFOLD_INSPECTOR_WIDTH = 272\n\n/** Most panels the canvas holds at once — omit Actions' `onAdd` when the\n * count reaches it so the Add segment hides. */\nexport const SCAFFOLD_PANEL_CAPACITY = 3\n\n/** Narrowest a panel may render, in px. When the canvas can't grant every\n * panel this width, the scaffold hides panels until the rest fit. */\nexport const SCAFFOLD_PANEL_MIN_WIDTH = 320\n\n/** Gap in px between side-by-side panels on the canvas (`gap-2`). */\nexport const SCAFFOLD_CANVAS_GAP = 8\n\n/** Gap in px between the drawer/actions and the viewport edges. */\nexport const SCAFFOLD_EDGE_GUTTER = 10\n\n/** Vertical room in px reserved above the canvas for the actions cluster. */\nexport const SCAFFOLD_HEADER_HEIGHT = 52\n\n/** Height in px of a panel's secondary strip. */\nexport const SCAFFOLD_SECONDARY_HEIGHT = 52\n\n/** Gap in px between a panel's primary surface and its secondary strip. */\nexport const SCAFFOLD_PANEL_GAP = 10\n\n/** How long the seam menu lingers expanded after the pointer leaves it (ms)\n * before it collapses back to the compact toggle. The timer keeps counting\n * even when the pointer leaves the window entirely. */\nexport const SCAFFOLD_MENU_COLLAPSE_DELAY = 4000\n\n/** Morph duration in seconds for drawer slides and panel layout shifts. */\nexport const SCAFFOLD_MORPH_DURATION = 0.3\n\n/** `--ease-smooth-out` as a motion/react easing tuple. */\nexport const SCAFFOLD_EASE = [0.22, 1, 0.36, 1] as const\n","import type { Variants } from \"motion/react\"\nimport type { ClassNameValue } from \"tailwind-merge\"\nimport type {\n ScaffoldPanelVisibility,\n TSubPanelVariant,\n} from \"@/components/blocks/scaffold/type.ts\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport {\n SCAFFOLD_CANVAS_GAP,\n SCAFFOLD_PANEL_CAPACITY,\n SCAFFOLD_PANEL_MIN_WIDTH,\n} from \"./constants\"\n\n/**\n * How many panels fit on a canvas of `width` px, granting each\n * `SCAFFOLD_PANEL_MIN_WIDTH` plus the gaps between them. Clamped to\n * [1, SCAFFOLD_PANEL_CAPACITY]; an unmeasured canvas (`null`) fits the cap.\n */\nexport function getPanelCapacity(width: number | null): number {\n if (width === null) return SCAFFOLD_PANEL_CAPACITY\n const fits = Math.floor(\n (width + SCAFFOLD_CANVAS_GAP) /\n (SCAFFOLD_PANEL_MIN_WIDTH + SCAFFOLD_CANVAS_GAP)\n )\n return Math.max(1, Math.min(SCAFFOLD_PANEL_CAPACITY, fits))\n}\n\n/** @internal An untracked scaffold: nothing registered, nothing hidden. */\nexport const EMPTY_SCAFFOLD_VISIBILITY: ScaffoldPanelVisibility = {\n visibleOrder: [],\n autoHidden: [],\n userHidden: [],\n}\n\n/**\n * @internal Fold the registered ids and current capacity into a settled\n * visibility: prune departed panels, admit new ones, evict the\n * least-recently-activated visible panels past capacity, and restore\n * auto-hidden ones when room returns. Returns `prev` untouched when nothing\n * changes, so callers can compare identities instead of contents.\n */\nexport function reconcileVisibility(\n prev: ScaffoldPanelVisibility,\n ids: readonly string[],\n capacity: number\n): ScaffoldPanelVisibility {\n const known = new Set(ids)\n const visibleOrder = prev.visibleOrder.filter((id) => known.has(id))\n const autoHidden = prev.autoHidden.filter((id) => known.has(id))\n const userHidden = prev.userHidden.filter((id) => known.has(id))\n\n const tracked = new Set([...visibleOrder, ...autoHidden, ...userHidden])\n for (const id of ids) if (!tracked.has(id)) visibleOrder.push(id)\n\n while (visibleOrder.length > capacity && visibleOrder.length > 1) {\n autoHidden.push(visibleOrder.shift() as string)\n }\n while (visibleOrder.length < capacity && autoHidden.length > 0) {\n visibleOrder.push(autoHidden.pop() as string)\n }\n\n const unchanged =\n visibleOrder.join(\" \") === prev.visibleOrder.join(\" \") &&\n autoHidden.join(\" \") === prev.autoHidden.join(\" \") &&\n userHidden.join(\" \") === prev.userHidden.join(\" \")\n return unchanged ? prev : { visibleOrder, autoHidden, userHidden }\n}\n\n/** Desktop backdrop the whole scaffold sits on — a soft warm-gray wash. */\nexport const scaffoldBackgroundClass: ClassNameValue =\n \"bg-linear-to-tr/increasing from-neutral-400 via-stone-200 to-neutral-300 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950\"\n\n/** Card surface shared by a panel's primary area and secondary strip. */\nexport const panelSurfaceClass: ClassNameValue =\n \"rounded-2xl bg-slate-100 inset-ring-1 inset-ring-white/60 dark:bg-neutral-900 dark:inset-ring-white/5\"\n\n/** Floating icon button hovering over a panel (close, swap). */\nexport const floatingButtonClass: ClassNameValue =\n \"transition-[opacity,scale,box-shadow] duration-200 ease-smooth-out hover:text-neutral-900 hover:shadow-md active:scale-97 dark:bg-neutral-800/95 dark:text-neutral-300 dark:inset-ring-white/10 dark:hover:text-white motion-reduce:transition-none motion-reduce:active:scale-100 z-20\"\n\n/** Hidden until the pointer rests on the panel (always shown for touch and\n * while focused) — the affordances stay quiet until the panel is engaged. */\nexport const revealOnPanelHoverClass: ClassNameValue =\n \"opacity-0 scale-95 group-hover/panel:opacity-100 group-hover/panel:scale-100 focus-visible:opacity-100 focus-visible:scale-100 pointer-coarse:opacity-100 pointer-coarse:scale-100\"\n\n/** Pill segment inside the actions cluster (Add, browse). */\nexport const actionSegmentClass: ClassNameValue =\n \"flex h-[30px] items-center rounded-full text-neutral-700 transition-[background-color,color,scale,box-shadow] duration-150 ease-smooth-out hover:bg-white hover:text-neutral-900 hover:shadow-xs active:scale-97 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:hover:text-white motion-reduce:transition-none motion-reduce:active:scale-100\"\n\n/** Pill segments (seam-menu actions, tabs, Add) blur/fade in place while\n * the track morphs around them. The exit is a fast tween, not the layout\n * spring — the track stays overflow-visible, so popped-out segments must be\n * gone before the shrinking pill leaves them behind as a ghost. */\nexport const segmentVariants: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: {\n opacity: 0,\n filter: \"blur(4px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n}\n\n/** Map of sub-panel variants to their corresponding side. */\nexport const subPanelVariant: Record<TSubPanelVariant, ClassNameValue> = {\n card: \"bg-neutral-50 dark:bg-neutral-900 rounded-md border-t border-b border-t-white dark:border-t-neutral-700/50 border-b-neutral-900/10 dark:border-b-black/70 shadow-sm shadow-neutral-900/10 dark:shadow-black/50 inset-shadow-sm inset-shadow-white dark:inset-shadow-neutral-800\",\n subtle: \"bg-neutral-100 dark:bg-neutral-800\",\n inset: \"bg-neutral-200 dark:bg-neutral-700\",\n} as const\n","\"use client\"\n\nimport { RiCloseLine } from \"@remixicon/react\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { PanelFloatingButtonProps } from \"./type\"\nimport { floatingButtonClass, revealOnPanelHoverClass } from \"./utils\"\n\n/** Floating close affordance in a panel's top-right corner. */\nexport function PanelCloseButton({\n onClick,\n label,\n sound = true,\n className,\n}: PanelFloatingButtonProps): React.ReactElement {\n return (\n <button\n id=\"scaffold-panel-close-button\"\n aria-label={label}\n className={cn(\n floatingButtonClass,\n revealOnPanelHoverClass,\n \"absolute top-4 right-3.5 z-10\",\n className\n )}\n data-cuelume-press={sound ? \"\" : undefined}\n data-cuelume-release={sound ? \"\" : undefined}\n data-slot=\"scaffold-panel-close\"\n onClick={onClick}\n type=\"button\"\n >\n <RiCloseLine aria-hidden className=\"size-4\" />\n </button>\n )\n}\n","import { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { motion, type HTMLMotionProps } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nconst buttonGroupVariants = cva(\n \"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0\",\n vertical:\n \"flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: HTMLMotionProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <motion.div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"button-group-text\",\n },\n })\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n","\"use client\"\n\nimport {\n type FrostGlassVariantProp,\n glassVariantStyles,\n} from \"@/lib/glass-variants\"\nimport { cn } from \"@/lib/utils\"\n\nimport { ButtonGroup } from \"../button-group\"\nimport { LiquidGlass } from \"./liquid-glass\"\n\ntype GlassButtonGroupProps = React.ComponentProps<typeof ButtonGroup> &\n FrostGlassVariantProp\n\nfunction GlassButtonGroup({\n className,\n glassVariant = \"liquid-refract\",\n children,\n ...props\n}: GlassButtonGroupProps) {\n if (glassVariant === \"liquid-refract\") {\n return (\n <LiquidGlass className={cn(\"\", className)}>\n <ButtonGroup\n data-slot=\"glass-button-group\"\n data-glass-variant={glassVariant}\n className={cn(\"bg-transparent\", className)}\n {...props}\n >\n {children}\n </ButtonGroup>\n </LiquidGlass>\n )\n }\n\n return (\n <ButtonGroup\n data-slot=\"glass-button-group\"\n data-glass-variant={glassVariant}\n className={cn(\"rounded-lg\", glassVariantStyles[glassVariant], className)}\n {...props}\n >\n {children}\n </ButtonGroup>\n )\n}\n\nexport { GlassButtonGroup }\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Returns true only on devices that have a true hover (mouse / trackpad).\n * Touch devices fire phantom `:hover` on tap that sticks until tap-elsewhere\n * — gate hover-only effects (scale lifts, magnetic pulls) behind this.\n */\nexport function useHoverCapable() {\n const [canHover, setCanHover] = useState(false);\n\n useEffect(() => {\n if (typeof window === \"undefined\" || !window.matchMedia) return;\n const mq = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n const update = () => setCanHover(mq.matches);\n update();\n mq.addEventListener?.(\"change\", update);\n return () => mq.removeEventListener?.(\"change\", update);\n }, []);\n\n return canHover;\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { More } from \"iconsax-reactjs\"\nimport { LucideArrowUpDown, LucideChevronDown, LucideX } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { PanelMenuButtonProps } from \"./type\"\nimport { floatingButtonClass, revealOnPanelHoverClass } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { GlassButtonGroup } from \"@/components/ui/glasscn/glass-button-group.tsx\"\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\"\nimport { SCAFFOLD_MENU_COLLAPSE_DELAY } from \"./constants\"\n\n/** One side of the seam menu. Both sides stay mounted; the pill morphs by\n * collapsing one side's grid column to 0fr while the other grows — pure\n * CSS, driven by `data-expanded` on the group. The hidden side is inert\n * and aria-hidden so it can't be clicked, focused or found by queries. */\nconst menuCellClass =\n \"grid transition-[grid-template-columns,opacity] duration-300 ease-smooth-out motion-reduce:transition-none\"\n\n/**\n * Floating menu affordance centered on the seam between a panel's primary\n * surface and its secondary strip: a compact ⋯ toggle that morphs into the\n * Expand | Swap (| Close) actions.\n */\nexport function PanelMenuButton({\n onClick,\n onExpand,\n onCloseSecondary,\n secondaryExpanded = false,\n swapped = false,\n label,\n sound = true,\n className,\n}: PanelMenuButtonProps): React.ReactElement {\n const canHover = useHoverCapable()\n const actionsId = React.useId()\n const groupRef = React.useRef<HTMLDivElement>(null)\n const actionsRef = React.useRef<HTMLDivElement>(null)\n const [expanded, setExpanded] = React.useState(false);\n\n const collapseTimerRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)\n const suppressHoverOpenUntilRef = React.useRef(0)\n const focusActionsOnOpenRef = React.useRef(false)\n\n React.useEffect(() => () => clearTimeout(collapseTimerRef.current), [])\n\n const cancelCollapse = React.useCallback(() => {\n clearTimeout(collapseTimerRef.current)\n }, [])\n\n // Arms when the pointer stops hovering the group: the menu lingers for the\n // grace period, then collapses — unless the pointer (or focus) came back.\n const armCollapse = React.useCallback(() => {\n if (!canHover) return\n clearTimeout(collapseTimerRef.current)\n collapseTimerRef.current = setTimeout(() => {\n // Focus keeps the menu open — don't collapse under the keyboard.\n if (groupRef.current?.contains(document.activeElement)) return\n setExpanded(false)\n }, SCAFFOLD_MENU_COLLAPSE_DELAY)\n }, [canHover])\n\n // The grace period must keep counting when the pointer leaves the whole\n // app — leaving the window can skip the group's own pointerleave, so arm\n // on viewport exit and window blur as well.\n React.useEffect(() => {\n if (!expanded || !canHover) return\n const root = document.documentElement\n root.addEventListener(\"pointerleave\", armCollapse)\n window.addEventListener(\"blur\", armCollapse)\n return () => {\n root.removeEventListener(\"pointerleave\", armCollapse)\n window.removeEventListener(\"blur\", armCollapse)\n }\n }, [expanded, canHover, armCollapse])\n\n // Click-opens replace the toggle with the actions — hand focus over so\n // keyboard users aren't dropped onto an inert control.\n React.useEffect(() => {\n if (!expanded || !focusActionsOnOpenRef.current) return\n focusActionsOnOpenRef.current = false\n actionsRef.current?.querySelector<HTMLButtonElement>(\"button\")?.focus()\n }, [expanded])\n\n const collapse = () => {\n // The shrinking toggle can glide under a resting cursor and hover-reopen\n // the menu it just closed — ignore hover-opens until it has settled.\n suppressHoverOpenUntilRef.current = Date.now() + 600\n setExpanded(false)\n }\n\n // Acting collapses the menu — the pill returns to the compact toggle.\n const handleAction = (action?: () => void) => {\n action?.()\n collapse()\n }\n\n // Click open — the touch and keyboard path.\n const handleOnExpand = () => {\n if (groupRef.current?.contains(document.activeElement)) {\n focusActionsOnOpenRef.current = true\n }\n setExpanded(true)\n }\n\n // Hover on the toggle opens the menu (hover-capable devices only — touch\n // and keyboard go through the click toggle).\n const handleToggleHover = () => {\n if (!canHover || Date.now() < suppressHoverOpenUntilRef.current) return\n cancelCollapse()\n setExpanded(true)\n }\n\n return (\n <GlassButtonGroup\n ref={groupRef}\n onPointerEnter={cancelCollapse}\n onPointerLeave={armCollapse}\n glassVariant=\"subtle\"\n data-expanded={expanded ? \"\" : undefined}\n className={cn(\n floatingButtonClass,\n revealOnPanelHoverClass,\n \"group/menu absolute top-1/2 z-10 -translate-y-1/2\",\n className\n )}\n >\n <div\n aria-hidden={expanded || undefined}\n inert={expanded || undefined}\n className={cn(\n menuCellClass,\n \"grid-cols-[1fr] opacity-100 group-data-expanded/menu:grid-cols-[0fr] group-data-expanded/menu:opacity-0\"\n )}\n >\n <div className=\"flex min-w-0 overflow-hidden\">\n <Button\n id=\"scaffold-panel-menu-toggle-button\"\n aria-label={label}\n aria-expanded={expanded}\n aria-controls={actionsId}\n size=\"icon-sm\"\n variant=\"ghost\"\n sound={sound}\n // The hidden Expand|Swap|Close side stretches the pill to the sm\n // button height — match it so the collapsed toggle stays square.\n className=\"size-8 sm:size-7\"\n data-slot=\"scaffold-panel-menu-toggle\"\n onClick={handleOnExpand}\n onPointerEnter={handleToggleHover}\n >\n <More size={16} />\n </Button>\n </div>\n </div>\n <div\n id={actionsId}\n ref={actionsRef}\n aria-hidden={!expanded || undefined}\n inert={!expanded || undefined}\n className={cn(\n menuCellClass,\n \"grid-cols-[0fr] opacity-0 group-data-expanded/menu:grid-cols-[1fr] group-data-expanded/menu:opacity-100\"\n )}\n >\n <div className=\"flex min-w-0 overflow-hidden\">\n <Button\n id=\"scaffold-panel-menu-expand\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-expand\"\n className=\"rounded-r-none\"\n onClick={() => handleAction(onExpand)}\n >\n {/* Points at the sub-panel that grows next, in VISUAL space —\n a swapped panel is column-reverse, so the direction mirrors.\n Button's [&_svg]:transition-transform eases the flip. */}\n <LucideChevronDown\n size={16}\n className={cn(secondaryExpanded !== swapped && \"rotate-180\")}\n />\n Expand\n </Button>\n <Button\n id=\"scaffold-panel-menu-swap\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-swap\"\n className={cn(\n \"border-l-0\",\n onCloseSecondary ? \"rounded-none\" : \"rounded-l-none\"\n )}\n onClick={() => handleAction(onClick)}\n >\n <LucideArrowUpDown size={16} />\n Swap\n </Button>\n {onCloseSecondary && (\n <Button\n id=\"scaffold-panel-menu-close\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-close\"\n className=\"rounded-l-none border-l-0\"\n onClick={() => handleAction(onCloseSecondary)}\n >\n <LucideX size={16} />\n Close\n </Button>\n )}\n </div>\n </div>\n </GlassButtonGroup>\n )\n}\n","/**\n * Scaffold state — Jotai atom families keyed by a scaffold id.\n *\n * Same layout as the tree (`components/composed/tree/tree-atom.ts`), the\n * shell (`blocks/shell/shell-fit-atom.ts`) and the profile card: in-house\n * `keyed()` families per field, write-only action atoms, a composed\n * read-only state atom, and `removeScaffoldInstance` to drop an id from\n * every family.\n *\n * The visibility bookkeeping (`visibleOrder` / `autoHidden` / `userHidden`)\n * stays one atom on purpose — `reconcileVisibility` always settles the three\n * lists together, so splitting them would only invite half-written states.\n * The reconcile rule itself lives in `utils.ts`, and every action that moves\n * an input (ids, capacity, a toggle) settles the visibility before it\n * returns, so readers never see an interim state — the render-time settling\n * the old `usePanelVisibility` hook needed has no equivalent here.\n */\n\nimport { atom } from \"jotai\"\nimport type { Atom, Getter, Setter } from \"jotai\"\n\nimport { SCAFFOLD_PANEL_CAPACITY } from \"./constants\"\nimport type {\n ScaffoldConfig,\n ScaffoldHandlers,\n ScaffoldInstanceId,\n ScaffoldPanelVisibility,\n ScaffoldState,\n} from \"./type\"\nimport {\n EMPTY_SCAFFOLD_VISIBILITY,\n getPanelCapacity,\n reconcileVisibility,\n} from \"./utils\"\n\nconst DEFAULT_CONFIG: ScaffoldConfig = { controlsInspector: false }\nconst NO_HANDLERS: ScaffoldHandlers = {}\nconst NO_PANEL_IDS: readonly string[] = []\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: ScaffoldInstanceId) => AtomType) & {\n remove: (id: ScaffoldInstanceId) => void\n}\n\nconst families: { remove: (id: ScaffoldInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ScaffoldInstanceId) => AtomType) {\n const cache = new Map<ScaffoldInstanceId, AtomType>()\n const family = ((id: ScaffoldInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ScaffoldInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ScaffoldInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ScaffoldInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\n/** A family keyed by scaffold AND panel, so a tab or a panel subscribes to\n * its own boolean and sits still when a sibling's changes — the per-node\n * rule from the tree, at panel scale. Removal drops a whole scaffold. */\nfunction panelFamily<Value>(\n name: string,\n read: (get: Getter, id: ScaffoldInstanceId, panelId: string) => Value\n) {\n const cache = new Map<ScaffoldInstanceId, Map<string, Atom<Value>>>()\n const family = (id: ScaffoldInstanceId, panelId: string): Atom<Value> => {\n let panels = cache.get(id)\n if (panels === undefined) {\n panels = new Map()\n cache.set(id, panels)\n }\n let instance = panels.get(panelId)\n if (instance === undefined) {\n const created = atom((get) => read(get, id, panelId))\n created.debugLabel = `scaffold/${id}/${panelId}/${name}`\n panels.set(panelId, created)\n instance = created\n }\n return instance\n }\n families.push({\n remove: (id: ScaffoldInstanceId) => {\n cache.delete(id)\n },\n })\n return family\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\nexport const scaffoldInspectorOpenAtom = stateFamily<boolean>(\n \"inspectorOpen\",\n false\n)\n\n/** @internal The canvas's ordered panel ids, as registered each render. */\nexport const scaffoldPanelIdsAtom = stateFamily<readonly string[]>(\n \"panelIds\",\n NO_PANEL_IDS\n)\n\n/** @internal The capacity derived from the canvas's measured width — the\n * derived number is stored, not the raw width, so resize storms only touch\n * the store when a panel actually gains or loses room. */\nexport const scaffoldMeasuredCapacityAtom = stateFamily<number | null>(\n \"measuredCapacity\",\n null\n)\n\n/** @internal The three visibility lists, settled as one value. */\nexport const scaffoldVisibilityAtom = stateFamily<ScaffoldPanelVisibility>(\n \"visibility\",\n EMPTY_SCAFFOLD_VISIBILITY\n)\n\nexport const scaffoldHoveredPanelIdAtom = stateFamily<string | null>(\n \"hoveredPanelId\",\n null\n)\n\n/** @internal */\nexport const scaffoldConfigAtom = stateFamily<ScaffoldConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n/** @internal */\nexport const scaffoldHandlersAtom = stateFamily<ScaffoldHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** How many panels fit side by side; the cap while the canvas is unmeasured. */\nexport const scaffoldPanelCapacityAtom = readFamily(\n \"panelCapacity\",\n (get, id) =>\n get(scaffoldMeasuredCapacityAtom(id)) ?? SCAFFOLD_PANEL_CAPACITY\n)\n\n/** Ids of panels currently hidden (auto + user), for tabs to reflect. */\nexport const scaffoldHiddenPanelIdsAtom = readFamily<readonly string[]>(\n \"hiddenPanelIds\",\n (get, id) => {\n const visibility = get(scaffoldVisibilityAtom(id))\n return [...visibility.autoHidden, ...visibility.userHidden]\n }\n)\n\n/** Whether one panel is hidden. A tab subscribes here and sits still while\n * its siblings toggle. Empty `panelId` (a tab without one) reads false. */\nexport const scaffoldPanelHiddenAtom = panelFamily(\n \"hidden\",\n (get, id, panelId) => {\n if (panelId === \"\") return false\n const visibility = get(scaffoldVisibilityAtom(id))\n return (\n visibility.autoHidden.includes(panelId) ||\n visibility.userHidden.includes(panelId)\n )\n }\n)\n\n/** Whether one panel fades back while another panel's tab holds the\n * spotlight. Moving the hover between two tabs re-renders those panels\n * only — everyone else's boolean holds. */\nexport const scaffoldPanelDimmedAtom = panelFamily(\n \"dimmed\",\n (get, id, panelId) => {\n if (panelId === \"\") return false\n const hovered = get(scaffoldHoveredPanelIdAtom(id))\n return hovered !== null && hovered !== panelId\n }\n)\n\n/** The whole state of one scaffold. This changes on every hover move, so a\n * component that reads one field should subscribe to that field's atom\n * instead: `useAtomValue(scaffoldInspectorOpenAtom(\"workspace\"))`. */\nexport const scaffoldStateAtom = readFamily<ScaffoldState>(\n \"state\",\n (get, id) => ({\n inspectorOpen: get(scaffoldInspectorOpenAtom(id)),\n panelCapacity: get(scaffoldPanelCapacityAtom(id)),\n hiddenPanelIds: get(scaffoldHiddenPanelIdsAtom(id)),\n hoveredPanelId: get(scaffoldHoveredPanelIdAtom(id)),\n })\n)\n\n// ── visibility settling ────────────────────────────────────────────────────\n\n/** Re-settle the lists after any input moved. Inert when nothing changes —\n * `reconcileVisibility` returns `prev` untouched then. */\nfunction settleVisibility(get: Getter, set: Setter, id: ScaffoldInstanceId) {\n const prev = get(scaffoldVisibilityAtom(id))\n const settled = reconcileVisibility(\n prev,\n get(scaffoldPanelIdsAtom(id)),\n get(scaffoldPanelCapacityAtom(id))\n )\n if (settled !== prev) set(scaffoldVisibilityAtom(id), settled)\n}\n\n// ── actions: inspector ─────────────────────────────────────────────────────\n\n/** Reports through `onInspectorOpenChange` always; writes the store only\n * when no `inspectorOpen` prop controls the root — the prop is truth then. */\nexport const setScaffoldInspectorOpenAtom = actionFamily<[open: boolean]>(\n \"setInspectorOpen\",\n (get, set, id, open) => {\n if (get(scaffoldInspectorOpenAtom(id)) === open) return\n if (!get(scaffoldConfigAtom(id)).controlsInspector)\n set(scaffoldInspectorOpenAtom(id), open)\n get(scaffoldHandlersAtom(id)).onInspectorOpenChange?.(open)\n }\n)\n\nexport const toggleScaffoldInspectorAtom = actionFamily<[]>(\n \"toggleInspector\",\n (get, set, id) => {\n set(setScaffoldInspectorOpenAtom(id), !get(scaffoldInspectorOpenAtom(id)))\n }\n)\n\n// ── actions: panels ────────────────────────────────────────────────────────\n\n/** Show/hide an id'd panel. Showing past capacity auto-hides the\n * least-recently-activated visible panel; the last visible one never hides. */\nexport const toggleScaffoldPanelAtom = actionFamily<[panelId: string]>(\n \"togglePanel\",\n (get, set, id, panelId) => {\n const ids = get(scaffoldPanelIdsAtom(id))\n if (!ids.includes(panelId)) return\n const prev = get(scaffoldVisibilityAtom(id))\n const hidden =\n prev.autoHidden.includes(panelId) || prev.userHidden.includes(panelId)\n if (!hidden && prev.visibleOrder.length <= 1) return\n\n const next: ScaffoldPanelVisibility = hidden\n ? {\n // Showing: newest activation — reconcile evicts the oldest\n // visible panel if the canvas can't fit one more.\n visibleOrder: [...prev.visibleOrder, panelId],\n autoHidden: prev.autoHidden.filter((other) => other !== panelId),\n userHidden: prev.userHidden.filter((other) => other !== panelId),\n }\n : {\n visibleOrder: prev.visibleOrder.filter((other) => other !== panelId),\n autoHidden: prev.autoHidden,\n userHidden: [...prev.userHidden, panelId],\n }\n set(\n scaffoldVisibilityAtom(id),\n reconcileVisibility(next, ids, get(scaffoldPanelCapacityAtom(id)))\n )\n }\n)\n\n/** @internal Tabs report pointer enter/leave on their label. Leaving clears\n * only its own id — a tab that unmounts mid-hover must not wipe out a hover\n * the pointer has already moved on to. */\nexport const setScaffoldPanelHoveredAtom = actionFamily<\n [panelId: string, hovered: boolean]\n>(\"setPanelHovered\", (get, set, id, panelId, hovered) => {\n const prev = get(scaffoldHoveredPanelIdAtom(id))\n if (hovered) {\n if (prev !== panelId) set(scaffoldHoveredPanelIdAtom(id), panelId)\n return\n }\n if (prev === panelId) set(scaffoldHoveredPanelIdAtom(id), null)\n})\n\n/** @internal Canvas reports its ordered panel ids each render. Inert when\n * the ids did not move; otherwise the visibility settles in the same write. */\nexport const registerScaffoldPanelIdsAtom = actionFamily<\n [ids: readonly string[]]\n>(\"registerPanelIds\", (get, set, id, ids) => {\n const prev = get(scaffoldPanelIdsAtom(id))\n if (prev.length === ids.length && prev.every((v, i) => v === ids[i])) return\n set(scaffoldPanelIdsAtom(id), [...ids])\n settleVisibility(get, set, id)\n})\n\n/** @internal Canvas reports its measured width. Only the derived capacity is\n * stored, so resize storms settle to at most one visibility change. */\nexport const measureScaffoldCanvasAtom = actionFamily<[width: number]>(\n \"measureCanvas\",\n (get, set, id, width) => {\n const capacity = getPanelCapacity(width)\n if (get(scaffoldMeasuredCapacityAtom(id)) === capacity) return\n set(scaffoldMeasuredCapacityAtom(id), capacity)\n settleVisibility(get, set, id)\n }\n)\n\n// ── internal projections ───────────────────────────────────────────────────\n\n/** @internal Projection of the mounted root's controlled props. */\nexport const projectScaffoldPropsAtom = actionFamily<\n [config: ScaffoldConfig, inspectorOpen: boolean | undefined]\n>(\"projectProps\", (_get, set, id, config, inspectorOpen) => {\n set(scaffoldConfigAtom(id), config)\n if (config.controlsInspector && inspectorOpen !== undefined)\n set(scaffoldInspectorOpenAtom(id), inspectorOpen)\n})\n\n/** @internal */\nexport const setScaffoldHandlersAtom = actionFamily<\n [handlers: ScaffoldHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(scaffoldHandlersAtom(id), handlers)\n})\n\n/** @internal Seed the uncontrolled inspector on mount without firing\n * `onInspectorOpenChange`. */\nexport const seedScaffoldInspectorAtom = actionFamily<[open: boolean]>(\n \"seedInspector\",\n (_get, set, id, open) => {\n set(scaffoldInspectorOpenAtom(id), open)\n }\n)\n\n// ── reset ──────────────────────────────────────────────────────────────────\n\nexport const resetScaffoldAtom = actionFamily<[]>(\"reset\", (_get, set, id) => {\n set(scaffoldInspectorOpenAtom(id), false)\n set(scaffoldPanelIdsAtom(id), NO_PANEL_IDS)\n set(scaffoldMeasuredCapacityAtom(id), null)\n set(scaffoldVisibilityAtom(id), EMPTY_SCAFFOLD_VISIBILITY)\n set(scaffoldHoveredPanelIdAtom(id), null)\n set(scaffoldConfigAtom(id), DEFAULT_CONFIG)\n set(scaffoldHandlersAtom(id), NO_HANDLERS)\n})\n\n/** Forget a scaffold entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeScaffoldInstance(id: ScaffoldInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport type { ScaffoldContextValue } from \"./type\"\n\nexport const ScaffoldContext = React.createContext<ScaffoldContextValue | null>(\n null\n)\n\n/** Read the scaffold's identity (`scaffoldId`, `inspectorWidth`); must run\n * under `Scaffold.Root`. State itself lives in the store — subscribe to the\n * atoms, or reach them by id through `useScaffoldState` / `useScaffoldActions`. */\nexport function useScaffoldContext(): ScaffoldContextValue {\n const context = React.useContext(ScaffoldContext)\n if (!context) {\n throw new Error(\"useScaffoldContext must be used within <Scaffold.Root>\")\n }\n return context\n}\n","\"use client\"\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { useAtomValue } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_EASE, SCAFFOLD_EDGE_GUTTER, SCAFFOLD_MORPH_DURATION } from \"./constants\"\nimport { scaffoldInspectorOpenAtom } from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldActionsProps } from \"./type\"\nimport { segmentVariants } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport { LucidePlus } from \"lucide-react\"\n\n/**\n * The floating pill cluster in the main region's top-right corner — the\n * design's \"Panel Context Menu\": one tab per open panel (`Scaffold.Tab`\n * children) plus an Add segment. Add renders only while `onAdd` is\n * present — omit it once the canvas holds `SCAFFOLD_PANEL_CAPACITY`\n * panels. Slides left in step with the inspector opening.\n */\nexport function ScaffoldActions({\n onAdd,\n addLabel = \"Panel\",\n addIcon,\n sound = true,\n className,\n children,\n ...rest\n}: ScaffoldActionsProps): React.ReactElement {\n const { scaffoldId, inspectorWidth } = useScaffoldContext()\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const reducedMotion = useReducedMotion()\n const transition = reducedMotion ? { duration: 0 } : SPRING_LAYOUT\n\n return (\n <motion.div\n id=\"scaffold-actions\"\n animate={{\n x: inspectorOpen ? -(inspectorWidth + SCAFFOLD_EDGE_GUTTER) : 0,\n }}\n className={cn(\n \"sticky inline-flex h-12 items-center gap-0.5\",\n \"justify-end\",\n className\n )}\n data-slot=\"scaffold-actions\"\n initial={false}\n transition={{\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }}\n {...rest}\n >\n <motion.div\n layout\n transition={transition}\n className=\"flex items-center gap-1.5\"\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {onAdd && (\n <motion.div\n key=\"scaffold-add\"\n layout\n animate={reducedMotion ? { opacity: 1 } : \"visible\"}\n className=\"flex shrink-0\"\n exit={reducedMotion ? { opacity: 0 } : \"exit\"}\n initial={reducedMotion ? { opacity: 0 } : \"hidden\"}\n transition={transition}\n variants={segmentVariants}\n >\n <Button\n onClick={onAdd}\n size=\"sm\"\n sound={sound}\n variant=\"ghost\"\n className=\"h-full gap-2 rounded-sm py-1.5 pr-3 pl-2\"\n >\n {addIcon ?? <LucidePlus className=\"stroke-2\" />}\n {addLabel}\n </Button>\n </motion.div>\n )}\n {children}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n )\n}\n","\"use client\"\n\nimport { AnimatePresence } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n measureScaffoldCanvasAtom,\n registerScaffoldPanelIdsAtom,\n scaffoldHiddenPanelIdsAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldCanvasProps, ScaffoldPanelProps } from \"./type\"\n\n/** A canvas child's panel id when it opted into responsive hiding. */\nfunction panelIdOf(child: React.ReactNode): string | undefined {\n if (!React.isValidElement<Pick<ScaffoldPanelProps, \"id\">>(child))\n return undefined\n const id = child.props.id\n return typeof id === \"string\" ? id : undefined\n}\n\n/**\n * The panel row below the action cluster: 8px gutters, 8px gaps, panels\n * side by side. Key each `Scaffold.Panel` child so closes animate out.\n * Measures its own width and hides id'd panels (oldest activation first)\n * whenever it can't grant each one `SCAFFOLD_PANEL_MIN_WIDTH`.\n */\nexport function ScaffoldCanvas({\n className,\n children,\n ...rest\n}: ScaffoldCanvasProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n const hiddenPanelIds = useAtomValue(scaffoldHiddenPanelIdsAtom(scaffoldId))\n const registerPanelIds = useSetAtom(registerScaffoldPanelIdsAtom(scaffoldId))\n const measureCanvas = useSetAtom(measureScaffoldCanvasAtom(scaffoldId))\n const ref = React.useRef<HTMLDivElement>(null)\n\n React.useLayoutEffect(() => {\n const element = ref.current\n if (!element || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(([entry]) =>\n measureCanvas(entry.contentRect.width)\n )\n observer.observe(element)\n return () => observer.disconnect()\n }, [measureCanvas])\n\n const childArray = React.Children.toArray(children)\n const panelIds = childArray\n .map(panelIdOf)\n .filter((id): id is string => id !== undefined)\n const idsKey = panelIds.join(\" \")\n\n React.useLayoutEffect(() => {\n registerPanelIds(panelIds)\n // panelIds is rebuilt each render; idsKey carries its identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [idsKey, registerPanelIds])\n\n const visibleChildren = childArray.filter((child) => {\n const id = panelIdOf(child)\n return id === undefined || !hiddenPanelIds.includes(id)\n })\n\n return (\n <div\n className={cn(\"relative flex min-h-0 w-full flex-1 gap-2\", className)}\n data-slot=\"scaffold-canvas\"\n ref={ref}\n {...rest}\n >\n {/* Sync mode (no `mode=\"wait\"`): an exiting panel shrinks in place\n while its siblings grow into the freed room in the same beat. */}\n <AnimatePresence initial={false}>{visibleChildren}</AnimatePresence>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n type FrostGlassVariant,\n type FrostGlassVariantProp,\n glassVariantStyles,\n} from \"@/lib/glass-variants\"\nimport { cn } from \"@/lib/utils\"\nimport { LiquidGlass } from \"./liquid-glass\"\n\nconst glassSidebarVariableStyles: Record<FrostGlassVariant, string> = {\n clear: [\n \"[--sidebar:rgba(255,255,255,0.18)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.48)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.34)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.38)]\",\n \"dark:[--sidebar:rgba(0,0,0,0.28)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.1)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.16)]\",\n ].join(\" \"),\n frosted: [\n \"[--sidebar:rgba(255,255,255,0.4)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.62)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.3)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.32)]\",\n \"dark:[--sidebar:rgba(0,0,0,0.38)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.14)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.1)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.14)]\",\n ].join(\" \"),\n subtle: [\n \"[--sidebar:rgba(255,255,255,0.14)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.28)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(0,0,0,0.05)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.28)]\",\n \"dark:[--sidebar:rgba(255,255,255,0.05)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.08)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.08)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.12)]\",\n ].join(\" \"),\n liquid: [\n \"[--sidebar:rgba(255,255,255,0.22)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.55)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.42)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.45)]\",\n \"dark:[--sidebar:rgba(255,255,255,0.06)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.16)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.20)]\",\n ].join(\" \"),\n \"liquid-refract\": [\n \"[--sidebar:rgba(255,255,255,0.18)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.48)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.34)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.38)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.15)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.18)]\",\n ].join(\" \"),\n}\n\ntype GlassSidebarProps = React.HTMLAttributes<HTMLDivElement> &\n FrostGlassVariantProp\n\nfunction getGlassSidebarStandaloneClasses(glassVariant: FrostGlassVariant) {\n return cn(\n glassVariantStyles[glassVariant],\n glassSidebarVariableStyles[glassVariant],\n \"overflow-hidden\",\n \"shadow-[0_24px_80px_rgba(15,23,42,0.08)] dark:shadow-[0_24px_80px_rgba(0,0,0,0.28)]\"\n )\n}\n\nfunction GlassContainer({\n glassVariant = \"liquid-refract\",\n className,\n children,\n ...props\n}: GlassSidebarProps) {\n return (\n <LiquidGlass\n className={cn(\"rounded-[1.75rem]\", className)}\n blur={5}\n refraction={50}\n >\n <div\n className={cn(\n getGlassSidebarStandaloneClasses(glassVariant),\n glassVariant === \"liquid-refract\" &&\n \"border-0 bg-transparent shadow-none\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n </LiquidGlass>\n )\n}\n\nexport { GlassContainer, glassSidebarVariableStyles }\nexport type { FrostGlassVariant } from \"@/lib/glass-variants\"\n","\"use client\"\n\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_EASE, SCAFFOLD_EDGE_GUTTER, SCAFFOLD_MORPH_DURATION } from \"./constants\"\nimport {\n scaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldInspectorProps } from \"./type\"\nimport { GlassContainer } from \"@/components/ui/glasscn/glass-container.tsx\"\nimport { Button } from \"@/components/ui/button\"\nimport { LucideX } from \"lucide-react\"\n\n/**\n * The right-hand drawer: a brighter card that slides in over the canvas,\n * inset from the viewport edges. Open state lives on `Scaffold.Root` (or\n * `useScaffold().providerProps`); the drawer stays mounted so it can slide\n * back out.\n */\nexport function ScaffoldInspector({\n children,\n name = \"Inspector\",\n className,\n ...rest\n}: ScaffoldInspectorProps): React.ReactElement {\n const { scaffoldId, inspectorWidth } = useScaffoldContext()\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n const reducedMotion = useReducedMotion()\n\n // Slide fully past the edge gutter and the drop shadow's blur radius.\n const offcanvasX = inspectorWidth + SCAFFOLD_EDGE_GUTTER + 12\n\n return (\n <motion.aside\n id=\"scaffold-inspector\"\n animate={{ x: inspectorOpen ? 0 : offcanvasX }}\n aria-hidden={inspectorOpen ? undefined : true}\n aria-label={name}\n className={cn(\n \"absolute right-0 z-20 my-2 flex h-full max-h-[calc(100%-0.5rem)] w-96 flex-col\",\n !inspectorOpen && \"pointer-events-none\",\n className\n )}\n data-slot=\"scaffold-inspector\"\n inert={inspectorOpen ? undefined : true}\n initial={false}\n role=\"complementary\"\n style={{ width: inspectorWidth }}\n transition={{\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }}\n {...rest}\n >\n <GlassContainer\n className=\"flex flex-1 flex-col rounded-md border-t border-white bg-neutral-50/20 shadow-inner shadow-lg dark:border-neutral-800 dark:bg-black/5\"\n glassVariant=\"subtle\"\n >\n <div\n id=\"scaffold-inspector-header\"\n className=\"flex h-12 items-center justify-between gap-2 border-b pr-3 pl-4\"\n >\n <span className=\"text-base font-normal text-card-foreground/70\">\n {name}\n </span>\n <Button\n size=\"icon-xs\"\n variant=\"glass\"\n glassVariant=\"subtle\"\n className=\"scale-85\"\n aria-label=\"Close inspector\"\n onClick={toggleInspector}\n >\n <LucideX className=\"stroke-3\" />\n </Button>\n </div>\n {children}\n </GlassContainer>\n </motion.aside>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldMainProps } from \"./type\"\n\n/**\n * The region right of the rail. Hosts `Scaffold.Actions` (top-right),\n * `Scaffold.Canvas` and the `Scaffold.Inspector` overlay — all positioned\n * against this box.\n */\nexport function ScaffoldMain({\n className,\n children,\n ...rest\n}: ScaffoldMainProps): React.ReactElement {\n return (\n <div\n id=\"scaffold-main\"\n className={cn(\"relative flex min-w-0 flex-1 flex-col\", className)}\n data-slot=\"scaffold-main\"\n {...rest}\n >\n {children}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldSubPanelProps } from \"./type\"\nimport { subPanelVariant } from \"@/components/blocks/scaffold/utils.ts\"\nimport { SCAFFOLD_EASE, SCAFFOLD_MORPH_DURATION } from \"./constants\"\n\nexport function ScaffoldSubPanel({\n className,\n children,\n variant = \"card\",\n primary = false,\n expanded,\n ...rest\n}: ScaffoldSubPanelProps): React.ReactElement {\n const reduce = useReducedMotion()\n // The primary card holds the flexible slot unless the panel says otherwise.\n const isExpanded = expanded ?? primary\n\n return (\n <motion.div\n // Full `layout` (position + size), not `layout=\"size\"`: a swap flips\n // the panel's flex direction in a single commit, and only a position\n // FLIP makes the two cards glide past each other instead of teleport.\n layout\n id={`scaffold-sub-panel-${variant}`}\n // Grow is animated as a style, not a class flip — a class flip rides the\n // layout FLIP, which scales both cards into a swap-like morph. Animating\n // flex-grow slides only the shared boundary: the collapsed card grows up\n // (or down) while the other is squeezed and cropped in place.\n initial={false}\n animate={{ flexGrow: isExpanded ? 1 : 0 }}\n transition={\n reduce\n ? { duration: 0 }\n : { duration: SCAFFOLD_MORPH_DURATION, ease: SCAFFOLD_EASE }\n }\n className={cn(\n \"flex w-full flex-col\",\n subPanelVariant[variant],\n // basis-14 + clip let the primary squeeze down to the strip height;\n // the strip keeps its natural (basis-auto) height when collapsed.\n primary ? \"min-h-14 basis-14 overflow-clip\" : \"min-h-14 basis-auto\",\n className\n )}\n data-slot={`scaffold-sub-panel-${variant}`}\n data-expanded={isExpanded ? \"\" : undefined}\n {...rest}\n >\n {children}\n </motion.div>\n )\n}\n","\"use client\"\n\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useState } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n SCAFFOLD_EASE,\n SCAFFOLD_MORPH_DURATION,\n SCAFFOLD_PANEL_MIN_WIDTH,\n} from \"./constants\"\nimport { useAtomValue } from \"jotai\"\n\nimport { PanelMenuButton } from \"./panel-menu-button.tsx\"\nimport { scaffoldPanelDimmedAtom } from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldPanelProps, TSubPanelPosition } from \"./type\"\nimport { ScaffoldSubPanel } from \"@/components/blocks/scaffold/scaffold-sub-panel.tsx\"\n\n/**\n * A canvas panel: a primary card plus an optional secondary strip below it,\n * separated by a slice of the desktop backdrop. Floating close and swap\n * buttons reveal on hover when their callbacks are provided. Swapping trades\n * the two cards with a layout morph — the strip glides up and grows into the\n * primary slot while the primary card shrinks down into the strip.\n */\nexport function ScaffoldPanel({\n id,\n children,\n SecondaryPanel,\n onSwap,\n onCloseSecondary,\n name,\n swapLabel = \"Swap panel content\",\n sound = true,\n className,\n}: ScaffoldPanelProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n const reducedMotion = useReducedMotion()\n\n // A hovered tab spotlights its own panel — every other id'd panel fades\n // back so the pairing reads at a glance. The per-panel atom keeps a hover\n // moving between two tabs from re-rendering the panels that stay dimmed;\n // the empty-key sentinel reads false for a panel without an `id`.\n const dimmed = useAtomValue(scaffoldPanelDimmedAtom(scaffoldId, id ?? \"\"))\n\n const transition = {\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }\n\n const [subPanelPosition, setSubPanelPosition] =\n useState<TSubPanelPosition>(\"top\")\n const [isSwapped, setIsSwapped] = useState<boolean>(false)\n const handleSwap = () => {\n setIsSwapped((prev) => !prev)\n onSwap?.()\n }\n\n // Trades which sub-panel holds the flexible slot — the collapsed card grows\n // into `flex-1` while the expanded one shrinks to the `min-h-14` strip.\n const handleExpand = () => {\n setSubPanelPosition((prev) => (prev === \"top\" ? \"bottom\" : \"top\"))\n }\n\n // Enter/exit grow and shrink the panel's slot in the flex row: flexGrow\n // carries the width (the panel is basis-0, so `width` itself is inert on\n // the main axis) and minWidth releases the 320px floor so the slot can\n // reach zero. scaleX pins the visual anchor to the panel's center —\n // flexbox collapses a slot toward whichever edge its neighbors grow\n // from, so without it the panel would wipe from one side.\n const hidden = { flexGrow: 0, minWidth: 0, scaleX: 0, opacity: 0 }\n\n return (\n <motion.section\n id={id ?? \"scaffold-panel\"}\n animate={{\n flexGrow: 1,\n // id panels opt into responsive hiding, so each visible one can\n // hold the 320px floor — the canvas hides siblings before this\n // floor would overflow it.\n minWidth: id !== undefined ? SCAFFOLD_PANEL_MIN_WIDTH : 0,\n scaleX: 1,\n // The hovered tab's panel keeps full opacity; the rest fade back\n // so the tab↔panel pairing reads at a glance. Inline (not a\n // class) because motion owns this element's opacity.\n opacity: dimmed ? 0.35 : 1,\n }}\n initial={hidden}\n exit={hidden}\n style={{ originX: 0.5 }}\n aria-label={name}\n className={cn(\n \"group/panel relative flex w-full min-w-0 flex-1\",\n // Swap flips the direction as a class, NOT an animate target:\n // flex-direction is discrete, so motion would apply it instantly —\n // the flip lands in one commit and the children's `layout` FLIP is\n // what glides the cards past each other.\n isSwapped ? \"flex-col-reverse\" : \"flex-col\",\n className\n )}\n layout\n data-slot=\"scaffold-panel\"\n data-dimmed={dimmed ? \"\" : undefined}\n data-swapped={isSwapped ? \"\" : undefined}\n transition={transition}\n >\n <ScaffoldSubPanel id=\"top\" expanded={subPanelPosition === \"top\"} primary>\n {children}\n </ScaffoldSubPanel>\n {(onSwap || onCloseSecondary) && SecondaryPanel && (\n // `layout` keeps the seam glued to the moving boundary while the\n // cards trade places around it.\n <motion.div\n layout\n transition={transition}\n className=\"relative flex h-2 items-center justify-center\"\n >\n <PanelMenuButton\n label={swapLabel}\n onClick={handleSwap}\n onExpand={handleExpand}\n onCloseSecondary={onCloseSecondary}\n secondaryExpanded={subPanelPosition === \"bottom\"}\n swapped={isSwapped}\n sound={sound}\n />\n </motion.div>\n )}\n {SecondaryPanel && (\n <ScaffoldSubPanel id=\"bottom\" expanded={subPanelPosition === \"bottom\"}>\n {SecondaryPanel}\n </ScaffoldSubPanel>\n )}\n </motion.section>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_INSPECTOR_WIDTH } from \"./constants\"\nimport {\n projectScaffoldPropsAtom,\n removeScaffoldInstance,\n seedScaffoldInspectorAtom,\n setScaffoldHandlersAtom,\n} from \"./scaffold-atom\"\nimport { ScaffoldContext } from \"./scaffold-context\"\nimport type {\n ScaffoldConfig,\n ScaffoldContextValue,\n ScaffoldHandlers,\n ScaffoldRootProps,\n} from \"./type\"\nimport type { ClassNameValue } from \"tailwind-merge\"\n\n/**\n * The scaffold's viewport: desktop backdrop + horizontal row of rail and\n * main region, and the binding between this instance's props and its slice\n * of the store. Fills its container — size it from the outside (e.g.\n * `h-svh` for a full page).\n *\n * State lives in the store under `scaffoldId`; the context carries only the\n * id and the drawer width, so its value never changes while the scaffold is\n * mounted and parts subscribe to exactly the atoms they render from. A\n * controlled `inspectorOpen` stays the source of truth: it is projected\n * one-way into the store (so remote readers see current data), and the\n * inspector actions report through `onInspectorOpenChange` instead of\n * writing.\n */\nexport function ScaffoldRoot({\n scaffoldId: scaffoldIdProp,\n inspectorOpen: inspectorOpenProp,\n defaultInspectorOpen,\n onInspectorOpenChange,\n inspectorWidth = SCAFFOLD_INSPECTOR_WIDTH,\n className,\n children,\n ...rest\n}: ScaffoldRootProps): React.ReactElement {\n const generatedId = React.useId()\n const scaffoldId = scaffoldIdProp ?? generatedId\n const background: ClassNameValue = `bg-linear-to-tr/increasing from-neutral-200 via-neutral-100 to-stone-200 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950`\n\n const controlsInspector = inspectorOpenProp !== undefined\n const config = React.useMemo<ScaffoldConfig>(\n () => ({ controlsInspector }),\n [controlsInspector]\n )\n const handlers = React.useMemo<ScaffoldHandlers>(\n () => ({ onInspectorOpenChange }),\n [onInspectorOpenChange]\n )\n\n const project = useSetAtom(projectScaffoldPropsAtom(scaffoldId))\n const publishHandlers = useSetAtom(setScaffoldHandlersAtom(scaffoldId))\n const seedInspector = useSetAtom(seedScaffoldInspectorAtom(scaffoldId))\n\n // Seed the uncontrolled inspector once per mount, before the projection —\n // `defaultInspectorOpen` describes the mount, not every render. Layout\n // effects so children read settled values in the same commit; primitive\n // deps, so no loop guard is needed.\n const [seed] = React.useState(\n () => inspectorOpenProp ?? defaultInspectorOpen ?? false\n )\n React.useLayoutEffect(() => {\n if (!controlsInspector) seedInspector(seed)\n // Mount-time seed only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n // Handlers before the projection — they must be in the store before any\n // action can fire.\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n React.useLayoutEffect(() => {\n project(config, inspectorOpenProp)\n }, [project, config, inspectorOpenProp])\n\n React.useEffect(() => {\n if (scaffoldIdProp !== undefined) return\n return () => removeScaffoldInstance(scaffoldId)\n }, [scaffoldIdProp, scaffoldId])\n\n const value = React.useMemo<ScaffoldContextValue>(\n () => ({ scaffoldId, inspectorWidth }),\n [scaffoldId, inspectorWidth]\n )\n\n return (\n <ScaffoldContext.Provider value={value}>\n <div\n id={\"scaffold-root\"}\n className={cn(\n // `clip`, not `hidden`: the off canvas inspector extends the\n // scrollable overflow, and focus/scrollIntoView would scroll a\n // hidden-overflow root sideways to reveal it.\n \"relative isolate flex size-full flex-1 overflow-clip pr-2 pb-2\",\n background,\n className\n )}\n data-slot=\"scaffold\"\n {...rest}\n >\n {children}\n </div>\n </ScaffoldContext.Provider>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldSidebarProps } from \"./type\"\n\n/**\n * The 64px icon rail on the left edge. Transparent — it sits directly on\n * the desktop backdrop; fill it with icon buttons.\n */\nexport function ScaffoldSidebar({\n className,\n children,\n ...rest\n}: ScaffoldSidebarProps): React.ReactElement {\n return (\n <nav\n id=\"scaffold-sidebar\"\n aria-label=\"Primary\"\n className={cn(\n \"flex h-full min-w-12 shrink-0 flex-col items-center gap-1 overflow-y-auto pt-10 pb-2\",\n className\n )}\n data-slot=\"scaffold-sidebar\"\n {...rest}\n >\n {children}\n </nav>\n )\n}\n","\"use client\"\n\nimport { useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport {\n scaffoldPanelHiddenAtom,\n setScaffoldPanelHoveredAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldTabProps } from \"./type\"\nimport { segmentVariants } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { LucideAppWindow, LucideEyeOff, LucideX } from \"lucide-react\"\nimport { GlassButtonGroup } from \"@/components/ui/glasscn/glass-button-group.tsx\"\n\n/**\n * A panel's tab inside the action cluster: its label plus a close\n * affordance. Render one per open panel as Actions children, keyed —\n * closes animate out of the pill. Omit `onClose` on the last remaining\n * panel's tab; the canvas keeps at least one panel open.\n *\n * With `panelId` (matching a `Scaffold.Panel`'s `id`), the tab also fronts\n * that panel's visibility: a hidden panel dims its tab behind an eye-off\n * icon, and pressing the label toggles the panel — showing one past\n * capacity hides the least-recently-activated panel in its place.\n */\nexport function ScaffoldTab({\n children,\n panelId,\n onClose,\n closeLabel = \"Close panel\",\n sound = true,\n className,\n ...rest\n}: ScaffoldTabProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n // The per-panel atom keeps this tab still while its siblings toggle; the\n // empty-key sentinel reads false for a tab without a `panelId`.\n const hidden = useAtomValue(scaffoldPanelHiddenAtom(scaffoldId, panelId ?? \"\"))\n const togglePanel = useSetAtom(toggleScaffoldPanelAtom(scaffoldId))\n const setPanelHovered = useSetAtom(setScaffoldPanelHoveredAtom(scaffoldId))\n const reduce = useReducedMotion()\n const transition = reduce ? { duration: 0 } : SPRING_LAYOUT\n\n // A tab closed mid-hover never fires pointer-leave — release the\n // spotlight it holds so the canvas doesn't stay dimmed.\n React.useEffect(() => {\n if (panelId === undefined) return\n return () => setPanelHovered(panelId, false)\n }, [panelId, setPanelHovered])\n\n return (\n <GlassButtonGroup\n layout\n animate={reduce ? { opacity: 1, width: \"auto\" } : \"visible\"}\n data-slot=\"scaffold-tab\"\n data-panel-hidden={hidden ? \"\" : undefined}\n onPointerEnter={\n panelId !== undefined ? () => setPanelHovered(panelId, true) : undefined\n }\n onPointerLeave={\n panelId !== undefined\n ? () => setPanelHovered(panelId, false)\n : undefined\n }\n exit={reduce ? { opacity: 0, width: 0 } : \"exit\"}\n initial={reduce ? { opacity: 0, width: 0 } : \"hidden\"}\n transition={transition}\n variants={segmentVariants}\n glassVariant=\"subtle\"\n className={cn(\"h-full rounded-sm\", className)}\n {...rest}\n >\n <Button\n aria-pressed={panelId !== undefined ? !hidden : undefined}\n onClick={panelId !== undefined ? () => togglePanel(panelId) : undefined}\n size=\"sm\"\n sound={sound}\n variant=\"ghost\"\n className={cn(\n \"gap-2.5 rounded-sm pl-2\",\n onClose && \"pr-2\",\n hidden && \"text-muted-foreground/70\"\n )}\n >\n {hidden ? <LucideEyeOff size={16} /> : <LucideAppWindow size={16} />}\n {children}\n </Button>\n {onClose && (\n <Button\n aria-label={closeLabel}\n onClick={onClose}\n size=\"icon-sm\"\n sound={sound}\n variant=\"ghost\"\n className=\"self-center rounded-none!\"\n >\n <LucideX size={16} />\n </Button>\n )}\n </GlassButtonGroup>\n )\n}\n","\"use client\"\n\nimport { useEffect, useId, useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n removeScaffoldInstance,\n scaffoldInspectorOpenAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n} from \"./scaffold-atom\"\nimport type { ScaffoldControls, UseScaffoldOptions } from \"./type\"\n\n/**\n * Owns the scaffold's inspector state for UI living outside the scaffold\n * (title-bar buttons, command palette, shortcuts). Spread the returned\n * `providerProps` onto `Scaffold.Root`; without this hook the root manages\n * the same state internally via `defaultInspectorOpen`.\n *\n * The hook and the root meet in the store: `providerProps` carries a\n * `scaffoldId`, both sides read and write that instance's atoms, and\n * `useScaffoldState` / `useScaffoldActions` reach the same slice from\n * anywhere else by id. Unnamed scaffolds key off `useId` and are dropped on\n * unmount; an explicit `scaffoldId` outlives its component.\n */\nexport function useScaffold({\n scaffoldId: scaffoldIdProp,\n defaultInspectorOpen,\n onInspectorChange,\n}: UseScaffoldOptions = {}): ScaffoldControls {\n const generatedId = useId()\n const scaffoldId = scaffoldIdProp ?? generatedId\n\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const setInspectorOpen = useSetAtom(setScaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n\n useEffect(() => {\n if (scaffoldIdProp !== undefined) return\n return () => removeScaffoldInstance(scaffoldId)\n }, [scaffoldIdProp, scaffoldId])\n\n const providerProps = useMemo<ScaffoldControls[\"providerProps\"]>(\n () => ({\n scaffoldId,\n defaultInspectorOpen,\n onInspectorOpenChange: onInspectorChange,\n }),\n [scaffoldId, defaultInspectorOpen, onInspectorChange]\n )\n\n return {\n scaffoldId,\n inspectorOpen,\n setInspectorOpen,\n toggleInspector,\n providerProps,\n }\n}\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n resetScaffoldAtom,\n scaffoldStateAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nimport type {\n ScaffoldInstanceId,\n ScaffoldState,\n ScaffoldStateActions,\n} from \"./type\"\n\n/**\n * Read the scaffold registered under `scaffoldId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { inspectorOpen, hiddenPanelIds } = useScaffoldState(\"workspace\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on every\n * change, hovers included. A component that reads one field should subscribe\n * to that field's atom instead:\n * `useAtomValue(scaffoldInspectorOpenAtom(\"workspace\"))`.\n */\nexport function useScaffoldState(scaffoldId: ScaffoldInstanceId): ScaffoldState {\n return useAtomValue(scaffoldStateAtom(scaffoldId))\n}\n\n/**\n * Drive the scaffold registered under `scaffoldId` from anywhere. Writes\n * only — the caller never re-renders when the scaffold changes, so this is\n * what a command palette or a keyboard shortcut should reach for.\n *\n * ```tsx\n * const scaffold = useScaffoldActions(\"workspace\")\n * <Button onClick={scaffold.toggleInspector}>Inspect</Button>\n * ```\n */\nexport function useScaffoldActions(\n scaffoldId: ScaffoldInstanceId\n): ScaffoldStateActions {\n const setInspectorOpen = useSetAtom(setScaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n const togglePanel = useSetAtom(toggleScaffoldPanelAtom(scaffoldId))\n const reset = useSetAtom(resetScaffoldAtom(scaffoldId))\n\n return useMemo(\n () => ({ setInspectorOpen, toggleInspector, togglePanel, reset }),\n [setInspectorOpen, toggleInspector, togglePanel, reset]\n )\n}\n","import { PanelCloseButton } from \"./panel-close-button\"\nimport { PanelMenuButton } from \"./panel-menu-button.tsx\"\nimport { ScaffoldActions } from \"./scaffold-actions\"\nimport { ScaffoldCanvas } from \"./scaffold-canvas\"\nimport { ScaffoldInspector } from \"./scaffold-inspector\"\nimport { ScaffoldMain } from \"./scaffold-main\"\nimport { ScaffoldPanel } from \"./scaffold-panel\"\nimport { ScaffoldRoot } from \"./scaffold-root\"\nimport { ScaffoldSidebar } from \"./scaffold-sidebar\"\nimport { ScaffoldTab } from \"./scaffold-tab\"\nimport { ScaffoldSubPanel } from \"@/components/blocks/scaffold/scaffold-sub-panel.tsx\"\n\nexport { useScaffoldContext } from \"./scaffold-context\"\nexport { useScaffold } from \"./use-scaffold\"\nexport { useScaffoldActions, useScaffoldState } from \"./use-scaffold-state\"\nexport {\n removeScaffoldInstance,\n resetScaffoldAtom,\n scaffoldHiddenPanelIdsAtom,\n scaffoldHoveredPanelIdAtom,\n scaffoldInspectorOpenAtom,\n scaffoldPanelCapacityAtom,\n scaffoldPanelDimmedAtom,\n scaffoldPanelHiddenAtom,\n scaffoldStateAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nexport type * from \"./type\"\nexport * from \"./constants\"\n\nexport {\n PanelCloseButton,\n PanelMenuButton,\n ScaffoldActions,\n ScaffoldCanvas,\n ScaffoldInspector,\n ScaffoldMain,\n ScaffoldPanel,\n ScaffoldRoot,\n ScaffoldSidebar,\n ScaffoldTab,\n}\n\nexport const Scaffold = {\n Root: ScaffoldRoot,\n Sidebar: ScaffoldSidebar,\n Main: ScaffoldMain,\n Actions: ScaffoldActions,\n Canvas: ScaffoldCanvas,\n Panel: ScaffoldPanel,\n Tab: ScaffoldTab,\n Inspector: ScaffoldInspector,\n SubPanel: ScaffoldSubPanel,\n}\n","import ShellLayout, {\n AnimatedPanel,\n AnimatedPanelTrigger,\n useShellPanels,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitMeasuredAtom,\n shellFitMetricsAtom,\n shellFitPanelBoundsAtom,\n shellFitPanelWidthAtom,\n shellFitRequestedWidthAtom,\n shellFitStateAtom,\n} from \"@/components/blocks/shell\"\n\nconst Layout = {\n Main: ShellLayout,\n Panel: AnimatedPanel,\n Trigger: AnimatedPanelTrigger,\n}\n\nexport {\n useShellPanels,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitMeasuredAtom,\n shellFitMetricsAtom,\n shellFitPanelBoundsAtom,\n shellFitPanelWidthAtom,\n shellFitRequestedWidthAtom,\n shellFitStateAtom,\n}\n\nexport default Layout\n","/**\n * Profile card state — Jotai atom families keyed by a card id.\n *\n * Same layout as the tree (`components/composed/tree/tree-atom.ts`) and the\n * avatar (`components/user-avatar/user-avatar-atom.ts`): in-house `keyed()`\n * families per field, write-only action atoms, a composed read-only state\n * atom, and `removeProfileCardInstance` to drop an id from every family.\n */\n\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport type {\n ProfileCardAction,\n ProfileCardConfig,\n ProfileCardHandlers,\n ProfileCardInstanceId,\n ProfileCardState,\n ProfileCardVariant,\n} from \"./type\"\n\nconst DEFAULT_CONFIG: ProfileCardConfig = {\n controlsVariant: false,\n controlsMenuOpen: false,\n}\nconst NO_HANDLERS: ProfileCardHandlers = {}\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: ProfileCardInstanceId) => AtomType) & {\n remove: (id: ProfileCardInstanceId) => void\n}\n\nconst families: { remove: (id: ProfileCardInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ProfileCardInstanceId) => AtomType) {\n const cache = new Map<ProfileCardInstanceId, AtomType>()\n const family = ((id: ProfileCardInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ProfileCardInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ProfileCardInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ProfileCardInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\nexport const profileCardVariantAtom = stateFamily<ProfileCardVariant>(\n \"variant\",\n \"expanded\"\n)\n\nexport const profileCardMenuOpenAtom = stateFamily<boolean>(\"menuOpen\", false)\n\nexport const profileCardPendingActionIdAtom = stateFamily<string | null>(\n \"pendingActionId\",\n null\n)\n\n/** @internal */\nexport const profileCardConfigAtom = stateFamily<ProfileCardConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n/** @internal */\nexport const profileCardHandlersAtom = stateFamily<ProfileCardHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\nexport const profileCardCollapsedAtom = readFamily(\n \"collapsed\",\n (get, id) => get(profileCardVariantAtom(id)) === \"collapsed\"\n)\n\nexport const profileCardBusyAtom = readFamily(\n \"busy\",\n (get, id) => get(profileCardPendingActionIdAtom(id)) !== null\n)\n\n/** Whole-state read for callers that want the object; the field atoms are\n * cheaper for components that watch one thing. */\nexport const profileCardStateAtom = readFamily<ProfileCardState>(\n \"state\",\n (get, id) => ({\n variant: get(profileCardVariantAtom(id)),\n menuOpen: get(profileCardMenuOpenAtom(id)),\n pendingActionId: get(profileCardPendingActionIdAtom(id)),\n busy: get(profileCardBusyAtom(id)),\n })\n)\n\n// ── actions: variant ───────────────────────────────────────────────────────\n\n/** Reports through `onVariantChange` always; writes the store only when no\n * `variant` prop controls the card — the prop is truth then. */\nexport const setProfileCardVariantAtom = actionFamily<\n [variant: ProfileCardVariant]\n>(\"setVariant\", (get, set, id, variant) => {\n if (get(profileCardVariantAtom(id)) === variant) return\n if (!get(profileCardConfigAtom(id)).controlsVariant)\n set(profileCardVariantAtom(id), variant)\n get(profileCardHandlersAtom(id)).onVariantChange?.(variant)\n})\n\nexport const toggleProfileCardVariantAtom = actionFamily<[]>(\n \"toggleVariant\",\n (get, set, id) => {\n set(\n setProfileCardVariantAtom(id),\n get(profileCardVariantAtom(id)) === \"collapsed\" ? \"expanded\" : \"collapsed\"\n )\n }\n)\n\n// ── actions: menu ──────────────────────────────────────────────────────────\n\n/** Inert while an `open` prop controls the menu. */\nexport const setProfileCardMenuOpenAtom = actionFamily<[open: boolean]>(\n \"setMenuOpen\",\n (get, set, id, open) => {\n if (get(profileCardConfigAtom(id)).controlsMenuOpen) return\n set(profileCardMenuOpenAtom(id), open)\n }\n)\n\n// ── actions: selection ─────────────────────────────────────────────────────\n\n/**\n * Run an action's `onSelect`. A returned promise marks the card busy until it\n * settles; a rejection goes to `onError` and the card leaves its busy state\n * either way. Because the pending id is a store value, it survives the card\n * unmounting mid-flight (sign-out typically unmounts it) — the settle just\n * writes to an instance nobody renders any more.\n */\nexport const selectProfileCardActionAtom = actionFamily<\n [action: ProfileCardAction]\n>(\"selectAction\", (get, set, id, action) => {\n const result = action.onSelect?.()\n if (!(result instanceof Promise)) return\n set(profileCardPendingActionIdAtom(id), action.id)\n result\n .catch((cause: unknown) => get(profileCardHandlersAtom(id)).onError?.(cause))\n .finally(() => {\n // Only clear our own flight — a later action may have taken over.\n if (get(profileCardPendingActionIdAtom(id)) === action.id)\n set(profileCardPendingActionIdAtom(id), null)\n })\n})\n\n// ── internal projections ───────────────────────────────────────────────────\n\n/** @internal Projection of the mounted component's controlled props. */\nexport const projectProfileCardPropsAtom = actionFamily<\n [\n config: ProfileCardConfig,\n variant: ProfileCardVariant | undefined,\n menuOpen: boolean | undefined,\n ]\n>(\"projectProps\", (_get, set, id, config, variant, menuOpen) => {\n set(profileCardConfigAtom(id), config)\n if (config.controlsVariant && variant !== undefined)\n set(profileCardVariantAtom(id), variant)\n if (config.controlsMenuOpen && menuOpen !== undefined)\n set(profileCardMenuOpenAtom(id), menuOpen)\n})\n\n/** @internal */\nexport const setProfileCardHandlersAtom = actionFamily<\n [handlers: ProfileCardHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(profileCardHandlersAtom(id), handlers)\n})\n\n/** @internal Seed the uncontrolled variant on mount without firing\n * `onVariantChange`. */\nexport const seedProfileCardVariantAtom = actionFamily<\n [variant: ProfileCardVariant]\n>(\"seedVariant\", (_get, set, id, variant) => {\n set(profileCardVariantAtom(id), variant)\n})\n\n// ── reset ──────────────────────────────────────────────────────────────────\n\nexport const resetProfileCardAtom = actionFamily<[]>(\n \"reset\",\n (_get, set, id) => {\n set(profileCardVariantAtom(id), \"expanded\")\n set(profileCardMenuOpenAtom(id), false)\n set(profileCardPendingActionIdAtom(id), null)\n set(profileCardConfigAtom(id), DEFAULT_CONFIG)\n set(profileCardHandlersAtom(id), NO_HANDLERS)\n }\n)\n\n/** Forget a card entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeProfileCardInstance(id: ProfileCardInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n profileCardBusyAtom,\n profileCardMenuOpenAtom,\n profileCardVariantAtom,\n projectProfileCardPropsAtom,\n removeProfileCardInstance,\n seedProfileCardVariantAtom,\n selectProfileCardActionAtom,\n setProfileCardHandlersAtom,\n setProfileCardMenuOpenAtom,\n} from \"./profile-card-atom\"\nimport type {\n ProfileCardAction,\n ProfileCardConfig,\n ProfileCardHandlers,\n ProfileCardInstanceId,\n ProfileCardVariant,\n} from \"./type\"\n\nexport interface UseProfileCardOptions {\n profileCardId?: ProfileCardInstanceId\n /** Controlled fold. `undefined` leaves the store (and `defaultVariant`) in charge. */\n variant?: ProfileCardVariant\n defaultVariant?: ProfileCardVariant\n onVariantChange?: (variant: ProfileCardVariant) => void\n /** Controlled menu. */\n open?: boolean\n defaultOpen?: boolean\n onError?: (error: unknown) => void\n}\n\nexport interface ProfileCardBinding {\n profileCardId: ProfileCardInstanceId\n variant: ProfileCardVariant\n collapsed: boolean\n menuOpen: boolean\n busy: boolean\n /** Hand to the menu's `onOpenChange` (first argument). Stable. */\n setMenuOpen: (open: boolean) => void\n /** Run an action: `onSelect`, promise → busy, rejection → `onError`. Stable. */\n select: (action: ProfileCardAction) => void\n}\n\n/**\n * Binds one profile card to its slice of the store: projects the controlled\n * `variant` / `open` props (one-way, with write gates so the store never\n * overwrites a prop), publishes the latest handlers, and returns the values\n * the component renders from.\n *\n * Unnamed cards key off `useId` and are dropped on unmount; a named\n * `profileCardId` outlives its component, so a fold set from elsewhere\n * (`useProfileCardActions(id).collapse()`) survives a route change.\n */\nexport function useProfileCard(options: UseProfileCardOptions): ProfileCardBinding {\n const {\n variant: variantProp,\n defaultVariant = \"expanded\",\n onVariantChange,\n open: openProp,\n onError,\n } = options\n const generatedId = React.useId()\n const profileCardId = options.profileCardId ?? generatedId\n\n const controlsVariant = variantProp !== undefined\n const controlsMenuOpen = openProp !== undefined\n const config = React.useMemo<ProfileCardConfig>(\n () => ({ controlsVariant, controlsMenuOpen }),\n [controlsVariant, controlsMenuOpen]\n )\n const handlers = React.useMemo<ProfileCardHandlers>(\n () => ({ onVariantChange, onError }),\n [onVariantChange, onError]\n )\n\n const project = useSetAtom(projectProfileCardPropsAtom(profileCardId))\n const publishHandlers = useSetAtom(setProfileCardHandlersAtom(profileCardId))\n const seedVariant = useSetAtom(seedProfileCardVariantAtom(profileCardId))\n const setMenuOpen = useSetAtom(setProfileCardMenuOpenAtom(profileCardId))\n const select = useSetAtom(selectProfileCardActionAtom(profileCardId))\n\n // Seed the uncontrolled fold once per mount, before the projection — the\n // `default*` options describe the mount, not every render. Layout effects\n // so children read settled values in the same commit; primitive deps, so\n // no loop guard is needed.\n const [seed] = React.useState(() => ({\n variant: variantProp ?? defaultVariant,\n open: openProp ?? options.defaultOpen ?? false,\n }))\n React.useLayoutEffect(() => {\n if (!controlsVariant) seedVariant(seed.variant)\n if (!controlsMenuOpen) setMenuOpen(seed.open)\n // Mount-time seed only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n React.useLayoutEffect(() => {\n project(config, variantProp, openProp)\n }, [project, config, variantProp, openProp])\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n\n React.useEffect(() => {\n if (options.profileCardId !== undefined) return\n return () => removeProfileCardInstance(profileCardId)\n }, [options.profileCardId, profileCardId])\n\n const variant = useAtomValue(profileCardVariantAtom(profileCardId))\n const menuOpen = useAtomValue(profileCardMenuOpenAtom(profileCardId))\n const busy = useAtomValue(profileCardBusyAtom(profileCardId))\n\n return {\n profileCardId,\n variant,\n collapsed: variant === \"collapsed\",\n menuOpen,\n busy,\n setMenuOpen,\n select,\n }\n}\n","\"use client\"\n\nimport {\n ChevronsUpDownIcon,\n LogOutIcon,\n SettingsIcon,\n UserIcon,\n UserPlusIcon,\n UsersIcon,\n} from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport {\n AnimatedSidebarPanelContext,\n LABEL_ENTER_TRANSITION,\n LABEL_EXIT_TRANSITION,\n REDUCED_TRANSITION,\n} from \"@/components/blocks/shell/utils\"\nimport { UserAvatar } from \"@/components/user-avatar\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n type MenuPrimitive,\n} from \"@/components/ui/menu\"\nimport { playCue } from \"@/lib/sound\"\nimport { cn } from \"@/lib/utils\"\n\nimport { useProfileCard } from \"./use-profile-card\"\nimport type {\n ProfileCardAction,\n ProfileCardItem,\n ProfileCardUser,\n ProfileCardVariant,\n} from \"./type\"\n\nexport type {\n ProfileCardAction,\n ProfileCardActions,\n ProfileCardInstanceId,\n ProfileCardItem,\n ProfileCardLabel,\n ProfileCardSeparator,\n ProfileCardState,\n ProfileCardUser,\n ProfileCardVariant,\n} from \"./type\"\n\n/**\n * The menu the card ships with. Spread it to keep the shape and attach your\n * own handlers, or ignore it and pass `items` of your own.\n */\nexport const defaultProfileCardItems: ProfileCardItem[] = [\n { type: \"label\", label: \"Management\" },\n { id: \"profile\", label: \"Profile\", icon: <UserIcon aria-hidden=\"true\" /> },\n {\n id: \"settings\",\n label: \"Settings\",\n icon: <SettingsIcon aria-hidden=\"true\" />,\n },\n { type: \"separator\" },\n { id: \"teams\", label: \"Teams\", icon: <UsersIcon aria-hidden=\"true\" /> },\n { id: \"invite\", label: \"Invite\", icon: <UserPlusIcon aria-hidden=\"true\" /> },\n { type: \"separator\" },\n {\n id: \"sign-out\",\n label: \"Log out\",\n icon: <LogOutIcon aria-hidden=\"true\" />,\n variant: \"destructive\",\n },\n]\n\ntype PopupProps = React.ComponentProps<typeof DropdownMenuContent>\n\nexport interface ProfileCardBlockProps {\n user: ProfileCardUser\n /**\n * The menu, flat: actions plus `{ type: \"separator\" }` / `{ type: \"label\" }`\n * entries. Defaults to `defaultProfileCardItems` (no handlers attached).\n */\n items?: ProfileCardItem[]\n /** Menu placement relative to the card. */\n align?: PopupProps[\"align\"]\n side?: PopupProps[\"side\"]\n sideOffset?: PopupProps[\"sideOffset\"]\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: MenuPrimitive.Root.Props[\"onOpenChange\"]\n /**\n * \"content\" sizes the menu to its items; \"card\" locks it to the trigger's\n * width, so `align` stops mattering horizontally.\n */\n menuWidth?: \"content\" | \"card\"\n /**\n * `expanded` shows avatar, name and handle; `collapsed` folds the card to\n * its avatar — for an icon-collapsed sidebar rail. The fold animates: the\n * identity lines and chevron slide to zero width, the avatar stays put.\n * Controlled when passed. Left unset, the card follows the `AnimatedPanel`\n * it sits in (a panel footer folds with the rail on its own), and\n * outside a panel starts from `defaultVariant`.\n */\n variant?: ProfileCardVariant\n defaultVariant?: ProfileCardVariant\n onVariantChange?: (variant: ProfileCardVariant) => void\n /**\n * Name this card's slice of the store so `useProfileCardState(id)` /\n * `useProfileCardActions(id)` can read or drive it (fold it, open its\n * menu) from anywhere under `ExegiaProvider`. Unnamed cards key off\n * `useId` and are dropped on unmount.\n */\n profileCardId?: string\n /**\n * Presence badge on the avatar — overrides `user.presence`. Name the avatar\n * with `avatarId` and `useUserAvatarActions(id).setPresence()` can flip it\n * from a socket handler instead.\n */\n presence?: ProfileCardUser[\"presence\"]\n avatarId?: string\n /**\n * Emit cuelume press/release on the card and play the open/close cues.\n * Inert unless the app opts into interaction sound via `bindSounds()`.\n */\n sound?: boolean\n /** Called when an action's promise rejects — the card leaves its loading state either way. */\n onError?: (error: unknown) => void\n className?: string\n}\n\n/** Split a flat item list into the groups the menu renders. */\nfunction toGroups(\n items: ProfileCardItem[]\n): { label?: string; actions: ProfileCardAction[] }[] {\n const groups: { label?: string; actions: ProfileCardAction[] }[] = []\n let current: { label?: string; actions: ProfileCardAction[] } = {\n actions: [],\n }\n\n for (const item of items) {\n if (item.type === \"separator\") {\n groups.push(current)\n current = { actions: [] }\n } else if (item.type === \"label\") {\n current.label = item.label\n } else {\n current.actions.push(item)\n }\n }\n groups.push(current)\n\n return groups.filter(\n (group) => group.actions.length > 0 || group.label !== undefined\n )\n}\n\n/**\n * Avatar card that opens an account menu.\n *\n * The trigger is the rich identity chip (avatar + name over handle) and the\n * popup is a plain action menu. `items` is the whole menu — a flat list of\n * actions, separators and labels — defaulting to `defaultProfileCardItems`.\n */\nexport function ProfileCardBlock({\n user,\n items = defaultProfileCardItems,\n align = \"center\",\n side = \"bottom\",\n sideOffset = 8,\n menuWidth = \"content\",\n variant: variantProp,\n defaultVariant,\n onVariantChange,\n profileCardId,\n presence,\n avatarId,\n open,\n defaultOpen,\n onOpenChange,\n sound = true,\n onError,\n className,\n}: ProfileCardBlockProps): React.ReactElement {\n const groups = React.useMemo(() => toGroups(items), [items])\n\n // Optional, not required: the card is a standalone block that also lands\n // in sidebar footers, so it reads the panel context when there is one and\n // does not throw when there is not. Inside a panel the rail is the truth\n // for the fold, so it is projected as a controlled variant.\n const panel = React.useContext(AnimatedSidebarPanelContext)\n const card = useProfileCard({\n profileCardId,\n variant:\n variantProp ??\n (panel ? (panel.collapsed ? \"collapsed\" : \"expanded\") : undefined),\n defaultVariant,\n onVariantChange,\n open,\n defaultOpen,\n onError,\n })\n const { collapsed, busy, menuOpen, setMenuOpen, select } = card\n const reduce = useReducedMotion()\n const identity = `${user.name}${user.username ? ` ${user.username}` : \"\"}`\n\n const handleOpenChange: MenuPrimitive.Root.Props[\"onOpenChange\"] = (\n nextOpen,\n details\n ) => {\n if (sound) playCue(nextOpen ? \"bloom\" : \"droplet\")\n setMenuOpen(nextOpen)\n onOpenChange?.(nextOpen, details)\n }\n\n return (\n // The store mirrors the menu: `open` (when passed) is projected into it,\n // and this always renders from it, so `useProfileCardActions(id).openMenu()`\n // works the same whether or not the consumer controls the prop.\n <DropdownMenu onOpenChange={handleOpenChange} open={menuOpen}>\n <DropdownMenuTrigger\n disabled={busy}\n render={\n <Button\n // Spelled out rather than left to the name-from-contents rule: the\n // avatar sits inside the button and the handle is a second line.\n aria-label={`${identity}, account menu`}\n className={cn(\n // Quiet at rest — the background only surfaces on hover or\n // while the menu is open.\n \"h-auto w-full justify-between py-1.5 pl-1.5 data-popup-open:bg-accent sm:h-auto\",\n // Folded: a 40px avatar tile, the size the tree rail uses. It\n // is 8px wider than a footer's 32px inner box on purpose — the\n // -mx-1 lets it borrow the footer padding so the 32px avatar\n // clears the 1px border and sits dead centre. The label spans\n // below fold to zero width rather than unmounting so the change\n // animates. Button's own gap-2 stays: its always-mounted loading\n // slot carries a -ms-2 that cancels it, so zeroing the gap would\n // pull the avatar 8px left; the folded chevron cancels its own\n // gap instead (see below). `sm:size-10` because the base carries\n // an `sm:h-auto` that an unprefixed size would not beat.\n collapsed &&\n \"-mx-1 size-10 shrink-0 justify-center rounded-xl p-0 sm:size-10\",\n className\n )}\n data-collapsed={collapsed ? \"\" : undefined}\n data-slot=\"profile-card\"\n data-variant={collapsed ? \"collapsed\" : \"expanded\"}\n loading={busy}\n sound={sound}\n // The visible name is gone while folded — name the tile on hover\n // the way the rail's menu buttons do.\n title={collapsed ? identity : undefined}\n variant=\"ghost\"\n >\n <span\n className={cn(\n \"flex min-w-0 items-center justify-start\",\n collapsed ? \"w-auto gap-0\" : \"w-full gap-2\"\n )}\n >\n <UserAvatar\n // Decorative: the name beside it already labels the card.\n alt=\"\"\n avatarId={avatarId}\n initials={user.initials}\n name={user.name}\n presence={presence ?? user.presence}\n src={user.avatar}\n />\n <motion.span\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? -4 : 0,\n }}\n aria-hidden={collapsed || undefined}\n className={cn(\n \"flex min-w-0 flex-col overflow-hidden text-left whitespace-nowrap\",\n collapsed && \"pointer-events-none\"\n )}\n data-slot=\"profile-card-identity\"\n initial={false}\n transition={\n reduce\n ? REDUCED_TRANSITION\n : collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n >\n <span className=\"truncate font-medium\">{user.name}</span>\n {user.username ? (\n <span className=\"truncate text-xs font-normal text-muted-foreground\">\n {user.username}\n </span>\n ) : null}\n </motion.span>\n </span>\n <motion.span\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? 4 : 0,\n }}\n aria-hidden=\"true\"\n className={cn(\n \"flex shrink-0 items-center overflow-hidden\",\n // 0px wide while folded, but the flex gap before it would\n // still offset the avatar — pull it back by that gap.\n collapsed && \"-ml-2\"\n )}\n initial={false}\n transition={\n reduce\n ? REDUCED_TRANSITION\n : collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n >\n <ChevronsUpDownIcon aria-hidden=\"true\" className=\"size-3.5\" />\n </motion.span>\n </Button>\n }\n />\n <DropdownMenuContent\n align={align}\n // Content-width by default so `align` reads: a popup locked to\n // `--anchor-width` lands in the same place for every value. `!`\n // because the popup's own `not-[class*='w-']:min-w-32` compiles to\n // a higher-specificity `:not(:is())` that would otherwise win.\n className={cn(\n menuWidth === \"card\" ? \"w-(--anchor-width)\" : \"min-w-44!\",\n \"origin-(--transform-origin) transition-[opacity,scale,translate] duration-150 ease-smooth-out data-ending-style:scale-98 data-ending-style:opacity-0 data-ending-style:duration-100 data-starting-style:scale-98 data-starting-style:opacity-0 data-[side=bottom]:data-ending-style:-translate-y-1 data-[side=bottom]:data-starting-style:-translate-y-1 data-[side=top]:data-ending-style:translate-y-1 data-[side=top]:data-starting-style:translate-y-1 motion-reduce:transition-none\"\n )}\n side={side}\n sideOffset={sideOffset}\n >\n {groups.map((group, index) => (\n <React.Fragment key={group.label ?? `group-${group.actions[0]?.id}`}>\n {index > 0 ? <DropdownMenuSeparator /> : null}\n <DropdownMenuGroup>\n {group.label ? (\n <DropdownMenuLabel>{group.label}</DropdownMenuLabel>\n ) : null}\n {group.actions.map((item) => (\n <DropdownMenuItem\n disabled={item.disabled}\n key={item.id}\n onClick={() => select(item)}\n variant={item.variant}\n >\n {item.icon}\n <span>{item.label}</span>\n {item.shortcut ? (\n <DropdownMenuShortcut>{item.shortcut}</DropdownMenuShortcut>\n ) : null}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </React.Fragment>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n profileCardStateAtom,\n resetProfileCardAtom,\n setProfileCardMenuOpenAtom,\n setProfileCardVariantAtom,\n toggleProfileCardVariantAtom,\n} from \"./profile-card-atom\"\nimport type {\n ProfileCardActions,\n ProfileCardInstanceId,\n ProfileCardState,\n} from \"./type\"\n\n/**\n * Read the card registered under `profileCardId` from anywhere below\n * `ExegiaProvider` — no props, no ref, no provider of its own.\n *\n * ```tsx\n * const { variant, busy } = useProfileCardState(\"account\")\n * ```\n *\n * Returns the whole state object, so the caller re-renders on any change. A\n * component that watches one field should subscribe to that atom instead:\n * `useAtomValue(profileCardVariantAtom(\"account\"))`.\n */\nexport function useProfileCardState(\n profileCardId: ProfileCardInstanceId\n): ProfileCardState {\n return useAtomValue(profileCardStateAtom(profileCardId))\n}\n\n/**\n * Write-only handles onto the card registered under `profileCardId`. Nothing\n * here subscribes, so a rail toggle can fold the card without re-rendering\n * when the card changes.\n *\n * ```tsx\n * const { collapse, expand } = useProfileCardActions(\"account\")\n * ```\n */\nexport function useProfileCardActions(\n profileCardId: ProfileCardInstanceId\n): ProfileCardActions {\n const setVariant = useSetAtom(setProfileCardVariantAtom(profileCardId))\n const toggleVariant = useSetAtom(toggleProfileCardVariantAtom(profileCardId))\n const setMenuOpen = useSetAtom(setProfileCardMenuOpenAtom(profileCardId))\n const reset = useSetAtom(resetProfileCardAtom(profileCardId))\n\n return React.useMemo(\n () => ({\n setVariant,\n toggleVariant,\n collapse: () => setVariant(\"collapsed\"),\n expand: () => setVariant(\"expanded\"),\n setMenuOpen,\n openMenu: () => setMenuOpen(true),\n closeMenu: () => setMenuOpen(false),\n reset,\n }),\n [setVariant, toggleVariant, setMenuOpen, reset]\n )\n}\n","\"use client\";\n\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\nimport {\n Children,\n cloneElement,\n forwardRef,\n type HTMLAttributes,\n isValidElement,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useId,\n useState,\n} from \"react\";\nimport { SPRING_LAYOUT } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface SharedLayoutBgProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n children: ReactNode;\n /** Semantic container used for the children. */\n as?: \"div\" | \"ul\";\n /** Tailwind class applied to the moving pill. Defaults to a subtle foreground tint. */\n pillClassName?: string;\n /** Horizontal inset of the pill relative to each row (px). Default 20. */\n inset?: number;\n /** Optional positioning override for the pill wrapper inside each item. */\n pillContainerClassName?: string;\n}\n\nconst variants: Variants = {\n initial: { opacity: 0, filter: \"blur(6px)\" },\n animate: { opacity: 1, filter: \"blur(0px)\" },\n exit: (isActive: boolean) =>\n !isActive ? { opacity: 0, filter: \"blur(6px)\" } : {},\n};\n\nconst reducedVariants: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: (isActive: boolean) => (!isActive ? { opacity: 0 } : {}),\n};\n\nexport const SharedLayoutBg = forwardRef<HTMLElement, SharedLayoutBgProps>(\n function SharedLayoutBg(\n {\n children,\n as = \"div\",\n className,\n onMouseLeave,\n pillClassName,\n pillContainerClassName,\n inset = 20,\n ...props\n },\n forwardedRef,\n ) {\n const [activeId, setActiveId] = useState<string | null>(null);\n const uid = useId();\n const reduce = useReducedMotion();\n\n const renderedChildren = Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const el = child as ReactElement<{\n className?: string;\n onMouseEnter?: () => void;\n children?: ReactNode;\n }>;\n const childKey = el.key ? String(el.key) : `item-${index}`;\n return cloneElement(\n el,\n {\n key: childKey,\n className: cn(\"relative\", el.props.className),\n onMouseEnter: () => {\n el.props.onMouseEnter?.();\n setActiveId(childKey);\n },\n },\n <>\n <AnimatePresence custom={activeId !== null}>\n {activeId !== null ? (\n <motion.div\n variants={reduce ? reducedVariants : variants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n custom={activeId !== null}\n className={cn(\n \"pointer-events-none absolute inset-y-0\",\n pillContainerClassName,\n )}\n style={{ left: -inset, right: -inset }}\n >\n {activeId === childKey ? (\n <motion.div\n layoutId={`shared-bg-${uid}`}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n className={cn(\n \"pointer-events-none h-full w-full rounded-2xl bg-primary/[0.06]\",\n pillClassName,\n )}\n />\n ) : null}\n </motion.div>\n ) : null}\n </AnimatePresence>\n <div className=\"relative z-10\">{el.props.children}</div>\n </>,\n );\n });\n\n const handleMouseLeave = (event: MouseEvent<HTMLElement>) => {\n setActiveId(null);\n onMouseLeave?.(event);\n };\n\n // layoutRoot scopes the pill's layout projection to this list, so fixed or\n // scrolled ancestors can't smear scroll offsets into its movement.\n return as === \"ul\" ? (\n <motion.ul\n {...(props as HTMLMotionProps<\"ul\">)}\n ref={forwardedRef as Ref<HTMLUListElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.ul>\n ) : (\n <motion.div\n {...(props as HTMLMotionProps<\"div\">)}\n ref={forwardedRef as Ref<HTMLDivElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.div>\n );\n },\n);\n","/* eslint-disable react-refresh/only-export-components */\nimport * as React from \"react\"\n\ntype Theme = \"dark\" | \"light\" | \"system\"\ntype ResolvedTheme = \"dark\" | \"light\"\n\ntype ThemeProviderProps = {\n children: React.ReactNode\n defaultTheme?: Theme\n storageKey?: string\n disableTransitionOnChange?: boolean\n}\n\ntype ThemeProviderState = {\n theme: Theme\n setTheme: (theme: Theme) => void\n}\n\nconst COLOR_SCHEME_QUERY = \"(prefers-color-scheme: dark)\"\nconst THEME_VALUES: Theme[] = [\"dark\", \"light\", \"system\"]\n\nconst ThemeProviderContext = React.createContext<\n ThemeProviderState | undefined\n>(undefined)\n\nfunction isTheme(value: string | null): value is Theme {\n if (value === null) {\n return false\n }\n\n return THEME_VALUES.includes(value as Theme)\n}\n\nfunction getSystemTheme(): ResolvedTheme {\n if (window.matchMedia(COLOR_SCHEME_QUERY).matches) {\n return \"dark\"\n }\n\n return \"light\"\n}\n\nfunction disableTransitionsTemporarily() {\n const style = document.createElement(\"style\")\n style.appendChild(\n document.createTextNode(\n \"*,*::before,*::after{-webkit-transition:none!important;transition:none!important}\"\n )\n )\n document.head.appendChild(style)\n\n return () => {\n window.getComputedStyle(document.body)\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n style.remove()\n })\n })\n }\n}\n\nfunction isEditableTarget(target: EventTarget | null) {\n if (!(target instanceof HTMLElement)) {\n return false\n }\n\n if (target.isContentEditable) {\n return true\n }\n\n const editableParent = target.closest(\n \"input, textarea, select, [contenteditable='true']\"\n )\n if (editableParent) {\n return true\n }\n\n return false\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme = \"system\",\n storageKey = \"theme\",\n disableTransitionOnChange = true,\n ...props\n}: ThemeProviderProps) {\n const [theme, setThemeState] = React.useState<Theme>(() => {\n const storedTheme = localStorage.getItem(storageKey)\n if (isTheme(storedTheme)) {\n return storedTheme\n }\n\n return defaultTheme\n })\n\n const setTheme = React.useCallback(\n (nextTheme: Theme) => {\n localStorage.setItem(storageKey, nextTheme)\n setThemeState(nextTheme)\n },\n [storageKey]\n )\n\n const applyTheme = React.useCallback(\n (nextTheme: Theme) => {\n const root = document.documentElement\n const resolvedTheme =\n nextTheme === \"system\" ? getSystemTheme() : nextTheme\n const restoreTransitions = disableTransitionOnChange\n ? disableTransitionsTemporarily()\n : null\n\n root.classList.remove(\"light\", \"dark\")\n root.classList.add(resolvedTheme)\n\n if (restoreTransitions) {\n restoreTransitions()\n }\n },\n [disableTransitionOnChange]\n )\n\n React.useEffect(() => {\n applyTheme(theme)\n\n if (theme !== \"system\") {\n return undefined\n }\n\n const mediaQuery = window.matchMedia(COLOR_SCHEME_QUERY)\n const handleChange = () => {\n applyTheme(\"system\")\n }\n\n mediaQuery.addEventListener(\"change\", handleChange)\n\n return () => {\n mediaQuery.removeEventListener(\"change\", handleChange)\n }\n }, [theme, applyTheme])\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.repeat) {\n return\n }\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n if (isEditableTarget(event.target)) {\n return\n }\n\n if (event.key.toLowerCase() !== \"d\") {\n return\n }\n\n setThemeState((currentTheme) => {\n const nextTheme =\n currentTheme === \"dark\"\n ? \"light\"\n : currentTheme === \"light\"\n ? \"dark\"\n : getSystemTheme() === \"dark\"\n ? \"light\"\n : \"dark\"\n\n localStorage.setItem(storageKey, nextTheme)\n return nextTheme\n })\n }\n\n window.addEventListener(\"keydown\", handleKeyDown)\n\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown)\n }\n }, [storageKey])\n\n React.useEffect(() => {\n const handleStorageChange = (event: StorageEvent) => {\n if (event.storageArea !== localStorage) {\n return\n }\n\n if (event.key !== storageKey) {\n return\n }\n\n if (isTheme(event.newValue)) {\n setThemeState(event.newValue)\n return\n }\n\n setThemeState(defaultTheme)\n }\n\n window.addEventListener(\"storage\", handleStorageChange)\n\n return () => {\n window.removeEventListener(\"storage\", handleStorageChange)\n }\n }, [defaultTheme, storageKey])\n\n const value = React.useMemo(\n () => ({\n theme,\n setTheme,\n }),\n [theme, setTheme]\n )\n\n return (\n <ThemeProviderContext.Provider {...props} value={value}>\n {children}\n </ThemeProviderContext.Provider>\n )\n}\n\nexport const useTheme = () => {\n const context = React.useContext(ThemeProviderContext)\n\n if (context === undefined) {\n throw new Error(\"useTheme must be used within a ThemeProvider\")\n }\n\n return context\n}\n","import { createStore } from \"jotai\"\n\n/** A Jotai store as created by `createStore()`. */\nexport type ExegiaStore = ReturnType<typeof createStore>\n\n/**\n * The library's default store — the one `ExegiaProvider` mounts unless it is\n * handed another. Exported so non-React code (a router guard, a command\n * palette, a test) can read and write library state imperatively:\n *\n * ```ts\n * exegiaStore.get(treeExpandedIdsAtom(\"app-nav\"))\n * ```\n *\n * A single module-level store is wrong for SSR — state would leak between\n * requests — so render-per-request apps pass a fresh `createStore()` to\n * `ExegiaProvider` instead.\n */\nexport const exegiaStore: ExegiaStore = createStore()\n","\"use client\"\n\n/* eslint-disable react-refresh/only-export-components */\n/**\n * The library's one and only state provider.\n *\n * Mount it once at the app root. Every library state hook then works\n * anywhere below it — there are no per-component providers to nest.\n *\n * One provider suffices because library state lives in module-level Jotai\n * atom families keyed by an instance id, not in a context created per\n * component. A new stateful component adds atoms to that module scope; it\n * never adds a provider. Consumer code therefore stays exactly as it is as\n * the library grows.\n *\n * Without this provider the hooks still run, which is the trap: Jotai falls\n * back to its implicit default store, and that store is NOT `exegiaStore`,\n * so imperative access would read a different store than the one the\n * components render from. Mount the provider.\n *\n * ```tsx\n * export function App() {\n * return (\n * <ExegiaProvider sound>\n * <Routes />\n * </ExegiaProvider>\n * )\n * }\n * ```\n */\nimport * as React from \"react\"\nimport { Provider, useStore } from \"jotai\"\n\nimport { ThemeProvider } from \"@/components/theme-provider\"\nimport { bindSounds } from \"@/lib/sound\"\nimport { exegiaStore } from \"./store\"\nimport type { ExegiaStore } from \"./store\"\n\n/** Options forwarded to the library's `ThemeProvider`. */\nexport interface ExegiaThemeOptions {\n defaultTheme?: \"dark\" | \"light\" | \"system\"\n storageKey?: string\n disableTransitionOnChange?: boolean\n}\n\nexport interface ExegiaProviderProps {\n children: React.ReactNode\n /** Store to mount. Defaults to the library's `exegiaStore`. */\n store?: ExegiaStore\n /** Opt into interaction sound. Off unless the app asks for it. */\n sound?: boolean\n /** Mount `ThemeProvider` with these options. Omit it and none is mounted —\n * it reads `localStorage` in its state initializer, so an unconditional\n * mount would break SSR consumers, and `useTheme` already throws without\n * one. */\n theme?: ExegiaThemeOptions\n}\n\nexport function ExegiaProvider({\n children,\n store,\n sound = false,\n theme,\n}: ExegiaProviderProps): React.ReactElement {\n React.useEffect(() => {\n // Idempotent, and deliberately not at module scope: opting into sound is\n // the consuming app's decision, not an import side effect.\n if (sound) bindSounds()\n }, [sound])\n\n return (\n <Provider store={store ?? exegiaStore}>\n {theme ? <ThemeProvider {...theme}>{children}</ThemeProvider> : children}\n </Provider>\n )\n}\n\n/** The store mounted by the nearest `ExegiaProvider` above the caller. */\nexport const useExegiaStore = useStore\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,CAAM,CAAC;AAC7B;;;ACCA,SAAgB,GAAO,EACrB,cACA,GAAG,KAC8C;CACjD,OACE,kBAAC,EAAgB,MAAjB;EACE,WAAW,EACT,mJACA,CACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,GAAY,EAC1B,cACA,GAAG,KAC+C;CAClD,OACE,kBAAC,EAAgB,OAAjB;EACE,WAAW,EAAG,0BAA0B,CAAS;EACjD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,GAAe,EAC7B,cACA,GAAG,KACkD;CACrD,OACE,kBAAC,EAAgB,UAAjB;EACE,WAAW,EACT,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AAwB,CAAS,CAAC;EAC7D,IAAI,CAAC,KAAY,MAAa,EAAU,KAAK,IAAI;EACjD,IAAM,IAAS,GACb,EAAM,IAAI,GAAmB,CAAS,CAAC,GACvC,CACF;EACA,IAAI,KAAU,GAAiB,GAAQ,EAAU,KAAK,EAAE,GAAG;EAE3D,AADA,EAAM,eAAe,GACrB,EAAM,gBAAgB;EACtB,IAAM,IAAO,EAAM,cAAc,sBAAsB,GACjD,KAAS,EAAM,UAAU,EAAK,OAAO,EAAK,QAC1C,IACJ,CAAC,EAAU,KAAK,YAChB,GAAW,EAAU,IAAI,KACzB,KAAS,OACT,KAAS,MACL,WACA,IAAQ,KACN,WACA;EACR,GAAc;GAAE,IAAI,EAAU,KAAK;GAAI;EAAS,CAAC;CACnD,GACA;EAAC;EAAe;EAAW;CAAK,CAClC,GAEM,KAAM,SACH;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF,GAEM,KAAQ,SACL;EACL;EACA,UAAU;EACV;EACA,OAAO;CACT,IACA;EAAC;EAAY;EAAe;EAAW;CAAU,CACnD;CAEA,OAAO,SACE;EACL;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF;;;ACjmBA,IAAa,KAAmB,GAC9B,IACF;AAEA,SAAgB,KAA6C;CAC3D,IAAM,IAAU,GAAW,EAAgB;CAC3C,IAAI,CAAC,GAAS,MAAU,MAAM,8CAA8C;CAC5E,OAAO;AACT;;;ACXA,SAAgB,GAAY,GA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,EAAM,QAAQ,GAAG;KAC3B,EAAc,EAAM,QAAQ;KAC5B;IACF;IAEA,EAAc,CAAY;GAF1B;EAGF;EAIA,OAFA,OAAO,iBAAiB,WAAW,CAAmB,SAEzC;GACX,OAAO,oBAAoB,WAAW,CAAmB;EAC3D;CACF,GAAG,CAAC,GAAc,CAAU,CAAC;CAE7B,IAAM,IAAQ,EAAM,eACX;EACL;EACA;CACF,IACA,CAAC,GAAO,CAAQ,CAClB;CAEA,OACE,kBAAC,GAAqB,UAAtB;EAA+B,GAAI;EAAc;EAC9C;CAC4B,CAAA;AAEnC;;;ACzMA,IAAa,KAA2B,GAAY;;;ACwCpD,SAAgB,GAAe,EAC7B,aACA,UACA,WAAQ,IACR,YAC0C;CAO1C,OANA,EAAM,gBAAgB;EAGpB,AAAI,KAAO,GAAW;CACxB,GAAG,CAAC,CAAK,CAAC,GAGR,kBAAC,IAAD;EAAU,OAAO,KAAS;YACvB,IAAQ,kBAAC,IAAD;GAAe,GAAI;GAAQ;EAAwB,CAAA,IAAI;CACxD,CAAA;AAEd;AAGA,IAAa,KAAiB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/utils.ts","../src/components/ui/avatar.tsx","../src/components/ui/spinner.tsx","../src/components/ui/glasscn/liquid-glass.tsx","../src/lib/glass-variants.ts","../src/components/ui/button.tsx","../src/components/ui/card.tsx","../src/lib/sound.ts","../src/components/ui/checkbox.tsx","../src/components/ui/field.tsx","../src/components/ui/frame.tsx","../src/components/ui/input.tsx","../src/components/ui/textarea.tsx","../src/components/ui/input-group.tsx","../src/components/ui/label.tsx","../src/components/ui/menu.tsx","../src/components/ui/separator.tsx","../src/components/ui/otp-field.tsx","../src/components/ui/skeleton.tsx","../src/components/icons/file-badge-cfm.tsx","../src/components/icons/file-badge-corpus.tsx","../src/components/icons/file-badge-pdf.tsx","../src/components/icons/file-badge-tei.tsx","../src/components/icons/file-badge-tf.tsx","../src/components/icons/file-badge-txt.tsx","../src/components/icons/file-badge-xml.tsx","../src/components/icons/file-wordmark-cfm.tsx","../src/components/icons/file-wordmark-corpus.tsx","../src/components/icons/file-wordmark-pdf.tsx","../src/components/icons/file-wordmark-tei.tsx","../src/components/icons/file-wordmark-tf.tsx","../src/components/icons/file-wordmark-txt.tsx","../src/components/icons/file-wordmark-xml.tsx","../src/lib/ease.ts","../src/components/user-avatar/utils.ts","../src/components/user-avatar/fallback.tsx","../src/components/user-avatar/presence-badge.tsx","../src/components/user-avatar/user-avatar-atom.ts","../src/components/user-avatar/use-user-avatar.ts","../src/components/user-avatar/component.tsx","../src/components/user-avatar/use-user-avatar-state.ts","../src/components/composed/logo.tsx","../src/components/composed/password-input.tsx","../src/components/composed/social-providers.tsx","../src/components/ui/tooltip.tsx","../src/components/composed/tree/tree-context.ts","../src/components/composed/tree/constants.ts","../src/components/composed/tree/utils.ts","../src/components/composed/tree/tree-atom.ts","../src/components/composed/tree/tree-node.tsx","../src/components/composed/tree/use-tree-dnd.ts","../src/components/composed/tree/use-tree.ts","../src/components/composed/tree/tree.tsx","../src/components/composed/tree/use-tree-state.ts","../src/lib/auth-accent.ts","../src/components/blocks/auth/auth-shell.tsx","../src/components/blocks/auth/code-auth-block.tsx","../src/components/blocks/auth/forgot-password-block.tsx","../src/components/blocks/auth/login-block.tsx","../src/components/blocks/auth/onboarding/profile-step.tsx","../src/components/blocks/auth/onboarding-block.tsx","../src/components/blocks/auth/signup-block.tsx","../src/components/blocks/auth/update-password-block.tsx","../src/components/blocks/auth/auth-session-atom.ts","../src/components/blocks/auth/auth-flow-atom.ts","../src/components/blocks/auth/use-auth-state.ts","../src/components/blocks/auth/auth-flow-block.tsx","../src/components/blocks/auth/linked-accounts-block.tsx","../src/components/blocks/auth/passkey-manager-block.tsx","../src/components/blocks/auth/passkey-sign-in-block.tsx","../src/components/blocks/nav/sidebar/utils.ts","../src/components/blocks/nav/sidebar/ai-sidebar-atom.ts","../src/components/blocks/nav/sidebar/use-ai-sidebar.ts","../src/components/blocks/nav/sidebar/sidebar-context.ts","../src/components/blocks/nav/sidebar/sidebar-icon.tsx","../src/components/blocks/nav/sidebar/marquee-label.tsx","../src/components/motion/popover-position.ts","../src/components/motion/popover-morph.tsx","../src/components/blocks/nav/sidebar/sidebar-row.tsx","../src/components/blocks/nav/sidebar/ai-sidebar.tsx","../src/components/blocks/nav/sidebar/use-ai-sidebar-state.ts","../src/components/blocks/nav/sidebar/index.ts","../src/components/blocks/shell/utils.ts","../src/components/blocks/shell/animated-panel.tsx","../src/components/blocks/shell/shell-metrics.ts","../src/components/blocks/shell/shell-fit-atom.ts","../src/components/blocks/shell/use-shell-fit.ts","../src/components/blocks/shell/animated-panel-provider.tsx","../src/components/blocks/shell/animated-panel-trigger.tsx","../src/components/blocks/shell/animated-panel-inset.tsx","../src/components/blocks/shell/shell-layout.tsx","../src/components/blocks/shell/use-shell-panels.ts","../src/components/blocks/shell/use-shell-fit-state.ts","../src/components/blocks/scaffold/constants.ts","../src/components/blocks/scaffold/utils.ts","../src/components/blocks/scaffold/panel-close-button.tsx","../src/components/ui/button-group.tsx","../src/components/ui/glasscn/glass-button-group.tsx","../src/lib/hooks/use-hover-capable.ts","../src/components/blocks/scaffold/panel-menu-button.tsx","../src/components/blocks/scaffold/scaffold-atom.ts","../src/components/blocks/scaffold/scaffold-context.ts","../src/components/blocks/scaffold/scaffold-actions.tsx","../src/components/blocks/scaffold/scaffold-canvas.tsx","../src/components/ui/glasscn/glass-container.tsx","../src/components/blocks/scaffold/scaffold-inspector.tsx","../src/components/blocks/scaffold/scaffold-main.tsx","../src/components/blocks/scaffold/scaffold-sub-panel.tsx","../src/components/blocks/scaffold/scaffold-panel.tsx","../src/components/blocks/scaffold/scaffold-root.tsx","../src/components/blocks/scaffold/scaffold-sidebar.tsx","../src/components/blocks/scaffold/scaffold-tab.tsx","../src/components/blocks/scaffold/use-scaffold.ts","../src/components/blocks/scaffold/use-scaffold-state.ts","../src/components/blocks/scaffold/index.ts","../src/components/blocks/layout.ts","../src/components/blocks/profile/profile-card-atom.ts","../src/components/blocks/profile/use-profile-card.ts","../src/components/blocks/profile/profile-card-block.tsx","../src/components/blocks/profile/use-profile-card-state.ts","../src/components/motion/shared-layout-bg.tsx","../src/components/theme-provider.tsx","../src/state/store.ts","../src/state/exegia-provider.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\";\n\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Avatar({\n className,\n ...props\n}: AvatarPrimitive.Root.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Root\n className={cn(\n \"inline-flex size-8 shrink-0 select-none items-center justify-center overflow-hidden rounded-full bg-background align-middle font-medium text-xs\",\n className,\n )}\n data-slot=\"avatar\"\n {...props}\n />\n );\n}\n\nexport function AvatarImage({\n className,\n ...props\n}: AvatarPrimitive.Image.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Image\n className={cn(\"size-full object-cover\", className)}\n data-slot=\"avatar-image\"\n {...props}\n />\n );\n}\n\nexport function AvatarFallback({\n className,\n ...props\n}: AvatarPrimitive.Fallback.Props): React.ReactElement {\n return (\n <AvatarPrimitive.Fallback\n className={cn(\n \"flex size-full items-center justify-center rounded-full bg-muted\",\n className,\n )}\n data-slot=\"avatar-fallback\"\n {...props}\n />\n );\n}\n\nexport { AvatarPrimitive };\n","import { Loader2Icon } from \"lucide-react\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Spinner({\n className,\n ...props\n}: React.ComponentProps<typeof Loader2Icon>): React.ReactElement {\n return (\n <Loader2Icon\n aria-label=\"Loading\"\n className={cn(\"animate-spin\", className)}\n role=\"status\"\n {...props}\n />\n );\n}\n","\"use client\"\n\nimport {\n type CSSProperties,\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype MapGeometry = {\n width: number // element width, CSS px, integer\n height: number // element height, CSS px, integer\n radius: number // corner radius, CSS px, already clamped to min(width, height) / 2\n bezel: number // fraction (0..1] of the half-min-dimension used as the refractive band\n}\n\nconst MAX_TEXTURE_SIZE = 480\nconst EDGE_TAPER_PX = 1.25\n\nconst displacementMapCache = new Map<string, string>()\n\n// CSS.supports(\"backdrop-filter\", \"url(#f)\") returns true in Safari and\n// Firefox (they parse the value) but neither browser actually renders SVG\n// filters through backdrop-filter. UA sniffing is the only reliable approach.\n// When WebKit ships support (track WebKit bug 245510), loosen this function.\nfunction supportsSvgBackdropFilter() {\n if (typeof navigator === \"undefined\") return false\n const ua = navigator.userAgent\n const isChromium = /Chrom(e|ium)/.test(ua) || /Edg\\//.test(ua)\n return isChromium && !/Firefox/.test(ua)\n}\n\n// NOTE: Per-corner radii and percentage radii are NOT supported. The map\n// reads only borderTopLeftRadius in px. If a future consumer needs\n// asymmetric corners, extend the corner SDF branch to accept four radii.\n//\n// NOTE: Map regeneration renders a ≤480 px texture and encodes a PNG for\n// each unique (width, height, radius, bezel). Continuously animating the\n// element's SIZE will thrash the cache; animate transform: scale instead.\nfunction createDisplacementMap({ width, height, radius, bezel }: MapGeometry) {\n const cacheKey = `${width}:${height}:${radius}:${bezel}`\n const cached = displacementMapCache.get(cacheKey)\n if (cached !== undefined) return cached\n\n const downscale = Math.min(1, MAX_TEXTURE_SIZE / Math.max(width, height))\n const texWidth = Math.max(2, Math.round(width * downscale))\n const texHeight = Math.max(2, Math.round(height * downscale))\n\n const canvas = document.createElement(\"canvas\")\n canvas.width = texWidth\n canvas.height = texHeight\n const ctx = canvas.getContext(\"2d\")\n if (!ctx) return \"\"\n\n const image = ctx.createImageData(texWidth, texHeight)\n const data = image.data\n const halfWidth = width / 2\n const halfHeight = height / 2\n const r = Math.min(radius, halfWidth, halfHeight)\n const bezelPx = Math.max(1, bezel * Math.min(halfWidth, halfHeight))\n\n for (let ty = 0; ty < texHeight; ty += 1) {\n for (let tx = 0; tx < texWidth; tx += 1) {\n // Texel center in element coordinates, origin at element center.\n const px = ((tx + 0.5) / texWidth) * width - halfWidth\n const py = ((ty + 0.5) / texHeight) * height - halfHeight\n\n // Signed distance + outward normal of the rounded-rectangle contour.\n const qx = Math.abs(px) - (halfWidth - r)\n const qy = Math.abs(py) - (halfHeight - r)\n let signedDistance: number\n let dirX = 0\n let dirY = 0\n if (qx > 0 && qy > 0) {\n const len = Math.hypot(qx, qy)\n signedDistance = len - r\n dirX = (Math.sign(px) * qx) / len\n dirY = (Math.sign(py) * qy) / len\n } else if (qx > qy) {\n signedDistance = qx - r\n dirX = Math.sign(px)\n } else {\n signedDistance = qy - r\n dirY = Math.sign(py)\n }\n\n const index = (ty * texWidth + tx) * 4\n const inside = -signedDistance // px from the contour, positive inside\n\n if (inside <= 0) {\n data[index] = 128\n data[index + 1] = 128\n data[index + 2] = 128\n data[index + 3] = 255\n continue\n }\n\n const t = Math.min(1, inside / bezelPx) // 0 at the edge → 1 at the bezel's inner end\n let magnitude = 1 - convexSquircle(t) // max refraction at the edge, optically flat interior\n magnitude *= Math.min(1, inside / EDGE_TAPER_PX) // avoid sampling artifacts on the outermost pixels\n\n data[index] = Math.round(128 + dirX * magnitude * 127)\n data[index + 1] = Math.round(128 + dirY * magnitude * 127)\n data[index + 2] = 128\n data[index + 3] = 255\n }\n }\n\n ctx.putImageData(image, 0, 0)\n const mapUrl = canvas.toDataURL(\"image/png\")\n displacementMapCache.set(cacheKey, mapUrl)\n return mapUrl\n}\n\nfunction convexSquircle(x: number) {\n return Math.pow(1 - Math.pow(1 - x, 4), 0.25)\n}\n\nexport type LiquidGlassProps = HTMLAttributes<HTMLDivElement> & {\n /** Extra blur mixed into the backdrop-filter after the SVG refraction. */\n blur?: number\n /** SVG displacement strength. Higher values bend the sampled backdrop more. */\n refraction?: number\n /**\n * @deprecated Texture size now derives from element size. Accepted for\n * backwards-compatibility but has no effect.\n */\n mapSize?: number\n /** Fraction of the radius used as the curved edge where most refraction happens. */\n bezel?: number\n /** Backdrop saturation. */\n saturation?: number\n}\n\nexport const LiquidGlass = forwardRef<HTMLDivElement, LiquidGlassProps>(\n function LiquidGlass(\n {\n blur = 2,\n refraction = 15,\n mapSize: _mapSize,\n bezel = 0.34,\n saturation = 1.28,\n className,\n style,\n children,\n ...props\n },\n ref\n ) {\n const rawId = useId()\n const filterId = useMemo(\n () => `liquid-glass-${rawId.replace(/:/g, \"\")}`,\n [rawId]\n )\n\n // -------------------------------------------------------------------------\n // Ref merge — we need the DOM node to measure geometry while still\n // forwarding the ref to the consumer.\n // -------------------------------------------------------------------------\n\n const localRef = useRef<HTMLDivElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node\n if (typeof ref === \"function\") ref(node)\n else if (ref) ref.current = node\n },\n [ref]\n )\n\n // -------------------------------------------------------------------------\n // Geometry measurement via ResizeObserver\n // -------------------------------------------------------------------------\n\n const [geometry, setGeometry] = useState<MapGeometry | null>(null)\n\n useEffect(() => {\n const el = localRef.current\n if (!el) return\n const measure = () => {\n const rect = el.getBoundingClientRect()\n const width = Math.round(rect.width)\n const height = Math.round(rect.height)\n if (!width || !height) return\n const parsed = Number.parseFloat(\n getComputedStyle(el).borderTopLeftRadius\n )\n const radius = Math.min(\n Number.isFinite(parsed) ? parsed : Math.min(width, height) / 2,\n width / 2,\n height / 2\n )\n setGeometry((prev) =>\n prev &&\n prev.width === width &&\n prev.height === height &&\n prev.radius === radius &&\n prev.bezel === bezel\n ? prev\n : { width, height, radius, bezel }\n )\n }\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(el)\n return () => observer.disconnect()\n }, [bezel])\n\n const mapUrl = useMemo(\n () => (geometry ? createDisplacementMap(geometry) : \"\"),\n [geometry]\n )\n\n // -------------------------------------------------------------------------\n // Browser capability gate\n //\n // Both SSR and the first client render take the fallback branch so hydration\n // never mismatches. The state is set in an effect (client-only).\n // -------------------------------------------------------------------------\n\n const [supported, setSupported] = useState(false)\n\n useEffect(() => {\n setSupported(supportsSvgBackdropFilter())\n }, [])\n\n const refractionActive = supported && mapUrl !== \"\"\n const backdropFilter = refractionActive\n ? `url(#${filterId}) blur(${blur}px) saturate(${saturation})`\n : `blur(${blur + 2}px) saturate(${saturation})`\n\n return (\n <>\n <div\n ref={setRefs}\n className={cn(\n \"relative overflow-hidden rounded-full bg-white/[0.08]\",\n className\n )}\n style={\n {\n ...style,\n backdropFilter,\n WebkitBackdropFilter: backdropFilter,\n } as CSSProperties\n }\n {...props}\n >\n {children}\n <span\n aria-hidden\n className=\"pointer-events-none absolute inset-0 rounded-[inherit]\"\n style={{\n // Rim thickness, overridable per-consumer via --liquid-glass-rim-width.\n padding: \"var(--liquid-glass-rim-width, 0.5px)\",\n background:\n // iOS 27 liquid-glass rim. Each gradient runs ALONG its edges and\n // fades to nothing at the corners, uniform in between:\n // - to right → white streak on the top + bottom runs\n // - to bottom → dark streak on the left + right runs\n // Streak colors are overridable per-consumer via the\n // --liquid-glass-rim-light / --liquid-glass-rim-dark variables;\n // --liquid-glass-rim-fade sets how far from each corner the\n // streak takes to reach full strength (smaller = longer streak).\n \"linear-gradient(to right, rgba(255,255,255,0), var(--liquid-glass-rim-light, rgba(255,255,255,0.25)) var(--liquid-glass-rim-fade, 18%), var(--liquid-glass-rim-light, rgba(255,255,255,0.25)) calc(100% - var(--liquid-glass-rim-fade, 18%)), rgba(255,255,255,0)), \" +\n \"linear-gradient(to bottom, rgba(0,0,0,0), var(--liquid-glass-rim-dark, rgba(0,0,0,0.2)) var(--liquid-glass-rim-fade, 18%), var(--liquid-glass-rim-dark, rgba(0,0,0,0.2)) calc(100% - var(--liquid-glass-rim-fade, 18%)), rgba(0,0,0,0))\",\n WebkitMask:\n \"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\",\n WebkitMaskComposite: \"xor\",\n mask: \"linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0)\",\n }}\n />\n </div>\n\n {refractionActive && (\n <svg className=\"absolute size-0 overflow-hidden\" aria-hidden>\n <filter\n id={filterId}\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feImage\n href={mapUrl}\n x=\"0\"\n y=\"0\"\n width=\"100%\"\n height=\"100%\"\n preserveAspectRatio=\"none\"\n result=\"map\"\n />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"map\"\n scale={refraction}\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n result=\"displaced\"\n />\n <feGaussianBlur in=\"displaced\" stdDeviation=\"0.15\" />\n </filter>\n </svg>\n )}\n </>\n )\n }\n)\n","export type FrostGlassVariant = \"clear\" | \"frosted\" | \"subtle\" | \"liquid\" | \"liquid-refract\";\nexport type FrostGlassVariantProp = { glassVariant?: FrostGlassVariant };\n\nexport const liquidRefractStyles = \"bg-transparent border-0 shadow-none\";\n\nexport const glassVariantStyles: Record<FrostGlassVariant, string> = {\n clear: [\n \"backdrop-blur-[2px] backdrop-saturate-[1.9]\",\n \"bg-white/[0.25] dark:bg-black/[0.25]\",\n \"border border-white/[0.5] dark:border-white/[0.12]\",\n \"shadow-[0_1px_12px_rgba(0,0,0,0.05)] dark:shadow-[0_1px_12px_rgba(0,0,0,0.2)]\",\n ].join(\" \"),\n frosted: [\n \"backdrop-blur-[16px] backdrop-saturate-[1.6]\",\n \"bg-white/[0.55] dark:bg-black/[0.35]\",\n \"border border-white/[0.4] dark:border-white/10\",\n \"shadow-[0_2px_20px_rgba(0,0,0,0.06)] dark:shadow-[0_2px_20px_rgba(0,0,0,0.3)]\",\n ].join(\" \"),\n subtle: [\n \"backdrop-blur-[4px] backdrop-saturate-[1.5]\",\n \"bg-white/[0.3] dark:bg-white/[0.06]\",\n \"border border-black/[0.05] dark:border-white/[0.08]\",\n \"shadow-sm\",\n ].join(\" \"),\n liquid: [\n // 1) Refractive backdrop — lighter than frosted so the background reads\n // clearly through the lens; saturation + brightness lift makes it bloom.\n \"backdrop-blur-[12px] backdrop-saturate-[1.8] backdrop-brightness-[1.05]\",\n \"dark:backdrop-saturate-[1.6] dark:backdrop-brightness-[0.95]\",\n\n // 2) Base translucent fill (acts as the panel's \"tint\").\n \"bg-white/[0.10] dark:bg-white/[0.04]\",\n\n // 3) Layered radial-gradient sheen + warm bottom tint + vertical wash.\n // Underscores represent spaces inside Tailwind arbitrary values.\n \"[background-image:radial-gradient(120%_85%_at_15%_8%,rgba(255,255,255,0.55)_0%,rgba(255,255,255,0.18)_38%,rgba(255,255,255,0)_70%),radial-gradient(110%_80%_at_85%_100%,rgba(255,210,230,0.22)_0%,rgba(255,255,255,0)_60%),linear-gradient(180deg,rgba(255,255,255,0.28)_0%,rgba(255,255,255,0.12)_100%)]\",\n \"dark:[background-image:radial-gradient(120%_85%_at_15%_8%,rgba(255,255,255,0.18)_0%,rgba(255,255,255,0.05)_40%,rgba(255,255,255,0)_70%),radial-gradient(110%_80%_at_85%_100%,rgba(120,170,255,0.12)_0%,rgba(0,0,0,0)_60%),linear-gradient(180deg,rgba(255,255,255,0.06)_0%,rgba(0,0,0,0.18)_100%)]\",\n \"[background-size:200%_200%,180%_180%,100%_100%]\",\n \"[background-repeat:no-repeat]\",\n\n // 4) Multi-layer bevel:\n // - inset top hairline highlight (light-from-above)\n // - inset fish-eye glow at the bottom (lensing artifact)\n // - thin inset side rails\n // - outer contact shadow + broader halo (panel feels floating)\n \"shadow-[inset_0_1px_0_0_rgba(255,255,255,0.65),inset_0_-12px_24px_-10px_rgba(255,255,255,0.45),inset_1px_0_0_0_rgba(255,255,255,0.22),inset_-1px_0_0_0_rgba(255,255,255,0.18),0_24px_60px_-18px_rgba(15,23,42,0.30),0_8px_24px_-8px_rgba(15,23,42,0.18)]\",\n \"dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.30),inset_0_-14px_28px_-10px_rgba(180,210,255,0.18),inset_1px_0_0_0_rgba(255,255,255,0.10),inset_-1px_0_0_0_rgba(255,255,255,0.08),0_28px_70px_-18px_rgba(0,0,0,0.55),0_10px_28px_-10px_rgba(0,0,0,0.40)]\",\n\n // 5) Hairline border for the chamfer's outer edge.\n \"border border-white/[0.45] dark:border-white/[0.10]\",\n\n // 6) Slow ambient drift; respects prefers-reduced-motion.\n \"animate-[liquid-drift_18s_ease-in-out_infinite] motion-reduce:animate-none\",\n \"[will-change:background-position]\",\n ].join(\" \"),\n \"liquid-refract\": \"\",\n};\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Spinner } from \"@/components/ui/spinner\";\nimport { LiquidGlass } from \"@/components/ui/glasscn/liquid-glass\";\nimport {\n type FrostGlassVariant,\n glassVariantStyles,\n liquidRefractStyles,\n} from \"@/lib/glass-variants\";\n\nexport const buttonVariants = cva(\n \"relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-[scale,box-shadow,width,height,background-color,border-color] [transition-duration:150ms,150ms,300ms,300ms,150ms,150ms] ease-smooth-out active:scale-97 data-pressed:scale-97 motion-reduce:transition-none motion-reduce:active:scale-100 motion-reduce:data-pressed:scale-100 [&_svg]:transition-transform [&_svg]:duration-150 [&_svg]:ease-smooth-out motion-reduce:[&_svg]:transition-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-loading:select-none sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0\",\n {\n compoundVariants: [\n {\n // `link` is inline text, not a control surface: drop the button box so\n // it sits with the surrounding copy instead of riding high in a 32/36px\n // flex box. Both the bare and `sm:` heights have to be reset —\n // tailwind-merge keeps modifier-prefixed classes in a separate group,\n // so a call-site `h-auto` alone still loses to `sm:h-8`. border-0 makes\n // the inline box exactly one line-height so it doesn't grow the line.\n //\n // align-middle is the alignment that holds: an inline-flex box exposes\n // the baseline of its *first* flex item, which here is the always-\n // mounted loading indicator rather than the label, so plain baseline\n // alignment leaves the text ~3px high. `items-baseline` fixes that but\n // then hangs icons 3px above the label. Centering the box lands within\n // ~1px in every state without touching the loading-morph machinery.\n //\n // Icon sizes are excluded; they keep their square hit area.\n class: \"h-auto border-0 px-0 align-middle sm:h-auto\",\n size: [\"xs\", \"sm\", \"default\", \"lg\", \"xl\"],\n variant: \"link\",\n },\n ],\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n default: \"h-9 px-[calc(--spacing(3)-1px)] sm:h-8\",\n icon: \"size-9 sm:size-8\",\n \"icon-lg\": \"size-8 sm:size-8\",\n \"icon-sm\": \"size-7 sm:size-6\",\n \"icon-xl\":\n \"size-10 sm:size-9 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n \"icon-xs\":\n \"size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9\",\n sm: \"h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7\",\n xl: \"h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n xs: \"h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5\",\n },\n variant: {\n default:\n \"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n destructive:\n \"not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n \"destructive-outline\":\n \"border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n ghost:\n \"border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground\",\n // Base for the glass treatment. The finish itself (blur, tint, bevel)\n // comes from glassVariantStyles keyed by the `glassVariant` prop,\n // which is only accepted when variant is \"glass\".\n glass:\n \"border-transparent text-foreground *:data-[slot=button-loading-indicator]:text-foreground\",\n link: \"border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground\",\n outline:\n \"border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80\",\n },\n },\n },\n);\n\ntype ButtonVariant = VariantProps<typeof buttonVariants>[\"variant\"];\n\ninterface ButtonBaseProps extends useRender.ComponentProps<\"button\"> {\n size?: VariantProps<typeof buttonVariants>[\"size\"];\n loading?: boolean;\n /**\n * Emit cuelume press/release attributes. Inert unless the app opts into\n * interaction sound by calling `bindSounds()` once.\n */\n sound?: boolean;\n}\n\nexport type ButtonProps = ButtonBaseProps &\n (\n | {\n variant: \"glass\";\n /** Glass finish. Only available when `variant` is \"glass\". */\n glassVariant?: FrostGlassVariant;\n }\n | {\n variant?: Exclude<ButtonVariant, \"glass\">;\n glassVariant?: never;\n }\n );\n\nexport function Button({\n className,\n variant,\n size,\n render,\n children,\n loading = false,\n disabled: disabledProp,\n glassVariant,\n sound = true,\n ...props\n}: ButtonProps): React.ReactElement {\n const isDisabled: boolean = Boolean(loading || disabledProp);\n const typeValue: React.ButtonHTMLAttributes<HTMLButtonElement>[\"type\"] =\n render ? undefined : \"button\";\n\n const resolvedGlassVariant: FrostGlassVariant | undefined =\n variant === \"glass\" ? (glassVariant ?? \"liquid-refract\") : undefined;\n const isLiquidRefract = resolvedGlassVariant === \"liquid-refract\";\n\n // Icon-only sizes overlay the spinner on top of the (hidden) icon; text\n // sizes keep the label visible and show the spinner inline before it.\n const isIconSize = (size ?? \"default\").startsWith(\"icon\");\n\n const defaultProps = {\n children: (\n <>\n {!isIconSize && (\n // Always mounted so the button width morphs as the slot collapses\n // and expands; the closed state cancels the flex gap (which varies\n // per size) with a matching negative margin.\n <span\n aria-hidden={loading ? undefined : true}\n data-slot=\"button-loading-indicator\"\n className={cn(\n \"pointer-events-none inline-flex shrink-0 items-center overflow-hidden transition-[max-width,margin-inline-start,opacity,filter] duration-300 ease-smooth-out motion-reduce:transition-none\",\n loading\n ? \"max-w-6\"\n : cn(\n \"max-w-0 opacity-0 blur-[2px]\",\n size === \"xs\" ? \"-ms-1\" : size === \"sm\" ? \"-ms-1.5\" : \"-ms-2\",\n ),\n )}\n >\n <Spinner className={loading ? undefined : \"animate-none\"} />\n </span>\n )}\n {children}\n {loading && isIconSize && (\n <Spinner\n className=\"pointer-events-none absolute\"\n data-slot=\"button-loading-indicator\"\n />\n )}\n </>\n ),\n className: cn(\n buttonVariants({ size, variant }),\n // Label + icon buttons: icons do a gentle scale bump on hover. The\n // class-based :not() skips the spinner (animate-spin / animate-none).\n !isIconSize &&\n \"hover:[&_svg:not([class*='animate-'])]:scale-110 motion-reduce:hover:[&_svg]:scale-100\",\n loading && isIconSize && \"data-loading:text-transparent\",\n resolvedGlassVariant && glassVariantStyles[resolvedGlassVariant],\n isLiquidRefract && liquidRefractStyles,\n className,\n ),\n \"aria-disabled\": loading || undefined,\n \"data-cuelume-press\": sound ? \"\" : undefined,\n \"data-cuelume-release\": sound ? \"\" : undefined,\n \"data-loading\": loading ? \"\" : undefined,\n \"data-glass-variant\": resolvedGlassVariant,\n \"data-slot\": \"button\",\n disabled: isDisabled,\n type: typeValue,\n };\n\n const element = useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(defaultProps, props),\n render,\n });\n\n // liquid-refract delegates the finish to the LiquidGlass wrapper, which\n // renders the SVG-displacement backdrop behind an unstyled button.\n if (isLiquidRefract) {\n return <LiquidGlass>{element}</LiquidGlass>;\n }\n\n return element;\n}\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Card({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ),\n \"data-slot\": \"card\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrame({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=card]:first:[--clip-top:1px]\",\n className,\n ),\n \"data-slot\": \"card-frame\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameHeader({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"relative flex grid auto-rows-min grid-rows-[auto_auto] flex-col items-start gap-x-4 px-6 py-4 has-data-[slot=card-frame-action]:grid-cols-[1fr_auto]\",\n className,\n ),\n \"data-slot\": \"card-frame-header\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameTitle({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"self-center font-semibold text-sm\", className),\n \"data-slot\": \"card-frame-title\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameDescription({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"self-center text-muted-foreground text-sm\", className),\n \"data-slot\": \"card-frame-description\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"col-start-2 nth-3:row-span-2 nth-3:row-start-1 inline-flex self-center justify-self-end\",\n className,\n ),\n \"data-slot\": \"card-frame-action\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFrameFooter({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"px-6 py-4\", className),\n \"data-slot\": \"card-frame-footer\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardHeader({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]\",\n className,\n ),\n \"data-slot\": \"card-header\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardTitle({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"font-heading font-semibold text-lg leading-none\", className),\n \"data-slot\": \"card-title\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardDescription({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\"text-muted-foreground text-sm\", className),\n \"data-slot\": \"card-description\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"col-start-2 row-span-2 row-start-1 inline-flex self-start justify-self-end\",\n className,\n ),\n \"data-slot\": \"card-action\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardPanel({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0\",\n className,\n ),\n \"data-slot\": \"card-panel\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport function CardFooter({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"flex items-center p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pt-4\",\n className,\n ),\n \"data-slot\": \"card-footer\",\n };\n\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(defaultProps, props),\n render,\n });\n}\n\nexport { CardPanel as CardContent };\n","/**\n * Interaction sound for the library, powered by cuelume (Web Audio synthesis,\n * zero runtime deps, SSR-safe).\n *\n * Components only emit inert `data-cuelume-*` attributes — nothing plays\n * until the consuming app opts in once:\n *\n * import { bindSounds } from \"@corpora/ui\"\n * bindSounds()\n *\n * The app owns preferences via setSoundEnabled / setSoundVolume.\n */\nimport { bind, play } from \"cuelume\";\nimport type { SoundName } from \"cuelume\";\n\nlet bound = false;\n\n/** Opt into interaction sound. Delegated and idempotent (see cuelume bind). */\nexport function bindSounds(root?: ParentNode): void {\n bound = true;\n bind(root);\n}\n\n/**\n * Imperative cue used by library components for keyboard-driven interactions\n * the data attributes can't cover (OTP typing, visibility toggles, …).\n * No-op until the app has opted in via bindSounds().\n */\nexport function playCue(name: SoundName, options?: { volume?: number }): void {\n if (bound) play(name, options);\n}\n\nexport {\n play as playSound,\n setEnabled as setSoundEnabled,\n setVolume as setSoundVolume,\n sounds,\n} from \"cuelume\";\nexport type { SoundName };\n","\"use client\";\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport type React from \"react\";\nimport { playCue } from \"@/lib/sound\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Checkbox({\n className,\n sound = true,\n onCheckedChange,\n ...props\n}: CheckboxPrimitive.Root.Props & {\n /** Play the cuelume toggle cue on check/uncheck. Silent until bindSounds(). */\n sound?: boolean;\n}): React.ReactElement {\n return (\n <CheckboxPrimitive.Root\n // Cued off the state change rather than data-cuelume-toggle: Base UI\n // renders the native input as a *sibling* of this root, so a click on an\n // associated <label> never bubbles through an element carrying the\n // attribute and would toggle silently. This fires once for box clicks,\n // label clicks and keyboard Space alike, and not for programmatic changes.\n onCheckedChange={(checked, eventDetails) => {\n if (sound) playCue(\"toggle\");\n onCheckedChange?.(checked, eventDetails);\n }}\n className={cn(\n \"relative inline-flex size-4.5 shrink-0 cursor-pointer items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none\",\n className,\n )}\n data-slot=\"checkbox\"\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className=\"absolute -inset-px flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground\"\n data-slot=\"checkbox-indicator\"\n render={(\n props: React.ComponentProps<\"span\">,\n state: CheckboxPrimitive.Indicator.State,\n ) => (\n <span {...props}>\n {state.indeterminate ? (\n <svg\n aria-hidden=\"true\"\n className=\"size-3.5 sm:size-3\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12h13.496\" />\n </svg>\n ) : (\n <svg\n aria-hidden=\"true\"\n className=\"size-3.5 sm:size-3\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"3\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n )}\n </span>\n )}\n />\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { CheckboxPrimitive };\n","\"use client\";\n\nimport { Field as FieldPrimitive } from \"@base-ui/react/field\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Field({\n className,\n ...props\n}: FieldPrimitive.Root.Props): React.ReactElement {\n return (\n <FieldPrimitive.Root\n className={cn(\"flex flex-col items-start gap-2\", className)}\n data-slot=\"field\"\n {...props}\n />\n );\n}\n\nexport function FieldLabel({\n className,\n ...props\n}: FieldPrimitive.Label.Props): React.ReactElement {\n return (\n <FieldPrimitive.Label\n className={cn(\n \"inline-flex cursor-pointer items-center gap-2 font-medium text-base/4 text-foreground data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:text-xs/3.5 ml-3\",\n className,\n )}\n data-slot=\"field-label\"\n {...props}\n />\n );\n}\n\nexport function FieldItem({\n className,\n ...props\n}: FieldPrimitive.Item.Props): React.ReactElement {\n return (\n <FieldPrimitive.Item\n className={cn(\"flex\", className)}\n data-slot=\"field-item\"\n {...props}\n />\n );\n}\n\nexport function FieldDescription({\n className,\n ...props\n}: FieldPrimitive.Description.Props): React.ReactElement {\n return (\n <FieldPrimitive.Description\n // Entrance morph when conditionally shown: height tweens from 0 via\n // interpolate-size (set on :root) plus a fade/blur rise. Removal is\n // unmount-instant; wrap in AnimatePresence when an exit is needed.\n className={cn(\n \"overflow-hidden text-muted-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none\",\n className,\n )}\n data-slot=\"field-description\"\n {...props}\n />\n );\n}\n\nexport function FieldError({\n className,\n ...props\n}: FieldPrimitive.Error.Props): React.ReactElement {\n return (\n <FieldPrimitive.Error\n className={cn(\n \"overflow-hidden text-destructive-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none\",\n className,\n )}\n data-slot=\"field-error\"\n {...props}\n />\n );\n}\n\nexport const FieldControl: typeof FieldPrimitive.Control =\n FieldPrimitive.Control;\nexport const FieldValidity: typeof FieldPrimitive.Validity =\n FieldPrimitive.Validity;\n\nexport { FieldPrimitive };\n","import type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Frame({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative flex flex-col rounded-2xl bg-muted/72 p-1\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n className,\n )}\n data-slot=\"frame\"\n {...props}\n />\n );\n}\n\nexport function FramePanel({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative rounded-xl border bg-background bg-clip-padding p-5 shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nexport function FrameHeader({\n className,\n ...props\n}: React.ComponentProps<\"header\">): React.ReactElement {\n return (\n <header\n className={cn(\"flex flex-col px-5 py-4\", className)}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nexport function FrameTitle({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nexport function FrameDescription({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nexport function FrameFooter({\n className,\n ...props\n}: React.ComponentProps<\"footer\">): React.ReactElement {\n return (\n <footer\n className={cn(\"px-5 py-4\", className)}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport { Input as InputPrimitive } from \"@base-ui/react/input\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type InputProps = Omit<\n InputPrimitive.Props & React.RefAttributes<HTMLInputElement>,\n \"size\"\n> & {\n size?: \"sm\" | \"default\" | \"lg\" | number;\n unstyled?: boolean;\n nativeInput?: boolean;\n};\n\nexport function Input({\n className,\n size = \"default\",\n unstyled = false,\n nativeInput = false,\n style,\n ...props\n}: InputProps): React.ReactElement {\n const inputClassName = cn(\n // The 5000000s background-color entry is the autofill-flash suppression\n // hack; height/line-height/padding tween size-prop changes.\n \"h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s,height_300ms_var(--ease-smooth-out),line-height_300ms_var(--ease-smooth-out),padding_300ms_var(--ease-smooth-out),font-size_300ms_var(--ease-smooth-out)] placeholder:text-muted-foreground/72 motion-reduce:[transition:background-color_5000000s_ease-in-out_0s] sm:h-7.5 sm:leading-7.5\",\n size === \"sm\" &&\n \"h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5\",\n size === \"lg\" && \"h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5\",\n props.type === \"search\" &&\n \"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none\",\n props.type === \"file\" &&\n \"text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm\",\n );\n\n return (\n <span\n className={\n cn(\n !unstyled &&\n \"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-[box-shadow,border-color] duration-150 ease-smooth-out has-aria-invalid:animate-input-shake motion-reduce:animate-none motion-reduce:transition-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ) || undefined\n }\n data-size={size}\n data-slot=\"input-control\"\n >\n {nativeInput ? (\n <input\n className={inputClassName}\n data-slot=\"input\"\n size={typeof size === \"number\" ? size : undefined}\n style={typeof style === \"function\" ? undefined : style}\n {...props}\n />\n ) : (\n <InputPrimitive\n className={inputClassName}\n data-slot=\"input\"\n size={typeof size === \"number\" ? size : undefined}\n style={style}\n {...props}\n />\n )}\n </span>\n );\n}\n\nexport { InputPrimitive };\n","\"use client\";\n\nimport { Field as FieldPrimitive } from \"@base-ui/react/field\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type TextareaProps = React.ComponentPropsWithoutRef<\"textarea\"> &\n React.RefAttributes<HTMLTextAreaElement> & {\n size?: \"sm\" | \"default\" | \"lg\" | number;\n unstyled?: boolean;\n };\n\nexport function Textarea({\n className,\n size = \"default\",\n unstyled = false,\n ref,\n ...props\n}: TextareaProps): React.ReactElement {\n return (\n <span\n className={\n cn(\n !unstyled &&\n \"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n ) || undefined\n }\n data-size={size}\n data-slot=\"textarea-control\"\n >\n <FieldPrimitive.Control\n ref={ref}\n value={props.value}\n defaultValue={props.defaultValue}\n disabled={props.disabled}\n id={props.id}\n name={props.name}\n render={(defaultProps: React.ComponentProps<\"textarea\">) => (\n <textarea\n className={cn(\n \"field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5\",\n size === \"sm\" &&\n \"min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5\",\n size === \"lg\" &&\n \"min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5\",\n )}\n data-slot=\"textarea\"\n {...mergeProps(defaultProps, props)}\n />\n )}\n />\n </span>\n );\n}\n\nexport { FieldPrimitive };\n","\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { Input, type InputProps } from \"@/components/ui/input\";\nimport { Textarea, type TextareaProps } from \"@/components/ui/textarea\";\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text select-none items-center justify-center gap-2 leading-none [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:-mx-0.5 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"inline-end\":\n \"order-last pe-[calc(--spacing(3)-1px)] has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"order-first ps-[calc(--spacing(3)-1px)] has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nexport function InputGroup({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-autofill:bg-foreground/4 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nexport function InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof inputGroupAddonVariants>): React.ReactElement {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e: React.MouseEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\n \"button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']\",\n );\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nexport function InputGroupText({\n className,\n ...props\n}: React.ComponentProps<\"span\">): React.ReactElement {\n return (\n <span\n className={cn(\n \"line-clamp-1 flex items-center gap-2 whitespace-nowrap text-muted-foreground leading-none in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function InputGroupInput({\n className,\n ...props\n}: InputProps): React.ReactElement {\n return <Input className={className} unstyled {...props} />;\n}\n\nexport function InputGroupTextarea({\n className,\n ...props\n}: TextareaProps): React.ReactElement {\n return <Textarea className={className} unstyled {...props} />;\n}\n","\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Label({\n className,\n render,\n sound = false,\n ...props\n}: useRender.ComponentProps<\"label\"> & {\n /**\n * Emit the cuelume hover tick. Opt-in: a label is a click target for its\n * control, and that control already owns the interaction cue (Checkbox\n * plays `toggle` on check/uncheck), so hover-ticking here double-sounds.\n * Inert until the app calls bindSounds().\n */\n sound?: boolean;\n}): React.ReactElement {\n const defaultProps = {\n className: cn(\n \"inline-flex cursor-pointer items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4\",\n className,\n ),\n \"data-cuelume-hover\": sound ? \"tick\" : undefined,\n \"data-slot\": \"label\",\n };\n\n return useRender({\n defaultTagName: \"label\",\n props: mergeProps<\"label\">(defaultProps, props),\n render,\n });\n}\n","\"use client\";\n\nimport { Menu as MenuPrimitive } from \"@base-ui/react/menu\";\nimport { ChevronRightIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport const MenuCreateHandle: typeof MenuPrimitive.createHandle =\n MenuPrimitive.createHandle;\n\nexport const Menu: typeof MenuPrimitive.Root = MenuPrimitive.Root;\n\nexport const MenuPortal: typeof MenuPrimitive.Portal = MenuPrimitive.Portal;\n\nexport function MenuTrigger({\n className,\n children,\n ...props\n}: MenuPrimitive.Trigger.Props): React.ReactElement {\n return (\n <MenuPrimitive.Trigger\n className={className}\n data-slot=\"menu-trigger\"\n {...props}\n >\n {children}\n </MenuPrimitive.Trigger>\n );\n}\n\nexport function MenuPopup({\n children,\n className,\n sideOffset = 4,\n align = \"center\",\n alignOffset,\n side = \"bottom\",\n anchor,\n portalProps,\n ...props\n}: MenuPrimitive.Popup.Props & {\n align?: MenuPrimitive.Positioner.Props[\"align\"];\n sideOffset?: MenuPrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: MenuPrimitive.Positioner.Props[\"alignOffset\"];\n side?: MenuPrimitive.Positioner.Props[\"side\"];\n anchor?: MenuPrimitive.Positioner.Props[\"anchor\"];\n portalProps?: MenuPrimitive.Portal.Props;\n}): React.ReactElement {\n return (\n <MenuPortal {...portalProps}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"z-50\"\n data-slot=\"menu-positioner\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n className={cn(\n \"relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"menu-popup\"\n {...props}\n >\n <div className=\"max-h-(--available-height) w-full overflow-y-auto p-1\">\n {children}\n </div>\n </MenuPrimitive.Popup>\n </MenuPrimitive.Positioner>\n </MenuPortal>\n );\n}\n\nexport function MenuGroup(\n props: MenuPrimitive.Group.Props,\n): React.ReactElement {\n return <MenuPrimitive.Group data-slot=\"menu-group\" {...props} />;\n}\n\nexport function MenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: MenuPrimitive.Item.Props & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.Item\n className={cn(\n \"flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-item\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nexport function MenuLinkItem({\n className,\n inset,\n variant = \"default\",\n closeOnClick = true,\n ...props\n}: MenuPrimitive.LinkItem.Props & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.LinkItem\n className={cn(\n \"flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0\",\n className,\n )}\n closeOnClick={closeOnClick}\n data-inset={inset}\n data-slot=\"menu-link-item\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nexport function MenuCheckboxItem({\n className,\n children,\n checked,\n variant = \"default\",\n ...props\n}: MenuPrimitive.CheckboxItem.Props & {\n variant?: \"default\" | \"switch\";\n}): React.ReactElement {\n return (\n <MenuPrimitive.CheckboxItem\n checked={checked}\n className={cn(\n \"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n variant === \"switch\"\n ? \"grid-cols-[1fr_auto] gap-4 pe-1.5\"\n : \"grid-cols-[.75rem_1fr] pe-4\",\n className,\n )}\n data-slot=\"menu-checkbox-item\"\n {...props}\n >\n {variant === \"switch\" ? (\n <>\n <span className=\"col-start-1\">{children}</span>\n <MenuPrimitive.CheckboxItemIndicator\n className=\"inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]\"\n keepMounted\n >\n <span className=\"pointer-events-none block aspect-square h-full in-[[data-slot=menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </>\n ) : (\n <>\n <MenuPrimitive.CheckboxItemIndicator className=\"col-start-1 -ms-0.5\">\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </MenuPrimitive.CheckboxItemIndicator>\n <span className=\"col-start-2\">{children}</span>\n </>\n )}\n </MenuPrimitive.CheckboxItem>\n );\n}\n\nexport function MenuRadioGroup(\n props: MenuPrimitive.RadioGroup.Props,\n): React.ReactElement {\n return <MenuPrimitive.RadioGroup data-slot=\"menu-radio-group\" {...props} />;\n}\n\nexport function MenuRadioItem({\n className,\n children,\n ...props\n}: MenuPrimitive.RadioItem.Props): React.ReactElement {\n return (\n <MenuPrimitive.RadioItem\n className={cn(\n \"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[.75rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"menu-radio-item\"\n {...props}\n >\n <MenuPrimitive.RadioItemIndicator className=\"col-start-1 -ms-0.5\">\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n height=\"24\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M5.252 12.7 10.2 18.63 18.748 5.37\" />\n </svg>\n </MenuPrimitive.RadioItemIndicator>\n <span className=\"col-start-2\">{children}</span>\n </MenuPrimitive.RadioItem>\n );\n}\n\nexport function MenuGroupLabel({\n className,\n inset,\n ...props\n}: MenuPrimitive.GroupLabel.Props & {\n inset?: boolean;\n}): React.ReactElement {\n return (\n <MenuPrimitive.GroupLabel\n className={cn(\n \"px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-label\"\n {...props}\n />\n );\n}\n\nexport function MenuSeparator({\n className,\n ...props\n}: MenuPrimitive.Separator.Props): React.ReactElement {\n return (\n <MenuPrimitive.Separator\n className={cn(\"mx-2 my-1 h-px bg-border\", className)}\n data-slot=\"menu-separator\"\n {...props}\n />\n );\n}\n\nexport function MenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"kbd\">): React.ReactElement {\n return (\n <kbd\n className={cn(\n \"ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest\",\n className,\n )}\n data-slot=\"menu-shortcut\"\n {...props}\n />\n );\n}\n\nexport function MenuSub(\n props: MenuPrimitive.SubmenuRoot.Props,\n): React.ReactElement {\n return <MenuPrimitive.SubmenuRoot data-slot=\"menu-sub\" {...props} />;\n}\n\nexport function MenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: MenuPrimitive.SubmenuTrigger.Props & {\n inset?: boolean;\n}): React.ReactElement {\n return (\n <MenuPrimitive.SubmenuTrigger\n className={cn(\n \"flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not(:last-child)]:-mx-0.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n data-inset={inset}\n data-slot=\"menu-sub-trigger\"\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ms-auto -me-0.5 opacity-80\" />\n </MenuPrimitive.SubmenuTrigger>\n );\n}\n\nexport function MenuSubPopup({\n className,\n sideOffset = 0,\n alignOffset,\n align = \"start\",\n ...props\n}: MenuPrimitive.Popup.Props & {\n align?: MenuPrimitive.Positioner.Props[\"align\"];\n sideOffset?: MenuPrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: MenuPrimitive.Positioner.Props[\"alignOffset\"];\n}): React.ReactElement {\n const defaultAlignOffset = align !== \"center\" ? -5 : undefined;\n\n return (\n <MenuPopup\n align={align}\n alignOffset={alignOffset ?? defaultAlignOffset}\n className={className}\n data-slot=\"menu-sub-content\"\n side=\"inline-end\"\n sideOffset={sideOffset}\n {...props}\n />\n );\n}\n\nexport {\n MenuPrimitive,\n MenuCreateHandle as DropdownMenuCreateHandle,\n Menu as DropdownMenu,\n MenuPortal as DropdownMenuPortal,\n MenuTrigger as DropdownMenuTrigger,\n MenuPopup as DropdownMenuContent,\n MenuGroup as DropdownMenuGroup,\n MenuItem as DropdownMenuItem,\n MenuCheckboxItem as DropdownMenuCheckboxItem,\n MenuRadioGroup as DropdownMenuRadioGroup,\n MenuRadioItem as DropdownMenuRadioItem,\n MenuGroupLabel as DropdownMenuLabel,\n MenuSeparator as DropdownMenuSeparator,\n MenuShortcut as DropdownMenuShortcut,\n MenuSub as DropdownMenuSub,\n MenuSubTrigger as DropdownMenuSubTrigger,\n MenuSubPopup as DropdownMenuSubContent,\n};\n","import { Separator as SeparatorPrimitive } from \"@base-ui/react/separator\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n ...props\n}: SeparatorPrimitive.Props) {\n return (\n <SeparatorPrimitive\n data-slot=\"separator\"\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Separator }\n","\"use client\";\n\nimport { OTPField as OTPFieldPrimitive } from \"@base-ui/react/otp-field\";\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { playCue } from \"@/lib/sound\";\nimport { Separator } from \"@/components/ui/separator\";\n\nexport function OTPField({\n className,\n size = \"default\",\n sound = true,\n onValueChange,\n ...props\n}: React.ComponentProps<typeof OTPFieldPrimitive.Root> & {\n size?: \"default\" | \"lg\";\n /** Play a tick cue per entered character. Inert until bindSounds(). */\n sound?: boolean;\n}): React.ReactElement {\n // Typing is keyboard-driven, so the cue is imperative (playCue is gated on\n // the app having called bindSounds). Tick only when characters are added.\n const lastLength = React.useRef(\n String(props.value ?? props.defaultValue ?? \"\").length,\n );\n\n const handleValueChange: NonNullable<typeof onValueChange> = (\n value,\n ...rest\n ) => {\n if (sound && value.length > lastLength.current) {\n playCue(\"tick\");\n }\n lastLength.current = value.length;\n onValueChange?.(value, ...rest);\n };\n\n return (\n <OTPFieldPrimitive.Root\n className={cn(\n \"flex items-center gap-2 has-disabled:opacity-64 has-disabled:**:data-[slot=otp-field-input]:shadow-none has-disabled:**:data-[slot=otp-field-input]:before:shadow-none!\",\n className,\n )}\n data-size={size}\n data-slot=\"otp-field\"\n onValueChange={handleValueChange}\n {...props}\n />\n );\n}\n\nexport function OTPFieldInput({\n className,\n ...props\n}: React.ComponentProps<typeof OTPFieldPrimitive.Input>): React.ReactElement {\n return (\n <OTPFieldPrimitive.Input\n className={cn(\n \"relative in-[[data-slot=otp-field][data-size=lg]]:size-10 size-9 min-w-0 rounded-lg border border-input bg-background not-dark:bg-clip-padding text-center in-[[data-slot=otp-field][data-size=lg]]:text-lg text-base text-foreground in-[[data-slot=otp-field][data-size=lg]]:leading-10 leading-9 shadow-xs/5 outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-focus-visible:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:z-10 focus-visible:border-ring focus-visible:shadow-none focus-visible:ring-[3px] focus-visible:ring-ring/24 aria-invalid:border-destructive/36 aria-invalid:shadow-none aria-invalid:focus-visible:border-destructive/64 aria-invalid:focus-visible:ring-destructive/16 sm:in-[[data-slot=otp-field][data-size=lg]]:size-9 sm:size-8 sm:in-[[data-slot=otp-field][data-size=lg]]:text-base sm:text-sm sm:in-[[data-slot=otp-field][data-size=lg]]:leading-9 sm:leading-8 dark:bg-input/32 dark:aria-invalid:focus-visible:ring-destructive/24 dark:not-focus-visible:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]\",\n className,\n )}\n data-slot=\"otp-field-input\"\n spellCheck={false}\n {...props}\n />\n );\n}\n\nexport function OTPFieldSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>): React.ReactElement {\n return (\n <OTPFieldPrimitive.Separator\n render={\n <Separator\n className={cn(\n \"rounded-full bg-input data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:w-3\",\n className,\n )}\n orientation=\"horizontal\"\n {...props}\n />\n }\n />\n );\n}\n\nexport { OTPFieldPrimitive };\n","import type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n return (\n <div\n className={cn(\n \"animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]\",\n className,\n )}\n data-slot=\"skeleton\"\n {...props}\n />\n );\n}\n","import type { FileIconProps } from \"./types\"\n\n/**\n * CFM file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeCfm({\n size = 64,\n title = \"CFM file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-36 -48 1060 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"cfm-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"cfm-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"cfm-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <path\n d=\"M190,0 L380,0 C469.566859,0 514.350288,0 542.175144,27.8248558 C549.969778,35.6194896 556.348349,44.7112465 561.025334,54.6931524 C570,73.8474329 570,98.5649553 570,148 C570,197.435045 570,222.152567 561.025334,241.306848 C556.348349,251.288754 549.969778,260.38051 542.175144,268.175144 C514.350288,296 469.566859,296 380,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"cfm-badge-l-path-9\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-10\"\n >\n <feOffset\n dx=\"15\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-11\"\n >\n <feGaussianBlur\n stdDeviation=\"7.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-12\"\n dy=\"-9\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.572021293 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <g id=\"cfm-badge-l-text-12\">\n <g transform=\"translate(51, 36)\">\n <defs>\n <g>\n <g id=\"cfm-badge-l-lbl-glyph0-1\">\n <path d=\"M 141.40625 -41.203125 L 111.40625 -50.203125 C 106.40625 -33.59375 94.59375 -24.796875 77.40625 -24.796875 C 54 -24.796875 39.59375 -42.203125 39.59375 -70.40625 C 39.59375 -98.796875 54 -116 77.203125 -116 C 94.59375 -116 106.40625 -107.203125 111.40625 -90.59375 L 141.796875 -99.796875 C 134.203125 -128.59375 112 -144 77.40625 -144 C 35.203125 -144 6.40625 -114.796875 6.40625 -70.40625 C 6.40625 -26.203125 35.203125 3.203125 77.59375 3.203125 C 112 3.203125 133.796875 -12.40625 141.40625 -41.203125 Z M 141.40625 -41.203125 \" />\n </g>\n <g id=\"cfm-badge-l-lbl-glyph0-2\">\n <path d=\"M 11.59375 0 L 42.796875 0 L 42.796875 -60 L 88.40625 -60 L 88.40625 -86.59375 L 42.796875 -86.59375 L 42.796875 -114.40625 L 99.796875 -114.40625 L 99.796875 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n <g id=\"cfm-badge-l-lbl-glyph0-3\">\n <path d=\"M 11.59375 0 L 41.40625 0 L 41.40625 -125.59375 L 67.40625 0 L 111.59375 0 L 137.796875 -125.59375 L 137.796875 0 L 167.40625 0 L 167.40625 -141 L 113 -141 L 89.59375 -14.40625 L 66 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#cfm-badge-l-lbl-glyph0-1\" x=\"0.172602\" y=\"182\" />\n <use\n href=\"#cfm-badge-l-lbl-glyph0-2\"\n x=\"151.332602\"\n y=\"182\"\n />\n <use\n href=\"#cfm-badge-l-lbl-glyph0-3\"\n x=\"259.292602\"\n y=\"182\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-l-filter-13\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"11\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.24543391 0 0 0 0 0.172711707 0 0 0 0 0 0 0 0 0.93 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-l-filter-4)\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#cfm-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-l-filter-5)\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#cfm-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#cfm-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#cfm-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#cfm-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g opacity=\"0.98\">\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-l-filter-10)\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n <use\n fill=\"#F7B500\"\n fillRule=\"evenodd\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-l-filter-11)\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#cfm-badge-l-filter-13)\"\n href=\"#cfm-badge-l-text-12\"\n ></use>\n <use href=\"#cfm-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"cfm-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-d-filter-8\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-d-filter-9\"\n >\n <feGaussianBlur\n stdDeviation=\"7\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-14\"\n dy=\"-3\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.44 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-badge-d-filter-11\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"11.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.652951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-d-filter-4)\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#cfm-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-d-filter-5)\"\n href=\"#cfm-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#cfm-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-d-filter-8)\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n <use\n fill=\"#F7B500\"\n fillRule=\"evenodd\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-badge-d-filter-9)\"\n href=\"#cfm-badge-l-path-9\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#cfm-badge-d-filter-11)\"\n href=\"#cfm-badge-l-text-12\"\n ></use>\n <use href=\"#cfm-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeCfm\n","import type { FileIconProps } from \"./types\"\n\n/**\n * Corpus file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeCorpus({\n size = 64,\n title = \"Corpus file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-44 -48 1068 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"corpus-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"corpus-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"corpus-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-9\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.655695735 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <path\n d=\"M190,0 L688,0 C777.566859,0 822.350288,0 850.175144,27.8248558 C857.969778,35.6194896 864.348349,44.7112465 869.025334,54.6931524 C878,73.8474329 878,98.5649553 878,148 C878,197.435045 878,222.152567 869.025334,241.306848 C864.348349,251.288754 857.969778,260.38051 850.175144,268.175144 C822.350288,296 777.566859,296 688,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"corpus-badge-l-path-10\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-11\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-12\"\n >\n <feGaussianBlur\n stdDeviation=\"6\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-16\"\n dy=\"0\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.577441023 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <g id=\"corpus-badge-l-text-13\">\n <g transform=\"translate(60, 48)\">\n <defs>\n <g>\n <g id=\"corpus-badge-l-lbl-glyph0-1\">\n <path d=\"M 125.84375 -36.671875 L 99.140625 -44.671875 C 94.703125 -29.90625 84.1875 -22.078125 68.890625 -22.078125 C 48.0625 -22.078125 35.25 -37.5625 35.25 -62.65625 C 35.25 -87.9375 48.0625 -103.234375 68.703125 -103.234375 C 84.1875 -103.234375 94.703125 -95.40625 99.140625 -80.640625 L 126.203125 -88.828125 C 119.4375 -114.453125 99.6875 -128.15625 68.890625 -128.15625 C 31.328125 -128.15625 5.703125 -102.171875 5.703125 -62.65625 C 5.703125 -23.3125 31.328125 2.84375 69.0625 2.84375 C 99.6875 2.84375 119.078125 -11.03125 125.84375 -36.671875 Z M 125.84375 -36.671875 \" />\n </g>\n <g id=\"corpus-badge-l-lbl-glyph0-2\">\n <path d=\"M 71.5625 3.03125 C 111.25 3.03125 137.59375 -23.140625 137.59375 -62.65625 C 137.59375 -102.34375 111.25 -128.515625 71.5625 -128.515625 C 31.859375 -128.515625 5.703125 -102.34375 5.703125 -62.65625 C 5.703125 -23.140625 31.859375 3.03125 71.5625 3.03125 Z M 71.5625 -22.078125 C 49.65625 -22.078125 35.25 -38.09375 35.25 -62.65625 C 35.25 -87.390625 49.65625 -103.421875 71.5625 -103.421875 C 93.453125 -103.421875 108.046875 -87.390625 108.046875 -62.65625 C 108.046875 -38.09375 93.453125 -22.078125 71.5625 -22.078125 Z M 71.5625 -22.078125 \" />\n </g>\n <g id=\"corpus-badge-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -58.390625 L 83.84375 0 L 117.84375 0 L 72.796875 -54.109375 C 96.125 -56.609375 109.109375 -69.78125 109.109375 -89.53125 C 109.109375 -111.78125 92.921875 -125.484375 64.265625 -125.484375 L 10.328125 -125.484375 Z M 63.1875 -103.421875 C 74.9375 -103.421875 81.875 -98.796875 81.875 -89.53125 C 81.875 -80.453125 74.9375 -76 63.1875 -76 L 38.09375 -76 L 38.09375 -103.421875 Z M 63.1875 -103.421875 \" />\n </g>\n <g id=\"corpus-badge-l-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -50.734375 L 64.265625 -50.734375 C 92.921875 -50.734375 109.109375 -65.140625 109.109375 -88.109375 C 109.109375 -111.25 92.921875 -125.484375 64.265625 -125.484375 L 10.328125 -125.484375 Z M 63.1875 -103.0625 C 74.9375 -103.0625 81.875 -98.078125 81.875 -88.109375 C 81.875 -78.140625 74.9375 -73.15625 63.1875 -73.15625 L 38.09375 -73.15625 L 38.09375 -103.0625 Z M 63.1875 -103.0625 \" />\n </g>\n <g id=\"corpus-badge-l-lbl-glyph0-5\">\n <path d=\"M 62.125 3.03125 C 94.515625 3.03125 113.921875 -16.375 113.921875 -45.390625 L 113.921875 -125.484375 L 85.265625 -125.484375 L 85.265625 -50.015625 C 85.265625 -33.8125 76.890625 -23.859375 62.125 -23.859375 C 47.171875 -23.859375 38.625 -33.8125 38.625 -50.015625 L 38.625 -125.484375 L 9.96875 -125.484375 L 9.96875 -45.390625 C 9.96875 -16.375 29.546875 3.03125 62.125 3.03125 Z M 62.125 3.03125 \" />\n </g>\n <g id=\"corpus-badge-l-lbl-glyph0-6\">\n <path d=\"M 104.484375 -37.375 C 104.484375 -55.890625 93.984375 -67.8125 75.46875 -73.6875 L 53.046875 -80.640625 C 44.328125 -83.484375 40.046875 -88.109375 40.046875 -94.515625 C 40.046875 -102.53125 46.28125 -107.328125 55.53125 -107.328125 C 65.859375 -107.328125 72.984375 -102 75.65625 -90.953125 L 102.171875 -95.046875 C 98.609375 -115.875 81.34375 -128.515625 55.359375 -128.515625 C 28.296875 -128.515625 11.21875 -113.734375 11.21875 -92.203125 C 11.21875 -75.65625 22.609375 -63.1875 39.875 -58.03125 L 59.984375 -51.796875 C 71.5625 -48.234375 75.65625 -43.25 75.65625 -34.890625 C 75.65625 -25.09375 69.0625 -19.046875 57.140625 -19.046875 C 43.96875 -19.046875 33.8125 -27.40625 31.5 -45.21875 L 3.921875 -39.6875 C 8.015625 -10.140625 27.953125 3.03125 57.140625 3.03125 C 87.21875 3.03125 104.484375 -13.171875 104.484375 -37.375 Z M 104.484375 -37.375 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#corpus-badge-l-lbl-glyph0-1\"\n x=\"0.162793\"\n y=\"162\"\n />\n <use\n href=\"#corpus-badge-l-lbl-glyph0-2\"\n x=\"134.374792\"\n y=\"162\"\n />\n <use\n href=\"#corpus-badge-l-lbl-glyph0-3\"\n x=\"280.512792\"\n y=\"162\"\n />\n <use\n href=\"#corpus-badge-l-lbl-glyph0-4\"\n x=\"402.976792\"\n y=\"162\"\n />\n <use\n href=\"#corpus-badge-l-lbl-glyph0-5\"\n x=\"518.854793\"\n y=\"162\"\n />\n <use\n href=\"#corpus-badge-l-lbl-glyph0-6\"\n x=\"645.768793\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-l-filter-14\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0161792652 0 0 0 0 0 0 0 0 0 0 0 0 0 0.462951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-4)\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#corpus-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-5)\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#corpus-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#corpus-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#corpus-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#corpus-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g\n filter=\"url(#corpus-badge-l-filter-9)\"\n fillRule=\"evenodd\"\n transform=\"translate(0, 266)\"\n >\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-11)\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n <use\n fill=\"#F7B500\"\n fillRule=\"evenodd\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-12)\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#corpus-badge-l-filter-14)\"\n href=\"#corpus-badge-l-text-13\"\n ></use>\n <use href=\"#corpus-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"corpus-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-d-filter-4)\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#corpus-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-d-filter-5)\"\n href=\"#corpus-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#corpus-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g\n filter=\"url(#corpus-badge-l-filter-9)\"\n fillRule=\"evenodd\"\n transform=\"translate(0, 266)\"\n >\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-11)\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n <use\n fill=\"#F7B500\"\n fillRule=\"evenodd\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-badge-l-filter-12)\"\n href=\"#corpus-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#corpus-badge-l-filter-14)\"\n href=\"#corpus-badge-l-text-13\"\n ></use>\n <use href=\"#corpus-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeCorpus\n","import type { FileIconProps } from \"./types\"\n\n/**\n * PDF file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgePdf({\n size = 64,\n title = \"PDF file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-44 -48 1068 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"pdf-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"pdf-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"pdf-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-9\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.655695735 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"pdf-badge-l-linearGradient-10\"\n >\n <stop stopColor=\"#A70000\" offset=\"0%\"></stop>\n <stop stopColor=\"#E80000\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M190,0 L328,0 C417.566859,0 462.350288,0 490.175144,27.8248558 C497.969778,35.6194896 504.348349,44.7112465 509.025334,54.6931524 C518,73.8474329 518,98.5649553 518,148 C518,197.435045 518,222.152567 509.025334,241.306848 C504.348349,251.288754 497.969778,260.38051 490.175144,268.175144 C462.350288,296 417.566859,296 328,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"pdf-badge-l-path-11\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-12\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <g id=\"pdf-badge-l-text-13\">\n <g transform=\"translate(68, 36)\">\n <defs>\n <g>\n <g id=\"pdf-badge-l-lbl-glyph0-1\">\n <path d=\"M 11.59375 0 L 42.796875 0 L 42.796875 -57 L 72.203125 -57 C 104.40625 -57 122.59375 -73.203125 122.59375 -99 C 122.59375 -125 104.40625 -141 72.203125 -141 L 11.59375 -141 Z M 71 -115.796875 C 84.203125 -115.796875 92 -110.203125 92 -99 C 92 -87.796875 84.203125 -82.203125 71 -82.203125 L 42.796875 -82.203125 L 42.796875 -115.796875 Z M 71 -115.796875 \" />\n </g>\n <g id=\"pdf-badge-l-lbl-glyph0-2\">\n <path d=\"M 11.59375 0 L 59.203125 0 C 104.59375 0 132.796875 -26 132.796875 -70.40625 C 132.796875 -114.796875 104.796875 -141 59.40625 -141 L 11.59375 -141 Z M 57.40625 -114.203125 C 85.203125 -114.203125 99.40625 -98.203125 99.40625 -70.40625 C 99.40625 -42.59375 85.40625 -26.796875 57.40625 -26.796875 L 42.796875 -26.796875 L 42.796875 -114.203125 Z M 57.40625 -114.203125 \" />\n </g>\n <g id=\"pdf-badge-l-lbl-glyph0-3\">\n <path d=\"M 11.59375 0 L 42.796875 0 L 42.796875 -60 L 88.40625 -60 L 88.40625 -86.59375 L 42.796875 -86.59375 L 42.796875 -114.40625 L 99.796875 -114.40625 L 99.796875 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#pdf-badge-l-lbl-glyph0-1\" x=\"0.372602\" y=\"182\" />\n <use\n href=\"#pdf-badge-l-lbl-glyph0-2\"\n x=\"130.932602\"\n y=\"182\"\n />\n <use\n href=\"#pdf-badge-l-lbl-glyph0-3\"\n x=\"273.692602\"\n y=\"182\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-l-filter-14\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-l-filter-4)\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#pdf-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-l-filter-5)\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#pdf-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#pdf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#pdf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#pdf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g\n filter=\"url(#pdf-badge-l-filter-9)\"\n fillRule=\"evenodd\"\n transform=\"translate(0, 266)\"\n >\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-l-filter-12)\"\n href=\"#pdf-badge-l-path-11\"\n ></use>\n <use\n fillOpacity=\"0.76\"\n fill=\"url(#pdf-badge-l-linearGradient-10)\"\n fillRule=\"evenodd\"\n href=\"#pdf-badge-l-path-11\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#pdf-badge-l-filter-14)\"\n href=\"#pdf-badge-l-text-13\"\n ></use>\n <use href=\"#pdf-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"pdf-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-badge-d-filter-12\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"17\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-d-filter-4)\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#pdf-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-d-filter-5)\"\n href=\"#pdf-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#pdf-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g\n filter=\"url(#pdf-badge-l-filter-9)\"\n fillRule=\"evenodd\"\n transform=\"translate(0, 266)\"\n >\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-badge-l-filter-12)\"\n href=\"#pdf-badge-l-path-11\"\n ></use>\n <use\n fillOpacity=\"0.88\"\n fill=\"url(#pdf-badge-l-linearGradient-10)\"\n fillRule=\"evenodd\"\n href=\"#pdf-badge-l-path-11\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#pdf-badge-d-filter-12)\"\n href=\"#pdf-badge-l-text-13\"\n ></use>\n <use href=\"#pdf-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgePdf\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TEI file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeTei({\n size = 64,\n title = \"TEI file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-36 -48 1060 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"tei-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"tei-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"tei-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"tei-badge-l-linearGradient-9\"\n >\n <stop stopColor=\"#009F08\" offset=\"0%\"></stop>\n <stop stopColor=\"#00E004\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M190,0 L237,0 C326.566859,0 371.350288,0 399.175144,27.8248558 C406.969778,35.6194896 413.348349,44.7112465 418.025334,54.6931524 C427,73.8474329 427,98.5649553 427,148 C427,197.435045 427,222.152567 418.025334,241.306848 C413.348349,251.288754 406.969778,260.38051 399.175144,268.175144 C371.350288,296 326.566859,296 237,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"tei-badge-l-path-10\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-l-filter-11\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <g id=\"tei-badge-l-text-12\">\n <g transform=\"translate(69, 42)\">\n <defs>\n <g>\n <g id=\"tei-badge-l-lbl-glyph0-1\">\n <path d=\"M 41.796875 0 L 73 0 L 73 -112.796875 L 110.796875 -112.796875 L 110.796875 -141 L 4 -141 L 4 -112.796875 L 41.796875 -112.796875 Z M 41.796875 0 \" />\n </g>\n <g id=\"tei-badge-l-lbl-glyph0-2\">\n <path d=\"M 11.59375 0 L 103 0 L 103 -26.59375 L 42.796875 -26.59375 L 42.796875 -62 L 89.40625 -62 L 89.40625 -88.59375 L 42.796875 -88.59375 L 42.796875 -114.40625 L 102.59375 -114.40625 L 102.59375 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n <g id=\"tei-badge-l-lbl-glyph0-3\">\n <path d=\"M 11.59375 0 L 42.796875 0 L 42.796875 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#tei-badge-l-lbl-glyph0-1\" x=\"0\" y=\"182\" />\n <use href=\"#tei-badge-l-lbl-glyph0-2\" x=\"118.36\" y=\"182\" />\n <use href=\"#tei-badge-l-lbl-glyph0-3\" x=\"230.72\" y=\"182\" />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-l-filter-13\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"16\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0539556118 0 0 0 0 0.212309966 0 0 0 0 0 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-l-filter-4)\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#tei-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-l-filter-5)\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tei-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#tei-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#tei-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#tei-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-l-filter-11)\"\n href=\"#tei-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.8\"\n fill=\"url(#tei-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#tei-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#tei-badge-l-filter-13)\"\n href=\"#tei-badge-l-text-12\"\n ></use>\n <use href=\"#tei-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"tei-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-badge-d-filter-11\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0.124023438 0 0 0 0 0.0202621011 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-d-filter-4)\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#tei-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-d-filter-5)\"\n href=\"#tei-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tei-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-badge-l-filter-11)\"\n href=\"#tei-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.81\"\n fill=\"url(#tei-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#tei-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#tei-badge-d-filter-11)\"\n href=\"#tei-badge-l-text-12\"\n ></use>\n <use href=\"#tei-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeTei\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TF file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeTf({\n size = 64,\n title = \"TF file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-36 -48 1060 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"tf-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"tf-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"tf-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"tf-badge-l-linearGradient-9\"\n >\n <stop stopColor=\"#006B7A\" offset=\"0%\"></stop>\n <stop stopColor=\"#00C8DC\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M186,0 C271.681559,0 314.522339,0 341.91738,25.6405467 C350.73639,33.8947499 357.900344,43.7550864 363.025334,54.6931524 C372,73.8474329 372,98.5649553 372,148 C372,197.435045 372,222.152567 363.025334,241.306848 C357.900344,252.244914 350.73639,262.10525 341.91738,270.359453 C314.522339,296 271.681559,296 186,296 C100.318441,296 57.4776611,296 30.0826199,270.359453 C21.2636099,262.10525 14.0996561,252.244914 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C14.0996561,43.7550864 21.2636099,33.8947499 30.0826199,25.6405467 C57.4776611,0 100.318441,0 186,0 Z\"\n id=\"tf-badge-l-path-10\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-11\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-12\"\n >\n <feGaussianBlur\n stdDeviation=\"2.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-14\"\n dy=\"-3\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.867266681 0 0 0 0 0.867266681 0 0 0 0 0.867266681 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <g id=\"tf-badge-l-text-13\">\n <g transform=\"translate(72.5, 36)\">\n <defs>\n <g>\n <g id=\"tf-badge-l-lbl-glyph0-1\">\n <path d=\"M 41.796875 0 L 73 0 L 73 -112.796875 L 110.796875 -112.796875 L 110.796875 -141 L 4 -141 L 4 -112.796875 L 41.796875 -112.796875 Z M 41.796875 0 \" />\n </g>\n <g id=\"tf-badge-l-lbl-glyph0-2\">\n <path d=\"M 11.59375 0 L 42.796875 0 L 42.796875 -60 L 88.40625 -60 L 88.40625 -86.59375 L 42.796875 -86.59375 L 42.796875 -114.40625 L 99.796875 -114.40625 L 99.796875 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#tf-badge-l-lbl-glyph0-1\" x=\"0.348401\" y=\"182\" />\n <use href=\"#tf-badge-l-lbl-glyph0-2\" x=\"118.708401\" y=\"182\" />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-l-filter-14\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"14\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.462951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-l-filter-4)\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#tf-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-l-filter-5)\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tf-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#tf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#tf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#tf-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-l-filter-11)\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.91\"\n fill=\"url(#tf-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-l-filter-12)\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#tf-badge-l-filter-14)\"\n href=\"#tf-badge-l-text-13\"\n ></use>\n <use href=\"#tf-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"tf-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-d-filter-9\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-d-filter-10\"\n >\n <feGaussianBlur\n stdDeviation=\"2\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-14\"\n dy=\"-2\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.950881546 0 0 0 0 0.950881546 0 0 0 0 0.950881546 0 0 0 0.19 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-badge-d-filter-12\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"25.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.782951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-d-filter-4)\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#tf-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-d-filter-5)\"\n href=\"#tf-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tf-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(1, 256)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-d-filter-9)\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n <use\n fill=\"url(#tf-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-badge-d-filter-10)\"\n href=\"#tf-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#tf-badge-d-filter-12)\"\n href=\"#tf-badge-l-text-13\"\n ></use>\n <use href=\"#tf-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeTf\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TXT file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeTxt({\n size = 64,\n title = \"TXT file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-36 -48 1060 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"txt-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"txt-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"txt-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"txt-badge-l-linearGradient-9\"\n >\n <stop stopColor=\"#000108\" offset=\"0%\"></stop>\n <stop stopColor=\"#000000\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M190,0 L332,0 C421.566859,0 466.350288,0 494.175144,27.8248558 C501.969778,35.6194896 508.348349,44.7112465 513.025334,54.6931524 C522,73.8474329 522,98.5649553 522,148 C522,197.435045 522,222.152567 513.025334,241.306848 C508.348349,251.288754 501.969778,260.38051 494.175144,268.175144 C466.350288,296 421.566859,296 332,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"txt-badge-l-path-10\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-11\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-12\"\n >\n <feGaussianBlur\n stdDeviation=\"7.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-18\"\n dy=\"-7\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.738677154 0 0 0 0 0.738677154 0 0 0 0 0.738677154 0 0 0 0.45 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <g id=\"txt-badge-l-text-13\">\n <g transform=\"translate(76, 36)\">\n <defs>\n <g>\n <g id=\"txt-badge-l-lbl-glyph0-1\">\n <path d=\"M 41.796875 0 L 73 0 L 73 -112.796875 L 110.796875 -112.796875 L 110.796875 -141 L 4 -141 L 4 -112.796875 L 41.796875 -112.796875 Z M 41.796875 0 \" />\n </g>\n <g id=\"txt-badge-l-lbl-glyph0-2\">\n <path d=\"M 107.59375 0 L 142.203125 0 L 97.203125 -74.59375 L 136.40625 -141 L 100.796875 -141 L 72.203125 -91 L 43.40625 -141 L 7.796875 -141 L 47.203125 -74.59375 L 2 0 L 36.796875 0 L 72.203125 -59.796875 Z M 107.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#txt-badge-l-lbl-glyph0-1\" x=\"0\" y=\"182\" />\n <use href=\"#txt-badge-l-lbl-glyph0-2\" x=\"118.36\" y=\"182\" />\n <use href=\"#txt-badge-l-lbl-glyph0-1\" x=\"266.12\" y=\"182\" />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-l-filter-14\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-l-filter-4)\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#txt-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-l-filter-5)\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#txt-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#txt-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#txt-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#txt-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-l-filter-11)\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.8\"\n fill=\"url(#txt-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-l-filter-12)\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#txt-badge-l-filter-14)\"\n href=\"#txt-badge-l-text-13\"\n ></use>\n <use href=\"#txt-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"txt-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"txt-badge-d-linearGradient-7\"\n >\n <stop stopColor=\"#D3D3D3\" offset=\"0%\"></stop>\n <stop stopColor=\"#FFFFFF\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-d-filter-10\"\n >\n <feGaussianBlur\n stdDeviation=\"3\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"2\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.664827914 0 0 0 0 0.664827914 0 0 0 0 0.664827914 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-badge-d-filter-12\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-d-filter-4)\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#txt-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-d-filter-5)\"\n href=\"#txt-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#txt-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-l-filter-11)\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.9\"\n fill=\"url(#txt-badge-d-linearGradient-7)\"\n fillRule=\"evenodd\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-badge-d-filter-10)\"\n href=\"#txt-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#txt-badge-d-filter-12)\"\n href=\"#txt-badge-l-text-13\"\n ></use>\n <use href=\"#txt-badge-l-text-13\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeTxt\n","import type { FileIconProps } from \"./types\"\n\n/**\n * XML file icon — badge variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileBadgeXml({\n size = 64,\n title = \"XML file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"-36 -48 1060 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"xml-badge-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"xml-badge-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"19.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.825750613 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 0 0.989073057 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"5.5\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"xml-badge-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <linearGradient\n x1=\"50%\"\n y1=\"8.3581851%\"\n x2=\"50%\"\n y2=\"83.7772412%\"\n id=\"xml-badge-l-linearGradient-9\"\n >\n <stop stopColor=\"#000FA7\" offset=\"0%\"></stop>\n <stop stopColor=\"#5000E8\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M190,0 L374,0 C463.566859,0 508.350288,0 536.175144,27.8248558 C543.969778,35.6194896 550.348349,44.7112465 555.025334,54.6931524 C564,73.8474329 564,98.5649553 564,148 C564,197.435045 564,222.152567 555.025334,241.306848 C550.348349,251.288754 543.969778,260.38051 536.175144,268.175144 C508.350288,296 463.566859,296 374,296 L190,296 C100.433141,296 55.6497116,296 27.8248558,268.175144 C20.030222,260.38051 13.6516509,251.288754 8.9746663,241.306848 C0,222.152567 0,197.435045 0,148 C0,98.5649553 0,73.8474329 8.9746663,54.6931524 C13.6516509,44.7112465 20.030222,35.6194896 27.8248558,27.8248558 C55.6497116,0 100.433141,0 190,0 Z\"\n id=\"xml-badge-l-path-10\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-l-filter-11\"\n >\n <feOffset\n dx=\"-9\"\n dy=\"-18\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"13.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feComposite\n in=\"shadowBlurOuter1\"\n in2=\"SourceAlpha\"\n operator=\"out\"\n result=\"shadowBlurOuter1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.0196078431 0 0 0 0 0 0 0 0 0 0.309803922 0 0 0 0.121568627 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <g id=\"xml-badge-l-text-12\">\n <g transform=\"translate(69, 36)\">\n <defs>\n <g>\n <g id=\"xml-badge-l-lbl-glyph0-1\">\n <path d=\"M 107.59375 0 L 142.203125 0 L 97.203125 -74.59375 L 136.40625 -141 L 100.796875 -141 L 72.203125 -91 L 43.40625 -141 L 7.796875 -141 L 47.203125 -74.59375 L 2 0 L 36.796875 0 L 72.203125 -59.796875 Z M 107.59375 0 \" />\n </g>\n <g id=\"xml-badge-l-lbl-glyph0-2\">\n <path d=\"M 11.59375 0 L 41.40625 0 L 41.40625 -125.59375 L 67.40625 0 L 111.59375 0 L 137.796875 -125.59375 L 137.796875 0 L 167.40625 0 L 167.40625 -141 L 113 -141 L 89.59375 -14.40625 L 66 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n <g id=\"xml-badge-l-lbl-glyph0-3\">\n <path d=\"M 11.59375 0 L 100 0 L 100 -28.203125 L 42.796875 -28.203125 L 42.796875 -141 L 11.59375 -141 Z M 11.59375 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#xml-badge-l-lbl-glyph0-1\" x=\"0\" y=\"182\" />\n <use href=\"#xml-badge-l-lbl-glyph0-2\" x=\"147.76\" y=\"182\" />\n <use href=\"#xml-badge-l-lbl-glyph0-3\" x=\"330.32\" y=\"182\" />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-l-filter-13\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.872951134 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-l-filter-4)\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#xml-badge-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-l-filter-5)\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#xml-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#xml-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#xml-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#xml-badge-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-l-filter-11)\"\n href=\"#xml-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.8\"\n fill=\"url(#xml-badge-l-linearGradient-9)\"\n fillRule=\"evenodd\"\n href=\"#xml-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#xml-badge-l-filter-13)\"\n href=\"#xml-badge-l-text-12\"\n ></use>\n <use href=\"#xml-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"xml-badge-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-d-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"5.87430251%\"\n y1=\"50%\"\n x2=\"94.2856529%\"\n y2=\"55.0848143%\"\n id=\"xml-badge-d-linearGradient-7\"\n >\n <stop\n stopColor=\"#3A0FFA\"\n stopOpacity=\"0.892348346\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#0E1FFE\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-d-filter-10\"\n >\n <feGaussianBlur\n stdDeviation=\"8\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-11\"\n dy=\"0\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.367072374 0 0 0 0 0.357100939 0 0 0 0 1 0 0 0 0.5 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-badge-d-filter-12\"\n >\n <feOffset\n dx=\"0\"\n dy=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"22.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0113775451 0 0 0 0 0.00367444652 0 0 0 0 0.16369299 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-d-filter-4)\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n <use\n fill=\"url(#xml-badge-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-d-filter-5)\"\n href=\"#xml-badge-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#xml-badge-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(266.5027, 355.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fillRule=\"evenodd\" transform=\"translate(0, 266)\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-l-filter-11)\"\n href=\"#xml-badge-l-path-10\"\n ></use>\n <use\n fillOpacity=\"0.85\"\n fill=\"url(#xml-badge-d-linearGradient-7)\"\n fillRule=\"evenodd\"\n href=\"#xml-badge-l-path-10\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#xml-badge-d-filter-10)\"\n href=\"#xml-badge-l-path-10\"\n ></use>\n </g>\n <g fill=\"#EDEBF1\">\n <use\n filter=\"url(#xml-badge-d-filter-12)\"\n href=\"#xml-badge-l-text-12\"\n ></use>\n <use href=\"#xml-badge-l-text-12\"></use>\n </g>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileBadgeXml\n","import type { FileIconProps } from \"./types\"\n\n/**\n * CFM file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkCfm({\n size = 64,\n title = \"CFM file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"cfm-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"cfm-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"cfm-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"cfm-wordmark-l-text-9\">\n <g transform=\"translate(309, 721.762)\">\n <defs>\n <g>\n <g id=\"cfm-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"cfm-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 125.84375 -36.671875 L 99.140625 -44.671875 C 94.703125 -29.90625 84.1875 -22.078125 68.890625 -22.078125 C 48.0625 -22.078125 35.25 -37.5625 35.25 -62.65625 C 35.25 -87.9375 48.0625 -103.234375 68.703125 -103.234375 C 84.1875 -103.234375 94.703125 -95.40625 99.140625 -80.640625 L 126.203125 -88.828125 C 119.4375 -114.453125 99.6875 -128.15625 68.890625 -128.15625 C 31.328125 -128.15625 5.703125 -102.171875 5.703125 -62.65625 C 5.703125 -23.3125 31.328125 2.84375 69.0625 2.84375 C 99.6875 2.84375 119.078125 -11.03125 125.84375 -36.671875 Z M 125.84375 -36.671875 \" />\n </g>\n <g id=\"cfm-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -53.40625 L 78.671875 -53.40625 L 78.671875 -77.078125 L 38.09375 -77.078125 L 38.09375 -101.8125 L 88.828125 -101.8125 L 88.828125 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n <g id=\"cfm-wordmark-l-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 36.84375 0 L 36.84375 -111.78125 L 59.984375 0 L 99.328125 0 L 122.640625 -111.78125 L 122.640625 0 L 148.984375 0 L 148.984375 -125.484375 L 100.5625 -125.484375 L 79.75 -12.8125 L 58.734375 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#cfm-wordmark-l-lbl-glyph0-1\"\n x=\"0.0300664\"\n y=\"162\"\n />\n <use\n href=\"#cfm-wordmark-l-lbl-glyph0-2\"\n x=\"36.591266\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#cfm-wordmark-l-lbl-glyph0-3\"\n x=\"163.220466\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#cfm-wordmark-l-lbl-glyph0-4\"\n x=\"251.401666\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#cfm-wordmark-l-filter-4)\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#cfm-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-wordmark-l-filter-5)\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#cfm-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#cfm-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#cfm-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#cfm-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#D9A300\">\n <use\n filter=\"url(#cfm-wordmark-l-filter-10)\"\n href=\"#cfm-wordmark-l-text-9\"\n ></use>\n <use href=\"#cfm-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"cfm-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"cfm-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#cfm-wordmark-l-filter-4)\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#cfm-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#cfm-wordmark-d-filter-5)\"\n href=\"#cfm-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#cfm-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#F5C400\">\n <use\n filter=\"url(#cfm-wordmark-l-filter-10)\"\n href=\"#cfm-wordmark-l-text-9\"\n ></use>\n <use href=\"#cfm-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkCfm\n","import type { FileIconProps } from \"./types\"\n\n/**\n * Corpus file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkCorpus({\n size = 64,\n title = \"Corpus file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"corpus-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"corpus-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"corpus-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"corpus-wordmark-l-text-9\">\n <g transform=\"translate(196.5, 746.762)\">\n <defs>\n <g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 21.453125 0.75 C 29.40625 0.75 34.953125 -5.25 34.953125 -12.75 C 34.953125 -20.09375 29.40625 -26.09375 21.453125 -26.09375 C 13.34375 -26.09375 7.796875 -20.09375 7.796875 -12.75 C 7.796875 -5.25 13.34375 0.75 21.453125 0.75 Z M 21.453125 0.75 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 106.046875 -30.90625 L 83.546875 -37.65625 C 79.796875 -25.203125 70.953125 -18.59375 58.046875 -18.59375 C 40.5 -18.59375 29.703125 -31.65625 29.703125 -52.796875 C 29.703125 -74.09375 40.5 -87 57.90625 -87 C 70.953125 -87 79.796875 -80.40625 83.546875 -67.953125 L 106.34375 -74.84375 C 100.65625 -96.453125 84 -108 58.046875 -108 C 26.40625 -108 4.796875 -86.09375 4.796875 -52.796875 C 4.796875 -19.65625 26.40625 2.40625 58.203125 2.40625 C 84 2.40625 100.34375 -9.296875 106.046875 -30.90625 Z M 106.046875 -30.90625 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 60.296875 2.546875 C 93.75 2.546875 115.953125 -19.5 115.953125 -52.796875 C 115.953125 -86.25 93.75 -108.296875 60.296875 -108.296875 C 26.84375 -108.296875 4.796875 -86.25 4.796875 -52.796875 C 4.796875 -19.5 26.84375 2.546875 60.296875 2.546875 Z M 60.296875 -18.59375 C 41.84375 -18.59375 29.703125 -32.09375 29.703125 -52.796875 C 29.703125 -73.65625 41.84375 -87.15625 60.296875 -87.15625 C 78.75 -87.15625 91.046875 -73.65625 91.046875 -52.796875 C 91.046875 -32.09375 78.75 -18.59375 60.296875 -18.59375 Z M 60.296875 -18.59375 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-4\">\n <path d=\"M 8.703125 0 L 32.09375 0 L 32.09375 -49.203125 L 70.65625 0 L 99.296875 0 L 61.34375 -45.59375 C 81 -47.703125 91.953125 -58.796875 91.953125 -75.453125 C 91.953125 -94.203125 78.296875 -105.75 54.15625 -105.75 L 8.703125 -105.75 Z M 53.25 -87.15625 C 63.15625 -87.15625 69 -83.25 69 -75.453125 C 69 -67.796875 63.15625 -64.046875 53.25 -64.046875 L 32.09375 -64.046875 L 32.09375 -87.15625 Z M 53.25 -87.15625 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-5\">\n <path d=\"M 8.703125 0 L 32.09375 0 L 32.09375 -42.75 L 54.15625 -42.75 C 78.296875 -42.75 91.953125 -54.90625 91.953125 -74.25 C 91.953125 -93.75 78.296875 -105.75 54.15625 -105.75 L 8.703125 -105.75 Z M 53.25 -86.84375 C 63.15625 -86.84375 69 -82.65625 69 -74.25 C 69 -65.84375 63.15625 -61.65625 53.25 -61.65625 L 32.09375 -61.65625 L 32.09375 -86.84375 Z M 53.25 -86.84375 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-6\">\n <path d=\"M 52.34375 2.546875 C 79.65625 2.546875 96 -13.796875 96 -38.25 L 96 -105.75 L 71.84375 -105.75 L 71.84375 -42.15625 C 71.84375 -28.5 64.796875 -20.09375 52.34375 -20.09375 C 39.75 -20.09375 32.546875 -28.5 32.546875 -42.15625 L 32.546875 -105.75 L 8.40625 -105.75 L 8.40625 -38.25 C 8.40625 -13.796875 24.90625 2.546875 52.34375 2.546875 Z M 52.34375 2.546875 \" />\n </g>\n <g id=\"corpus-wordmark-l-lbl-glyph0-7\">\n <path d=\"M 88.046875 -31.5 C 88.046875 -47.09375 79.203125 -57.15625 63.59375 -62.09375 L 44.703125 -67.953125 C 37.34375 -70.34375 33.75 -74.25 33.75 -79.65625 C 33.75 -86.40625 39 -90.453125 46.796875 -90.453125 C 55.5 -90.453125 61.5 -85.953125 63.75 -76.65625 L 86.09375 -80.09375 C 83.09375 -97.65625 68.546875 -108.296875 46.65625 -108.296875 C 23.84375 -108.296875 9.453125 -95.84375 9.453125 -77.703125 C 9.453125 -63.75 19.046875 -53.25 33.59375 -48.90625 L 50.546875 -43.65625 C 60.296875 -40.65625 63.75 -36.453125 63.75 -29.40625 C 63.75 -21.15625 58.203125 -16.046875 48.15625 -16.046875 C 37.046875 -16.046875 28.5 -23.09375 26.546875 -38.09375 L 3.296875 -33.453125 C 6.75 -8.546875 23.546875 2.546875 48.15625 2.546875 C 73.5 2.546875 88.046875 -11.09375 88.046875 -31.5 Z M 88.046875 -31.5 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-1\"\n x=\"0.445112\"\n y=\"137\"\n />\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-2\"\n x=\"31.255112\"\n y=\"137\"\n />\n </g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-3\"\n x=\"137.965112\"\n y=\"137\"\n />\n </g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-4\"\n x=\"254.725112\"\n y=\"137\"\n />\n </g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-5\"\n x=\"351.535112\"\n y=\"137\"\n />\n </g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-6\"\n x=\"442.795112\"\n y=\"137\"\n />\n </g>\n <g>\n <use\n href=\"#corpus-wordmark-l-lbl-glyph0-7\"\n x=\"543.355112\"\n y=\"137\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-wordmark-l-filter-4)\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#corpus-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-wordmark-l-filter-5)\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#corpus-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#corpus-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#corpus-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#corpus-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#D9A300\">\n <use\n filter=\"url(#corpus-wordmark-l-filter-10)\"\n href=\"#corpus-wordmark-l-text-9\"\n ></use>\n <use href=\"#corpus-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"corpus-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"corpus-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#corpus-wordmark-l-filter-4)\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#corpus-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#corpus-wordmark-d-filter-5)\"\n href=\"#corpus-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#corpus-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#F5C400\">\n <use\n filter=\"url(#corpus-wordmark-l-filter-10)\"\n href=\"#corpus-wordmark-l-text-9\"\n ></use>\n <use href=\"#corpus-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkCorpus\n","import type { FileIconProps } from \"./types\"\n\n/**\n * PDF file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkPdf({\n size = 64,\n title = \"PDF file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"pdf-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"pdf-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"pdf-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"pdf-wordmark-l-text-9\">\n <g transform=\"translate(333, 721.762)\">\n <defs>\n <g>\n <g id=\"pdf-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"pdf-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -50.734375 L 64.265625 -50.734375 C 92.921875 -50.734375 109.109375 -65.140625 109.109375 -88.109375 C 109.109375 -111.25 92.921875 -125.484375 64.265625 -125.484375 L 10.328125 -125.484375 Z M 63.1875 -103.0625 C 74.9375 -103.0625 81.875 -98.078125 81.875 -88.109375 C 81.875 -78.140625 74.9375 -73.15625 63.1875 -73.15625 L 38.09375 -73.15625 L 38.09375 -103.0625 Z M 63.1875 -103.0625 \" />\n </g>\n <g id=\"pdf-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 52.6875 0 C 93.09375 0 118.1875 -23.140625 118.1875 -62.65625 C 118.1875 -102.171875 93.265625 -125.484375 52.859375 -125.484375 L 10.328125 -125.484375 Z M 51.09375 -101.640625 C 75.828125 -101.640625 88.46875 -87.390625 88.46875 -62.65625 C 88.46875 -37.90625 76 -23.859375 51.09375 -23.859375 L 38.09375 -23.859375 L 38.09375 -101.640625 Z M 51.09375 -101.640625 \" />\n </g>\n <g id=\"pdf-wordmark-l-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -53.40625 L 78.671875 -53.40625 L 78.671875 -77.078125 L 38.09375 -77.078125 L 38.09375 -101.8125 L 88.828125 -101.8125 L 88.828125 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#pdf-wordmark-l-lbl-glyph0-1\"\n x=\"0.238066\"\n y=\"162\"\n />\n <use\n href=\"#pdf-wordmark-l-lbl-glyph0-2\"\n x=\"42.139266\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#pdf-wordmark-l-lbl-glyph0-3\"\n x=\"150.434466\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#pdf-wordmark-l-lbl-glyph0-4\"\n x=\"269.587666\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-wordmark-l-filter-4)\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#pdf-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#pdf-wordmark-l-filter-5)\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#pdf-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#pdf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#pdf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#pdf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#C41010\">\n <use\n filter=\"url(#pdf-wordmark-l-filter-10)\"\n href=\"#pdf-wordmark-l-text-9\"\n ></use>\n <use href=\"#pdf-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"pdf-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"pdf-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <g id=\"pdf-wordmark-d-text-7\">\n <g transform=\"translate(328.523, 733.762)\">\n <defs>\n <g>\n <g id=\"pdf-wordmark-d-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"pdf-wordmark-d-lbl-glyph0-2\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -50.734375 L 64.265625 -50.734375 C 92.921875 -50.734375 109.109375 -65.140625 109.109375 -88.109375 C 109.109375 -111.25 92.921875 -125.484375 64.265625 -125.484375 L 10.328125 -125.484375 Z M 63.1875 -103.0625 C 74.9375 -103.0625 81.875 -98.078125 81.875 -88.109375 C 81.875 -78.140625 74.9375 -73.15625 63.1875 -73.15625 L 38.09375 -73.15625 L 38.09375 -103.0625 Z M 63.1875 -103.0625 \" />\n </g>\n <g id=\"pdf-wordmark-d-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 52.6875 0 C 93.09375 0 118.1875 -23.140625 118.1875 -62.65625 C 118.1875 -102.171875 93.265625 -125.484375 52.859375 -125.484375 L 10.328125 -125.484375 Z M 51.09375 -101.640625 C 75.828125 -101.640625 88.46875 -87.390625 88.46875 -62.65625 C 88.46875 -37.90625 76 -23.859375 51.09375 -23.859375 L 38.09375 -23.859375 L 38.09375 -101.640625 Z M 51.09375 -101.640625 \" />\n </g>\n <g id=\"pdf-wordmark-d-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -53.40625 L 78.671875 -53.40625 L 78.671875 -77.078125 L 38.09375 -77.078125 L 38.09375 -101.8125 L 88.828125 -101.8125 L 88.828125 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#pdf-wordmark-d-lbl-glyph0-1\"\n x=\"0.219134\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#pdf-wordmark-d-lbl-glyph0-2\"\n x=\"42.1186\"\n y=\"162\"\n />\n <use\n href=\"#pdf-wordmark-d-lbl-glyph0-3\"\n x=\"161.432\"\n y=\"162\"\n />\n <use\n href=\"#pdf-wordmark-d-lbl-glyph0-4\"\n x=\"291.6034\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#pdf-wordmark-l-filter-4)\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#pdf-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#pdf-wordmark-d-filter-5)\"\n href=\"#pdf-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#pdf-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#FF5656\">\n <use\n filter=\"url(#pdf-wordmark-l-filter-10)\"\n href=\"#pdf-wordmark-d-text-7\"\n ></use>\n <use href=\"#pdf-wordmark-d-text-7\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkPdf\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TEI file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkTei({\n size = 64,\n title = \"TEI file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"tei-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"tei-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"tei-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"tei-wordmark-l-text-9\">\n <g transform=\"translate(383, 721.762)\">\n <defs>\n <g>\n <g id=\"tei-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"tei-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 37.203125 0 L 64.96875 0 L 64.96875 -100.390625 L 98.609375 -100.390625 L 98.609375 -125.484375 L 3.5625 -125.484375 L 3.5625 -100.390625 L 37.203125 -100.390625 Z M 37.203125 0 \" />\n </g>\n <g id=\"tei-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 91.671875 0 L 91.671875 -23.671875 L 38.09375 -23.671875 L 38.09375 -55.1875 L 79.5625 -55.1875 L 79.5625 -78.859375 L 38.09375 -78.859375 L 38.09375 -101.8125 L 91.3125 -101.8125 L 91.3125 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n <g id=\"tei-wordmark-l-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#tei-wordmark-l-lbl-glyph0-1\"\n x=\"0.434066\"\n y=\"162\"\n />\n <use\n href=\"#tei-wordmark-l-lbl-glyph0-2\"\n x=\"24.357266\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#tei-wordmark-l-lbl-glyph0-3\"\n x=\"121.794466\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#tei-wordmark-l-lbl-glyph0-4\"\n x=\"213.891666\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-wordmark-l-filter-4)\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#tei-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tei-wordmark-l-filter-5)\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tei-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#tei-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#tei-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#tei-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#009F08\">\n <use\n filter=\"url(#tei-wordmark-l-filter-10)\"\n href=\"#tei-wordmark-l-text-9\"\n ></use>\n <use href=\"#tei-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"tei-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tei-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tei-wordmark-l-filter-4)\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#tei-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tei-wordmark-d-filter-5)\"\n href=\"#tei-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tei-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#2EE85C\">\n <use\n filter=\"url(#tei-wordmark-l-filter-10)\"\n href=\"#tei-wordmark-l-text-9\"\n ></use>\n <use href=\"#tei-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkTei\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TF file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkTf({\n size = 64,\n title = \"TF file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"tf-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"tf-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"tf-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"tf-wordmark-l-text-9\">\n <g transform=\"translate(407, 721.762)\">\n <defs>\n <g>\n <g id=\"tf-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"tf-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 37.203125 0 L 64.96875 0 L 64.96875 -100.390625 L 98.609375 -100.390625 L 98.609375 -125.484375 L 3.5625 -125.484375 L 3.5625 -100.390625 L 37.203125 -100.390625 Z M 37.203125 0 \" />\n </g>\n <g id=\"tf-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 38.09375 0 L 38.09375 -53.40625 L 78.671875 -53.40625 L 78.671875 -77.078125 L 38.09375 -77.078125 L 38.09375 -101.8125 L 88.828125 -101.8125 L 88.828125 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use href=\"#tf-wordmark-l-lbl-glyph0-1\" x=\"0.2318\" y=\"162\" />\n <use href=\"#tf-wordmark-l-lbl-glyph0-2\" x=\"24.155\" y=\"162\" />\n </g>\n <g>\n <use\n href=\"#tf-wordmark-l-lbl-glyph0-3\"\n x=\"121.5922\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-wordmark-l-filter-4)\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#tf-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-wordmark-l-filter-5)\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tf-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#tf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#tf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#tf-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#00707F\">\n <use\n filter=\"url(#tf-wordmark-l-filter-10)\"\n href=\"#tf-wordmark-l-text-9\"\n ></use>\n <use href=\"#tf-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"tf-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"tf-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#tf-wordmark-l-filter-4)\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#tf-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#tf-wordmark-d-filter-5)\"\n href=\"#tf-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#tf-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#22D3E0\">\n <use\n filter=\"url(#tf-wordmark-l-filter-10)\"\n href=\"#tf-wordmark-l-text-9\"\n ></use>\n <use href=\"#tf-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkTf\n","import type { FileIconProps } from \"./types\"\n\n/**\n * TXT file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkTxt({\n size = 64,\n title = \"TXT file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"txt-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"txt-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"txt-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"txt-wordmark-l-text-9\">\n <g transform=\"translate(340.5, 721.762)\">\n <defs>\n <g>\n <g id=\"txt-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"txt-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 37.203125 0 L 64.96875 0 L 64.96875 -100.390625 L 98.609375 -100.390625 L 98.609375 -125.484375 L 3.5625 -125.484375 L 3.5625 -100.390625 L 37.203125 -100.390625 Z M 37.203125 0 \" />\n </g>\n <g id=\"txt-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 95.765625 0 L 126.5625 0 L 86.515625 -66.390625 L 121.390625 -125.484375 L 89.71875 -125.484375 L 64.265625 -80.984375 L 38.625 -125.484375 L 6.9375 -125.484375 L 42.015625 -66.390625 L 1.78125 0 L 32.75 0 L 64.265625 -53.21875 Z M 95.765625 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#txt-wordmark-l-lbl-glyph0-1\"\n x=\"0.303066\"\n y=\"162\"\n />\n <use\n href=\"#txt-wordmark-l-lbl-glyph0-2\"\n x=\"24.226266\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#txt-wordmark-l-lbl-glyph0-3\"\n x=\"121.663466\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#txt-wordmark-l-lbl-glyph0-2\"\n x=\"245.266666\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-wordmark-l-filter-4)\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#txt-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-wordmark-l-filter-5)\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#txt-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#txt-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#txt-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#txt-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#1A1A1A\">\n <use\n filter=\"url(#txt-wordmark-l-filter-10)\"\n href=\"#txt-wordmark-l-text-9\"\n ></use>\n <use href=\"#txt-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"txt-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"txt-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#txt-wordmark-l-filter-4)\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#txt-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#txt-wordmark-d-filter-5)\"\n href=\"#txt-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#txt-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#E8E8E8\">\n <use\n filter=\"url(#txt-wordmark-l-filter-10)\"\n href=\"#txt-wordmark-l-text-9\"\n ></use>\n <use href=\"#txt-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkTxt\n","import type { FileIconProps } from \"./types\"\n\n/**\n * XML file icon — wordmark variant.\n * Light/dark artwork layers switch on Tailwind's `dark` variant.\n */\nexport function FileWordmarkXml({\n size = 64,\n title = \"XML file\",\n className,\n ...props\n}: FileIconProps) {\n return (\n <svg\n viewBox=\"0 -48 1024 1114\"\n width={size}\n height={size}\n role={title ? \"img\" : \"presentation\"}\n aria-label={title ?? undefined}\n aria-hidden={title ? undefined : true}\n className={className}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <g data-theme-layer=\"light\" className=\"dark:hidden\">\n <defs>\n <linearGradient\n x1=\"17.6604798%\"\n y1=\"0%\"\n x2=\"49.177195%\"\n y2=\"97.4557292%\"\n id=\"xml-wordmark-l-linearGradient-2\"\n >\n <stop stopColor=\"#FBFAFF\" offset=\"0%\"></stop>\n <stop stopColor=\"#E8E7F0\" offset=\"100%\"></stop>\n </linearGradient>\n <path\n d=\"M332,12 L557.393952,12 C613.901876,12 642.155838,12 664.135334,22.0470049 C686.11483,32.0940098 704.602278,53.4598851 741.577175,96.1916357 L853.580372,225.633315 C884.253388,261.082006 899.589896,278.806351 906.574274,297.524519 C913.558651,316.242686 913.581362,339.681124 913.626783,386.558 L914.017631,789.931634 C914.119069,894.620332 914.169788,946.964682 881.683622,979.482341 C849.197455,1012 796.853082,1012 692.164334,1012 L332,1012 C227.348196,1012 175.022295,1012 142.511147,979.488853 C110,946.977705 110,894.651804 110,790 L110,234 C110,129.348196 110,77.0222946 142.511147,44.5111473 C175.022295,12 227.348196,12 332,12 Z\"\n id=\"xml-wordmark-l-path-3\"\n ></path>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-wordmark-l-filter-4\"\n >\n <feOffset\n dx=\"12\"\n dy=\"-3\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"28.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n ></feColorMatrix>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-wordmark-l-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-wordmark-l-filter-6\"\n >\n <feOffset\n dx=\"0\"\n dy=\"5\"\n in=\"SourceAlpha\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feGaussianBlur\n stdDeviation=\"3.5\"\n in=\"shadowOffsetOuter1\"\n result=\"shadowBlurOuter1\"\n ></feGaussianBlur>\n <feColorMatrix\n values=\"0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0 0.0889199747 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowBlurOuter1\"\n result=\"shadowMatrixOuter1\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixOuter1\"></feMergeNode>\n <feMergeNode in=\"SourceGraphic\"></feMergeNode>\n </feMerge>\n </filter>\n <linearGradient\n x1=\"50%\"\n y1=\"0%\"\n x2=\"50%\"\n y2=\"100%\"\n id=\"xml-wordmark-l-linearGradient-7\"\n >\n <stop stopColor=\"#4B008F\" offset=\"0%\"></stop>\n <stop stopColor=\"#080043\" offset=\"61.8567708%\"></stop>\n </linearGradient>\n <g id=\"xml-wordmark-l-text-9\">\n <g transform=\"translate(307.5, 721.762)\">\n <defs>\n <g>\n <g id=\"xml-wordmark-l-lbl-glyph0-1\">\n <path d=\"M 25.453125 0.890625 C 34.890625 0.890625 41.46875 -6.234375 41.46875 -15.125 C 41.46875 -23.859375 34.890625 -30.96875 25.453125 -30.96875 C 15.84375 -30.96875 9.25 -23.859375 9.25 -15.125 C 9.25 -6.234375 15.84375 0.890625 25.453125 0.890625 Z M 25.453125 0.890625 \" />\n </g>\n <g id=\"xml-wordmark-l-lbl-glyph0-2\">\n <path d=\"M 95.765625 0 L 126.5625 0 L 86.515625 -66.390625 L 121.390625 -125.484375 L 89.71875 -125.484375 L 64.265625 -80.984375 L 38.625 -125.484375 L 6.9375 -125.484375 L 42.015625 -66.390625 L 1.78125 0 L 32.75 0 L 64.265625 -53.21875 Z M 95.765625 0 \" />\n </g>\n <g id=\"xml-wordmark-l-lbl-glyph0-3\">\n <path d=\"M 10.328125 0 L 36.84375 0 L 36.84375 -111.78125 L 59.984375 0 L 99.328125 0 L 122.640625 -111.78125 L 122.640625 0 L 148.984375 0 L 148.984375 -125.484375 L 100.5625 -125.484375 L 79.75 -12.8125 L 58.734375 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n <g id=\"xml-wordmark-l-lbl-glyph0-4\">\n <path d=\"M 10.328125 0 L 89 0 L 89 -25.09375 L 38.09375 -25.09375 L 38.09375 -125.484375 L 10.328125 -125.484375 Z M 10.328125 0 \" />\n </g>\n </g>\n </defs>\n <g>\n <g>\n <use\n href=\"#xml-wordmark-l-lbl-glyph0-1\"\n x=\"0.462066\"\n y=\"162\"\n />\n <use\n href=\"#xml-wordmark-l-lbl-glyph0-2\"\n x=\"41.651266\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#xml-wordmark-l-lbl-glyph0-3\"\n x=\"165.254466\"\n y=\"162\"\n />\n </g>\n <g>\n <use\n href=\"#xml-wordmark-l-lbl-glyph0-4\"\n x=\"319.829666\"\n y=\"162\"\n />\n </g>\n </g>\n </g>\n </g>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-wordmark-l-filter-10\"\n >\n <feMorphology\n radius=\"0.5\"\n operator=\"dilate\"\n in=\"SourceAlpha\"\n result=\"shadowSpreadOuter1\"\n ></feMorphology>\n <feOffset\n dx=\"-3\"\n dy=\"3\"\n in=\"shadowSpreadOuter1\"\n result=\"shadowOffsetOuter1\"\n ></feOffset>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0501685049 0\"\n type=\"matrix\"\n in=\"shadowOffsetOuter1\"\n ></feColorMatrix>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-wordmark-l-filter-4)\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#xml-wordmark-l-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#xml-wordmark-l-filter-5)\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#xml-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fill=\"url(#xml-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fill=\"url(#xml-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fill=\"url(#xml-wordmark-l-linearGradient-7)\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#2515C7\">\n <use\n filter=\"url(#xml-wordmark-l-filter-10)\"\n href=\"#xml-wordmark-l-text-9\"\n ></use>\n <use href=\"#xml-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n <g data-theme-layer=\"dark\" className=\"hidden dark:inline\">\n <defs>\n <linearGradient\n x1=\"25.9355099%\"\n y1=\"0%\"\n x2=\"63.5613444%\"\n y2=\"91.834983%\"\n id=\"xml-wordmark-d-linearGradient-2\"\n >\n <stop\n stopColor=\"#2A2A2A\"\n stopOpacity=\"0.980392157\"\n offset=\"0%\"\n ></stop>\n <stop stopColor=\"#050505\" offset=\"100%\"></stop>\n </linearGradient>\n <filter\n x=\"-50%\"\n y=\"-50%\"\n width=\"200%\"\n height=\"200%\"\n filterUnits=\"objectBoundingBox\"\n id=\"xml-wordmark-d-filter-5\"\n >\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner1\"\n ></feGaussianBlur>\n <feOffset\n dx=\"-10\"\n dy=\"14\"\n in=\"shadowBlurInner1\"\n result=\"shadowOffsetInner1\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner1\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner1\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 0 0.194256757 0 0 0 1 0\"\n type=\"matrix\"\n in=\"shadowInnerInner1\"\n result=\"shadowMatrixInner1\"\n ></feColorMatrix>\n <feGaussianBlur\n stdDeviation=\"4\"\n in=\"SourceAlpha\"\n result=\"shadowBlurInner2\"\n ></feGaussianBlur>\n <feOffset\n dx=\"4\"\n dy=\"-10\"\n in=\"shadowBlurInner2\"\n result=\"shadowOffsetInner2\"\n ></feOffset>\n <feComposite\n in=\"shadowOffsetInner2\"\n in2=\"SourceAlpha\"\n operator=\"arithmetic\"\n k2=\"-1\"\n k3=\"1\"\n result=\"shadowInnerInner2\"\n ></feComposite>\n <feColorMatrix\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0\"\n type=\"matrix\"\n in=\"shadowInnerInner2\"\n result=\"shadowMatrixInner2\"\n ></feColorMatrix>\n <feMerge>\n <feMergeNode in=\"shadowMatrixInner1\"></feMergeNode>\n <feMergeNode in=\"shadowMatrixInner2\"></feMergeNode>\n </feMerge>\n </filter>\n </defs>\n <g stroke=\"none\" fill=\"none\">\n <g>\n <use\n fill=\"black\"\n filter=\"url(#xml-wordmark-l-filter-4)\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"url(#xml-wordmark-d-linearGradient-2)\"\n fillRule=\"evenodd\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n <use\n fill=\"black\"\n filter=\"url(#xml-wordmark-d-filter-5)\"\n href=\"#xml-wordmark-l-path-3\"\n ></use>\n </g>\n <g\n filter=\"url(#xml-wordmark-l-filter-6)\"\n opacity=\"0.13\"\n fillRule=\"evenodd\"\n transform=\"translate(256.5027, 305.518)\"\n fill=\"#B2B2B2\"\n >\n <path\n d=\"M304.544551,0.447520067 C319.125735,0.47109626 330.927008,12.3105936 330.903467,26.8917774 C330.879856,41.4729613 319.040358,53.2742341 304.459175,53.2506931 L27.7029447,52.8031731 C13.1217608,52.7795969 1.32048809,40.9400996 1.34402902,26.3589157 C1.36764048,11.7777318 13.2071378,-0.0235409293 27.7883217,1.01746264e-13 L304.544551,0.447520067 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M509,164.674408 C509,179.255611 497.1796,191.076012 482.598397,191.076012 L27.296573,191.076012 C12.7153701,191.076012 0.894969607,179.255611 0.894969607,164.674408 C0.894969607,150.093206 12.7153701,138.272805 27.296573,138.272805 L482.598397,138.272805 C497.1796,138.272805 509,150.093206 509,164.674408 Z\"\n fillRule=\"nonzero\"\n ></path>\n <path\n d=\"M508.552515,304.737062 C508.552515,319.318265 496.732115,331.138666 482.150912,331.138666 L26.8490882,331.138666 C12.2678853,331.138666 0.447484804,319.318265 0.447484804,304.737062 C0.447484804,290.15586 12.2678853,278.335459 26.8490882,278.335459 L482.150912,278.335459 C496.732115,278.335459 508.552515,290.15586 508.552515,304.737062 Z\"\n fillRule=\"nonzero\"\n ></path>\n </g>\n <g fill=\"#7B5CFF\">\n <use\n filter=\"url(#xml-wordmark-l-filter-10)\"\n href=\"#xml-wordmark-l-text-9\"\n ></use>\n <use href=\"#xml-wordmark-l-text-9\"></use>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n\nexport default FileWordmarkXml\n","import type { Transition, Variants } from \"motion/react\"\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n/** CSS string form of EASE_OUT for inline style transitions. */\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n/** Press feedback on buttons and other tappable surfaces. */\nexport const SPRING_PRESS = {\n type: \"spring\",\n stiffness: 500,\n damping: 30,\n mass: 0.6,\n} as const;\n\n/** Content swaps — label/icon slots trading places inside a control. */\nexport const SPRING_SWAP = {\n type: \"spring\",\n stiffness: 460,\n damping: 30,\n mass: 0.55,\n} as const;\n\n/** Overlay panel entrances — modals and sheets summoned by pointer. */\nexport const SPRING_PANEL = {\n type: \"spring\",\n stiffness: 420,\n damping: 40,\n mass: 0.5,\n} as const;\n\n/** Shared-layout glides — pills, indicators and panels morphing between positions. */\nexport const SPRING_LAYOUT = {\n type: \"spring\",\n stiffness: 360,\n damping: 32,\n mass: 0.6,\n} as const;\n\n/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). */\nexport const SPRING_MOUSE = {\n stiffness: 200,\n damping: 15,\n mass: 0.3,\n} as const;\n\n/** Dragged handles and fills (sliders) — critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. */\nexport const SPRING_GLIDE = {\n stiffness: 700,\n damping: 50,\n mass: 0.5,\n} as const;\n\n\n// This needs a softer layout spring than the app defaults, so the overflow group\n// stays visually attached to the toggle while entering and leaving.\nexport const SHELL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nexport const ICON_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(3px)\" },\n visible: {\n opacity: 1,\n filter: \"blur(0px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n exit: {\n opacity: 0,\n filter: \"blur(3px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n};\n","/** \"Jenny Hamilton\" → \"JH\", \"luna\" → \"L\". */\nexport function initialsFrom(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n if (parts.length === 0) return \"\"\n const first = parts[0]?.[0] ?? \"\"\n const last = parts.length > 1 ? (parts.at(-1)?.[0] ?? \"\") : \"\"\n return (first + last).toUpperCase()\n}\n\n/** Sampling grid for `measureRimTone`. 16² px is enough to average a rim. */\nconst TONE_SAMPLE_SIZE = 16\n/** Pixels this far (in radii) from the centre count as rim — the band the\n * bezel sits on. Matches the ring's mask, which fades in from ~78%. */\nconst TONE_RIM_RADIUS = 0.6\n\nconst toneCache = new Map<string, Promise<number | null>>()\n\n/**\n * Average perceived lightness, 0 (black) → 1 (white), of an image's outer\n * band — the pixels the bezel ring overlays — or `null` when it cannot be\n * measured: no DOM/canvas (SSR, test DOM), a decode failure, or a host\n * without CORS headers (the sample needs a CORS-clean image; the avatar's\n * own `<img>` is left untouched, so a non-CORS host still displays).\n * Results are memoised per `src`, so a room of the same face samples once.\n */\nexport function measureRimTone(src: string): Promise<number | null> {\n const cached = toneCache.get(src)\n if (cached) return cached\n const promise = new Promise<number | null>((resolve) => {\n if (typeof document === \"undefined\" || typeof Image === \"undefined\") {\n resolve(null)\n return\n }\n const image = new Image()\n image.crossOrigin = \"anonymous\"\n image.decoding = \"async\"\n image.onerror = () => resolve(null)\n image.onload = () => {\n try {\n const size = TONE_SAMPLE_SIZE\n const canvas = document.createElement(\"canvas\")\n canvas.width = size\n canvas.height = size\n const context = canvas.getContext(\"2d\", { willReadFrequently: true })\n if (!context) {\n resolve(null)\n return\n }\n context.drawImage(image, 0, 0, size, size)\n const { data } = context.getImageData(0, 0, size, size)\n const centre = (size - 1) / 2\n const rim = TONE_RIM_RADIUS * centre\n let sum = 0\n let count = 0\n for (let y = 0; y < size; y++) {\n for (let x = 0; x < size; x++) {\n const dx = x - centre\n const dy = y - centre\n if (dx * dx + dy * dy < rim * rim) continue\n const offset = (y * size + x) * 4\n const r = data[offset] ?? 0\n const g = data[offset + 1] ?? 0\n const b = data[offset + 2] ?? 0\n // Rec. 709 luma on the gamma-encoded channels: close enough to\n // perceived lightness for a \"light or dark?\" verdict.\n sum += (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255\n count++\n }\n }\n resolve(count === 0 ? null : sum / count)\n } catch {\n // A tainted canvas throws on getImageData.\n resolve(null)\n }\n }\n image.src = src\n })\n toneCache.set(src, promise)\n // Only a real reading is worth keeping — a failed sample (flaky network,\n // a host that gained CORS headers later) gets another go next mount.\n void promise.then((tone) => {\n if (tone === null) toneCache.delete(src)\n })\n return promise\n}\n\n/**\n * Bezel highlight/shadow alphas for an image whose rim lightness is `tone`\n * (0 → 1). Against a dark rim the white highlight is eased off (it glares)\n * and the black shadow pushed up (it has to darken mid-tones to register);\n * against a pale rim the reverse — the highlight can be full (it barely\n * shows) and the shadow is what carries the emboss, so it sits lighter.\n * Linear between; the end points are tuned by eye on a dark and a light\n * photo in both themes.\n */\nexport function bezelAlphasForTone(tone: number): { hi: number; lo: number } {\n const t = Math.min(1, Math.max(0, tone))\n return {\n hi: 0.7 + 0.3 * t,\n lo: 0.6 - 0.4 * t,\n }\n}\n","import { AvatarFallback } from \"@/components/ui/avatar\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport { initialsFrom } from \"./utils\"\n\nexport function Fallback({\n name,\n initials,\n loading,\n}: {\n name?: string\n initials?: string\n loading?: boolean\n}) {\n return (\n // Initials scale with the disc: 42% of the avatar's width (≈ text-xl on\n // size-12), resolved against the `@container` on the Avatar root.\n <AvatarFallback className=\"text-[42cqw]\">\n {loading ? (\n <Skeleton\n className=\"size-full rounded-full\"\n data-slot=\"avatar-skeleton\"\n />\n ) : (\n (initials ?? initialsFrom(name ?? \"\"))\n )}\n </AvatarFallback>\n )\n}\n","import { cn } from \"@/lib/utils\"\nimport type { UserPresence } from \"./type\"\n\n/**\n * Corner dot naming whether the person is reachable. Sits on the avatar\n * frame, outside the clipped circle, with a background-coloured ring so it\n * reads against any image. Colour is not the only signal: `offline` is a\n * hollow ring, `online` a filled dot, and the label is spelled out for AT.\n *\n * `lightAngle` (degrees clockwise from 12) lays a faint sheen across the dot\n * from that side — the same angle the avatar's bezel is lit from, so the two\n * highlights agree and the badge reads as a bead sitting in the same light.\n */\nexport function PresenceBadge({\n presence,\n lightAngle,\n className,\n}: {\n presence: UserPresence\n lightAngle?: number\n className?: string\n}) {\n const online = presence === \"online\"\n return (\n <span\n aria-label={online ? \"Online\" : \"Offline\"}\n className={cn(\n \"absolute right-0 bottom-0 box-content size-[22%] min-h-1.5 min-w-1.5 overflow-hidden rounded-full\",\n \"ring-2 ring-background transition-colors duration-150 ease-smooth-out\",\n online\n ? \"bg-emerald-500 dark:bg-emerald-400\"\n : \"border-2 border-muted-foreground/60 bg-background dark:border-muted-foreground/70\",\n className\n )}\n data-presence={presence}\n data-slot=\"user-avatar-presence\"\n role=\"img\"\n >\n {lightAngle !== undefined ? (\n // Highlight at 12 o'clock, fading out by the middle, rotated so it\n // faces the light. Rotation transitions; the gradient is static.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n \"bg-[linear-gradient(to_bottom,--theme(--color-white/55%),--theme(--color-white/12%)_38%,transparent_58%)]\",\n \"dark:bg-[linear-gradient(to_bottom,--theme(--color-white/40%),--theme(--color-white/8%)_38%,transparent_58%)]\",\n \"transition-transform duration-150 ease-smooth-out motion-reduce:transition-none\"\n )}\n data-slot=\"user-avatar-presence-sheen\"\n style={{ transform: `rotate(${lightAngle}deg)` }}\n />\n ) : null}\n </span>\n )\n}\n","/**\n * User avatar state — Jotai atom families keyed by an avatar id.\n *\n * Follows the tree's layout (`components/composed/tree/tree-atom.ts`): one\n * in-house `keyed()` family per field, write-only action atoms for every\n * mutation, a composed read-only state atom, and `removeUserAvatarInstance`\n * to drop an id from every family. Nothing here touches the DOM — the\n * pointer maths that feeds `bezelAngle` lives in `use-user-avatar.ts`.\n */\n\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport type {\n ImageStatus,\n UserAvatarConfig,\n UserAvatarInstanceId,\n UserAvatarState,\n UserPresence,\n} from \"./type\"\n\n/** Light from the top-left, the classic emboss, until a pointer moves. */\nexport const DEFAULT_BEZEL_ANGLE = 315\n\nconst DEFAULT_CONFIG: UserAvatarConfig = { controlsPresence: false }\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: UserAvatarInstanceId) => AtomType) & {\n remove: (id: UserAvatarInstanceId) => void\n}\n\nconst families: { remove: (id: UserAvatarInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: UserAvatarInstanceId) => AtomType) {\n const cache = new Map<UserAvatarInstanceId, AtomType>()\n const family = ((id: UserAvatarInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: UserAvatarInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: UserAvatarInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: UserAvatarInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `userAvatar/${id}/${name}`\n return instance\n })\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\n/** `null` = no badge. */\nexport const userAvatarPresenceAtom = stateFamily<UserPresence | null>(\n \"presence\",\n null\n)\n\n/** Degrees clockwise from 12 o'clock — where the bezel highlight sits. */\nexport const userAvatarBezelAngleAtom = stateFamily<number>(\n \"bezelAngle\",\n DEFAULT_BEZEL_ANGLE\n)\n\nexport const userAvatarImageStatusAtom = stateFamily<ImageStatus>(\n \"imageStatus\",\n \"idle\"\n)\n\n/** Rim lightness of the loaded image, `null` until sampled (or unsampleable). */\nexport const userAvatarImageToneAtom = stateFamily<number | null>(\n \"imageTone\",\n null\n)\n\n/** @internal Which fields the mounted component controls from props. */\nexport const userAvatarConfigAtom = stateFamily<UserAvatarConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\nexport const userAvatarIsOnlineAtom = readFamily(\n \"isOnline\",\n (get, id) => get(userAvatarPresenceAtom(id)) === \"online\"\n)\n\n/** Whole-state read for callers that want the object; field atoms above are\n * cheaper for components that watch one thing. */\nexport const userAvatarStateAtom = readFamily<UserAvatarState>(\n \"state\",\n (get, id) => ({\n presence: get(userAvatarPresenceAtom(id)),\n bezelAngle: get(userAvatarBezelAngleAtom(id)),\n imageStatus: get(userAvatarImageStatusAtom(id)),\n imageTone: get(userAvatarImageToneAtom(id)),\n })\n)\n\n// ── actions ────────────────────────────────────────────────────────────────\n\n/** Inert while a `presence` prop controls the avatar — the prop is truth. */\nexport const setUserAvatarPresenceAtom = actionFamily<\n [presence: UserPresence | null]\n>(\"setPresence\", (get, set, id, presence) => {\n if (get(userAvatarConfigAtom(id)).controlsPresence) return\n set(userAvatarPresenceAtom(id), presence)\n})\n\n/** online ⇄ offline; a badge-less avatar comes online. */\nexport const toggleUserAvatarPresenceAtom = actionFamily<[]>(\n \"togglePresence\",\n (get, set, id) => {\n const next = get(userAvatarPresenceAtom(id)) === \"online\" ? \"offline\" : \"online\"\n set(setUserAvatarPresenceAtom(id), next)\n }\n)\n\n/** Stored as given — continuous, not wrapped into [0, 360): the rim is\n * rotated with a CSS transition, and an unwrapped angle is what lets a\n * 359° → 1° move take the short way round. Written on every pointer frame,\n * so it stays a bare set — no config gate, no side effects. */\nexport const setUserAvatarBezelAngleAtom = actionFamily<[angle: number]>(\n \"setBezelAngle\",\n (_get, set, id, angle) => {\n if (!Number.isFinite(angle)) return\n set(userAvatarBezelAngleAtom(id), angle)\n }\n)\n\n/** @internal Reported by the image element; drives the skeleton. */\nexport const setUserAvatarImageStatusAtom = actionFamily<[status: ImageStatus]>(\n \"setImageStatus\",\n (_get, set, id, status) => {\n set(userAvatarImageStatusAtom(id), status)\n }\n)\n\n/** @internal Written by the hook once the loaded image has been sampled;\n * cleared (null) when the image changes or goes away. Clamped to [0, 1]. */\nexport const setUserAvatarImageToneAtom = actionFamily<[tone: number | null]>(\n \"setImageTone\",\n (_get, set, id, tone) => {\n set(\n userAvatarImageToneAtom(id),\n tone === null || !Number.isFinite(tone) ? null : Math.min(1, Math.max(0, tone))\n )\n }\n)\n\n/** @internal Projection of the mounted component's controlled props. */\nexport const projectUserAvatarPropsAtom = actionFamily<\n [config: UserAvatarConfig, presence: UserPresence | null | undefined]\n>(\"projectProps\", (get, set, id, config, presence) => {\n const wasControlled = get(userAvatarConfigAtom(id)).controlsPresence\n set(userAvatarConfigAtom(id), config)\n if (config.controlsPresence) set(userAvatarPresenceAtom(id), presence ?? null)\n // Releasing control (`presence` prop → undefined) clears the badge rather\n // than leaving the last projected value stranded in the store — going\n // from \"online\" to no presence is a real transition for a user object.\n else if (wasControlled) set(userAvatarPresenceAtom(id), null)\n})\n\nexport const resetUserAvatarAtom = actionFamily<[]>(\n \"reset\",\n (_get, set, id) => {\n set(userAvatarPresenceAtom(id), null)\n set(userAvatarBezelAngleAtom(id), DEFAULT_BEZEL_ANGLE)\n set(userAvatarImageStatusAtom(id), \"idle\")\n set(userAvatarImageToneAtom(id), null)\n set(userAvatarConfigAtom(id), DEFAULT_CONFIG)\n }\n)\n\n/** Forget an avatar entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeUserAvatarInstance(id: UserAvatarInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport { useReducedMotion } from \"motion/react\"\n\nimport type {\n ImageStatus,\n UserAvatarConfig,\n UserAvatarInstanceId,\n UserPresence,\n} from \"./type\"\nimport {\n projectUserAvatarPropsAtom,\n removeUserAvatarInstance,\n setUserAvatarBezelAngleAtom,\n setUserAvatarImageStatusAtom,\n setUserAvatarImageToneAtom,\n userAvatarBezelAngleAtom,\n userAvatarImageStatusAtom,\n userAvatarImageToneAtom,\n userAvatarPresenceAtom,\n} from \"./user-avatar-atom\"\nimport { measureRimTone } from \"./utils\"\n\nexport interface UseUserAvatarOptions {\n avatarId?: UserAvatarInstanceId\n /** Controlled presence. `undefined` leaves the store in charge. */\n presence?: UserPresence\n /** Track the pointer for the bezel highlight. */\n bezel: boolean\n /** Only meaningful with an image — no image, no status to track. */\n hasImage: boolean\n /** The image URL, sampled for its rim lightness once it has loaded so the\n * bezel can pick alphas that read against it. Omit to skip sampling. */\n src?: string\n}\n\nexport interface UserAvatarBinding {\n avatarId: UserAvatarInstanceId\n presence: UserPresence | null\n bezelAngle: number\n imageStatus: ImageStatus\n /** Rim lightness of the loaded image, 0–1, or `null` while unknown. */\n imageTone: number | null\n /** Hand to the image's `onLoadingStatusChange`. Stable. */\n setImageStatus: (status: ImageStatus) => void\n /** Attach to the avatar root — the bezel is lit relative to its centre. */\n ref: React.RefObject<HTMLElement | null>\n}\n\n/** Below this the angle write is skipped: a rim highlight cannot show a\n * sub-degree change, and skipping keeps the pointer loop store-quiet. */\nconst ANGLE_EPSILON = 1.5\n\n/**\n * Binds one avatar to its slice of the store: projects the controlled\n * `presence` prop, tracks the image status, and — while `bezel` is on —\n * follows the pointer with a rAF-coalesced `pointermove` listener that turns\n * the pointer's bearing from the avatar's centre into `bezelAngle`.\n *\n * Unnamed avatars key off `useId` and are dropped from the store on unmount;\n * a named `avatarId` outlives its component so a presence set elsewhere\n * survives a remount.\n */\nexport function useUserAvatar(options: UseUserAvatarOptions): UserAvatarBinding {\n const { presence: presenceProp, bezel, hasImage, src } = options\n const generatedId = React.useId()\n const avatarId = options.avatarId ?? generatedId\n const controlsPresence = presenceProp !== undefined\n\n const config = React.useMemo<UserAvatarConfig>(\n () => ({ controlsPresence }),\n [controlsPresence]\n )\n\n const project = useSetAtom(projectUserAvatarPropsAtom(avatarId))\n const setBezelAngle = useSetAtom(setUserAvatarBezelAngleAtom(avatarId))\n const setImageStatus = useSetAtom(setUserAvatarImageStatusAtom(avatarId))\n const setImageTone = useSetAtom(setUserAvatarImageToneAtom(avatarId))\n\n // Layout effect: the projection must land before children read the store\n // in the same commit. Primitive deps, so no loop guard is needed here.\n React.useLayoutEffect(() => {\n project(config, presenceProp)\n }, [project, config, presenceProp])\n\n // A generated key belongs to this mount only; a given `avatarId` is the\n // app's handle and outlives it.\n React.useEffect(() => {\n if (options.avatarId !== undefined) return\n return () => removeUserAvatarInstance(avatarId)\n }, [options.avatarId, avatarId])\n\n const presence = useAtomValue(userAvatarPresenceAtom(avatarId))\n const bezelAngle = useAtomValue(userAvatarBezelAngleAtom(avatarId))\n const imageStatus = useAtomValue(userAvatarImageStatusAtom(avatarId))\n const imageTone = useAtomValue(userAvatarImageToneAtom(avatarId))\n\n const ref = React.useRef<HTMLElement | null>(null)\n const reduce = useReducedMotion()\n\n // Pointer → bearing. Coalesced to one write per animation frame, and only\n // when the angle moved enough to matter, so a room full of avatars is\n // still one cheap listener each and near-zero store traffic while idle.\n React.useEffect(() => {\n if (!bezel || reduce || typeof window === \"undefined\") return\n let frame = 0\n let last = Number.NaN\n let pointer: { x: number; y: number } | null = null\n\n const flush = () => {\n frame = 0\n const host = ref.current\n if (!host || !pointer) return\n const rect = host.getBoundingClientRect()\n if (rect.width === 0) return\n const dx = pointer.x - (rect.left + rect.width / 2)\n const dy = pointer.y - (rect.top + rect.height / 2)\n // atan2 measures from 3 o'clock anticlockwise-positive in screen\n // space; rotate so 0 is 12 o'clock and clockwise grows.\n const bearing = ((Math.atan2(dy, dx) * 180) / Math.PI + 90 + 360) % 360\n // Unwrap: step from the last value by the shortest arc, so the stored\n // angle is continuous and the rim never spins the long way round.\n let angle = bearing\n if (!Number.isNaN(last)) {\n let delta = bearing - (((last % 360) + 360) % 360)\n if (delta > 180) delta -= 360\n if (delta < -180) delta += 360\n if (Math.abs(delta) < ANGLE_EPSILON) return\n angle = last + delta\n }\n last = angle\n setBezelAngle(angle)\n }\n const onMove = (event: PointerEvent) => {\n pointer = { x: event.clientX, y: event.clientY }\n if (frame === 0) frame = window.requestAnimationFrame(flush)\n }\n\n window.addEventListener(\"pointermove\", onMove, { passive: true })\n return () => {\n window.removeEventListener(\"pointermove\", onMove)\n if (frame !== 0) window.cancelAnimationFrame(frame)\n }\n }, [bezel, reduce, setBezelAngle])\n\n // No image, no status: keep the store honest when `src` goes away.\n React.useEffect(() => {\n if (!hasImage) setImageStatus(\"idle\")\n }, [hasImage, setImageStatus])\n\n // Once the image is on screen, read how light its rim is so the bezel's\n // highlight and shadow can be weighted against it. Cleared whenever the\n // image changes or goes away — a stale tone from the previous photo would\n // light the new one wrong for a frame. Sampling is async (a second, CORS\n // clean decode of the same URL, memoised per src); the cancelled flag\n // keeps a slow sample from landing on a later src.\n React.useEffect(() => {\n setImageTone(null)\n if (!bezel || !hasImage || !src || imageStatus !== \"loaded\") return\n let cancelled = false\n void measureRimTone(src).then((tone) => {\n if (!cancelled) setImageTone(tone)\n })\n return () => {\n cancelled = true\n }\n }, [bezel, hasImage, src, imageStatus, setImageTone])\n\n return {\n avatarId,\n presence,\n bezelAngle,\n imageStatus,\n imageTone,\n setImageStatus,\n ref,\n }\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { Avatar, AvatarImage } from \"@/components/ui/avatar\"\nimport { cn } from \"@/lib/utils\"\nimport { Fallback } from \"./fallback\"\nimport { PresenceBadge } from \"./presence-badge\"\nimport type { UserAvatarProps } from \"./type\"\nimport { useUserAvatar } from \"./use-user-avatar\"\nimport { bezelAlphasForTone } from \"./utils\"\n\n/**\n * Identity avatar: an image when one is given, initials otherwise, with an\n * optional presence badge and a pointer-lit bezel.\n *\n * A passed `src` is assumed to be remote, so the slot holds a skeleton until\n * the image resolves rather than flashing initials that are about to be\n * replaced. A failed load settles on the initials.\n *\n * State (presence, bezel angle, image status) lives in Jotai atoms keyed by\n * `avatarId` — name the avatar and `useUserAvatarActions(id).setPresence()`\n * flips its badge from anywhere under `ExegiaProvider`.\n */\n/** The rim (and the badge sheen) trail the pointer's bearing slightly rather\n * than pointing dead at it — a touch of lag reads as weight. */\nconst BEZEL_DAMPING = 0.8\n\nexport function UserAvatar({\n src,\n name = \"\",\n initials,\n alt,\n loading: loadingProp,\n presence: presenceProp,\n bezel = true,\n avatarId,\n className,\n style,\n ...props\n}: UserAvatarProps): React.ReactElement {\n const hasImage = src !== undefined\n const avatar = useUserAvatar({\n avatarId,\n presence: presenceProp,\n bezel,\n hasImage,\n src,\n })\n const { presence, bezelAngle, imageStatus, imageTone, setImageStatus, ref } =\n avatar\n\n const loading =\n loadingProp ??\n (hasImage && (imageStatus === \"idle\" || imageStatus === \"loading\"))\n // A photo is actually on screen — not merely requested. A broken or\n // still-loading `src` shows initials/skeleton and should be treated as\n // the flat disc it is.\n const showsImage = hasImage && loadingProp !== true && imageStatus === \"loaded\"\n // With a photo on screen and its rim sampled, the bezel's alphas follow the\n // photo rather than the theme: the ring sits on the image, not the page.\n const bezelAlphas =\n showsImage && imageTone !== null ? bezelAlphasForTone(imageTone) : null\n\n return (\n // The frame is what the badge and bezel hang off: the Avatar root clips\n // to its circle, and the badge has to sit on the rim, half outside it.\n // Sizing classes still target the Avatar — the frame shrink-wraps it.\n <span\n className=\"relative inline-flex shrink-0 rounded-full\"\n data-slot=\"user-avatar-frame\"\n ref={ref as React.RefObject<HTMLSpanElement>}\n >\n <Avatar\n className={cn(\n // `@container` lets the fallback size its initials in cqw — a\n // fraction of whatever `size-*` the caller put on this element —\n // instead of a fixed text step. `text-xl` stays as the fallback for\n // engines without container units.\n \"@container size-8 border-1 border-white bg-neutral-800! text-xl dark:border-neutral-900\",\n // The emboss itself: an inset drop toward the light's opposite side\n // is what the ring below is rotated against.\n bezel &&\n \"shadow-[inset_0_3px_3px_--theme(--color-white/80%),inset_0_-1px_2px_--theme(--color-black/15%)] dark:shadow-[inset_0_1px_1px_--theme(--color-white/5%),inset_0_-8px_2px_--theme(--color-black/20%)]\",\n className\n )}\n data-avatar-id={avatar.avatarId}\n data-bezel={bezel ? \"\" : undefined}\n data-loading={loading || undefined}\n data-presence={presence ?? undefined}\n data-slot=\"user-avatar\"\n style={style}\n {...props}\n >\n {/* Held back while forced-loading: a loaded image would hide the\n fallback the skeleton lives in. */}\n {!hasImage || loadingProp === true ? null : (\n <AvatarImage\n alt={alt ?? name}\n onLoadingStatusChange={setImageStatus}\n src={src}\n />\n )}\n <Fallback name={name} initials={initials} loading={loading} />\n </Avatar>\n {presence === \"online\" ? (\n // The badge's green \"reflected\" onto the disc: a static radial wash\n // anchored at the badge corner that fades inward, so the dot reads\n // as a light source sitting on the avatar rather than a sticker on\n // it. Does not move with the bezel — it belongs to the badge, not\n // the pointer. Sits above the image, below the bezel and the badge.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n // One gradient, four knobs: colour, peak alpha, mid alpha, reach.\n // Light mode is quieter than dark (a green wash on a pale disc\n // reads as a stain, on a dark one as a glow), and an initials\n // disc — flat, no photo to sit on — takes a smaller, fainter\n // pool than an image does.\n \"[--reflect:--theme(--color-emerald-500)] dark:[--reflect:--theme(--color-emerald-400)]\",\n showsImage\n ? \"[--reflect-peak:30%] [--reflect-mid:12%] [--reflect-reach:56%] dark:[--reflect-peak:40%] dark:[--reflect-mid:16%] dark:[--reflect-reach:60%]\"\n : \"[--reflect-peak:16%] [--reflect-mid:6%] [--reflect-reach:40%] dark:[--reflect-peak:26%] dark:[--reflect-mid:9%] dark:[--reflect-reach:46%]\",\n \"bg-[radial-gradient(circle_at_88%_88%,color-mix(in_oklab,var(--reflect)_var(--reflect-peak),transparent)_0%,color-mix(in_oklab,var(--reflect)_var(--reflect-mid),transparent)_22%,transparent_var(--reflect-reach))]\",\n \"transition-opacity duration-150 ease-smooth-out\"\n )}\n data-image={showsImage ? \"\" : undefined}\n data-slot=\"user-avatar-reflection\"\n />\n ) : null}\n {bezel ? (\n // A conic highlight → shadow sweep, masked to a thin rim and rotated\n // so the highlight faces the pointer. Rotation (not the gradient\n // angle) is what moves, because `transform` transitions and a\n // gradient stop does not. The highlight is white and the shadow\n // black at alphas `--bezel-hi-a` / `--bezel-lo-a`: light and dark\n // pick their own defaults (a white rim glares on a dark page), and a\n // sampled photo overrides both inline so the ring is weighted against\n // the image it actually sits on — scaled by `--bezel-hi-k`, because\n // the rim borders the page as much as the photo and the same white\n // that lifts a dark portrait off a light page glares on a dark one.\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-full\",\n \"[--bezel-hi-a:1] [--bezel-lo-a:0.2] dark:[--bezel-hi-a:0.18] dark:[--bezel-lo-a:0.4]\",\n \"[--bezel-hi-k:1] dark:[--bezel-hi-k:0.55]\",\n \"[--bezel-hi:color-mix(in_oklab,white_calc(var(--bezel-hi-a)*100%),transparent)]\",\n \"[--bezel-lo:color-mix(in_oklab,black_calc(var(--bezel-lo-a)*100%),transparent)]\",\n // Starts at 6 o'clock: shadow there, highlight peaking at 12 (50%),\n // symmetric either side — so rotate(angle) puts the highlight at\n // exactly `bezelAngle` clockwise from 12.\n \"bg-[conic-gradient(from_180deg,var(--bezel-lo)_0%,transparent_24%,transparent_28%,var(--bezel-hi)_50%,transparent_72%,transparent_76%,var(--bezel-lo)_100%)]\",\n // Rim width is a share of the radius, not a px count, so the\n // bezel reads the same at size-8 and size-16: solid over the outer\n // 8%, feathering in over the 14% inside that.\n \"[mask-image:radial-gradient(farthest-side,transparent_78%,#000_92%)]\",\n \"mix-blend-normal transition-transform duration-150 ease-smooth-out motion-reduce:transition-none\"\n )}\n data-slot=\"user-avatar-bezel\"\n data-tone={imageTone === null ? undefined : imageTone.toFixed(2)}\n style={{\n transform: `rotate(${bezelAngle * BEZEL_DAMPING}deg)`,\n ...(bezelAlphas\n ? {\n \"--bezel-hi-a\": `calc(${bezelAlphas.hi.toFixed(2)} * var(--bezel-hi-k))`,\n \"--bezel-lo-a\": bezelAlphas.lo.toFixed(2),\n }\n : null),\n }}\n />\n ) : null}\n {presence ? (\n <PresenceBadge\n lightAngle={bezel ? bezelAngle * BEZEL_DAMPING : undefined}\n presence={presence}\n />\n ) : null}\n </span>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport type {\n UserAvatarActions,\n UserAvatarInstanceId,\n UserAvatarState,\n} from \"./type\"\nimport {\n resetUserAvatarAtom,\n setUserAvatarBezelAngleAtom,\n setUserAvatarPresenceAtom,\n toggleUserAvatarPresenceAtom,\n userAvatarStateAtom,\n} from \"./user-avatar-atom\"\n\n/**\n * Read the avatar registered under `avatarId` from anywhere below\n * `ExegiaProvider` — no props, no ref, no provider of its own.\n *\n * ```tsx\n * const { presence } = useUserAvatarState(\"me\")\n * ```\n *\n * Returns the whole state object, so the caller re-renders on any change —\n * including every bezel frame while a pointer moves. A component that only\n * cares about presence should subscribe to that atom instead:\n * `useAtomValue(userAvatarPresenceAtom(\"me\"))`.\n */\nexport function useUserAvatarState(\n avatarId: UserAvatarInstanceId\n): UserAvatarState {\n return useAtomValue(userAvatarStateAtom(avatarId))\n}\n\n/**\n * Write-only handles onto the avatar registered under `avatarId`. Nothing\n * here subscribes, so a presence indicator elsewhere in the app can flip\n * the badge without re-rendering when the avatar changes.\n *\n * ```tsx\n * const { setPresence } = useUserAvatarActions(\"me\")\n * socket.on(\"presence\", (p) => setPresence(p))\n * ```\n */\nexport function useUserAvatarActions(\n avatarId: UserAvatarInstanceId\n): UserAvatarActions {\n const setPresence = useSetAtom(setUserAvatarPresenceAtom(avatarId))\n const togglePresence = useSetAtom(toggleUserAvatarPresenceAtom(avatarId))\n const setBezelAngle = useSetAtom(setUserAvatarBezelAngleAtom(avatarId))\n const reset = useSetAtom(resetUserAvatarAtom(avatarId))\n\n return React.useMemo(\n () => ({ setPresence, togglePresence, setBezelAngle, reset }),\n [setPresence, togglePresence, setBezelAngle, reset]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport type { Variants } from \"motion/react\"\n\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils\"\nimport { initialsFrom } from \"@/components/user-avatar\"\n\n/** `full` shows mark + wordmark; `mark` folds the wordmark away — an icon\n * rail, a favicon-sized corner. */\nexport type LogoVariant = \"full\" | \"mark\"\n\nexport interface LogoProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n /**\n * Brand name. Labels the logo for AT (and the link, when `href` renders\n * one), drives the default wordmark, and the monogram tile when no mark\n * is given.\n */\n name: string\n /** Custom mark — an inline SVG sized to fill its box. Wins over `src`. */\n mark?: React.ReactNode\n /** Image URL for the mark. Decorative — `name` labels the logo. */\n src?: string\n /** Wordmark content. Defaults to `name`. */\n wordmark?: React.ReactNode\n /** `full` (default) or `mark` — the wordmark folds away, animated. */\n variant?: LogoVariant\n /** Renders the logo as a link — the usual \"mark goes home\" affordance. */\n href?: string\n}\n\n/** Wordmark fold/unfold — the same envelope the profile card's identity\n * lines use, so a logo and a profile card folding in the same rail move as\n * one. Kept local: composed components do not reach into blocks. Expressed\n * as named variants for consistency with the profile card's fold envelope —\n * house style for multi-property fold states, not a motion requirement. */\nconst WORDMARK_VARIANTS: Variants = {\n open: {\n width: \"auto\",\n opacity: 1,\n x: 0,\n transition: { duration: 0.2, delay: 0.08, ease: EASE_OUT },\n },\n folded: {\n width: 0,\n opacity: 0,\n x: -4,\n transition: { duration: 0.12, ease: EASE_OUT },\n },\n}\n\nconst WORDMARK_VARIANTS_REDUCED: Variants = {\n open: { width: \"auto\", opacity: 1, x: 0, transition: { duration: 0.16, ease: EASE_OUT } },\n folded: { width: 0, opacity: 0, x: 0, transition: { duration: 0.16, ease: EASE_OUT } },\n}\n\n/**\n * Brand lockup: a mark beside a wordmark. The mark is whatever the brand\n * has — an SVG (`mark`), an image (`src`), or, given neither, a monogram\n * tile derived from `name`. `variant=\"mark\"` folds the wordmark away with\n * the same motion a collapsing rail uses, so the lockup can sit in one and\n * follow its fold. With `href` the whole lockup is a link named by `name`.\n *\n * Sizing rides on the mark: it defaults to `size-8`; restyle via\n * `[&_[data-slot=logo-mark]]:size-*` or wrap in a text-size context for the\n * wordmark, which inherits.\n */\nexport function Logo({\n name,\n mark,\n src,\n wordmark,\n variant = \"full\",\n href,\n className,\n ...props\n}: LogoProps): React.ReactElement {\n const reduce = useReducedMotion()\n const folded = variant === \"mark\"\n\n const markNode = mark ?? (\n src !== undefined ? (\n // Decorative: the root's `name` (visible wordmark or aria-label)\n // already names the brand.\n <img alt=\"\" className=\"size-full object-contain\" src={src} />\n ) : (\n <span\n aria-hidden=\"true\"\n className=\"flex size-full items-center justify-center rounded-lg bg-foreground font-semibold text-background text-[45cqw]\"\n data-slot=\"logo-monogram\"\n >\n {initialsFrom(name)}\n </span>\n )\n )\n\n const content = (\n <>\n <span\n className=\"size-8 shrink-0 @container [&_svg]:size-full\"\n data-slot=\"logo-mark\"\n >\n {markNode}\n </span>\n <motion.span\n animate={folded ? \"folded\" : \"open\"}\n variants={reduce ? WORDMARK_VARIANTS_REDUCED : WORDMARK_VARIANTS}\n // Folded, the wordmark is gone for AT too — the root's label names\n // the brand on its own.\n aria-hidden={folded || undefined}\n className={cn(\n \"min-w-0 overflow-hidden font-semibold whitespace-nowrap tracking-tight\",\n folded && \"pointer-events-none\",\n // 0px wide while folded, but the flex gap before it would still\n // offset the mark — pull it back by that gap.\n folded && \"-ml-2\"\n )}\n data-slot=\"logo-wordmark\"\n initial={false}\n >\n {wordmark ?? name}\n </motion.span>\n </>\n )\n\n const rootClassName = cn(\n \"inline-flex shrink-0 items-center gap-2 text-foreground\",\n className\n )\n\n return href !== undefined ? (\n <a\n // Always labelled: the folded state hides the wordmark, and a link\n // must not lose its name mid-animation.\n aria-label={name}\n className={rootClassName}\n data-slot=\"logo\"\n data-variant={variant}\n href={href}\n {...props}\n >\n {content}\n </a>\n ) : (\n <span\n aria-label={folded ? name : undefined}\n className={rootClassName}\n data-slot=\"logo\"\n data-variant={variant}\n role={folded ? \"img\" : undefined}\n {...props}\n >\n {content}\n </span>\n )\n}\n","\"use client\";\n\nimport { CheckIcon, EyeIcon, EyeOffIcon, XIcon } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupInput,\n} from \"@/components/ui/input-group\";\nimport { playCue } from \"@/lib/sound\";\nimport { cn } from \"@/lib/utils\";\n\n// transitions.dev motion scale\nconst EASE = [0.22, 1, 0.36, 1] as const;\n\nexport const passwordRequirements = [\n { regex: /.{8,}/, text: \"At least 8 characters\" },\n { regex: /[0-9]/, text: \"At least 1 number\" },\n { regex: /[a-z]/, text: \"At least 1 lowercase letter\" },\n { regex: /[A-Z]/, text: \"At least 1 uppercase letter\" },\n] as const;\n\nexport function getPasswordStrength(password: string): number {\n return passwordRequirements.filter((req) => req.regex.test(password)).length;\n}\n\nconst STRENGTH_COLORS = [\n \"bg-border\",\n \"bg-red-500\",\n \"bg-orange-500\",\n \"bg-amber-500\",\n \"bg-emerald-500\",\n] as const;\n\nexport interface PasswordInputProps\n extends Omit<React.ComponentProps<typeof InputGroupInput>, \"type\" | \"size\"> {\n /** Render the eye toggle button. */\n visibilityToggle?: boolean;\n /** Render the animated strength meter and requirement checklist. */\n showStrength?: boolean;\n /** Play reveal/hide cues on the visibility toggle. Inert until bindSounds(). */\n sound?: boolean;\n}\n\n/**\n * Password field with visibility toggle and optional strength meter.\n * Composition of InputGroup + Button (coss particles p-input-9 and\n * p-input-group-26).\n */\nexport function PasswordInput({\n visibilityToggle = true,\n showStrength = false,\n sound = true,\n className,\n value: valueProp,\n defaultValue,\n onChange,\n ...props\n}: PasswordInputProps) {\n const [visible, setVisible] = React.useState(false);\n const [uncontrolled, setUncontrolled] = React.useState(\n String(defaultValue ?? \"\"),\n );\n const value = valueProp !== undefined ? String(valueProp) : uncontrolled;\n const score = getPasswordStrength(value);\n\n return (\n <div className={cn(\"flex w-full flex-col gap-3\", className)}>\n <InputGroup>\n <InputGroupInput\n placeholder=\"Enter your password\"\n {...props}\n type={visible ? \"text\" : \"password\"}\n value={value}\n onChange={(event) => {\n setUncontrolled(event.target.value);\n onChange?.(event);\n }}\n />\n {visibilityToggle && (\n <InputGroupAddon align=\"inline-end\">\n <Button\n aria-label={visible ? \"Hide password\" : \"Show password\"}\n onClick={() => {\n // Semantic cues from the cuelume palette: bloom = reveal,\n // droplet = dismiss. Press/release stays off to avoid layering.\n if (sound) playCue(visible ? \"droplet\" : \"bloom\");\n setVisible((v) => !v);\n }}\n size=\"icon-xs\"\n variant=\"ghost\"\n sound={false}\n >\n <AnimatePresence mode=\"wait\" initial={false}>\n <motion.span\n key={visible ? \"off\" : \"on\"}\n className=\"inline-flex\"\n initial={{ opacity: 0, scale: 0.8, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n exit={{ opacity: 0, scale: 0.8, filter: \"blur(2px)\" }}\n transition={{ duration: 0.15, ease: EASE }}\n >\n {visible ? (\n <EyeOffIcon aria-hidden=\"true\" />\n ) : (\n <EyeIcon aria-hidden=\"true\" />\n )}\n </motion.span>\n </AnimatePresence>\n </Button>\n </InputGroupAddon>\n )}\n </InputGroup>\n\n <AnimatePresence initial={false}>\n {showStrength && (\n <motion.div\n className=\"flex flex-col gap-2 overflow-hidden\"\n initial={{ height: 0, opacity: 0 }}\n animate={{ height: \"auto\", opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n transition={{ duration: 0.25, ease: EASE }}\n >\n <div\n aria-label=\"Password strength\"\n aria-valuemax={4}\n aria-valuemin={0}\n aria-valuenow={score}\n className=\"h-1 w-full overflow-hidden rounded-full bg-border\"\n role=\"progressbar\"\n >\n <motion.div\n className={cn(\"h-full rounded-full\", STRENGTH_COLORS[score])}\n animate={{ width: `${(score / 4) * 100}%` }}\n transition={{ duration: 0.4, ease: EASE }}\n />\n </div>\n <ul\n aria-label=\"Password requirements\"\n className=\"flex flex-col gap-1\"\n >\n {passwordRequirements.map((req) => {\n const met = req.regex.test(value);\n return (\n <li className=\"flex items-center gap-2 text-xs\" key={req.text}>\n {met ? (\n <CheckIcon\n aria-hidden=\"true\"\n className=\"size-3.5 text-emerald-500\"\n />\n ) : (\n <XIcon\n aria-hidden=\"true\"\n className=\"size-3.5 text-muted-foreground/80\"\n />\n )}\n <span\n className={\n met ? \"text-emerald-600\" : \"text-muted-foreground\"\n }\n >\n {req.text}\n <span className=\"sr-only\">\n {met ? \" - met\" : \" - not met\"}\n </span>\n </span>\n </li>\n );\n })}\n </ul>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n","\"use client\"\n\nimport {\n RiAppleFill,\n RiGithubFill,\n RiGoogleFill,\n RiTwitterXFill,\n} from \"@remixicon/react\"\nimport type * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nexport type SocialProvider = \"google\" | \"apple\" | \"github\" | \"x\"\n\n/** Google's four-color \"G\" — the only provider whose mark isn't monochrome. */\nfunction GoogleColorIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" {...props}>\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.76h3.56c2.09-1.92 3.28-4.74 3.28-8.09Z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.56-2.76c-.99.66-2.25 1.05-3.72 1.05-2.86 0-5.28-1.93-6.15-4.53H2.18v2.85A11 11 0 0 0 12 23Z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.85 14.1A6.6 6.6 0 0 1 5.5 12c0-.73.13-1.44.35-2.1V7.05H2.18a11 11 0 0 0 0 9.9l3.67-2.85Z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15A11 11 0 0 0 2.18 7.05L5.85 9.9C6.72 7.3 9.14 5.38 12 5.38Z\"\n />\n </svg>\n )\n}\n\n/**\n * Label + brand mark per provider, shared with the auth blocks. `Icon` is the\n * monochrome mark that inherits the current text color; `BrandIcon` +\n * `brandClassName` render it in the provider's own colors.\n */\nexport const SOCIAL_PROVIDERS: Record<\n SocialProvider,\n {\n label: string\n Icon: React.ComponentType<{ className?: string }>\n BrandIcon: React.ComponentType<{ className?: string }>\n brandClassName: string\n }\n> = {\n google: {\n label: \"Google\",\n Icon: RiGoogleFill,\n BrandIcon: GoogleColorIcon,\n brandClassName: \"\",\n },\n apple: {\n label: \"Apple\",\n Icon: RiAppleFill,\n BrandIcon: RiAppleFill,\n brandClassName: \"text-foreground\",\n },\n github: {\n label: \"GitHub\",\n Icon: RiGithubFill,\n BrandIcon: RiGithubFill,\n brandClassName: \"text-foreground\",\n },\n x: {\n label: \"X\",\n Icon: RiTwitterXFill,\n BrandIcon: RiTwitterXFill,\n brandClassName: \"text-foreground\",\n },\n}\n\nconst ACTION_LABELS = {\n login: \"Login with\",\n signup: \"Sign up with\",\n continue: \"Continue with\",\n} as const\n\nexport interface SocialProvidersProps {\n providers?: SocialProvider[]\n /** Verb used in the stacked layout labels. */\n action?: keyof typeof ACTION_LABELS\n /** \"stack\" = full-width labeled buttons; \"row\" = icon-only buttons. */\n layout?: \"stack\" | \"row\"\n /** Shows the matching button in its loading state and disables the rest. */\n loadingProvider?: SocialProvider | null\n disabled?: boolean\n onSelect?: (provider: SocialProvider) => void\n className?: string\n}\n\n/** Social auth buttons (coss particle p-button-38). UI only — wire onSelect. */\nexport function SocialProviders({\n providers = [\"google\", \"apple\", \"github\"],\n action = \"continue\",\n layout = \"stack\",\n loadingProvider = null,\n disabled = false,\n onSelect,\n className,\n}: SocialProvidersProps) {\n const row = layout === \"row\"\n\n return (\n <div\n className={cn(\n \"flex w-full gap-2\",\n row ? \"flex-row justify-center\" : \"flex-col\",\n className\n )}\n >\n {providers.map((provider) => {\n const { label, Icon } = SOCIAL_PROVIDERS[provider]\n return (\n <Button\n key={provider}\n variant=\"outline\"\n size={row ? \"icon\" : \"default\"}\n className={row ? undefined : \"w-full\"}\n aria-label={`${ACTION_LABELS[action]} ${label}`}\n loading={loadingProvider === provider}\n disabled={\n disabled ||\n (loadingProvider !== null && loadingProvider !== provider)\n }\n onClick={() => onSelect?.(provider)}\n >\n <Icon aria-hidden=\"true\" />\n {!row && (\n <span className=\"flex-1\">\n {ACTION_LABELS[action]} {label}\n </span>\n )}\n </Button>\n )\n })}\n </div>\n )\n}\n","\"use client\"\n\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction TooltipProvider({\n delay = 0,\n ...props\n}: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delay={delay}\n {...props}\n />\n )\n}\n\nfunction Tooltip({ ...props }: TooltipPrimitive.Root.Props) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n side = \"top\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <TooltipPrimitive.Popup\n data-slot=\"tooltip-content\"\n className={cn(\n \"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5\" />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport type { TreeContextValue } from \"./type\"\n\nexport const TreeContext = React.createContext<TreeContextValue | null>(null)\n\nexport function useTreeContext(): TreeContextValue {\n const context = React.useContext(TreeContext)\n if (!context) throw new Error(\"Tree rows must render inside <Tree>.\")\n return context\n}\n","import type { Transition, Variants } from \"motion/react\"\n\n/** `--ease-smooth-out` as a motion/react easing tuple. */\nexport const TREE_EASE = [0.22, 1, 0.36, 1] as const\n\n/** Branch open — `--duration-fast` territory (accordion open). */\nexport const TREE_OPEN_DURATION = 0.25\n\n/** Branch close — quicker than open, per open/close asymmetry. */\nexport const TREE_CLOSE_DURATION = 0.15\n\n/** Chevron flip and label fades. */\nexport const TREE_MICRO_DURATION = 0.15\n\n/** Sidebar rail label reveal/hide when `collapsed` flips. */\nexport const TREE_COLLAPSE_DURATION = 0.2\n\n/** The collapsed rail's width in px — one `h-10 rounded-xl` icon row, edge\n * to edge. Kept in sync with the `w-10` resting class the rail falls back to\n * before its expanded width has been measured. */\nexport const RAIL_COLLAPSED_WIDTH = 40\n\n/** Rail label text fade — starts as the width growth is finishing, so the\n * label never reads as clipped mid-grow. */\nexport const TREE_LABEL_REVEAL_DELAY = 0.01\n\n/** A branch's children group: grows open with a soft stagger, folds shut\n * faster. Height rides layout (\"auto\"), paint fades. */\nexport const TREE_BRANCH_VARIANTS: Variants = {\n closed: { height: 0, opacity: 0 },\n open: {\n height: \"auto\",\n opacity: 1,\n transition: {\n duration: TREE_OPEN_DURATION,\n ease: TREE_EASE,\n staggerChildren: 0.03,\n },\n },\n}\n\n/** Branch close — a plain target, NOT the \"closed\" variant label: a\n * labeled exit orchestrates every variant child and AnimatePresence then\n * waits on the whole subtree before unmounting. */\nexport const TREE_BRANCH_EXIT = {\n height: 0,\n opacity: 0,\n transition: { duration: TREE_CLOSE_DURATION, ease: TREE_EASE },\n}\n\n/** One row inside an opening branch — a short blurred rise. */\nexport const TREE_ROW_VARIANTS: Variants = {\n closed: { opacity: 0, x: -4 },\n open: { opacity: 1, x: 0 },\n}\n\nexport const TREE_MICRO_TRANSITION: Transition = {\n duration: TREE_MICRO_DURATION,\n ease: TREE_EASE,\n}\n","import type { TreeNode } from \"./type\"\n\n/** Depth-0 nodes read as sections only when the data actually nests three\n * levels — a two-level tree keeps its top level as plain link rows. */\nexport function hasThreeLevels(items: readonly TreeNode[]): boolean {\n return items.some((node) =>\n node.children?.some((child) => (child.children?.length ?? 0) > 0)\n )\n}\n\n/** Ids of every ancestor of `id` (nearest last); empty when absent. */\nexport function ancestorIdsOf(\n items: readonly TreeNode[],\n id: string\n): string[] {\n const walk = (nodes: readonly TreeNode[], trail: string[]): string[] | null => {\n for (const node of nodes) {\n if (node.id === id) return trail\n if (node.children) {\n const found = walk(node.children, [...trail, node.id])\n if (found) return found\n }\n }\n return null\n }\n return walk(items, []) ?? []\n}\n\n/** Ids that start expanded: `defaultOpen` nodes plus every ancestor of the\n * active entry, so the current location is never folded away. */\nexport function initialExpandedIds(\n items: readonly TreeNode[],\n activeId?: string\n): Set<string> {\n const expanded = new Set<string>()\n const walk = (nodes: readonly TreeNode[]) => {\n for (const node of nodes) {\n if (node.defaultOpen) expanded.add(node.id)\n if (node.children) walk(node.children)\n }\n }\n walk(items)\n if (activeId !== undefined)\n for (const id of ancestorIdsOf(items, activeId)) expanded.add(id)\n return expanded\n}\n\n/** Ids of every node that can hold children — the set `expandAll` opens.\n * In `files` an empty `children: []` still counts (it is a folder). */\nexport function expandableIdsOf(\n items: readonly TreeNode[],\n filesVariant = false\n): string[] {\n const ids: string[] = []\n const walk = (nodes: readonly TreeNode[]) => {\n for (const node of nodes) {\n const branch = filesVariant\n ? node.children !== undefined\n : (node.children?.length ?? 0) > 0\n if (branch) ids.push(node.id)\n if (node.children) walk(node.children)\n }\n }\n walk(items)\n return ids\n}\n\n/** Immutably relabel `id`. Returns the same array reference when absent. */\nexport function renameNode(\n items: readonly TreeNode[],\n id: string,\n label: string\n): TreeNode[] {\n return items.map((node) => {\n if (node.id === id) return { ...node, label }\n return node.children\n ? { ...node, children: renameNode(node.children, id, label) }\n : node\n })\n}\n\n/** Whether `candidateId` is `id` itself or nests anywhere under it — the\n * guard that keeps a folder from being dropped into its own subtree. */\nexport function containsNode(\n items: readonly TreeNode[],\n id: string,\n candidateId: string\n): boolean {\n if (id === candidateId) return true\n const root = findNode(items, id)\n if (!root?.children) return false\n return findNode(root.children, candidateId) !== null\n}\n\nexport function findNode(\n items: readonly TreeNode[],\n id: string\n): TreeNode | null {\n for (const node of items) {\n if (node.id === id) return node\n if (node.children) {\n const found = findNode(node.children, id)\n if (found) return found\n }\n }\n return null\n}\n\n/** Parent id (`null` at root) and index of `id` among its siblings. */\nexport function locateNode(\n items: readonly TreeNode[],\n id: string\n): { parentId: string | null; index: number } | null {\n const walk = (\n nodes: readonly TreeNode[],\n parentId: string | null\n ): { parentId: string | null; index: number } | null => {\n for (const [index, node] of nodes.entries()) {\n if (node.id === id) return { parentId, index }\n if (node.children) {\n const found = walk(node.children, node.id)\n if (found) return found\n }\n }\n return null\n }\n return walk(items, null)\n}\n\n/** Immutably lift `id` out of the tree and reinsert it under `parentId`\n * (`null` = root) at `index` — the standard `onMove` reducer, exported so\n * consumers don't each rebuild it. `index` addresses the sibling list\n * *after* the node has been lifted out. */\nexport function moveNode(\n items: readonly TreeNode[],\n id: string,\n parentId: string | null,\n index: number\n): TreeNode[] {\n // Dropping into the node's own subtree would orphan it — refuse.\n if (parentId !== null && containsNode(items, id, parentId)) return [...items]\n let moved: TreeNode | null = null\n const strip = (nodes: readonly TreeNode[]): TreeNode[] =>\n nodes.flatMap((node) => {\n if (node.id === id) {\n moved = node\n return []\n }\n return node.children\n ? [{ ...node, children: strip(node.children) }]\n : [node]\n })\n const stripped = strip(items)\n if (!moved) return [...items]\n const captured = moved as TreeNode\n\n if (parentId === null) {\n const next = [...stripped]\n next.splice(Math.min(index, next.length), 0, captured)\n return next\n }\n const insert = (nodes: readonly TreeNode[]): TreeNode[] =>\n nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])]\n children.splice(Math.min(index, children.length), 0, captured)\n return { ...node, children }\n }\n return node.children ? { ...node, children: insert(node.children) } : node\n })\n return insert(stripped)\n}\n","/**\n * Per-instance Jotai state for `Tree`.\n *\n * Every atom is a module-level family keyed by a tree id, so one\n * `ExegiaProvider` at the app root is enough: many trees coexist in one store\n * without a provider each, and any component can drive a tree by id without\n * holding its controller.\n *\n * Controlled props stay authoritative. `useTree` projects them into these\n * atoms on every commit so the action atoms and remote readers work off\n * current data — a one-way projection, not a second source of truth. The\n * write gates below (`controlsItems`, `controlsActiveId`, `controlsCollapsed`)\n * are what keep the store from overwriting a prop.\n */\nimport { atom } from \"jotai\"\nimport type { Atom, Getter, Setter } from \"jotai\"\n\nimport { playCue } from \"@/lib/sound\"\nimport type {\n TreeConfig,\n TreeDropPosition,\n TreeDropTarget,\n TreeHandlers,\n TreeInstanceId,\n TreeNode,\n TreeSeed,\n TreeState,\n TreeVariant,\n} from \"./type\"\nimport {\n ancestorIdsOf,\n expandableIdsOf,\n findNode,\n hasThreeLevels,\n initialExpandedIds,\n moveNode,\n renameNode,\n} from \"./utils\"\n\nconst NO_ITEMS: TreeNode[] = []\nconst NO_IDS: ReadonlySet<string> = new Set<string>()\nconst NO_HANDLERS: TreeHandlers = {}\n\n/** What a tree reads as before `useTree` publishes its options. */\nexport const DEFAULT_TREE_CONFIG: TreeConfig = {\n variant: \"navigation\",\n sound: true,\n controlsItems: false,\n controlsActiveId: false,\n controlsCollapsed: false,\n managesItems: true,\n hasRenameHandler: false,\n hasMoveHandler: false,\n}\n\nconst DEFAULT_TREE_SEED: TreeSeed = { items: NO_ITEMS, collapsed: false }\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: TreeInstanceId) => AtomType) & {\n remove: (id: TreeInstanceId) => void\n}\n\n/** Every family, so `removeTreeInstance` can drop an id from all of them. */\nconst families: { remove: (id: TreeInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: TreeInstanceId) => AtomType) {\n const cache = new Map<TreeInstanceId, AtomType>()\n const family = ((id: TreeInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: TreeInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: TreeInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (get: Getter, set: Setter, id: TreeInstanceId, ...args: Args) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `tree/${id}/${name}`\n return instance\n })\n}\n\n/**\n * A per-node derived atom, keyed by tree and then node id.\n *\n * This is where Jotai earns its place: a row subscribed to\n * `treeNodeExpandedAtom(treeId, node.id)` re-renders when *its* branch opens,\n * and stays put when a sibling's does. Reading the whole controller through\n * context instead re-rendered every row in the tree on every toggle.\n *\n * The outer family registers for cleanup, so `removeTreeInstance` drops all\n * of a tree's node atoms with it.\n */\nfunction nodeFamily<Value>(\n name: string,\n read: (get: Getter, id: TreeInstanceId, nodeId: string) => Value\n) {\n const outer = keyed((id: TreeInstanceId) => {\n const inner = new Map<string, Atom<Value>>()\n return (nodeId: string) => {\n let instance = inner.get(nodeId)\n if (instance === undefined) {\n instance = atom((get) => read(get, id, nodeId))\n instance.debugLabel = `tree/${id}/${name}/${nodeId}`\n inner.set(nodeId, instance)\n }\n return instance\n }\n })\n return (id: TreeInstanceId, nodeId: string) => outer(id)(nodeId)\n}\n\n// ── state ──────────────────────────────────────────────────────────────────\n\n/** @internal */\nexport const treeConfigAtom = stateFamily<TreeConfig>(\n \"config\",\n DEFAULT_TREE_CONFIG\n)\n/** @internal Refreshed every commit; nothing subscribes, so it is free. */\nexport const treeHandlersAtom = stateFamily<TreeHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\nconst treeSeedAtom = stateFamily<TreeSeed>(\"seed\", DEFAULT_TREE_SEED)\nconst treeInitializedAtom = stateFamily<boolean>(\"initialized\", false)\n\n/** The tree's current data — hook-owned, or the projection of a controlled\n * `items` prop. */\nexport const treeItemsAtom = stateFamily<TreeNode[]>(\"items\", NO_ITEMS)\nexport const treeActiveIdAtom = stateFamily<string | undefined>(\n \"activeId\",\n undefined\n)\nexport const treeExpandedIdsAtom = stateFamily<ReadonlySet<string>>(\n \"expandedIds\",\n NO_IDS\n)\n/** Raw rail fold. Read `treeCollapsedAtom` for the variant-masked value. */\nexport const treeRailCollapsedAtom = stateFamily<boolean>(\n \"railCollapsed\",\n false\n)\nexport const treeRenamingIdAtom = stateFamily<string | null>(\"renamingId\", null)\nexport const treeDraggedIdAtom = stateFamily<string | null>(\"draggedId\", null)\nexport const treeDropTargetAtom = stateFamily<TreeDropTarget | null>(\n \"dropTarget\",\n null\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** @internal The only items atom `useTree` may subscribe to: empty while a\n * controlled `items` prop owns the data, so the projection write never feeds\n * back into the render that produced it. An inline `items={[…]}` array is a\n * new reference every render, and a subscribed round-trip would loop. */\nexport const treeOwnedItemsAtom = readFamily(\"ownedItems\", (get, id) =>\n get(treeConfigAtom(id)).controlsItems ? NO_ITEMS : get(treeItemsAtom(id))\n)\n\n/** Rail folded to icons — always `false` outside `sidebar`. */\nexport const treeCollapsedAtom = readFamily(\"collapsed\", (get, id) =>\n get(treeConfigAtom(id)).variant === \"sidebar\"\n ? get(treeRailCollapsedAtom(id))\n : false\n)\n\nexport const treeSectionedAtom = readFamily(\n \"sectioned\",\n (get, id) =>\n get(treeConfigAtom(id)).variant === \"navigation\" &&\n hasThreeLevels(get(treeItemsAtom(id)))\n)\n\nexport const treeSectionIdsAtom = readFamily(\"sectionIds\", (get, id) =>\n get(treeSectionedAtom(id))\n ? get(treeItemsAtom(id)).map((node) => node.id)\n : []\n)\n\nexport const treeCanRenameAtom = readFamily(\"canRename\", (get, id) => {\n const config = get(treeConfigAtom(id))\n return (\n config.variant === \"files\" &&\n (config.hasRenameHandler || config.managesItems)\n )\n})\n\nexport const treeCanMoveAtom = readFamily(\"canMove\", (get, id) => {\n const config = get(treeConfigAtom(id))\n return (\n config.variant === \"files\" && (config.hasMoveHandler || config.managesItems)\n )\n})\n\nexport const treeVariantAtom = readFamily(\n \"variant\",\n (get, id) => get(treeConfigAtom(id)).variant\n)\n\nexport const treeSoundAtom = readFamily(\n \"sound\",\n (get, id) => get(treeConfigAtom(id)).sound\n)\n\n/** Whether this one node's branch is open. */\nexport const treeNodeExpandedAtom = nodeFamily(\"expanded\", (get, id, nodeId) =>\n get(treeExpandedIdsAtom(id)).has(nodeId)\n)\n\n/** Whether this one node is the current entry. */\nexport const treeNodeActiveAtom = nodeFamily(\n \"active\",\n (get, id, nodeId) => get(treeActiveIdAtom(id)) === nodeId\n)\n\n/** Whether this one node is in rename mode. */\nexport const treeNodeRenamingAtom = nodeFamily(\n \"renaming\",\n (get, id, nodeId) => get(treeRenamingIdAtom(id)) === nodeId\n)\n\n/** Whether this one node is the row in flight. */\nexport const treeNodeDraggingAtom = nodeFamily(\n \"dragging\",\n (get, id, nodeId) => get(treeDraggedIdAtom(id)) === nodeId\n)\n\n/** Where a drop on this one node would land, `null` when it is not hovered. */\nexport const treeNodeDropAtom = nodeFamily<TreeDropPosition | null>(\n \"drop\",\n (get, id, nodeId) => {\n const target = get(treeDropTargetAtom(id))\n return target?.id === nodeId ? target.position : null\n }\n)\n\n/** The whole state of one tree. Components reading a single field should\n * subscribe to that field's atom instead — this one changes on every edit. */\nexport const treeStateAtom = readFamily<TreeState>(\"state\", (get, id) => ({\n variant: get(treeConfigAtom(id)).variant,\n items: get(treeItemsAtom(id)),\n activeId: get(treeActiveIdAtom(id)),\n expandedIds: get(treeExpandedIdsAtom(id)),\n collapsed: get(treeCollapsedAtom(id)),\n renamingId: get(treeRenamingIdAtom(id)),\n sectioned: get(treeSectionedAtom(id)),\n sectionIds: get(treeSectionIdsAtom(id)),\n canRename: get(treeCanRenameAtom(id)),\n canMove: get(treeCanMoveAtom(id)),\n draggedId: get(treeDraggedIdAtom(id)),\n dropTarget: get(treeDropTargetAtom(id)),\n}))\n\n// ── shared write helpers ───────────────────────────────────────────────────\n\nfunction cue(get: Getter, id: TreeInstanceId): void {\n if (get(treeConfigAtom(id)).sound) playCue(\"toggle\")\n}\n\nfunction commitExpanded(\n get: Getter,\n set: Setter,\n id: TreeInstanceId,\n next: Set<string>\n): void {\n set(treeExpandedIdsAtom(id), next)\n get(treeHandlersAtom(id)).onExpandedChange?.([...next])\n}\n\n/** The atom only when the hook owns the data; the callback always. */\nfunction commitItems(\n get: Getter,\n set: Setter,\n id: TreeInstanceId,\n next: TreeNode[]\n): void {\n if (!get(treeConfigAtom(id)).controlsItems) set(treeItemsAtom(id), next)\n get(treeHandlersAtom(id)).onItemsChange?.(next)\n}\n\n/** `null` when every ancestor of `nodeId` is already open. */\nfunction withAncestors(\n get: Getter,\n id: TreeInstanceId,\n nodeId: string\n): Set<string> | null {\n const ancestors = ancestorIdsOf(get(treeItemsAtom(id)), nodeId)\n const expanded = get(treeExpandedIdsAtom(id))\n if (!ancestors.some((ancestor) => !expanded.has(ancestor))) return null\n return new Set([...expanded, ...ancestors])\n}\n\nfunction seedInstance(\n set: Setter,\n id: TreeInstanceId,\n seed: TreeSeed,\n variant: TreeVariant\n): void {\n set(treeItemsAtom(id), seed.items)\n set(treeActiveIdAtom(id), seed.activeId)\n set(treeRailCollapsedAtom(id), seed.collapsed)\n set(treeRenamingIdAtom(id), null)\n set(treeDraggedIdAtom(id), null)\n set(treeDropTargetAtom(id), null)\n const expanded = seed.expandedIds\n ? new Set(seed.expandedIds)\n : initialExpandedIds(seed.items, seed.activeId)\n // Section names default open — they are headings over their run of items,\n // not drawers; `defaultOpen: false` still starts one closed.\n if (\n !seed.expandedIds &&\n variant === \"navigation\" &&\n hasThreeLevels(seed.items)\n )\n for (const node of seed.items)\n if (node.defaultOpen !== false) expanded.add(node.id)\n set(treeExpandedIdsAtom(id), expanded)\n}\n\n// ── expansion ──────────────────────────────────────────────────────────────\n\nexport const expandTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"expand\",\n (get, set, id, nodeId) => {\n const expanded = get(treeExpandedIdsAtom(id))\n if (expanded.has(nodeId)) return\n commitExpanded(get, set, id, new Set([...expanded, nodeId]))\n cue(get, id)\n }\n)\n\nexport const collapseTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"collapse\",\n (get, set, id, nodeId) => {\n const expanded = get(treeExpandedIdsAtom(id))\n if (!expanded.has(nodeId)) return\n const next = new Set(expanded)\n next.delete(nodeId)\n commitExpanded(get, set, id, next)\n cue(get, id)\n }\n)\n\nexport const toggleTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"toggleExpanded\",\n (get, set, id, nodeId) => {\n const next = new Set(get(treeExpandedIdsAtom(id)))\n if (next.has(nodeId)) next.delete(nodeId)\n else next.add(nodeId)\n commitExpanded(get, set, id, next)\n cue(get, id)\n }\n)\n\nexport const expandAllTreeNodesAtom = actionFamily<[]>(\n \"expandAll\",\n (get, set, id) => {\n const filesVariant = get(treeConfigAtom(id)).variant === \"files\"\n const ids = expandableIdsOf(get(treeItemsAtom(id)), filesVariant)\n commitExpanded(get, set, id, new Set(ids))\n }\n)\n\nexport const collapseAllTreeNodesAtom = actionFamily<[]>(\n \"collapseAll\",\n (get, set, id) => {\n commitExpanded(get, set, id, new Set())\n }\n)\n\n/** Open every ancestor of `nodeId` without touching the rest of the tree. */\nexport const revealTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"reveal\",\n (get, set, id, nodeId) => {\n const next = withAncestors(get, id, nodeId)\n if (next) commitExpanded(get, set, id, next)\n }\n)\n\n/** @internal The same, silent. `useTree` runs it whenever the active id\n * changes so a nested entry is never folded away — the hook has never\n * reported that implicit reveal through `onExpandedChange`. */\nexport const revealTreeAncestorsAtom = actionFamily<[nodeId: string]>(\n \"revealAncestors\",\n (get, set, id, nodeId) => {\n const next = withAncestors(get, id, nodeId)\n if (next) set(treeExpandedIdsAtom(id), next)\n }\n)\n\n// ── rail ───────────────────────────────────────────────────────────────────\n\nexport const setTreeCollapsedAtom = actionFamily<[collapsed: boolean]>(\n \"setCollapsed\",\n (get, set, id, collapsed) => {\n if (!get(treeConfigAtom(id)).controlsCollapsed)\n set(treeRailCollapsedAtom(id), collapsed)\n get(treeHandlersAtom(id)).onCollapsedChange?.(collapsed)\n cue(get, id)\n }\n)\n\nexport const toggleTreeCollapsedAtom = actionFamily<[]>(\n \"toggleCollapsed\",\n (get, set, id) => {\n set(setTreeCollapsedAtom(id), !get(treeCollapsedAtom(id)))\n }\n)\n\n// ── selection ──────────────────────────────────────────────────────────────\n\n/** Runs the node's own `onSelect` first, then `onNavigate` — the order a row\n * press follows. Disabled and unknown nodes are inert. */\nexport const selectTreeNodeAtom = actionFamily<[nodeId: string]>(\n \"select\",\n (get, set, id, nodeId) => {\n const node = findNode(get(treeItemsAtom(id)), nodeId)\n if (!node || node.disabled) return\n if (!get(treeConfigAtom(id)).controlsActiveId)\n set(treeActiveIdAtom(id), nodeId)\n node.onSelect?.()\n get(treeHandlersAtom(id)).onNavigate?.(node)\n }\n)\n\n// ── rename ─────────────────────────────────────────────────────────────────\n\nexport const startTreeRenameAtom = actionFamily<[nodeId: string]>(\n \"startRename\",\n (get, set, id, nodeId) => {\n // An id from elsewhere (a stale selection, another tree) would arm rename\n // mode against a row that never renders.\n if (!get(treeCanRenameAtom(id))) return\n if (!findNode(get(treeItemsAtom(id)), nodeId)) return\n set(treeRenamingIdAtom(id), nodeId)\n }\n)\n\nexport const cancelTreeRenameAtom = actionFamily<[]>(\n \"cancelRename\",\n (_get, set, id) => {\n set(treeRenamingIdAtom(id), null)\n }\n)\n\n/** Commit a rename and leave rename mode. Blank or unchanged labels are\n * dropped. */\nexport const renameTreeNodeAtom = actionFamily<[nodeId: string, label: string]>(\n \"rename\",\n (get, set, id, nodeId, label) => {\n set(treeRenamingIdAtom(id), null)\n const next = label.trim()\n if (!get(treeCanRenameAtom(id)) || !next) return\n const items = get(treeItemsAtom(id))\n const node = findNode(items, nodeId)\n if (!node || node.label === next) return\n get(treeHandlersAtom(id)).onRename?.(nodeId, next)\n if (get(treeConfigAtom(id)).managesItems)\n commitItems(get, set, id, renameNode(items, nodeId, next))\n }\n)\n\n// ── data ───────────────────────────────────────────────────────────────────\n\nexport const moveTreeNodeAtom = actionFamily<\n [nodeId: string, parentId: string | null, index: number]\n>(\"move\", (get, set, id, nodeId, parentId, index) => {\n if (!get(treeCanMoveAtom(id))) return\n get(treeHandlersAtom(id)).onMove?.(nodeId, parentId, index)\n if (get(treeConfigAtom(id)).managesItems)\n commitItems(\n get,\n set,\n id,\n moveNode(get(treeItemsAtom(id)), nodeId, parentId, index)\n )\n})\n\n/** Replace the data. Reports through `onItemsChange`; writes the atom only\n * when no controlled `items` prop owns it. */\nexport const setTreeItemsAtom = actionFamily<[items: TreeNode[]]>(\n \"setItems\",\n (get, set, id, items) => {\n commitItems(get, set, id, items)\n }\n)\n\n// ── drag state ─────────────────────────────────────────────────────────────\n\nexport const endTreeDragAtom = actionFamily<[]>(\"endDrag\", (_get, set, id) => {\n set(treeDraggedIdAtom(id), null)\n set(treeDropTargetAtom(id), null)\n})\n\n// ── lifecycle ──────────────────────────────────────────────────────────────\n\n/** @internal Publish the latest options; seed the instance once. */\nexport const mountTreeAtom = actionFamily<[config: TreeConfig, seed: TreeSeed]>(\n \"mount\",\n (get, set, id, config, seed) => {\n set(treeConfigAtom(id), config)\n if (get(treeInitializedAtom(id))) return\n set(treeInitializedAtom(id), true)\n set(treeSeedAtom(id), seed)\n seedInstance(set, id, seed, config.variant)\n }\n)\n\n/** @internal */\nexport const setTreeHandlersAtom = actionFamily<[handlers: TreeHandlers]>(\n \"setHandlers\",\n (_get, set, id, handlers) => {\n set(treeHandlersAtom(id), handlers)\n }\n)\n\n/** @internal One-way projections of controlled props — no callbacks fire. */\nexport const projectTreeItemsAtom = actionFamily<[items: TreeNode[]]>(\n \"projectItems\",\n (_get, set, id, items) => {\n set(treeItemsAtom(id), items)\n }\n)\n\n/** @internal */\nexport const projectTreeActiveIdAtom = actionFamily<\n [activeId: string | undefined]\n>(\"projectActiveId\", (_get, set, id, activeId) => {\n set(treeActiveIdAtom(id), activeId)\n})\n\n/** @internal */\nexport const projectTreeCollapsedAtom = actionFamily<[collapsed: boolean]>(\n \"projectCollapsed\",\n (_get, set, id, collapsed) => {\n set(treeRailCollapsedAtom(id), collapsed)\n }\n)\n\n/** Back to the values the instance mounted with. */\nexport const resetTreeAtom = actionFamily<[]>(\"reset\", (get, set, id) => {\n seedInstance(set, id, get(treeSeedAtom(id)), get(treeConfigAtom(id)).variant)\n})\n\n/** Drop every atom for `id`. `useTree` calls this on unmount for trees it\n * keyed itself; an explicit `treeId` outlives its component, so a rail's fold\n * survives a route change. */\nexport function removeTreeInstance(id: TreeInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport { LucideChevronLeft, LucideChevronRight } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\"\nimport {\n TREE_BRANCH_EXIT,\n TREE_BRANCH_VARIANTS,\n TREE_COLLAPSE_DURATION,\n TREE_LABEL_REVEAL_DELAY,\n TREE_MICRO_TRANSITION,\n TREE_ROW_VARIANTS,\n} from \"./constants\"\nimport {\n cancelTreeRenameAtom,\n renameTreeNodeAtom,\n selectTreeNodeAtom,\n startTreeRenameAtom,\n toggleTreeNodeAtom,\n treeCanRenameAtom,\n treeCollapsedAtom,\n treeNodeActiveAtom,\n treeNodeDraggingAtom,\n treeNodeDropAtom,\n treeNodeExpandedAtom,\n treeNodeRenamingAtom,\n treeSectionedAtom,\n treeSoundAtom,\n treeVariantAtom,\n} from \"./tree-atom\"\nimport { useTreeContext } from \"./tree-context\"\nimport type { TreeNode } from \"./type\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { Button } from \"@/components/ui/button\"\n\n/** How a row behaves, resolved from variant + depth + shape. */\ntype RowKind =\n | \"section\" // navigation depth 0 with 3-level data — heading, toggles\n | \"toggle\" // expands/collapses on row press (nav parents, files folders)\n | \"link\" // navigates; may still carry a chevron that toggles separately\nexport interface TreeRowProps {\n node: TreeNode\n depth: number\n}\n\nfunction rowKindOf(\n node: TreeNode,\n depth: number,\n variant: string,\n sectioned: boolean\n): RowKind {\n if (variant === \"sidebar\") return \"link\"\n const branch =\n variant === \"files\" ? node.children !== undefined : !!node.children?.length\n if (!branch) return \"link\"\n if (variant === \"navigation\")\n return sectioned && depth === 0 ? \"section\" : \"toggle\"\n // toc parents navigate — their chevron is a separate toggle.\n return variant === \"toc\" ? \"link\" : \"toggle\"\n}\n\nfunction TreeRowImpl({ node, depth }: TreeRowProps): React.ReactElement {\n const { treeId, renderTrailing, dnd } = useTreeContext()\n const reduce = useReducedMotion()\n\n // One subscription per field, per node. A row re-renders when its own\n // branch, selection, rename or drag state changes and sits still while a\n // sibling's does — reading the whole controller off context instead\n // re-rendered every row in the tree on every toggle.\n const variant = useAtomValue(treeVariantAtom(treeId))\n const sectioned = useAtomValue(treeSectionedAtom(treeId))\n const collapsed = useAtomValue(treeCollapsedAtom(treeId))\n const canRename = useAtomValue(treeCanRenameAtom(treeId))\n const sound = useAtomValue(treeSoundAtom(treeId))\n const open = useAtomValue(treeNodeExpandedAtom(treeId, node.id))\n const active = useAtomValue(treeNodeActiveAtom(treeId, node.id))\n const renaming = useAtomValue(treeNodeRenamingAtom(treeId, node.id))\n const dragging = useAtomValue(treeNodeDraggingAtom(treeId, node.id))\n const drop = useAtomValue(treeNodeDropAtom(treeId, node.id))\n\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n\n const kind = rowKindOf(node, depth, variant, sectioned)\n\n // The sidebar rail is single-level by contract — nested children are\n // ignored rather than rendered somewhere misleading.\n const children = variant === \"sidebar\" ? [] : (node.children ?? [])\n const canExpand =\n kind !== \"link\" || (variant === \"toc\" && children.length > 0)\n\n const files = variant === \"files\"\n\n // toc rows below the route level are in-page anchors: they scroll to the\n // heading sharing their id (an explicit `#hash` href wins). Rows are\n // buttons, so the anchor default is reproduced by setting location.hash\n // after `select` — the same order the old <a> gave (handlers first, then\n // the browser's jump), with the same :target/history semantics.\n const anchorHash =\n variant === \"toc\" && kind === \"link\" && !node.disabled\n ? node.href?.startsWith(\"#\")\n ? node.href\n : depth > 0 && !node.href\n ? `#${node.id}`\n : undefined\n : undefined\n\n function handlePress(event: React.MouseEvent) {\n if (node.disabled) {\n event.preventDefault()\n return\n }\n if (kind === \"link\") {\n select(node.id)\n if (anchorHash !== undefined && typeof window !== \"undefined\") {\n window.location.hash = anchorHash\n }\n return\n }\n toggleExpanded(node.id)\n }\n\n function handleStartRename(event: React.MouseEvent) {\n if (!canRename || node.disabled) return\n event.preventDefault()\n startRename(node.id)\n }\n\n const label = renaming ? (\n <input\n autoFocus\n className={cn(\n \"h-5 min-w-0 flex-1 rounded-sm border-none bg-transparent px-1\",\n \"text-[length:inherit] text-foreground outline-none focus-visible:ring-0\"\n )}\n data-slot=\"tree-rename-input\"\n defaultValue={node.label}\n onBlur={(event) => rename(node.id, event.currentTarget.value)}\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === \"Enter\") rename(node.id, event.currentTarget.value)\n if (event.key === \"Escape\") cancelRename()\n }}\n />\n ) : variant === \"sidebar\" ? (\n // The rail label folds away with the rail instead of unmounting rows.\n <AnimatePresence initial={false} mode=\"wait\">\n <motion.span\n initial={{ width: 0, opacity: 0, x: -8 }}\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? -8 : 0,\n display: collapsed ? \"none\" : \"flex\",\n transition: reduce\n ? { duration: 0 }\n : {\n width: {\n delay: TREE_LABEL_REVEAL_DELAY,\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n opacity: {\n delay: TREE_LABEL_REVEAL_DELAY,\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n x: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeInOut\",\n },\n },\n }}\n exit={{\n width: 0,\n opacity: 0,\n display: \"none\",\n x: -8,\n transition: reduce\n ? { duration: 0 }\n : {\n display: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeOut\",\n },\n width: {\n duration: TREE_COLLAPSE_DURATION * 3,\n ease: EASE_OUT,\n },\n opacity: {\n duration: TREE_COLLAPSE_DURATION,\n ease: \"easeOut\",\n },\n x: {\n duration: TREE_COLLAPSE_DURATION * 3,\n ease: EASE_OUT,\n },\n },\n }}\n className={cn(\"min-w-0 overflow-clip whitespace-nowrap\")}\n data-slot=\"tree-row-label\"\n >\n {node.label}\n </motion.span>\n </AnimatePresence>\n ) : (\n <span\n className=\"min-w-0 flex-1 truncate\"\n onDoubleClick={canRename ? handleStartRename : undefined}\n >\n {node.label}\n </span>\n )\n\n const chevron = canExpand ? (\n <motion.span\n animate={{ rotate: open ? (variant === \"navigation\" ? -90 : 90) : 0 }}\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center text-muted-foreground/70\"\n transition={reduce ? { duration: 0 } : TREE_MICRO_TRANSITION}\n >\n {variant === \"sidebar\" && (\n <LucideChevronLeft className=\"size-3.5 stroke-3\" />\n )}\n {variant === \"toc\" && (\n <LucideChevronRight className=\"size-3.5 stroke-3\" />\n )}\n {variant === \"navigation\" && (\n <LucideChevronLeft className=\"size-3.5 stroke-3\" />\n )}\n </motion.span>\n ) : null\n\n // The trailing slot is consumer-rendered and usually holds buttons, so it\n // cannot live inside the row — every row is itself a <button>, and a\n // button nesting a button is invalid HTML. It sits beside the row\n // instead, overlaid like the toc toggle.\n const showTrailing = files && !!renderTrailing && !renaming\n\n const rowClassName = cn(\n \"group/row relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2\",\n \"text-left text-muted-foreground transition-colors duration-150 outline-none\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n files ? \"h-7 text-[0.8125rem]\" : \"h-8 text-sm\",\n node.disabled && \"pointer-events-none opacity-50\",\n active && \"bg-accent font-medium text-accent-foreground\",\n dragging && \"opacity-50\",\n drop === \"inside\" && \"bg-accent/60 ring-1 ring-primary/50 ring-inset\",\n variant === \"sidebar\" && collapsed && \"justify-center px-0\",\n // Room for the overlay expand toggle on toc parent rows.\n variant === \"toc\" && kind === \"link\" && children.length > 0 && \"pr-7\",\n // …and for the overlay trailing actions on files rows. Sized for one\n // icon button plus its inset; a wider slot clips the truncated label,\n // which is why the prop is documented as row actions, not free content.\n showTrailing && \"pr-9\"\n )\n\n const rowInteractionProps = {\n \"data-slot\": \"tree-row\" as const,\n \"data-id\": node.id,\n \"data-branch\": canExpand ? \"\" : undefined,\n \"data-expanded\": canExpand && open ? \"\" : undefined,\n \"data-active\": active ? \"\" : undefined,\n \"data-cuelume-press\": sound ? \"\" : undefined,\n draggable: dnd.enabled && !renaming ? true : undefined,\n onDragStart: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDragStart(event, node.id)\n : undefined,\n onDragOver: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDragOver(event, node)\n : undefined,\n onDragLeave: dnd.enabled ? dnd.onRowDragLeave : undefined,\n onDrop: dnd.enabled\n ? (event: React.DragEvent) => dnd.onRowDrop(event, node)\n : undefined,\n onDragEnd: dnd.enabled ? dnd.onRowDragEnd : undefined,\n }\n\n const content = (\n <>\n {kind !== \"section\" && files && chevron}\n {kind !== \"section\" && node.icon && (\n <span\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center [&>svg]:size-4\",\n active && \"text-accent-foreground\"\n )}\n >\n {node.icon}\n </span>\n )}\n {label}\n {node.badge !== undefined && !(variant === \"sidebar\" && collapsed) && (\n <span className=\"ml-auto shrink-0 text-xs text-muted-foreground/80\">\n {node.badge}\n </span>\n )}\n {/* nav toggle chevrons trail like the sidebar block; files lead;\n toc link rows get a separate overlay toggle instead. */}\n {kind === \"toggle\" && !files && (\n <span\n className={cn(\n node.badge === undefined ? \"ml-auto\" : \"ml-1\",\n \"flex shrink-0\"\n )}\n >\n {chevron}\n </span>\n )}\n </>\n )\n\n let row: React.ReactElement\n if (kind === \"section\") {\n row = (\n <button\n {...rowInteractionProps}\n aria-expanded={open}\n className={cn(\n \"group/row flex w-full cursor-pointer items-center gap-1 rounded-md px-2 py-1\",\n \"text-xs font-medium tracking-wide text-muted-foreground/80 uppercase\",\n \"transition-colors duration-150 outline-none hover:text-foreground\",\n \"focus-visible:ring-0 focus-visible:ring-ring\"\n )}\n onClick={handlePress}\n type=\"button\"\n >\n <span className=\"truncate\">{node.label}</span>\n {chevron}\n </button>\n )\n } else {\n // Every non-section row is the shared Button — link rows included. An\n // `href` no longer renders an anchor: navigation runs through\n // `selectTreeNodeAtom` (onSelect → onNavigate), and the consumer routes\n // from the node it receives. `sound` is forwarded so Button's own\n // press/release cues follow the tree's setting rather than its default.\n row = (\n <Button\n {...rowInteractionProps}\n variant={variant === \"sidebar\" && active ? \"secondary\" : \"ghost\"}\n aria-current={active ? \"page\" : undefined}\n aria-expanded={kind === \"toggle\" ? open : undefined}\n aria-label={variant === \"sidebar\" && collapsed ? node.label : undefined}\n className={cn(\n \"transform cursor-pointer! justify-start transition-transform ease-smooth-out\",\n variant === \"sidebar\" && collapsed ? \"h-10! rounded-xl!\" : undefined,\n rowClassName\n )}\n disabled={node.disabled}\n onClick={handlePress}\n sound={sound}\n >\n {content}\n </Button>\n )\n }\n\n // A collapsed rail row is icon-only — a tooltip names it on hover/focus.\n // Expanded, the visible label already does, so the tooltip is disabled\n // rather than unmounted: swapping the wrapper in and out with `collapsed`\n // would remount the row and cut the label's fold animation short.\n if (variant === \"sidebar\") {\n row = (\n <Tooltip disabled={!collapsed || node.disabled}>\n <TooltipTrigger render={row} />\n <TooltipContent side=\"right\">{node.label}</TooltipContent>\n </Tooltip>\n )\n }\n\n // toc parents navigate on the row itself, so their chevron lives beside\n // the row as its own toggle.\n const tocToggle =\n variant === \"toc\" && kind === \"link\" && children.length > 0 ? (\n <button\n aria-expanded={open}\n aria-label={`${open ? \"Collapse\" : \"Expand\"} ${node.label}`}\n className={cn(\n \"absolute top-1/2 right-1 flex size-5 -translate-y-1/2 cursor-pointer items-center\",\n \"justify-center rounded-sm text-muted-foreground/70 outline-none\",\n \"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n )}\n onClick={(event) => {\n event.stopPropagation()\n toggleExpanded(node.id)\n }}\n type=\"button\"\n >\n {chevron}\n </button>\n ) : null\n\n // Revealed by hovering/focusing anywhere in the row wrapper — the row and\n // the actions are siblings now, so the trigger group lives on the wrapper.\n const trailing = showTrailing ? (\n <span\n className={cn(\n \"absolute top-1/2 right-1 flex -translate-y-1/2 items-center\",\n \"opacity-0 transition-opacity duration-150\",\n \"group-focus-within/row-actions:opacity-100 group-hover/row-actions:opacity-100\",\n node.disabled && \"pointer-events-none opacity-50\"\n )}\n data-slot=\"tree-trailing\"\n >\n {renderTrailing?.(node)}\n </span>\n ) : null\n\n const branchClassName =\n kind === \"section\"\n ? \"flex flex-col gap-0.5 overflow-clip\"\n : cn(\n \"flex flex-col overflow-clip border-l border-border\",\n files ? \"mt-0.5 ml-3 gap-px pl-1.5\" : \"mt-1 ml-4 gap-0.5 pl-2.5\"\n )\n\n return (\n <motion.li\n aria-expanded={canExpand ? open : undefined}\n aria-level={depth + 1}\n aria-selected={active || undefined}\n className=\"relative flex min-w-0 flex-col\"\n data-slot=\"tree-item\"\n role=\"treeitem\"\n variants={reduce ? undefined : TREE_ROW_VARIANTS}\n >\n {drop === \"before\" && <TreeDropLine side=\"top\" />}\n <div className={cn(\"relative\", showTrailing && \"group/row-actions\")}>\n {row}\n {tocToggle}\n {trailing}\n </div>\n {canExpand && children.length > 0 && (\n <AnimatePresence initial={false}>\n {open && (\n <motion.ul\n animate={reduce ? { opacity: 1 } : \"open\"}\n className={branchClassName}\n exit={reduce ? { opacity: 0 } : TREE_BRANCH_EXIT}\n initial={reduce ? { opacity: 0 } : \"closed\"}\n key=\"branch\"\n role=\"group\"\n transition={reduce ? { duration: 0.12 } : undefined}\n variants={reduce ? undefined : TREE_BRANCH_VARIANTS}\n >\n {children.map((child) => (\n <TreeRow depth={depth + 1} key={child.id} node={child} />\n ))}\n </motion.ul>\n )}\n </AnimatePresence>\n )}\n {drop === \"after\" && <TreeDropLine side=\"bottom\" />}\n </motion.li>\n )\n}\n\n/** Rows are memoized so a re-render of the root — a rail measurement, a new\n * `renderTrailing` — does not walk the whole tree. Each row's own state\n * reaches it through its atoms instead. */\nexport const TreeRow = React.memo(TreeRowImpl)\nTreeRow.displayName = \"TreeRow\"\n\n/** Insertion indicator above or below a row while a drag hovers it. */\nfunction TreeDropLine({ side }: { side: \"top\" | \"bottom\" }) {\n return (\n <span\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-1 z-10 h-0.5 rounded-full bg-primary\",\n side === \"top\" ? \"top-0 -translate-y-1/2\" : \"bottom-0 translate-y-1/2\"\n )}\n data-slot=\"tree-drop-indicator\"\n />\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom, useStore } from \"jotai\"\n\nimport {\n endTreeDragAtom,\n moveTreeNodeAtom,\n treeCanMoveAtom,\n treeDraggedIdAtom,\n treeDropTargetAtom,\n treeItemsAtom,\n} from \"./tree-atom\"\nimport type {\n TreeDndContextValue,\n TreeDndHandlers,\n TreeDropPosition,\n TreeInstanceId,\n TreeNode,\n} from \"./type\"\nimport { containsNode, findNode, locateNode } from \"./utils\"\n\n/** How far into a folder row the pointer must sit (from either edge) to read\n * as \"inside\" rather than \"before\"/\"after\". */\nconst EDGE_RATIO = 0.25\n\n/**\n * The drag handlers for the `files` variant, stable for the life of the tree.\n *\n * Nothing here subscribes to drag state: items, the dragged id and the drop\n * target are read out of the store when a handler runs. That is what lets\n * every row share one handler object without re-rendering when a drag moves —\n * and it keeps `useTree` from subscribing to data it also projects from\n * props, which would loop on an inline `items` array.\n *\n * Inert unless the tree `canMove`. `dataTransfer` is set for interop but\n * never read, so the flow also works where the store is unavailable (tests,\n * some webviews).\n */\nexport function useTreeDndHandlers(treeId: TreeInstanceId): TreeDndHandlers {\n const store = useStore()\n const enabled = useAtomValue(treeCanMoveAtom(treeId))\n const setDraggedId = useSetAtom(treeDraggedIdAtom(treeId))\n const setDropTarget = useSetAtom(treeDropTargetAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const reset = useSetAtom(endTreeDragAtom(treeId))\n\n const readItems = React.useCallback(\n () => store.get(treeItemsAtom(treeId)),\n [store, treeId]\n )\n const readDraggedId = React.useCallback(\n () => store.get(treeDraggedIdAtom(treeId)),\n [store, treeId]\n )\n const readDropTarget = React.useCallback(\n () => store.get(treeDropTargetAtom(treeId)),\n [store, treeId]\n )\n\n const onRowDragStart = React.useCallback(\n (event: React.DragEvent, id: string) => {\n if (!enabled) return\n event.stopPropagation()\n setDraggedId(id)\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = \"move\"\n event.dataTransfer.setData(\"text/plain\", id)\n }\n },\n [enabled, setDraggedId]\n )\n\n const onRowDragOver = React.useCallback(\n (event: React.DragEvent, node: TreeNode) => {\n const draggedId = readDraggedId()\n if (!enabled || draggedId === null) return\n // A node never drops onto itself or into its own subtree.\n if (containsNode(readItems(), draggedId, node.id)) return\n event.preventDefault()\n event.stopPropagation()\n if (event.dataTransfer) event.dataTransfer.dropEffect = \"move\"\n\n const rect = event.currentTarget.getBoundingClientRect()\n const ratio =\n rect.height > 0 ? (event.clientY - rect.top) / rect.height : 0.5\n // Any node carrying a children array is a folder — an empty one still\n // accepts drops \"inside\".\n const folder = node.children !== undefined\n const position: TreeDropPosition = folder\n ? ratio < EDGE_RATIO\n ? \"before\"\n : ratio > 1 - EDGE_RATIO\n ? \"after\"\n : \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\"\n setDropTarget((prev) =>\n prev?.id === node.id && prev.position === position\n ? prev\n : { id: node.id, position }\n )\n },\n [enabled, readDraggedId, readItems, setDropTarget]\n )\n\n const onRowDragLeave = React.useCallback(\n (event: React.DragEvent) => {\n // Leaving for a child of the same row still counts as hovering it.\n const next = event.relatedTarget as Node | null\n if (next && event.currentTarget.contains(next)) return\n setDropTarget(null)\n },\n [setDropTarget]\n )\n\n const onRowDrop = React.useCallback(\n (event: React.DragEvent, node: TreeNode) => {\n if (!enabled) return\n event.preventDefault()\n event.stopPropagation()\n const draggedId = readDraggedId()\n const target = readDropTarget()\n if (draggedId === null || target === null || target.id !== node.id) {\n reset()\n return\n }\n const items = readItems()\n\n if (target.position === \"inside\") {\n // Append at the end of the folder, sized without the dragged node (it\n // may already live there).\n const children = node.children ?? []\n const index = children.filter((child) => child.id !== draggedId).length\n move(draggedId, node.id, index)\n } else {\n const location = locateNode(items, node.id)\n if (location) {\n const siblings = (\n location.parentId === null\n ? items\n : (findNode(items, location.parentId)?.children ?? [])\n ).filter((sibling) => sibling.id !== draggedId)\n const at = siblings.findIndex((sibling) => sibling.id === node.id)\n const index = target.position === \"after\" ? at + 1 : at\n move(draggedId, location.parentId, index)\n }\n }\n reset()\n },\n [enabled, move, readDraggedId, readDropTarget, readItems, reset]\n )\n\n return React.useMemo(\n () => ({\n enabled,\n onRowDragStart,\n onRowDragOver,\n onRowDragLeave,\n onRowDrop,\n onRowDragEnd: reset,\n }),\n [enabled, onRowDragStart, onRowDragOver, onRowDragLeave, onRowDrop, reset]\n )\n}\n\n/** The handlers plus live drag state, for `TreeController.dnd`. Rows take the\n * handlers alone and read the state per node instead. */\nexport function useTreeDnd(treeId: TreeInstanceId): TreeDndContextValue {\n const handlers = useTreeDndHandlers(treeId)\n const draggedId = useAtomValue(treeDraggedIdAtom(treeId))\n const dropTarget = useAtomValue(treeDropTargetAtom(treeId))\n\n return React.useMemo(\n () => ({ ...handlers, draggedId, dropTarget }),\n [handlers, draggedId, dropTarget]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n cancelTreeRenameAtom,\n collapseAllTreeNodesAtom,\n collapseTreeNodeAtom,\n expandAllTreeNodesAtom,\n expandTreeNodeAtom,\n mountTreeAtom,\n moveTreeNodeAtom,\n projectTreeActiveIdAtom,\n projectTreeCollapsedAtom,\n projectTreeItemsAtom,\n removeTreeInstance,\n renameTreeNodeAtom,\n resetTreeAtom,\n revealTreeAncestorsAtom,\n revealTreeNodeAtom,\n selectTreeNodeAtom,\n setTreeCollapsedAtom,\n setTreeHandlersAtom,\n startTreeRenameAtom,\n toggleTreeCollapsedAtom,\n toggleTreeNodeAtom,\n treeActiveIdAtom,\n treeCanMoveAtom,\n treeCanRenameAtom,\n treeCollapsedAtom,\n treeExpandedIdsAtom,\n treeOwnedItemsAtom,\n treeRenamingIdAtom,\n} from \"./tree-atom\"\nimport type {\n TreeConfig,\n TreeController,\n TreeHandlers,\n TreeSeed,\n UseTreeOptions,\n} from \"./type\"\nimport { useTreeDnd } from \"./use-tree-dnd\"\nimport { findNode, hasThreeLevels } from \"./utils\"\n\n/**\n * The tree's headless controller — every behaviour the component exposes,\n * callable from outside it: expand/collapse (a node, a section, the whole\n * tree), fold the `sidebar` rail, select a node, rename, reorder.\n *\n * Each piece of state is controlled-or-uncontrolled in the usual React\n * shape: pass `items`/`activeId`/`collapsed` to own it yourself, or\n * `defaultItems`/`defaultActiveId`/`defaultCollapsed` to let the hook. When\n * the hook owns `items` (or you pass `onItemsChange`), `rename` and `move`\n * apply the edit to the data themselves — otherwise they only report it\n * through `onRename`/`onMove` and you reduce the tree yourself.\n *\n * ```tsx\n * const tree = useTree({ variant: \"files\", defaultItems: files })\n * <Tree tree={tree} />\n * <Button onClick={tree.collapseAll}>Collapse all</Button>\n * ```\n *\n * State lives in Jotai atoms keyed by `treeId`, so anything under\n * `ExegiaProvider` can drive this tree without the controller — name it and\n * reach for `useTreeState(treeId)` / `useTreeActions(treeId)` elsewhere.\n */\nexport function useTree(options: UseTreeOptions): TreeController {\n const {\n variant,\n onNavigate,\n onRename,\n onMove,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n sound = true,\n } = options\n\n // A generated key isolates unnamed trees from each other; an explicit\n // `treeId` is the app's handle on this one.\n const generatedId = React.useId()\n const treeId = options.treeId ?? generatedId\n\n const controlsItems = options.items !== undefined\n const controlsActiveId = options.activeId !== undefined\n const controlsCollapsed = options.collapsed !== undefined\n // The hook may only rewrite the data when it owns it, or when the consumer\n // asked for the next tree through `onItemsChange`.\n const managesItems = !controlsItems || onItemsChange !== undefined\n const hasRenameHandler = onRename !== undefined\n const hasMoveHandler = onMove !== undefined\n\n // Primitives only, so this object is stable and the store write below runs\n // once per real change rather than once per render.\n const config = React.useMemo<TreeConfig>(\n () => ({\n variant,\n sound,\n controlsItems,\n controlsActiveId,\n controlsCollapsed,\n managesItems,\n hasRenameHandler,\n hasMoveHandler,\n }),\n [\n variant,\n sound,\n controlsItems,\n controlsActiveId,\n controlsCollapsed,\n managesItems,\n hasRenameHandler,\n hasMoveHandler,\n ]\n )\n\n const handlers = React.useMemo<TreeHandlers>(\n () => ({\n onNavigate,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n onRename,\n onMove,\n }),\n [\n onNavigate,\n onItemsChange,\n onExpandedChange,\n onCollapsedChange,\n onRename,\n onMove,\n ]\n )\n\n // Read once: the `default*` options describe the mount, not every render.\n const [seed] = React.useState<TreeSeed>(() => ({\n items: options.items ?? options.defaultItems ?? [],\n activeId: options.activeId ?? options.defaultActiveId,\n collapsed: options.collapsed ?? options.defaultCollapsed ?? false,\n expandedIds: options.defaultExpandedIds\n ? [...options.defaultExpandedIds]\n : undefined,\n }))\n\n const mount = useSetAtom(mountTreeAtom(treeId))\n const publishHandlers = useSetAtom(setTreeHandlersAtom(treeId))\n const projectItems = useSetAtom(projectTreeItemsAtom(treeId))\n const projectActiveId = useSetAtom(projectTreeActiveIdAtom(treeId))\n const projectCollapsed = useSetAtom(projectTreeCollapsedAtom(treeId))\n const revealAncestors = useSetAtom(revealTreeAncestorsAtom(treeId))\n\n // Handlers first — they must be in the store before any action can fire.\n // Rewritten every commit; no read atom depends on them, so nobody\n // re-renders for it.\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n\n // Before paint, so a seeded branch never paints closed for a frame.\n React.useLayoutEffect(() => {\n mount(config, seed)\n }, [mount, config, seed])\n\n // Controlled props stay the source of truth; the store carries a projection\n // so the action atoms and remote readers see current data.\n React.useLayoutEffect(() => {\n if (options.items !== undefined) projectItems(options.items)\n }, [options.items, projectItems])\n\n React.useLayoutEffect(() => {\n if (options.activeId !== undefined) projectActiveId(options.activeId)\n }, [options.activeId, projectActiveId])\n\n React.useLayoutEffect(() => {\n if (options.collapsed !== undefined) projectCollapsed(options.collapsed)\n }, [options.collapsed, projectCollapsed])\n\n // A tree the hook keyed is scrap once its component goes. An explicit\n // `treeId` is the app's key and outlives the mount.\n React.useEffect(() => {\n if (options.treeId !== undefined) return\n return () => removeTreeInstance(treeId)\n }, [treeId, options.treeId])\n\n // Never `treeItemsAtom` — see the note on `treeOwnedItemsAtom`.\n const ownedItems = useAtomValue(treeOwnedItemsAtom(treeId))\n const items = options.items ?? ownedItems\n const activeId = useAtomValue(treeActiveIdAtom(treeId))\n const expandedIds = useAtomValue(treeExpandedIdsAtom(treeId))\n const collapsed = useAtomValue(treeCollapsedAtom(treeId))\n const renamingId = useAtomValue(treeRenamingIdAtom(treeId))\n const canRename = useAtomValue(treeCanRenameAtom(treeId))\n const canMove = useAtomValue(treeCanMoveAtom(treeId))\n\n // Navigating into a nested entry from elsewhere reveals its ancestors, even\n // ones the reader had collapsed. In a layout effect, so the branch is open\n // before the frame paints.\n const lastActiveId = React.useRef(activeId)\n React.useLayoutEffect(() => {\n if (lastActiveId.current === activeId) return\n lastActiveId.current = activeId\n if (activeId !== undefined) revealAncestors(activeId)\n }, [activeId, revealAncestors])\n\n const sectioned = React.useMemo(\n () => variant === \"navigation\" && hasThreeLevels(items),\n [variant, items]\n )\n const sectionIds = React.useMemo(\n () => (sectioned ? items.map((node) => node.id) : []),\n [items, sectioned]\n )\n const getNode = React.useCallback(\n (id: string) => findNode(items, id),\n [items]\n )\n const isExpanded = React.useCallback(\n (id: string) => expandedIds.has(id),\n [expandedIds]\n )\n\n // `useSetAtom` setters are already stable — no useCallback needed.\n const expand = useSetAtom(expandTreeNodeAtom(treeId))\n const collapse = useSetAtom(collapseTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const expandAll = useSetAtom(expandAllTreeNodesAtom(treeId))\n const collapseAll = useSetAtom(collapseAllTreeNodesAtom(treeId))\n const reveal = useSetAtom(revealTreeNodeAtom(treeId))\n const setCollapsed = useSetAtom(setTreeCollapsedAtom(treeId))\n const toggleCollapsed = useSetAtom(toggleTreeCollapsedAtom(treeId))\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const reset = useSetAtom(resetTreeAtom(treeId))\n\n const dnd = useTreeDnd(treeId)\n\n return React.useMemo<TreeController>(\n () => ({\n treeId,\n variant,\n items,\n sectioned,\n sectionIds,\n sound,\n getNode,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n collapsed,\n setCollapsed,\n toggleCollapsed,\n activeId,\n select,\n canRename,\n renamingId,\n startRename,\n cancelRename,\n rename,\n canMove,\n move,\n reset,\n dnd,\n }),\n [\n treeId,\n variant,\n items,\n sectioned,\n sectionIds,\n sound,\n getNode,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n collapsed,\n setCollapsed,\n toggleCollapsed,\n activeId,\n select,\n canRename,\n renamingId,\n startRename,\n cancelRename,\n rename,\n canMove,\n move,\n reset,\n dnd,\n ]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { TooltipProvider } from \"@/components/ui/tooltip\"\nimport { TreeContext } from \"./tree-context\"\nimport { TreeRow } from \"./tree-node\"\nimport type {\n TreeContextValue,\n TreeController,\n TreeDataProps,\n TreeNode,\n TreeProps,\n} from \"./type\"\nimport {\n RAIL_COLLAPSED_WIDTH,\n TREE_COLLAPSE_DURATION,\n TREE_EASE,\n} from \"./constants\"\nimport { useTree } from \"./use-tree\"\nimport { useTreeDndHandlers } from \"./use-tree-dnd\"\nimport { motion, useReducedMotion } from \"motion/react\"\n\nconst DEFAULT_LABELS: Record<TreeController[\"variant\"], string> = {\n navigation: \"Main\",\n toc: \"On this page\",\n sidebar: \"Main\",\n files: \"Files\",\n}\n\n/**\n * A nested item tree with four shapes: `navigation` (app nav — 3-level\n * data promotes the top level to collapsible section names), `toc`\n * (routes on top, in-page `#` anchors at the leaves), `sidebar` (a\n * single-level rail that collapses to icons) and `files` (a compact file\n * explorer with rename, drag-and-drop and trailing row actions).\n *\n * Two ways to drive it. Data-driven like the sidebar block: pass `items`,\n * wire `onNavigate` into your router. Or hold a `useTree` controller and\n * pass it as `tree` — same rendering, but expand, collapse, select, rename\n * and reorder are then callable from anywhere in your app.\n *\n * Branches expand with a soft height morph and row stagger; the rail's\n * labels fold away when `collapsed` flips. Arrow keys walk visible rows,\n * expand and collapse; F2 renames in `files`.\n */\nexport function Tree(props: TreeProps): React.ReactElement {\n // Two components rather than one: hooks may not be called conditionally,\n // and the controller form has no props to build a fallback controller\n // from. Nobody switches a tree between the two forms at runtime.\n return props.tree ? (\n <TreeView\n ariaLabel={props.ariaLabel}\n className={props.className}\n renderTrailing={props.renderTrailing}\n tree={props.tree}\n />\n ) : (\n <UncontrolledTree {...props} />\n )\n}\n\n/** The props form: builds its own controller and renders through it. */\nfunction UncontrolledTree(props: TreeDataProps): React.ReactElement {\n const {\n variant,\n items,\n activeId,\n onNavigate,\n sound = true,\n ariaLabel,\n className,\n } = props\n const tree = useTree({\n treeId: props.treeId,\n variant,\n items,\n activeId,\n onNavigate,\n sound,\n collapsed: variant === \"sidebar\" ? (props.collapsed ?? false) : undefined,\n onMove: variant === \"files\" ? props.onMove : undefined,\n onRename: variant === \"files\" ? props.onRename : undefined,\n })\n return (\n <TreeView\n ariaLabel={ariaLabel}\n className={className}\n renderTrailing={variant === \"files\" ? props.renderTrailing : undefined}\n tree={tree}\n />\n )\n}\n\ninterface TreeViewProps {\n tree: TreeController\n ariaLabel?: string\n className?: string\n renderTrailing?: (node: TreeNode) => React.ReactNode\n}\n\n/** Rendering only — every piece of state and behaviour lives on `tree`. */\nfunction TreeView({\n tree,\n ariaLabel,\n className,\n renderTrailing,\n}: TreeViewProps): React.ReactElement {\n const { variant, items, sectioned, collapsed } = tree\n const rootRef = React.useRef<HTMLUListElement>(null)\n const reduce = useReducedMotion()\n\n // The rail animates between two px widths, so the expanded one has to be\n // measured off the container. Watched rather than read once: the rail is\n // as wide as whatever holds it, which can change on resize.\n //\n // A container with no width of its own sizes to the list — so it shrinks\n // around the 40px rail once collapsed and follows the list mid-tween. Both\n // would feed the list's own width back in as its target and pin it. So:\n // no observing while collapsed (the last expanded width stands), and each\n // sample is taken with the list's inline width cleared, so the classes'\n // resting width — not the tween — is what the container is holding.\n const railRef = React.useRef<HTMLElement>(null)\n const [railWidth, setRailWidth] = React.useState<number | null>(null)\n React.useLayoutEffect(() => {\n const container = railRef.current\n const list = rootRef.current\n if (variant !== \"sidebar\" || collapsed || !container || !list) return\n const measure = () => {\n const inline = list.style.width\n list.style.width = \"\"\n const width = container.clientWidth\n list.style.width = inline\n setRailWidth(width)\n }\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(container)\n return () => observer.disconnect()\n }, [variant, collapsed])\n\n // Until the measurement lands the className carries the width, so the\n // rail is never wrong — just not animated on its very first frame.\n const railTarget =\n variant === \"sidebar\" && railWidth !== null\n ? { width: collapsed ? RAIL_COLLAPSED_WIDTH : railWidth }\n : undefined\n\n // Roving over the DOM rather than a parallel model: collapsed branches\n // unmount, so a row query is exactly the visible set in order.\n function handleKeyDown(event: React.KeyboardEvent) {\n const row = (event.target as HTMLElement).closest<HTMLElement>(\n '[data-slot=\"tree-row\"]'\n )\n const root = rootRef.current\n if (!row || !root) return\n const rows = Array.from(\n root.querySelectorAll<HTMLElement>('[data-slot=\"tree-row\"]')\n )\n const index = rows.indexOf(row)\n if (index < 0) return\n const id = row.getAttribute(\"data-id\")\n const branch = row.hasAttribute(\"data-branch\")\n const open = row.hasAttribute(\"data-expanded\")\n\n const focusRow = (target: HTMLElement | undefined) => {\n if (!target) return\n event.preventDefault()\n target.focus()\n }\n\n switch (event.key) {\n case \"ArrowDown\":\n focusRow(rows[index + 1])\n break\n case \"ArrowUp\":\n focusRow(rows[index - 1])\n break\n case \"Home\":\n focusRow(rows[0])\n break\n case \"End\":\n focusRow(rows[rows.length - 1])\n break\n case \"ArrowRight\":\n if (branch && !open && id) {\n event.preventDefault()\n tree.expand(id)\n } else if (open) {\n focusRow(rows[index + 1])\n }\n break\n case \"ArrowLeft\":\n if (open && id) {\n event.preventDefault()\n tree.collapse(id)\n } else {\n focusRow(\n row\n .closest(\"li\")\n ?.parentElement?.closest(\"li\")\n ?.querySelector<HTMLElement>('[data-slot=\"tree-row\"]') ??\n undefined\n )\n }\n break\n case \"F2\":\n if (id && tree.canRename) {\n event.preventDefault()\n tree.startRename(id)\n }\n break\n }\n }\n\n // Rows take the tree's id and the stable drag handlers, never the\n // controller — so this value keeps its identity and a toggle re-renders only\n // the rows whose own atoms changed.\n const dnd = useTreeDndHandlers(tree.treeId)\n const context = React.useMemo<TreeContextValue>(\n () => ({ treeId: tree.treeId, renderTrailing, dnd }),\n [tree.treeId, renderTrailing, dnd]\n )\n\n const label = ariaLabel ?? DEFAULT_LABELS[variant]\n let rendered = (\n <motion.ul\n aria-label={label}\n className={cn(\n \"flex h-full min-w-0 flex-col\",\n // Resting widths, and the fallback until the rail is measured. The\n // motion target below overrides these with an inline width.\n collapsed ? \"w-10 gap-y-2!\" : \"w-full\",\n variant === \"files\" ? \"gap-px\" : sectioned ? \"gap-3\" : \"gap-0.5\"\n )}\n // Both endpoints must be px: motion cannot interpolate a number\n // against \"100%\", and animating 40 -> \"100%\" pinned the inline width\n // at 40px, so the rail collapsed once and never reopened. The\n // expanded target is the rail's own measured width.\n initial={false}\n animate={railTarget}\n transition={\n reduce\n ? { duration: 0 }\n : { duration: TREE_COLLAPSE_DURATION, ease: TREE_EASE }\n }\n data-collapsed={collapsed ? \"\" : undefined}\n data-slot=\"tree\"\n data-variant={variant}\n onKeyDown={handleKeyDown}\n ref={rootRef}\n role=\"tree\"\n >\n {items.map((node) => (\n <TreeRow depth={0} key={node.id} node={node} />\n ))}\n </motion.ul>\n )\n\n // The collapsed rail's rows carry tooltips — one provider groups their\n // open state and drops the hover delay across the rail. Mounted for the\n // expanded rail too: toggling the wrapper with `collapsed` would remount\n // every row and skip the label fold animation.\n if (variant === \"sidebar\")\n rendered = <TooltipProvider>{rendered}</TooltipProvider>\n\n return (\n <TreeContext.Provider value={context}>\n {variant === \"files\" ? (\n <div className={cn(\"min-w-0\", className)} data-slot=\"tree-root\">\n {rendered}\n </div>\n ) : (\n <nav\n aria-label={label}\n className={cn(\"flex h-full min-w-0 justify-center\", className)}\n data-slot=\"tree-root\"\n ref={railRef}\n >\n {rendered}\n </nav>\n )}\n </TreeContext.Provider>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n cancelTreeRenameAtom,\n collapseAllTreeNodesAtom,\n collapseTreeNodeAtom,\n expandAllTreeNodesAtom,\n expandTreeNodeAtom,\n moveTreeNodeAtom,\n renameTreeNodeAtom,\n resetTreeAtom,\n revealTreeNodeAtom,\n selectTreeNodeAtom,\n setTreeCollapsedAtom,\n setTreeItemsAtom,\n startTreeRenameAtom,\n toggleTreeCollapsedAtom,\n toggleTreeNodeAtom,\n treeStateAtom,\n} from \"./tree-atom\"\nimport type { TreeActions, TreeInstanceId, TreeState } from \"./type\"\n\n/**\n * Read the tree registered under `treeId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { collapsed, activeId } = useTreeState(\"app-nav\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(treeCollapsedAtom(\"app-nav\"))`.\n */\nexport function useTreeState(treeId: TreeInstanceId): TreeState {\n return useAtomValue(treeStateAtom(treeId))\n}\n\n/**\n * Drive the tree registered under `treeId` from anywhere. Writes only — the\n * caller never re-renders when the tree changes, so this is what a command\n * palette, a keyboard shortcut or a route guard should reach for.\n *\n * ```tsx\n * const nav = useTreeActions(\"app-nav\")\n * <Button onClick={nav.collapseAll}>Collapse all</Button>\n * ```\n */\nexport function useTreeActions(treeId: TreeInstanceId): TreeActions {\n const expand = useSetAtom(expandTreeNodeAtom(treeId))\n const collapse = useSetAtom(collapseTreeNodeAtom(treeId))\n const toggleExpanded = useSetAtom(toggleTreeNodeAtom(treeId))\n const expandAll = useSetAtom(expandAllTreeNodesAtom(treeId))\n const collapseAll = useSetAtom(collapseAllTreeNodesAtom(treeId))\n const reveal = useSetAtom(revealTreeNodeAtom(treeId))\n const setCollapsed = useSetAtom(setTreeCollapsedAtom(treeId))\n const toggleCollapsed = useSetAtom(toggleTreeCollapsedAtom(treeId))\n const select = useSetAtom(selectTreeNodeAtom(treeId))\n const startRename = useSetAtom(startTreeRenameAtom(treeId))\n const cancelRename = useSetAtom(cancelTreeRenameAtom(treeId))\n const rename = useSetAtom(renameTreeNodeAtom(treeId))\n const move = useSetAtom(moveTreeNodeAtom(treeId))\n const setItems = useSetAtom(setTreeItemsAtom(treeId))\n const reset = useSetAtom(resetTreeAtom(treeId))\n\n return React.useMemo(\n () => ({\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n setCollapsed,\n toggleCollapsed,\n select,\n startRename,\n cancelRename,\n rename,\n move,\n setItems,\n reset,\n }),\n [\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n setCollapsed,\n toggleCollapsed,\n select,\n startRename,\n cancelRename,\n rename,\n move,\n setItems,\n reset,\n ]\n )\n}\n","/**\n * Brand accents for the auth blocks.\n *\n * An accent is a set of custom properties set on the AuthCard root plus one\n * class string applied to the card's primary action. Splitting it this way\n * keeps the accent inheritable — anything else inside the card can opt into\n * `var(--auth-accent)` without the shell knowing about it.\n */\n\n/** Brand accents available to the auth blocks. */\nexport type AuthAccent = \"corpora\" | \"exegia\";\n\n/**\n * Custom properties an accent contributes, set on the AuthCard root.\n *\n * The gradient lives in `--auth-accent-image` because `background-color` can't\n * hold one; `--auth-accent` sits underneath as the solid that paints wherever\n * the image is `none`. Foregrounds are fixed rather than themed — the accent\n * itself is a constant, so its contrast pair has to be too (white on the\n * corpora yellow fails badly).\n */\nexport const authAccentVars: Record<AuthAccent, Record<string, string>> = {\n corpora: {\n \"--auth-accent\": \"#E8B124\",\n \"--auth-accent-image\": \"none\",\n \"--auth-accent-foreground\": \"oklch(0.145 0 0)\",\n },\n exegia: {\n \"--auth-accent\": \"#3B0080\",\n \"--auth-accent-image\":\n \"linear-gradient(44deg in oklab, rgba(29,0,202,0.66) 3%, #3B0080 37%, rgba(36,0,72,0.86) 98%)\",\n \"--auth-accent-foreground\": \"oklch(0.985 0 0)\",\n },\n};\n\n/**\n * Applied to the primary action inside an accented AuthCard, after the button\n * cva output so tailwind-merge lets it win over `bg-primary`. The hover and\n * pressed background entries are required: `hover:bg-primary/90` lives in a\n * different modifier group from `bg-*` and would otherwise survive and repaint\n * the button on hover.\n *\n * Hover uses `brightness` rather than a background tween because the button's\n * `transition-property` list is shared with its press/size animations — adding\n * `filter` to it means restating the whole list and its per-property\n * durations. The trade is an instant hover change instead of a 150ms one.\n */\nexport const authAccentActionStyles =\n \"border-transparent bg-[var(--auth-accent)] bg-[image:var(--auth-accent-image)] text-[var(--auth-accent-foreground)] shadow-none hover:bg-[var(--auth-accent)] hover:brightness-110 data-pressed:bg-[var(--auth-accent)] data-pressed:brightness-110 *:data-[slot=button-loading-indicator]:text-[var(--auth-accent-foreground)]\";\n","\"use client\";\n\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\";\nimport { Frame, FrameFooter } from \"@/components/ui/frame\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { type AuthAccent, authAccentVars } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\n\n/** transitions.dev motion scale, shared by all auth blocks. */\nexport const EASE = [0.22, 1, 0.36, 1] as const;\n\nexport type AuthStatus = \"idle\" | \"loading\" | \"success\" | \"error\";\n\n/**\n * Frame shell shared by the auth blocks (coss particle p-card-8): a raised\n * Card inside a muted Frame, with the footer in the frame strip below the\n * card. Wraps content in a MotionConfig that honors prefers-reduced-motion\n * and layout-animates height changes so step swaps morph instead of jumping.\n */\nexport function AuthCard({\n title,\n description,\n children,\n footer,\n className,\n logo,\n accent,\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the card's primary action. Omit to keep `bg-primary`. */\n accent?: AuthAccent;\n}) {\n return (\n <MotionConfig reducedMotion=\"user\">\n <Frame\n className={cn(\"w-full max-w-sm\", className)}\n data-accent={accent}\n style={\n accent ? (authAccentVars[accent] as React.CSSProperties) : undefined\n }\n >\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col\"\n >\n <Card>\n <CardHeader>\n {logo && (\n // Sized like the button's icon rule: a bare img/svg gets a\n // default height, an explicitly sized one keeps its own.\n <div\n className=\"mb-1.5 flex items-center [&_img:not([class*='h-'])]:h-8 [&_img]:w-auto [&_svg:not([class*='size-'])]:size-8\"\n data-slot=\"auth-logo\"\n >\n {logo}\n </div>\n )}\n <CardTitle>{title}</CardTitle>\n {description && <CardDescription>{description}</CardDescription>}\n </CardHeader>\n <CardPanel className=\"overflow-hidden\">{children}</CardPanel>\n </Card>\n {footer && (\n <FrameFooter className=\"text-center text-sm text-muted-foreground\">\n {footer}\n </FrameFooter>\n )}\n </motion.div>\n </Frame>\n </MotionConfig>\n );\n}\n\n/** Cross-morphs between steps (form → success, …) keyed by `step`. */\nexport function MorphStep({\n step,\n children,\n className,\n}: {\n step: string;\n children: React.ReactNode;\n className?: string;\n}) {\n return (\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.div\n key={step}\n className={className}\n initial={{ opacity: 0, y: 8, filter: \"blur(2px)\" }}\n animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={{ opacity: 0, y: -8, filter: \"blur(2px)\" }}\n transition={{ duration: 0.25, ease: EASE }}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n );\n}\n\n/**\n * Progressive-disclosure wrapper: collapses/expands a step as `show` flips.\n *\n * `overflow-hidden` is only worn while the height is in flight — leaving it on\n * would clip the focus ring of any full-width control inside (the ring sits\n * 3px outside the input's border box, so the left/right edges would be cut).\n */\nexport function Reveal({\n show,\n children,\n className,\n}: {\n show: boolean;\n children: React.ReactNode;\n className?: string;\n}) {\n // Reset during render (not in an effect) when `show` flips, matching\n // useCountdown below.\n const [state, setState] = React.useState({ show, settled: show });\n if (state.show !== show) setState({ show, settled: false });\n\n return (\n <AnimatePresence initial={false}>\n {show && (\n <motion.div\n className={cn(!state.settled && \"overflow-hidden\", className)}\n initial={{ height: 0, opacity: 0, y: -4, filter: \"blur(2px)\" }}\n animate={{ height: \"auto\", opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={{ height: 0, opacity: 0, y: -4, filter: \"blur(2px)\" }}\n transition={{ duration: 0.25, ease: EASE }}\n onAnimationComplete={() =>\n setState((current) => ({ ...current, settled: true }))\n }\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n/** Inline error message that shakes each time `message` changes. */\nexport function AuthError({ message }: { message: string | null }) {\n return (\n <AnimatePresence initial={false}>\n {message && (\n <motion.p\n key={message}\n role=\"alert\"\n className=\"text-sm text-destructive-foreground\"\n initial={{ opacity: 0, height: 0 }}\n animate={{\n opacity: 1,\n height: \"auto\",\n x: [0, -6, 6, -4, 4, 0],\n }}\n exit={{ opacity: 0, height: 0 }}\n transition={{\n duration: 0.25,\n ease: EASE,\n x: { duration: 0.4, ease: \"easeInOut\" },\n }}\n >\n {message}\n </motion.p>\n )}\n </AnimatePresence>\n );\n}\n\n/** Success panel with a stroke-drawn check. */\nexport function AuthSuccess({\n title,\n description,\n children,\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children?: React.ReactNode;\n}) {\n return (\n <div className=\"flex flex-col items-center gap-3 py-4 text-center\">\n <motion.span\n className=\"flex size-12 items-center justify-center rounded-full bg-emerald-500/12 text-emerald-600\"\n initial={{ scale: 0.6, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n transition={{ duration: 0.4, ease: EASE }}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n className=\"size-6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <motion.path\n d=\"M4 12.5l5 5L20 6.5\"\n initial={{ pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{ duration: 0.4, delay: 0.15, ease: EASE }}\n />\n </svg>\n </motion.span>\n <div className=\"flex flex-col gap-1\">\n <p className=\"font-medium\">{title}</p>\n {description && (\n <p className=\"text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n {children}\n </div>\n );\n}\n\n/** \"Or continue with\" style divider. */\nexport function AuthSeparator({ label = \"Or\" }: { label?: string }) {\n return (\n <div className=\"flex items-center gap-3\">\n <Separator className=\"flex-1\" />\n <span className=\"text-xs text-muted-foreground uppercase\">{label}</span>\n <Separator className=\"flex-1\" />\n </div>\n );\n}\n\n/** Countdown for resend links; restarts when `restartKey` changes. */\nexport function useCountdown(seconds: number, restartKey: number) {\n const [state, setState] = React.useState({ restartKey, seconds, remaining: seconds });\n\n // Reset during render (not in an effect) when the inputs change.\n if (state.restartKey !== restartKey || state.seconds !== seconds) {\n setState({ restartKey, seconds, remaining: seconds });\n }\n\n React.useEffect(() => {\n if (seconds <= 0) return;\n const interval = window.setInterval(() => {\n setState((current) =>\n current.remaining <= 0\n ? current\n : { ...current, remaining: current.remaining - 1 },\n );\n }, 1000);\n return () => window.clearInterval(interval);\n }, [seconds, restartKey]);\n\n return state.remaining;\n}\n","\"use client\";\n\nimport { MailIcon, SmartphoneIcon } from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { OTPField, OTPFieldInput } from \"@/components/ui/otp-field\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n EASE,\n MorphStep,\n useCountdown,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface CodeAuthBlockProps {\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /** Where the code was sent; drives copy and icon. */\n channel?: \"email\" | \"sms\";\n /** Masked destination shown in the description, e.g. \"y•••@example.com\". */\n destination?: string;\n length?: number;\n /** Submit automatically once all digits are entered. */\n autoSubmit?: boolean;\n /** Seconds before \"Resend code\" becomes available. 0 disables the wait. */\n resendSeconds?: number;\n /** Reject (or throw) to show the error shake and clear the code. */\n onVerify?: (code: string) => Promise<void> | void;\n onResend?: () => Promise<void> | void;\n onBack?: () => void;\n}\n\nexport function CodeAuthBlock({\n channel = \"email\",\n logo,\n accent,\n destination,\n length = 6,\n autoSubmit = true,\n resendSeconds = 30,\n onVerify,\n onResend,\n onBack,\n}: CodeAuthBlockProps) {\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [code, setCode] = React.useState(\"\");\n const [resendCount, setResendCount] = React.useState(0);\n const remaining = useCountdown(resendSeconds, resendCount);\n\n const ChannelIcon = channel === \"sms\" ? SmartphoneIcon : MailIcon;\n const channelLabel = channel === \"sms\" ? \"phone\" : \"email\";\n\n const verify = React.useCallback(\n async (value: string) => {\n setError(null);\n setStatus(\"loading\");\n try {\n await onVerify?.(value);\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setCode(\"\");\n setError(cause instanceof Error ? cause.message : \"Invalid code.\");\n }\n },\n [onVerify],\n );\n\n function handleChange(value: string) {\n setCode(value);\n if (error) setError(null);\n if (autoSubmit && value.length === length && status === \"idle\") {\n void verify(value);\n }\n }\n\n async function handleResend() {\n setResendCount((count) => count + 1);\n setCode(\"\");\n setError(null);\n await onResend?.();\n }\n\n return (\n <AuthCard\n title=\"Enter verification code\"\n logo={logo}\n accent={accent}\n description={\n <span className=\"inline-flex items-center gap-1.5\">\n <ChannelIcon className=\"size-3.5 shrink-0\" />\n <span>\n We sent a {length}-digit code to your {channelLabel}\n {destination ? (\n <>\n {\" \"}\n <span className=\"font-medium text-foreground\">\n {destination}\n </span>\n </>\n ) : null}\n .\n </span>\n </span>\n }\n footer={\n status !== \"success\" && (\n <Button variant=\"link\" onClick={onBack}>\n Use a different {channelLabel}\n </Button>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Verified\"\n description=\"Your identity has been confirmed.\"\n />\n ) : (\n <div className=\"flex flex-col items-center gap-4\">\n <motion.div\n // Shake the whole field on error; keying by message replays it.\n key={error ?? \"steady\"}\n animate={error ? { x: [0, -8, 8, -5, 5, 0] } : { x: 0 }}\n transition={{ duration: 0.4, ease: \"easeInOut\" }}\n >\n <OTPField\n length={length}\n value={code}\n onValueChange={handleChange}\n disabled={status === \"loading\"}\n >\n {Array.from({ length }, (_, index) => (\n <OTPFieldInput\n key={`slot-${index}`}\n aria-invalid={error ? true : undefined}\n aria-label={`Digit ${index + 1} of ${length}`}\n />\n ))}\n </OTPField>\n </motion.div>\n <AuthError message={error} />\n {!autoSubmit && (\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n loading={status === \"loading\"}\n disabled={code.length !== length}\n onClick={() => void verify(code)}\n >\n Verify\n </Button>\n )}\n <motion.p\n layout\n transition={{ duration: 0.25, ease: EASE }}\n className=\"text-center text-sm text-muted-foreground\"\n >\n {remaining > 0 ? (\n <>\n Resend code in{\" \"}\n <span className=\"font-medium tabular-nums text-foreground\">\n {remaining}s\n </span>\n </>\n ) : (\n <Button\n variant=\"link\"\n disabled={status === \"loading\"}\n onClick={() => void handleResend()}\n >\n Resend code\n </Button>\n )}\n </motion.p>\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport { ArrowLeftIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface ForgotPasswordBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n onSubmit?: (data: { email: string }) => Promise<void> | void;\n onBackToLogin?: () => void;\n}\n\nexport function ForgotPasswordBlock({\n title = \"Reset your password\",\n logo,\n accent,\n description = \"Enter your email and we will send you a reset link\",\n onSubmit,\n onBackToLogin,\n}: ForgotPasswordBlockProps) {\n const emailId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [email, setEmail] = React.useState(\"\");\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({ email });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to send reset link.\",\n );\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n <Button\n variant=\"link\"\n className=\"gap-1\"\n onClick={onBackToLogin}\n >\n <ArrowLeftIcon className=\"size-3.5\" />\n Back to login\n </Button>\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Check your inbox\"\n description={\n <>\n We sent a password reset link to{\" \"}\n <span className=\"font-medium text-foreground\">{email}</span>.\n </>\n }\n >\n <Button\n variant=\"link\"\n className=\"text-xs sm:text-xs\"\n onClick={() => setStatus(\"idle\")}\n >\n Use a different email\n </Button>\n </AuthSuccess>\n ) : (\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n name=\"email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={status === \"loading\"}\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n />\n </Field>\n <AuthError message={error} />\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n >\n Send reset link\n </Button>\n </form>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { PasswordInput } from \"@/components/composed/password-input\";\nimport {\n SocialProviders,\n type SocialProvider,\n} from \"@/components/composed/social-providers\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSeparator,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface LoginBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /** Social providers to offer; empty array hides the social section. */\n providers?: SocialProvider[];\n showRememberMe?: boolean;\n showForgotPassword?: boolean;\n /** Reject (or throw) to show the error state with the error's message. */\n onSubmit?: (data: {\n email: string;\n password: string;\n remember: boolean;\n }) => Promise<void> | void;\n onProviderSelect?: (provider: SocialProvider) => Promise<void> | void;\n onForgotPassword?: () => void;\n onSignup?: () => void;\n}\n\nexport function LoginBlock({\n title = \"Login to your account\",\n description = \"Enter your email and password to login\",\n logo,\n accent,\n providers = [\"google\", \"apple\", \"github\"],\n showRememberMe = true,\n showForgotPassword = true,\n onSubmit,\n onProviderSelect,\n onForgotPassword,\n onSignup,\n}: LoginBlockProps) {\n const emailId = React.useId();\n const rememberId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [loadingProvider, setLoadingProvider] =\n React.useState<SocialProvider | null>(null);\n const [remember, setRemember] = React.useState(false);\n const [email, setEmail] = React.useState(\"\");\n const [emailValid, setEmailValid] = React.useState(false);\n const [password, setPassword] = React.useState(\"\");\n\n const busy = status === \"loading\" || loadingProvider !== null;\n\n // Progressive disclosure: each step unlocks the next. The password field is\n // gated on the email input's own constraint validation (required + type\n // email), the submit button on the password being non-empty — a login form\n // verifies a credential rather than enforcing policy, so strength rules here\n // would lock out anyone whose password predates them. The submit gate\n // re-checks emailValid so a stale password (typed, then the email was edited\n // back into an invalid state) can't leave the button on its own.\n const passwordValid = password.trim().length > 0;\n const canSubmit = emailValid && passwordValid;\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n // Enter in any field submits the form even while the button is hidden.\n if (!canSubmit) return;\n const form = new FormData(event.currentTarget);\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({\n email: String(form.get(\"email\") ?? \"\"),\n password: String(form.get(\"password\") ?? \"\"),\n remember,\n });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(cause instanceof Error ? cause.message : \"Unable to login.\");\n }\n }\n\n async function handleProvider(provider: SocialProvider) {\n setError(null);\n setLoadingProvider(provider);\n try {\n await onProviderSelect?.(provider);\n setStatus(\"success\");\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to login.\",\n );\n } finally {\n setLoadingProvider(null);\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n status !== \"success\" && (\n <>\n Don&apos;t have an account?{\" \"}\n <Button variant=\"link\" onClick={onSignup}>\n Sign up\n </Button>\n </>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Welcome back\"\n description=\"You are now logged in.\"\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n aria-label=\"Email\"\n name=\"email\"\n type=\"email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={busy}\n value={email}\n onChange={(event) => {\n setEmail(event.currentTarget.value);\n setEmailValid(event.currentTarget.validity.valid);\n }}\n />\n </Field>\n <Reveal show={emailValid}>\n <Field name=\"password\">\n <FieldLabel htmlFor=\"password\">Password</FieldLabel>\n <PasswordInput\n id=\"password\"\n name=\"password\"\n autoComplete=\"current-password\"\n required\n disabled={busy}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n {showForgotPassword && (\n // self-end: Field root is items-start, so this aligns the\n // link with the input's trailing edge. sm:text-xs is\n // required — the cva's sm:text-sm survives tailwind-merge\n // and would otherwise win at the breakpoint.\n <Button\n variant=\"link\"\n type=\"button\"\n className=\"self-end font-normal text-muted-foreground text-xs hover:text-foreground sm:text-xs\"\n onClick={onForgotPassword}\n >\n Forgot password?\n </Button>\n )}\n </Field>\n </Reveal>\n {showRememberMe && (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={rememberId}\n checked={remember}\n onCheckedChange={(checked) => setRemember(checked)}\n disabled={busy}\n />\n <Label htmlFor={rememberId} className=\"font-normal\">\n Remember me\n </Label>\n </div>\n )}\n <AuthError message={error} />\n <Reveal show={canSubmit}>\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n disabled={busy}\n >\n Login\n </Button>\n </Reveal>\n </form>\n {providers.length > 0 && (\n // The social providers retire once the email path is filled in\n // and valid — the user has committed to a path, so the\n // alternatives are just noise. They come back if a field is\n // invalidated again. gap-4 on the wrapper reproduces the spacing\n // the two children had as direct flex items of the column above.\n <Reveal show={!canSubmit} className=\"flex flex-col gap-4\">\n <AuthSeparator label=\"Or continue with\" />\n <SocialProviders\n providers={providers}\n action=\"login\"\n loadingProvider={loadingProvider}\n disabled={status === \"loading\"}\n onSelect={handleProvider}\n />\n </Reveal>\n )}\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldError, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { cn } from \"@/lib/utils\";\nimport type {\n OnboardingFieldConfig,\n OnboardingStepConfig,\n OnboardingValue,\n} from \"../onboarding-block\";\n\nexport interface ProfileStepProps {\n step: OnboardingStepConfig;\n /** Seed values, so drafts survive back/forward navigation. */\n values: Record<string, OnboardingValue>;\n submitting?: boolean;\n submitLabel: string;\n onSubmit: (values: Record<string, OnboardingValue>) => void | Promise<void>;\n onBack?: () => void;\n /** Reports every edit so the flow can restore drafts across navigation. */\n onDraftChange?: (name: string, value: OnboardingValue) => void;\n}\n\nfunction initialValue(\n field: OnboardingFieldConfig,\n saved: OnboardingValue | undefined,\n): OnboardingValue {\n if (field.kind === \"checkbox\") return typeof saved === \"boolean\" ? saved : false;\n return typeof saved === \"string\" ? saved : \"\";\n}\n\n/** Built-in validation, mirroring the declared `FieldConfig` contract. */\nfunction validateField(\n field: OnboardingFieldConfig,\n value: OnboardingValue,\n): string | null {\n const required = field.required === true;\n\n if (field.kind === \"checkbox\") {\n if (required && value !== true) return `${field.label} is required`;\n return null;\n }\n\n const text = typeof value === \"string\" ? value.trim() : \"\";\n if (required && text.length === 0) return `${field.label} is required`;\n\n if (field.kind === \"url\" && text.length > 0) {\n try {\n new URL(text);\n } catch {\n return \"Enter a valid URL\";\n }\n }\n\n if (field.kind === \"select\" && text.length > 0) {\n const allowed = field.options.map((option) => option.value);\n if (!allowed.includes(text)) {\n return `Choose a valid option for ${field.label}`;\n }\n }\n\n return field.validate?.(text) ?? null;\n}\n\n/**\n * Renders one declared profile step: `OnboardingFieldConfig[]` → labeled\n * controls, validated locally before anything is handed to `onSubmit`. Mounted\n * keyed by `step.id` so drafts re-seed per step.\n */\nexport function ProfileStep({\n step,\n values,\n submitting = false,\n submitLabel,\n onSubmit,\n onBack,\n onDraftChange,\n}: ProfileStepProps) {\n const idPrefix = React.useId();\n const [draft, setDraft] = React.useState<Record<string, OnboardingValue>>(\n () =>\n Object.fromEntries(\n step.fields.map((field) => [\n field.name,\n initialValue(field, values[field.name]),\n ]),\n ),\n );\n const [errors, setErrors] = React.useState<Record<string, string>>({});\n\n function setValue(name: string, value: OnboardingValue) {\n setDraft((current) => ({ ...current, [name]: value }));\n onDraftChange?.(name, value);\n // Clear a field's error as soon as it is edited; re-validation happens on\n // the next submit rather than on every keystroke.\n setErrors((current) =>\n current[name] ? { ...current, [name]: \"\" } : current,\n );\n }\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (submitting) return;\n\n const next: Record<string, string> = {};\n for (const field of step.fields) {\n const message = validateField(field, draft[field.name]);\n if (message) next[field.name] = message;\n }\n if (Object.keys(next).length > 0) {\n setErrors(next);\n return;\n }\n setErrors({});\n\n const submitted: Record<string, OnboardingValue> = {};\n for (const field of step.fields) {\n const value = draft[field.name];\n submitted[field.name] = typeof value === \"string\" ? value.trim() : value;\n }\n await onSubmit(submitted);\n }\n\n return (\n <form className=\"flex flex-col gap-4\" noValidate onSubmit={handleSubmit}>\n {step.fields.map((field) => {\n const error = errors[field.name] || undefined;\n const controlId = `${idPrefix}-${field.name}`;\n const value = draft[field.name];\n\n if (field.kind === \"checkbox\") {\n return (\n <Field\n key={field.name}\n name={field.name}\n invalid={Boolean(error)}\n className=\"gap-1.5\"\n >\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={controlId}\n checked={value === true}\n disabled={submitting}\n onCheckedChange={(checked) => setValue(field.name, checked)}\n />\n <Label htmlFor={controlId} className=\"font-normal\">\n {field.label}\n </Label>\n </div>\n {error && <FieldError match>{error}</FieldError>}\n </Field>\n );\n }\n\n return (\n <Field key={field.name} name={field.name} invalid={Boolean(error)}>\n <FieldLabel htmlFor={controlId}>{field.label}</FieldLabel>\n {field.kind === \"textarea\" ? (\n <Textarea\n id={controlId}\n aria-invalid={error ? true : undefined}\n disabled={submitting}\n placeholder={field.placeholder}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n />\n ) : field.kind === \"select\" ? (\n // No select atom exists in the library yet; a native control\n // styled to match Input keeps the flow self-contained without\n // inventing one here.\n <select\n id={controlId}\n aria-invalid={error ? true : undefined}\n className={cn(\n \"h-8.5 w-full rounded-lg border border-input bg-background px-[calc(--spacing(3)-1px)] text-base text-foreground shadow-xs/5 outline-none transition-[box-shadow,border-color] duration-150 ease-smooth-out focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/24 disabled:opacity-64 aria-invalid:border-destructive/36 sm:h-7.5 sm:text-sm dark:bg-input/32\",\n )}\n disabled={submitting}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n >\n <option value=\"\">{field.placeholder ?? \"Choose an option\"}</option>\n {field.options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n ) : (\n <Input\n id={controlId}\n aria-invalid={error ? true : undefined}\n disabled={submitting}\n placeholder={field.placeholder}\n type={field.kind === \"url\" ? \"url\" : \"text\"}\n value={String(value ?? \"\")}\n onChange={(event) => setValue(field.name, event.target.value)}\n />\n )}\n {error && <FieldError match>{error}</FieldError>}\n </Field>\n );\n })}\n\n <div className=\"flex gap-2\">\n {onBack && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={submitting}\n onClick={onBack}\n >\n Back\n </Button>\n )}\n <Button className=\"flex-1\" type=\"submit\" loading={submitting}>\n {submitLabel}\n </Button>\n </div>\n </form>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport type { AuthAccent } from \"@/lib/auth-accent\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n type AuthStatus,\n} from \"./auth-shell\";\nimport { ProfileStep } from \"./onboarding/profile-step\";\n\n/** Value a single onboarding field can hold. */\nexport type OnboardingValue = string | boolean;\n\nexport interface OnboardingSelectOption {\n value: string;\n label: string;\n}\n\ninterface OnboardingFieldBase {\n /** Key the value is collected under; unique within the flow. */\n name: string;\n label: string;\n /** Required fields gate the step's advance. */\n required?: boolean;\n placeholder?: string;\n /** Extra validation; return a message to reject, `null` to accept. */\n validate?: (value: string) => string | null;\n}\n\nexport interface OnboardingTextField extends OnboardingFieldBase {\n kind: \"text\" | \"textarea\" | \"url\";\n}\n\nexport interface OnboardingCheckboxField extends OnboardingFieldBase {\n kind: \"checkbox\";\n}\n\nexport interface OnboardingSelectField extends OnboardingFieldBase {\n kind: \"select\";\n options: OnboardingSelectOption[];\n}\n\n/** Discriminated on `kind`. */\nexport type OnboardingFieldConfig =\n | OnboardingTextField\n | OnboardingCheckboxField\n | OnboardingSelectField;\n\nexport interface OnboardingStepConfig {\n /** Unique within the flow and stable across releases. */\n id: string;\n title: string;\n description?: string;\n fields: OnboardingFieldConfig[];\n}\n\n/** Default configuration: a single required display-name step. */\nexport const DEFAULT_ONBOARDING_STEPS: OnboardingStepConfig[] = [\n {\n id: \"profile\",\n title: \"Your profile\",\n fields: [\n { kind: \"text\", name: \"display_name\", label: \"Display name\", required: true },\n ],\n },\n];\n\nexport interface OnboardingBlockProps {\n /** Declared profile steps. */\n steps?: OnboardingStepConfig[];\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /**\n * Fires per step as it is submitted. Reject (or throw) to keep the user on\n * the step and show the error.\n */\n onStepSubmit?: (\n stepId: string,\n values: Record<string, OnboardingValue>,\n ) => Promise<void> | void;\n /** Fires once, after the final step is accepted, with the merged profile. */\n onComplete?: (profile: Record<string, OnboardingValue>) => Promise<void> | void;\n /** Shows a brief success screen once onboarding completes. */\n showCompleteScreen?: boolean;\n className?: string;\n}\n\n/**\n * Multi-step profile onboarding: a declared `steps` config renders as\n * progress-tracked forms with back/forward navigation, per-step submission and\n * a single completion signal. Drafts survive back-navigation, and the step\n * heading takes focus on advance so a screen reader announces where the flow\n * moved.\n *\n * Account creation and email confirmation are separate blocks (`SignupBlock`,\n * `CodeAuthBlock`) — this one picks up once the account exists.\n */\nexport function OnboardingBlock({\n steps = DEFAULT_ONBOARDING_STEPS,\n logo,\n accent,\n onStepSubmit,\n onComplete,\n showCompleteScreen = true,\n className,\n}: OnboardingBlockProps) {\n const headingRef = React.useRef<HTMLHeadingElement>(null);\n // Unsubmitted per-step drafts. Accumulated in a ref so a keystroke does not\n // re-render the whole flow, then published to state at each navigation —\n // the only moment the seed values are actually read.\n const draftsRef = React.useRef<\n Record<string, Record<string, OnboardingValue>>\n >({});\n const [drafts, setDrafts] = React.useState<\n Record<string, Record<string, OnboardingValue>>\n >({});\n\n const [index, setIndex] = React.useState(0);\n const [values, setValues] = React.useState<Record<string, OnboardingValue>>(\n {},\n );\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n\n const done = status === \"success\";\n const step = steps[index];\n const last = index >= steps.length - 1;\n\n // Focus the step heading on advance; on error the alert carries the message\n // and stealing focus would talk over it.\n React.useEffect(() => {\n if (error) return;\n headingRef.current?.focus();\n }, [index, done, error]);\n\n async function handleStepSubmit(stepValues: Record<string, OnboardingValue>) {\n if (!step) return;\n const merged = { ...values, ...stepValues };\n setError(null);\n setStatus(\"loading\");\n try {\n await onStepSubmit?.(step.id, stepValues);\n if (last) await onComplete?.(merged);\n setValues(merged);\n delete draftsRef.current[step.id];\n setDrafts({ ...draftsRef.current });\n setStatus(last ? \"success\" : \"idle\");\n if (!last) setIndex((current) => current + 1);\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to save your profile.\",\n );\n }\n }\n\n if (done && !showCompleteScreen) return null;\n\n const heading = done ? \"You're all set\" : (step?.title ?? \"Your profile\");\n\n return (\n <AuthCard\n title={heading}\n description={done ? undefined : step?.description}\n logo={logo}\n accent={accent}\n className={className}\n >\n <MorphStep step={done ? \"done\" : `step-${index}`}>\n {done ? (\n <AuthSuccess\n title=\"Profile saved\"\n description=\"Your account is ready and your profile has been saved.\"\n />\n ) : step ? (\n <div className=\"flex flex-col gap-4\">\n <nav aria-label=\"Onboarding progress\">\n <ol className=\"flex flex-wrap gap-x-3 gap-y-1 text-xs\">\n {steps.map((item, itemIndex) => (\n <li\n key={item.id}\n aria-current={itemIndex === index ? \"step\" : undefined}\n className={cn(\n \"text-muted-foreground\",\n itemIndex === index && \"font-medium text-foreground\",\n )}\n >\n {item.title}\n {itemIndex < index && (\n <span className=\"sr-only\"> (completed)</span>\n )}\n </li>\n ))}\n </ol>\n </nav>\n\n {/* The AuthCard title is the visible heading; this one exists to\n take focus on advance without duplicating it on screen. */}\n <h3 ref={headingRef} tabIndex={-1} className=\"sr-only\">\n {step.title}\n </h3>\n\n <AuthError message={error} />\n\n <ProfileStep\n key={step.id}\n step={step}\n values={{ ...values, ...drafts[step.id] }}\n submitting={status === \"loading\"}\n submitLabel={last ? \"Finish\" : \"Continue\"}\n onBack={\n index > 0\n ? () => {\n setError(null);\n setDrafts({ ...draftsRef.current });\n setIndex((current) => current - 1);\n }\n : undefined\n }\n onDraftChange={(name, value) => {\n draftsRef.current[step.id] = {\n ...draftsRef.current[step.id],\n [name]: value,\n };\n }}\n onSubmit={handleStepSubmit}\n />\n </div>\n ) : null}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n PasswordInput,\n getPasswordStrength,\n passwordRequirements,\n} from \"@/components/composed/password-input\";\nimport {\n SocialProviders,\n type SocialProvider,\n} from \"@/components/composed/social-providers\";\nimport { Button } from \"@/components/ui/button\";\nimport { Checkbox } from \"@/components/ui/checkbox\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSeparator,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface SignupBlockProps {\n title?: string;\n description?: string;\n /**\n * Replaces the built-in \"terms\" link inside the consent label — pass your\n * own dialog trigger to render it inline instead of wiring `onTerms`.\n */\n termsComponent?: React.ReactNode;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit keeping the default primary. */\n accent?: AuthAccent;\n providers?: SocialProvider[];\n showNameField?: boolean;\n /** Require the term checkbox before submitting. */\n showTerms?: boolean;\n /**\n * Controls the term checkbox. Pass it with `onTermsCheckedChange` when\n * something outside the block has to tick the box — an \"I agree\" action in\n * your own terms dialog, say. Omit letting the block own the state.\n */\n termsChecked?: boolean;\n /** Starting state of the term checkbox while it is uncontrolled. */\n defaultTermsChecked?: boolean;\n /** Fires on every change, controlled or not. */\n onTermsCheckedChange?: (checked: boolean) => void;\n /** Block submission until every password requirement is met. */\n enforceStrongPassword?: boolean;\n onSubmit?: (data: {\n name: string;\n email: string;\n password: string;\n }) => Promise<void> | void;\n onProviderSelect?: (provider: SocialProvider) => Promise<void> | void;\n onLogin?: () => void;\n onTerms?: () => void;\n}\n\nexport function SignupBlock({\n title = \"Create your account\",\n description = \"Start exploring manuscripts in minutes\",\n logo,\n accent,\n providers = [\"google\", \"apple\", \"github\"],\n showNameField = true,\n showTerms = true,\n termsChecked,\n defaultTermsChecked = false,\n onTermsCheckedChange,\n enforceStrongPassword = true,\n onSubmit,\n termsComponent,\n onProviderSelect,\n onLogin,\n onTerms,\n}: SignupBlockProps) {\n const nameId = React.useId();\n const emailId = React.useId();\n const passwordId = React.useId();\n const termsId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [loadingProvider, setLoadingProvider] =\n React.useState<SocialProvider | null>(null);\n const [password, setPassword] = React.useState(\"\");\n // Controlled when `termsChecked` is passed, uncontrolled otherwise. The\n // internal state is kept either way, so a block that switches between the\n // two mid-life does not lose the box, and the callback fires in both modes.\n const [uncontrolledTerms, setUncontrolledTerms] =\n React.useState(defaultTermsChecked);\n const terms = termsChecked ?? uncontrolledTerms;\n\n function handleTermsChange(checked: boolean) {\n if (termsChecked === undefined) setUncontrolledTerms(checked);\n onTermsCheckedChange?.(checked);\n }\n // Tracked from each input's own constraint validation rather than a regex.\n // The values stay uncontrolled — only validity is needed, and the form reads\n // values from FormData on submit.\n const [emailValid, setEmailValid] = React.useState(false);\n const [nameValid, setNameValid] = React.useState(false);\n\n const busy = status === \"loading\" || loadingProvider !== null;\n const strongEnough =\n !enforceStrongPassword ||\n getPasswordStrength(password) === passwordRequirements.length;\n\n // The social providers retire once the email path is filled in and valid —\n // the user has committed to a path, so the alternatives are just noise. It\n // comes back if they invalidate a field again.\n const passwordValid = password.trim().length > 0 && strongEnough;\n const emailPathComplete =\n (!showNameField || nameValid) && emailValid && passwordValid;\n\n async function handleSubmit(event: React.SubmitEvent<HTMLFormElement>) {\n event.preventDefault();\n setError(null);\n if (!strongEnough) {\n setError(\"Please meet all password requirements.\");\n return;\n }\n if (showTerms && !terms) {\n setError(\"Please accept the terms to continue.\");\n return;\n }\n const form = new FormData(event.currentTarget);\n setStatus(\"loading\");\n try {\n await onSubmit?.({\n name: String(form.get(\"name\") ?? \"\"),\n email: String(form.get(\"email\") ?? \"\"),\n password,\n });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to create account.\",\n );\n }\n }\n\n async function handleProvider(provider: SocialProvider) {\n setError(null);\n setLoadingProvider(provider);\n try {\n await onProviderSelect?.(provider);\n setStatus(\"success\");\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to create account.\",\n );\n } finally {\n setLoadingProvider(null);\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n footer={\n status !== \"success\" && (\n <>\n Already have an account?{\" \"}\n <Button variant=\"link\" onClick={onLogin}>\n Login\n </Button>\n </>\n )\n }\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Account created\"\n description=\"Check your inbox to confirm your email address.\"\n />\n ) : (\n <div className=\"flex flex-col gap-4\">\n {providers.length > 0 && (\n // gap-4 on the wrapper reproduces the spacing the two children\n // had as direct flex items of the column above.\n <Reveal show={!emailPathComplete} className=\"flex flex-col gap-4\">\n <SocialProviders\n providers={providers}\n action=\"signup\"\n loadingProvider={loadingProvider}\n disabled={status === \"loading\"}\n onSelect={handleProvider}\n />\n <AuthSeparator label=\"Or with email\" />\n </Reveal>\n )}\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n {showNameField && (\n <Field name=\"name\">\n <FieldLabel htmlFor={nameId}>Name</FieldLabel>\n <Input\n aria-label=\"Name\"\n id={nameId}\n name=\"name\"\n autoComplete=\"name\"\n placeholder=\"Your name\"\n required\n disabled={busy}\n onChange={(event) =>\n setNameValid(event.currentTarget.validity.valid)\n }\n />\n </Field>\n )}\n <Field name=\"email\">\n <FieldLabel htmlFor={emailId}>Email</FieldLabel>\n <Input\n id={emailId}\n name=\"email\"\n type=\"email\"\n aria-label=\"Email\"\n autoComplete=\"email\"\n placeholder=\"you@example.com\"\n required\n disabled={busy}\n onChange={(event) =>\n setEmailValid(event.currentTarget.validity.valid)\n }\n />\n </Field>\n <Reveal show={emailValid}>\n <Field name=\"password\">\n <FieldLabel htmlFor={passwordId}>Password</FieldLabel>\n <PasswordInput\n id={passwordId}\n name=\"password\"\n aria-label=\"Password\"\n autoComplete=\"new-password\"\n placeholder=\"Create a password\"\n showStrength\n required\n disabled={busy}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n </Field>\n </Reveal>\n {showTerms && (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={termsId}\n checked={terms}\n onCheckedChange={(checked) =>\n handleTermsChange(checked === true)\n }\n disabled={busy}\n />\n <Label htmlFor={termsId} className=\"font-normal\">\n I agree to the{\" \"}\n {termsComponent ?? (\n <Button variant=\"link\" type=\"button\" onClick={onTerms}>\n terms\n </Button>\n )}\n </Label>\n </div>\n )}\n <AuthError message={error} />\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n disabled={busy}\n >\n Create account\n </Button>\n </form>\n </div>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n getPasswordStrength,\n PasswordInput,\n} from \"@/components/composed/password-input\";\nimport { Button } from \"@/components/ui/button\";\nimport { Field, FieldLabel } from \"@/components/ui/field\";\nimport { type AuthAccent, authAccentActionStyles } from \"@/lib/auth-accent\";\nimport { cn } from \"@/lib/utils\";\nimport {\n AuthCard,\n AuthError,\n AuthSuccess,\n MorphStep,\n Reveal,\n type AuthStatus,\n} from \"./auth-shell\";\n\nexport interface UpdatePasswordBlockProps {\n title?: string;\n description?: string;\n /** Brand mark rendered above the title. Omit for no logo row at all. */\n logo?: React.ReactNode;\n /** Brand accent for the primary action. Omit to keep the default primary. */\n accent?: AuthAccent;\n /**\n * Minimum strength (0-4, as scored by `getPasswordStrength`) the new\n * password must reach before the confirm field is revealed. 0 disables the\n * gate.\n */\n minStrength?: number;\n /** Reject (or throw) to show the error state with the error's message. */\n onSubmit?: (data: { password: string }) => Promise<void> | void;\n onDone?: () => void;\n}\n\n/**\n * Password change form for an already-authenticated user: a strength-metered\n * new password gates the confirm field, which in turn gates the submit\n * button. Mismatch is caught client-side; everything else comes back as a\n * rejection from `onSubmit`.\n */\nexport function UpdatePasswordBlock({\n title = \"Update your password\",\n description = \"Choose a new password for your account\",\n logo,\n accent,\n minStrength = 4,\n onSubmit,\n onDone,\n}: UpdatePasswordBlockProps) {\n const passwordId = React.useId();\n const confirmId = React.useId();\n const [status, setStatus] = React.useState<AuthStatus>(\"idle\");\n const [error, setError] = React.useState<string | null>(null);\n const [password, setPassword] = React.useState(\"\");\n const [confirmPassword, setConfirmPassword] = React.useState(\"\");\n\n // Progressive disclosure, matching the signup block: the confirm field\n // appears once the new password clears the policy, the submit button once\n // the two match.\n const strongEnough = getPasswordStrength(password) >= minStrength;\n const matches = confirmPassword.length > 0 && confirmPassword === password;\n const canSubmit = strongEnough && matches;\n\n // Only flag a mismatch once the confirmation has diverged — while it is\n // still a prefix of the new password the user is simply mid-keystroke, and\n // nagging on every character would shake the field the whole way through.\n const mismatch =\n confirmPassword.length > 0 && !password.startsWith(confirmPassword);\n\n async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {\n event.preventDefault();\n // Enter in any field submits the form even while the button is hidden.\n if (!canSubmit) return;\n setError(null);\n setStatus(\"loading\");\n try {\n await onSubmit?.({ password });\n setStatus(\"success\");\n } catch (cause) {\n setStatus(\"idle\");\n setError(\n cause instanceof Error ? cause.message : \"Unable to update password.\",\n );\n }\n }\n\n return (\n <AuthCard\n title={title}\n description={description}\n logo={logo}\n accent={accent}\n >\n <MorphStep step={status === \"success\" ? \"success\" : \"form\"}>\n {status === \"success\" ? (\n <AuthSuccess\n title=\"Password updated\"\n description=\"Your password has been changed successfully.\"\n >\n {onDone && (\n <Button variant=\"link\" onClick={onDone}>\n Continue\n </Button>\n )}\n </AuthSuccess>\n ) : (\n <form className=\"flex flex-col gap-4\" onSubmit={handleSubmit}>\n <Field name=\"password\">\n <FieldLabel htmlFor={passwordId}>New password</FieldLabel>\n <PasswordInput\n id={passwordId}\n name=\"password\"\n autoComplete=\"new-password\"\n required\n showStrength\n disabled={status === \"loading\"}\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n />\n </Field>\n <Reveal show={strongEnough}>\n <Field name=\"confirmPassword\">\n <FieldLabel htmlFor={confirmId}>Confirm new password</FieldLabel>\n <PasswordInput\n id={confirmId}\n name=\"confirmPassword\"\n autoComplete=\"new-password\"\n required\n disabled={status === \"loading\"}\n value={confirmPassword}\n onChange={(event) => setConfirmPassword(event.target.value)}\n />\n </Field>\n </Reveal>\n <AuthError\n message={error ?? (mismatch ? \"Passwords do not match.\" : null)}\n />\n <Reveal show={canSubmit}>\n <Button\n className={cn(\"w-full\", accent && authAccentActionStyles)}\n type=\"submit\"\n loading={status === \"loading\"}\n >\n Update password\n </Button>\n </Reveal>\n </form>\n )}\n </MorphStep>\n </AuthCard>\n );\n}\n","/**\n * Session state for the auth blocks — singleton atoms, deliberately NOT a\n * family.\n *\n * A session is one-per-store: one signed-in user per app (per\n * `ExegiaProvider` store; SSR isolation comes from passing a fresh store).\n * Instance keying is for multi-instance components; a family here would\n * imply several concurrent users and be a lie.\n *\n * Import direction: this module is the LEAF — it imports nothing from\n * `auth-flow-atom.ts`. The flow module imports `signInAtom` from here (for\n * `completeAuthFlowAtom`) and defines the composite `endAuthSessionAtom`\n * that pairs `signOutAtom` with a flow reset. `signOutAtom` below clears the\n * session only.\n */\nimport { atom } from \"jotai\"\n\nimport type {\n AuthSessionState,\n AuthSessionStatus,\n AuthUser,\n} from \"./auth-state-type\"\n\n// ── primitives ───────────────────────────────────────────────────────────\n\n/** `\"unknown\"` until the app restores or rejects a session at boot. */\nexport const authSessionStatusAtom = atom<AuthSessionStatus>(\"unknown\")\nauthSessionStatusAtom.debugLabel = \"auth-session/status\"\n\nexport const authUserAtom = atom<AuthUser | null>(null)\nauthUserAtom.debugLabel = \"auth-session/user\"\n\n// ── derived ──────────────────────────────────────────────────────────────\n\nexport const isAuthenticatedAtom = atom(\n (get) => get(authSessionStatusAtom) === \"authenticated\"\n)\nisAuthenticatedAtom.debugLabel = \"auth-session/isAuthenticated\"\n\nexport const authSessionStateAtom = atom<AuthSessionState>((get) => ({\n status: get(authSessionStatusAtom),\n user: get(authUserAtom),\n}))\nauthSessionStateAtom.debugLabel = \"auth-session/state\"\n\n// ── actions ──────────────────────────────────────────────────────────────\n\nexport const signInAtom = atom(null, (_get, set, user: AuthUser) => {\n set(authUserAtom, user)\n set(authSessionStatusAtom, \"authenticated\")\n})\nsignInAtom.debugLabel = \"auth-session/signIn\"\n\nexport const updateAuthUserAtom = atom(\n null,\n (get, set, patch: Partial<AuthUser>) => {\n const user = get(authUserAtom)\n // No-op when signed out: there is no user to merge into, and inventing\n // one from a partial patch would fabricate an identity.\n if (user === null) return\n set(authUserAtom, { ...user, ...patch })\n }\n)\nupdateAuthUserAtom.debugLabel = \"auth-session/updateUser\"\n\n/** What an app calls at boot when session restore fails. */\nexport const markUnauthenticatedAtom = atom(null, (_get, set) => {\n set(authSessionStatusAtom, \"unauthenticated\")\n set(authUserAtom, null)\n})\nmarkUnauthenticatedAtom.debugLabel = \"auth-session/markUnauthenticated\"\n\n/**\n * Clears the session only. Most consumers want `endAuthSessionAtom` from\n * `auth-flow-atom.ts` instead, which also returns the default flow to the\n * login step — the hooks expose that one as `signOut`.\n */\nexport const signOutAtom = atom(null, (_get, set) => {\n set(authUserAtom, null)\n set(authSessionStatusAtom, \"unauthenticated\")\n})\nsignOutAtom.debugLabel = \"auth-session/signOut\"\n","/**\n * Per-instance Jotai state for the auth flow — which auth block the app is\n * showing, the identifier in flight, and the attempt status.\n *\n * Every atom is a module-level family keyed by a flow id, so one\n * `ExegiaProvider` at the app root is enough: a modal login and a full-page\n * login can coexist in one store, and any component can drive a flow by id\n * without holding a controller. Most apps have one flow and use\n * `DEFAULT_AUTH_FLOW_ID`.\n *\n * This is a coordination layer only. The auth blocks keep passwords, codes\n * and field values in local `useState` on purpose — never store those here.\n *\n * Import direction: `auth-session-atom.ts` is the LEAF. This module imports\n * `signInAtom` from it (`completeAuthFlowAtom` signs the session in) and\n * defines the composite `endAuthSessionAtom`; the session module never\n * imports from here.\n */\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport { signInAtom, signOutAtom } from \"./auth-session-atom\"\nimport type { AuthStatus } from \"./auth-shell\"\nimport type {\n AuthFlowChannel,\n AuthFlowId,\n AuthFlowState,\n AuthFlowStep,\n AuthUser,\n BeginAuthVerificationOptions,\n} from \"./auth-state-type\"\n\nexport const DEFAULT_AUTH_FLOW_ID: AuthFlowId = \"default\"\n\n/**\n * A string-keyed atom family (same in-house shape as `tree-atom.ts`:\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove`). Dropping a key lets the store's\n * WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: AuthFlowId) => AtomType) & {\n remove: (id: AuthFlowId) => void\n}\n\n/** Every family, so `removeAuthFlowInstance` can drop an id from all. */\nconst families: { remove: (id: AuthFlowId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: AuthFlowId) => AtomType) {\n const cache = new Map<AuthFlowId, AtomType>()\n const family = ((id: AuthFlowId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: AuthFlowId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: AuthFlowId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (get: Getter, set: Setter, id: AuthFlowId, ...args: Args) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `auth-flow/${id}/${name}`\n return instance\n })\n}\n\n// ── masking ──────────────────────────────────────────────────────────────\n\n/**\n * Mask an identifier for display. Email → first character of the local part\n * plus `\"•••\"`, domain intact (`\"y•••@example.com\"`; a 1-char local part\n * still gets `\"y•••@…\"`). Non-email (sms) → `\"•••\"` + last 4 characters;\n * fewer than 4 characters masks everything as `\"•••\"`.\n */\nexport function maskAuthIdentifier(identifier: string): string {\n const at = identifier.indexOf(\"@\")\n if (at > 0) return `${identifier[0]}•••${identifier.slice(at)}`\n // At 4 characters or fewer, \"keep the last 4\" would reveal the whole\n // identifier while implying redaction — mask everything instead.\n if (identifier.length <= 4) return \"•••\"\n return `•••${identifier.slice(-4)}`\n}\n\n// ── primitives ───────────────────────────────────────────────────────────\n\nexport const authFlowStepAtom = stateFamily<AuthFlowStep>(\"step\", \"login\")\n\n/** An email or phone number in flight — never a password or a code. */\nexport const authFlowIdentifierAtom = stateFamily<string | null>(\n \"identifier\",\n null\n)\n\nexport const authFlowChannelAtom = stateFamily<AuthFlowChannel>(\n \"channel\",\n \"email\"\n)\n\nexport const authFlowStatusAtom = stateFamily<AuthStatus>(\"status\", \"idle\")\n\nexport const authFlowErrorAtom = stateFamily<string | null>(\"error\", null)\n\n// ── derived ──────────────────────────────────────────────────────────────\n\n/** `identifier` masked for display, `null` while nothing is in flight. */\nexport const authFlowMaskedIdentifierAtom = readFamily<string | null>(\n \"maskedIdentifier\",\n (get, id) => {\n const identifier = get(authFlowIdentifierAtom(id))\n return identifier === null ? null : maskAuthIdentifier(identifier)\n }\n)\n\nexport const authFlowStateAtom = readFamily<AuthFlowState>(\n \"state\",\n (get, id) => ({\n step: get(authFlowStepAtom(id)),\n identifier: get(authFlowIdentifierAtom(id)),\n maskedIdentifier: get(authFlowMaskedIdentifierAtom(id)),\n channel: get(authFlowChannelAtom(id)),\n status: get(authFlowStatusAtom(id)),\n error: get(authFlowErrorAtom(id)),\n })\n)\n\n// ── actions ──────────────────────────────────────────────────────────────\n\n/** Show a step with a clean slate (`\"idle\"`, no error). Keeps the\n * identifier so \"back to verify\" flows don't lose the destination. */\nexport const goToAuthStepAtom = actionFamily<[step: AuthFlowStep]>(\n \"goToStep\",\n (_get, set, id, step) => {\n set(authFlowStepAtom(id), step)\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\n/** Record the identifier in flight and move to the verification step. */\nexport const beginAuthVerificationAtom = actionFamily<\n [options: BeginAuthVerificationOptions]\n>(\n \"beginVerification\",\n (_get, set, id, { identifier, channel = \"email\", step = \"verify-code\" }) => {\n set(authFlowIdentifierAtom(id), identifier)\n set(authFlowChannelAtom(id), channel)\n set(authFlowStepAtom(id), step)\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\n/** Mark the flow `\"loading\"` while an async attempt is in flight. */\nexport const beginAuthAttemptAtom = actionFamily<[]>(\n \"beginAttempt\",\n (_get, set, id) => {\n set(authFlowStatusAtom(id), \"loading\")\n set(authFlowErrorAtom(id), null)\n }\n)\n\nexport const failAuthFlowAtom = actionFamily<[message: string]>(\n \"fail\",\n (_get, set, id, message) => {\n set(authFlowStatusAtom(id), \"error\")\n set(authFlowErrorAtom(id), message)\n }\n)\n\n/** Mark the flow `\"success\"` and land on the success step. When `user` is\n * given, also sign the session in — one atomic write for the whole\n * \"verification passed\" transition. */\nexport const completeAuthFlowAtom = actionFamily<[user?: AuthUser]>(\n \"complete\",\n (_get, set, id, user) => {\n set(authFlowStatusAtom(id), \"success\")\n set(authFlowErrorAtom(id), null)\n set(authFlowStepAtom(id), \"success\")\n if (user) set(signInAtom, user)\n }\n)\n\n/** Back to the initial values (login step, no identifier, `\"email\"`,\n * `\"idle\"`, no error). */\nexport const resetAuthFlowAtom = actionFamily<[]>(\"reset\", (_get, set, id) => {\n set(authFlowStepAtom(id), \"login\")\n set(authFlowIdentifierAtom(id), null)\n set(authFlowChannelAtom(id), \"email\")\n set(authFlowStatusAtom(id), \"idle\")\n set(authFlowErrorAtom(id), null)\n})\n\n/**\n * Sign out and return the default flow to the login step — the one to wire\n * to a logout button. `useAuthSessionActions().signOut` is this atom;\n * `signOutAtom` in `auth-session-atom.ts` clears the session only.\n */\nexport const endAuthSessionAtom = atom(null, (_get, set) => {\n set(signOutAtom)\n set(resetAuthFlowAtom(DEFAULT_AUTH_FLOW_ID))\n})\nendAuthSessionAtom.debugLabel = \"auth-flow/endAuthSession\"\n\n/** Drop every atom for `id`. Call on teardown of an explicit flow id; the\n * default flow usually just gets `resetAuthFlowAtom`. */\nexport function removeAuthFlowInstance(id: AuthFlowId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n DEFAULT_AUTH_FLOW_ID,\n authFlowStateAtom,\n beginAuthAttemptAtom,\n beginAuthVerificationAtom,\n completeAuthFlowAtom,\n endAuthSessionAtom,\n failAuthFlowAtom,\n goToAuthStepAtom,\n resetAuthFlowAtom,\n} from \"./auth-flow-atom\"\nimport {\n authSessionStateAtom,\n isAuthenticatedAtom,\n markUnauthenticatedAtom,\n signInAtom,\n updateAuthUserAtom,\n} from \"./auth-session-atom\"\nimport type {\n AuthFlowActions,\n AuthFlowId,\n AuthFlowState,\n AuthSessionActions,\n AuthSessionState,\n} from \"./auth-state-type\"\n\n/**\n * Read the auth flow registered under `flowId` from anywhere below\n * `ExegiaProvider`. Pairs with `useAuthFlowActions` to wire the auth blocks\n * into one flow — the blocks keep passwords and codes in local state, the\n * flow tracks which block shows and what identifier is in flight:\n *\n * ```tsx\n * const flow = useAuthFlow()\n * const { beginVerification, complete, fail } = useAuthFlowActions()\n *\n * {flow.step === \"login\" && (\n * <LoginBlock\n * onSubmit={async ({ email }) => {\n * await api.requestCode(email)\n * beginVerification({ identifier: email })\n * }}\n * />\n * )}\n * {flow.step === \"verify-code\" && (\n * <CodeAuthBlock\n * destination={flow.maskedIdentifier ?? undefined}\n * onVerify={async (code) => complete(await api.verify(code))}\n * />\n * )}\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(authFlowStepAtom(flowId))`.\n */\nexport function useAuthFlow(\n flowId: AuthFlowId = DEFAULT_AUTH_FLOW_ID\n): AuthFlowState {\n return useAtomValue(authFlowStateAtom(flowId))\n}\n\n/**\n * Drive the auth flow registered under `flowId` from anywhere. Writes only —\n * the caller never re-renders when the flow changes. See `useAuthFlow` for\n * the intended wiring; a block's submit handler typically runs\n * `beginAttempt()` → the API call → `complete(user)` or `fail(message)`.\n */\nexport function useAuthFlowActions(\n flowId: AuthFlowId = DEFAULT_AUTH_FLOW_ID\n): AuthFlowActions {\n const goToStep = useSetAtom(goToAuthStepAtom(flowId))\n const beginVerification = useSetAtom(beginAuthVerificationAtom(flowId))\n const beginAttempt = useSetAtom(beginAuthAttemptAtom(flowId))\n const fail = useSetAtom(failAuthFlowAtom(flowId))\n const complete = useSetAtom(completeAuthFlowAtom(flowId))\n const reset = useSetAtom(resetAuthFlowAtom(flowId))\n\n return React.useMemo(\n () => ({\n goToStep,\n beginVerification,\n beginAttempt,\n fail,\n complete,\n reset,\n }),\n [goToStep, beginVerification, beginAttempt, fail, complete, reset]\n )\n}\n\n/**\n * Read the session: `status` (`\"unknown\"` until the app restores or rejects\n * a session at boot), the signed-in `user`, and derived `isAuthenticated`.\n */\nexport function useAuthSession(): AuthSessionState & {\n isAuthenticated: boolean\n} {\n const state = useAtomValue(authSessionStateAtom)\n const isAuthenticated = useAtomValue(isAuthenticatedAtom)\n return React.useMemo(\n () => ({ ...state, isAuthenticated }),\n [state, isAuthenticated]\n )\n}\n\n/**\n * Drive the session. Writes only. `signOut` is the composite\n * `endAuthSessionAtom`: it clears the session AND returns the default flow\n * to the login step — the one to wire to a logout button.\n */\nexport function useAuthSessionActions(): AuthSessionActions {\n const signIn = useSetAtom(signInAtom)\n const updateUser = useSetAtom(updateAuthUserAtom)\n const markUnauthenticated = useSetAtom(markUnauthenticatedAtom)\n const signOut = useSetAtom(endAuthSessionAtom)\n\n return React.useMemo(\n () => ({ signIn, updateUser, markUnauthenticated, signOut }),\n [signIn, updateUser, markUnauthenticated, signOut]\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { MotionConfig } from \"motion/react\"\n\nimport type { SocialProvider } from \"@/components/composed/social-providers\"\nimport type { AuthAccent } from \"@/lib/auth-accent\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthCard, AuthSuccess, MorphStep } from \"./auth-shell\"\nimport { CodeAuthBlock, type CodeAuthBlockProps } from \"./code-auth-block\"\nimport {\n ForgotPasswordBlock,\n type ForgotPasswordBlockProps,\n} from \"./forgot-password-block\"\nimport { LoginBlock, type LoginBlockProps } from \"./login-block\"\nimport {\n OnboardingBlock,\n type OnboardingBlockProps,\n type OnboardingStepConfig,\n type OnboardingValue,\n} from \"./onboarding-block\"\nimport { SignupBlock, type SignupBlockProps } from \"./signup-block\"\nimport {\n UpdatePasswordBlock,\n type UpdatePasswordBlockProps,\n} from \"./update-password-block\"\nimport type {\n AuthFlowId,\n AuthFlowState,\n AuthFlowStep,\n AuthUser,\n BeginAuthVerificationOptions,\n} from \"./auth-state-type\"\nimport { useAuthFlow, useAuthFlowActions } from \"./use-auth-state\"\n\n/**\n * Where the flow goes after a step callback resolves. Returned from every\n * `AuthFlowBlock` handler:\n *\n * - `{ user }` — the attempt signed someone in: mark the flow complete AND\n * sign the session in (one atomic write, `completeAuthFlowAtom`).\n * - `{ verify }` — a code went out: record the identifier and move to the\n * verification step (`beginAuthVerificationAtom`).\n * - `{ step }` — plain navigation with a clean slate (`goToAuthStepAtom`).\n * - `void` — stay put; the block renders its own success state.\n *\n * Rejections are NOT handled here — they propagate back into the block,\n * which owns its transient error/shake state (see `react/CLAUDE.md`,\n * \"Third implementation: auth\").\n */\nexport type AuthFlowDirective =\n | { user: AuthUser }\n | { verify: BeginAuthVerificationOptions }\n | { step: AuthFlowStep }\n | void\n\nexport type AuthFlowHandler<Data = void> = (\n data: Data\n) => Promise<AuthFlowDirective> | AuthFlowDirective\n\n/** Per-step prop overrides, merged over the orchestrator's wiring — spread\n * last, so an app can restyle a block or unhook a default navigation link\n * (`{ login: { onSignup: undefined } }` removes the sign-up hand-off). */\nexport interface AuthFlowStepOverrides {\n login?: Partial<LoginBlockProps>\n signup?: Partial<SignupBlockProps>\n \"verify-code\"?: Partial<CodeAuthBlockProps>\n \"forgot-password\"?: Partial<ForgotPasswordBlockProps>\n \"update-password\"?: Partial<UpdatePasswordBlockProps>\n onboarding?: Partial<OnboardingBlockProps>\n}\n\nexport interface AuthFlowBlockProps {\n /** Which flow instance to orchestrate. The default flow unless a re-auth\n * modal or a second surface needs its own. */\n flowId?: AuthFlowId\n /** Brand mark handed to every step's card. */\n logo?: React.ReactNode\n /** Brand accent handed to every step's card. */\n accent?: AuthAccent\n /** Social providers offered on the login and signup steps. */\n providers?: SocialProvider[]\n /** The login attempt. Resolve with a directive; reject to show the error\n * in the block. */\n onLogin?: AuthFlowHandler<{\n email: string\n password: string\n remember: boolean\n }>\n /** The signup attempt. */\n onSignup?: AuthFlowHandler<{ name: string; email: string; password: string }>\n /** A social provider chosen on the login or signup step. */\n onProviderSelect?: AuthFlowHandler<SocialProvider>\n /** The forgot-password request. Resolving without a directive stays on the\n * step (the block shows its own \"link sent\" state). */\n onRequestReset?: AuthFlowHandler<{ email: string }>\n /** The code entered on the verification step. */\n onVerifyCode?: AuthFlowHandler<string>\n /** \"Resend code\" on the verification step. */\n onResendCode?: AuthFlowHandler\n /** The update-password submit. */\n onUpdatePassword?: AuthFlowHandler<{ password: string }>\n /** Onboarding finished, with the merged profile. */\n onOnboardingComplete?: AuthFlowHandler<Record<string, OnboardingValue>>\n /** Declared onboarding steps, handed to `OnboardingBlock`. */\n onboardingSteps?: OnboardingStepConfig[]\n /** Per-step prop overrides, merged over the orchestrator's wiring. */\n steps?: AuthFlowStepOverrides\n /** Replace any step's UI entirely; return `undefined` to keep the default\n * for that step. Receives the flow state for destination copy etc. */\n renderStep?: (\n step: AuthFlowStep,\n flow: AuthFlowState\n ) => React.ReactNode | undefined\n /** Replaces the whole default success card. */\n success?: React.ReactNode\n /** Card title of the default success step. */\n successTitle?: string\n /** Body under the default success step's \"You're signed in\" check. */\n successDescription?: string\n className?: string\n}\n\n/**\n * Renders the right auth block for the flow's current step with the store\n * wiring built in — the switchboard every host app was hand-rolling around\n * `useAuthFlow`. Navigation links between steps (login ↔ signup, forgot\n * password, back from verification) are pre-wired to `goToStep`; each\n * submit-shaped prop awaits your handler and applies the returned\n * {@link AuthFlowDirective}.\n *\n * The blocks themselves stay untouched: passwords, codes and field drafts\n * live in their local state, and a rejected handler renders as the block's\n * own error — the orchestrator never mirrors transients into the store.\n * Needs `ExegiaProvider` above it, like every stateful block.\n *\n * ```tsx\n * <AuthFlowBlock\n * onLogin={async ({ email, password }) => {\n * const outcome = await api.signIn(email, password)\n * return outcome.mfa ? { verify: { identifier: email } } : { user: outcome.user }\n * }}\n * onVerifyCode={async (code) => ({ user: await api.verify(code) })}\n * />\n * ```\n */\nexport function AuthFlowBlock({\n flowId,\n logo,\n accent,\n providers,\n onLogin,\n onSignup,\n onProviderSelect,\n onRequestReset,\n onVerifyCode,\n onResendCode,\n onUpdatePassword,\n onOnboardingComplete,\n onboardingSteps,\n steps,\n renderStep,\n success,\n successTitle = \"Welcome\",\n successDescription,\n className,\n}: AuthFlowBlockProps): React.ReactElement {\n const flow = useAuthFlow(flowId)\n const { goToStep, beginVerification, complete } = useAuthFlowActions(flowId)\n\n const apply = React.useCallback(\n (directive: AuthFlowDirective) => {\n if (!directive) return\n if (\"user\" in directive) complete(directive.user)\n else if (\"verify\" in directive) beginVerification(directive.verify)\n else goToStep(directive.step)\n },\n [complete, beginVerification, goToStep]\n )\n\n /** Wrap a handler so its directive lands in the store. Errors propagate —\n * the block owns the error rendering. Absent handlers stay absent, so a\n * block keeps its \"no handler\" affordances (hidden buttons etc.). */\n function run<Data>(handler: AuthFlowHandler<Data> | undefined) {\n if (!handler) return undefined\n return async (data: Data) => {\n apply(await handler(data))\n }\n }\n\n const content = ((): React.ReactNode => {\n const custom = renderStep?.(flow.step, flow)\n if (custom !== undefined) return custom\n\n switch (flow.step) {\n case \"login\":\n return (\n <LoginBlock\n logo={logo}\n accent={accent}\n providers={providers}\n onSubmit={run(onLogin)}\n onProviderSelect={run(onProviderSelect)}\n onForgotPassword={() => goToStep(\"forgot-password\")}\n onSignup={() => goToStep(\"signup\")}\n {...steps?.login}\n />\n )\n case \"signup\":\n return (\n <SignupBlock\n logo={logo}\n accent={accent}\n providers={providers}\n onSubmit={run(onSignup)}\n onProviderSelect={run(onProviderSelect)}\n onLogin={() => goToStep(\"login\")}\n {...steps?.signup}\n />\n )\n case \"verify-code\":\n return (\n <CodeAuthBlock\n logo={logo}\n accent={accent}\n channel={flow.channel}\n destination={flow.maskedIdentifier ?? undefined}\n onVerify={run(onVerifyCode)}\n onResend={run(onResendCode)}\n onBack={() => goToStep(\"login\")}\n {...steps?.[\"verify-code\"]}\n />\n )\n case \"forgot-password\":\n return (\n <ForgotPasswordBlock\n logo={logo}\n accent={accent}\n onSubmit={run(onRequestReset)}\n onBackToLogin={() => goToStep(\"login\")}\n {...steps?.[\"forgot-password\"]}\n />\n )\n case \"update-password\":\n return (\n <UpdatePasswordBlock\n logo={logo}\n accent={accent}\n onSubmit={run(onUpdatePassword)}\n onDone={() => goToStep(\"login\")}\n {...steps?.[\"update-password\"]}\n />\n )\n case \"onboarding\":\n return (\n <OnboardingBlock\n logo={logo}\n accent={accent}\n steps={onboardingSteps}\n onComplete={run(onOnboardingComplete)}\n // The flow's success step is the completion screen — showing the\n // block's own too would stack two checkmarks.\n showCompleteScreen={false}\n {...steps?.onboarding}\n />\n )\n case \"success\":\n return (\n success ?? (\n // Header names the moment, the check screen names the outcome —\n // the same split the onboarding block's completion screen uses.\n <AuthCard title={successTitle} logo={logo} accent={accent}>\n <AuthSuccess\n title=\"You're signed in\"\n description={successDescription}\n />\n </AuthCard>\n )\n )\n }\n })()\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <div\n className={cn(\"flex w-full justify-center\", className)}\n data-slot=\"auth-flow\"\n data-step={flow.step}\n >\n <MorphStep step={flow.step} className=\"flex w-full justify-center\">\n {content}\n </MorphStep>\n </div>\n </MotionConfig>\n )\n}\n","\"use client\"\n\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport {\n SOCIAL_PROVIDERS,\n type SocialProvider,\n} from \"@/components/composed/social-providers\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthError, EASE } from \"./auth-shell\"\n\n/** One sign-in identity attached to the account. */\nexport interface LinkedIdentity {\n id: string\n provider: SocialProvider\n /** Account address shown under the provider name, when known. */\n email?: string | null\n}\n\nexport interface LinkedAccountsBlockProps {\n title?: string\n description?: string\n /** Identities already attached to the account. */\n identities?: LinkedIdentity[]\n /** Providers offered as connect candidates; connected ones are filtered out. */\n providers?: SocialProvider[]\n /** Shows the loading row instead of the list. */\n loading?: boolean\n /**\n * The account can also sign in through a method that has no row in this\n * list — an email/password credential, say. Lifts the last-method guard,\n * which otherwise refuses to disconnect the final listed identity.\n */\n hasOtherSignInMethods?: boolean\n /** Reject (or throw) to show the inline error. */\n onLink?: (provider: SocialProvider) => Promise<void> | void\n onUnlink?: (id: string) => Promise<void> | void\n className?: string\n}\n\nconst LAST_METHOD_EXPLANATION =\n \"This is your only way to sign in, so it can't be disconnected.\"\n\n/**\n * Settings panel for the sign-in identities attached to an account: lists the\n * connected ones, offers connect buttons for the rest, and guards the last\n * remaining method from being disconnected — the guard is a disabled button\n * plus an explanation rather than an error after the fact.\n */\nexport function LinkedAccountsBlock({\n title = \"Connected accounts\",\n description = \"Manage the accounts you can use to sign in.\",\n identities = [],\n providers = [\"google\", \"apple\", \"github\"],\n loading = false,\n hasOtherSignInMethods = false,\n onLink,\n onUnlink,\n className,\n}: LinkedAccountsBlockProps) {\n const noteId = React.useId()\n const [error, setError] = React.useState<string | null>(null)\n const [linking, setLinking] = React.useState<SocialProvider | null>(null)\n const [unlinking, setUnlinking] = React.useState<string | null>(null)\n\n const connected = new Set(identities.map((identity) => identity.provider))\n const connectable = providers.filter((provider) => !connected.has(provider))\n const busy = linking !== null || unlinking !== null\n // The backend rule, enforced here so we never fire a request that would\n // remove the account's only way in. An off-list method (a password) keeps\n // the account reachable, so it lifts the guard.\n const lastMethod = !hasOtherSignInMethods && identities.length <= 1\n\n async function connect(provider: SocialProvider) {\n if (busy) return\n setError(null)\n setLinking(provider)\n try {\n await onLink?.(provider)\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to connect account.\"\n )\n } finally {\n setLinking(null)\n }\n }\n\n async function disconnect(id: string) {\n if (busy || lastMethod) return\n setError(null)\n setUnlinking(id)\n try {\n await onUnlink?.(id)\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : \"Unable to disconnect account.\"\n )\n } finally {\n setUnlinking(null)\n }\n }\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <Card className={cn(\"w-full\", className)} data-slot=\"auth-block\">\n <CardHeader>\n <CardTitle>{title}</CardTitle>\n <CardDescription>{description}</CardDescription>\n </CardHeader>\n <CardPanel>\n {loading ? (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner className=\"size-4\" />\n Loading connected accounts…\n </div>\n ) : (\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col gap-3\"\n >\n <AuthError message={error} />\n\n {identities.length > 0 ? (\n <ul\n aria-label=\"Connected accounts\"\n className=\"flex flex-col gap-2\"\n >\n <AnimatePresence initial={false}>\n {identities.map((identity, index) => {\n const { label, BrandIcon, brandClassName } =\n SOCIAL_PROVIDERS[identity.provider]\n return (\n <motion.li\n key={identity.id}\n layout\n className=\"flex items-center justify-between gap-3 rounded-lg border px-3 py-2\"\n initial={{ opacity: 0, y: -4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n // 40ms per row, capped so a long identity list never\n // leaves the last row arriving noticeably late.\n transition={{\n duration: 0.25,\n ease: EASE,\n delay: Math.min(index, 5) * 0.04,\n }}\n >\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <BrandIcon\n aria-hidden=\"true\"\n className={cn(\"size-4\", brandClassName)}\n />\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"text-sm font-medium\">\n {label}\n </span>\n {identity.email && (\n <span className=\"truncate text-xs text-muted-foreground\">\n {identity.email}\n </span>\n )}\n </div>\n </div>\n <Button\n aria-describedby={lastMethod ? noteId : undefined}\n aria-label={`Disconnect ${label}`}\n size=\"sm\"\n type=\"button\"\n variant=\"destructive-outline\"\n disabled={busy || lastMethod}\n loading={unlinking === identity.id}\n onClick={() => void disconnect(identity.id)}\n >\n Disconnect\n </Button>\n </motion.li>\n )\n })}\n </AnimatePresence>\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n No sign-in methods connected yet.\n </p>\n )}\n\n {lastMethod && identities.length > 0 && (\n <p className=\"text-xs text-muted-foreground\" id={noteId}>\n {LAST_METHOD_EXPLANATION}\n </p>\n )}\n\n {connectable.map((provider) => {\n const { label, BrandIcon, brandClassName } =\n SOCIAL_PROVIDERS[provider]\n return (\n <Button\n key={provider}\n className=\"w-full\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n loading={linking === provider}\n onClick={() => void connect(provider)}\n >\n <BrandIcon aria-hidden=\"true\" className={brandClassName} />\n <span className=\"flex-1\">Connect {label}</span>\n </Button>\n )\n })}\n </motion.div>\n )}\n </CardPanel>\n </Card>\n </MotionConfig>\n )\n}\n","\"use client\"\n\nimport { KeyRoundIcon } from \"lucide-react\"\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Field, FieldError, FieldLabel } from \"@/components/ui/field\"\nimport { Input } from \"@/components/ui/input\"\nimport { Spinner } from \"@/components/ui/spinner\"\nimport { cn } from \"@/lib/utils\"\nimport { AuthError, EASE, Reveal } from \"./auth-shell\"\n\n/** One registered passkey, as rendered by {@link PasskeyManagerBlock}. */\nexport interface PasskeyRecord {\n id: string\n /** Server-derived name; falls back to \"Passkey\" when absent. */\n name?: string | null\n /** ISO timestamps. Unparseable values are simply not shown. */\n createdAt?: string | null\n lastUsedAt?: string | null\n}\n\nexport interface PasskeyManagerBlockProps {\n title?: string\n description?: string\n /** The account's passkeys, newest first. */\n passkeys?: PasskeyRecord[]\n /** Whether this device can register passkeys at all. */\n available?: boolean\n /** Shows the loading row instead of the list. */\n loading?: boolean\n /**\n * Reject (or throw) to show the error. Resolving with `{ cancelled: true }`\n * returns silently to idle — a dismissed OS prompt is not a failure.\n */\n onRegister?: () => Promise<{ cancelled?: boolean } | void> | void\n onRename?: (id: string, name: string) => Promise<void> | void\n onDelete?: (id: string) => Promise<void> | void\n className?: string\n}\n\nconst NAME_MAX = 120\n\nconst LAST_PASSKEY_WARNING =\n \"This is your last passkey. After deleting it you won't be able to sign in with a passkey until you register a new one.\"\n\nfunction formatDate(iso: string | null | undefined): string | null {\n if (!iso) return null\n const date = new Date(iso)\n return Number.isNaN(date.getTime()) ? null : date.toLocaleDateString()\n}\n\n/**\n * Settings panel for the passkeys on an account: register, inline rename with\n * field-level validation, and delete behind an explicit confirmation. Deleting\n * the last passkey is allowed — it is the account's passkey method that goes\n * away, not its only way in — so the confirmation carries a warning instead of\n * a block.\n */\nexport function PasskeyManagerBlock({\n title = \"Passkeys\",\n description = \"Sign in without a password using your device's biometrics or security key.\",\n passkeys = [],\n available = true,\n loading = false,\n onRegister,\n onRename,\n onDelete,\n className,\n}: PasskeyManagerBlockProps) {\n const [error, setError] = React.useState<string | null>(null)\n const [busy, setBusy] = React.useState(false)\n const [registering, setRegistering] = React.useState(false)\n const [renamingId, setRenamingId] = React.useState<string | null>(null)\n const [renameValue, setRenameValue] = React.useState(\"\")\n const [renameError, setRenameError] = React.useState<string | null>(null)\n const [confirmingId, setConfirmingId] = React.useState<string | null>(null)\n\n const lastPasskey = passkeys.length === 1\n\n async function run(action: () => Promise<unknown> | unknown) {\n if (busy) return { ok: false } as const\n setError(null)\n setBusy(true)\n try {\n const result = await action()\n return { ok: true, result } as const\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : \"Something went wrong.\")\n return { ok: false } as const\n } finally {\n setBusy(false)\n }\n }\n\n async function handleRegister() {\n setRegistering(true)\n await run(() => onRegister?.())\n setRegistering(false)\n }\n\n function startRename(passkey: PasskeyRecord) {\n setConfirmingId(null)\n setRenamingId(passkey.id)\n setRenameValue(passkey.name ?? \"\")\n setRenameError(null)\n }\n\n async function submitRename(id: string) {\n const name = renameValue.trim()\n if (name.length < 1 || name.length > NAME_MAX) {\n setRenameError(`Name must be between 1 and ${NAME_MAX} characters.`)\n return\n }\n const outcome = await run(() => onRename?.(id, name))\n if (!outcome.ok) return\n setRenamingId(null)\n setRenameError(null)\n }\n\n async function confirmDelete(id: string) {\n const outcome = await run(() => onDelete?.(id))\n setConfirmingId(null)\n if (!outcome.ok) return\n if (renamingId === id) setRenamingId(null)\n }\n\n return (\n <MotionConfig reducedMotion=\"user\">\n <Card className={cn(\"w-full\", className)} data-slot=\"auth-block\">\n <CardHeader>\n <CardTitle>{title}</CardTitle>\n <CardDescription>{description}</CardDescription>\n </CardHeader>\n <CardPanel>\n {!available ? (\n <p className=\"text-sm text-muted-foreground\">\n Passkeys aren&apos;t available on this device. You can manage them\n from a device that supports passkeys.\n </p>\n ) : loading ? (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner className=\"size-4\" />\n Loading passkeys…\n </div>\n ) : (\n <motion.div\n layout\n transition={{ duration: 0.3, ease: EASE }}\n className=\"flex flex-col gap-3\"\n >\n <AuthError message={error} />\n\n {passkeys.length > 0 ? (\n <ul aria-label=\"Passkeys\" className=\"flex flex-col gap-2\">\n <AnimatePresence initial={false}>\n {passkeys.map((passkey, index) => {\n const name = passkey.name ?? \"Passkey\"\n const created = formatDate(passkey.createdAt)\n const lastUsed = formatDate(passkey.lastUsedAt)\n return (\n <motion.li\n key={passkey.id}\n layout\n className=\"flex flex-col gap-2 rounded-lg border px-3 py-2\"\n initial={{ opacity: 0, y: -4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n // 40ms per row, capped so a long list never leaves\n // the last row arriving noticeably late.\n transition={{\n duration: 0.25,\n ease: EASE,\n delay: Math.min(index, 5) * 0.04,\n }}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <span\n aria-hidden=\"true\"\n className=\"grid size-8 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground\"\n >\n <KeyRoundIcon className=\"size-4\" />\n </span>\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"truncate text-sm font-medium\">\n {name}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {created ? `Added ${created}` : null}\n {created && lastUsed ? \" · \" : null}\n {lastUsed ? `Last used ${lastUsed}` : null}\n </span>\n </div>\n </div>\n <div className=\"flex shrink-0 gap-2\">\n <Button\n aria-label={`Rename ${name}`}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n onClick={() => startRename(passkey)}\n >\n Rename\n </Button>\n <Button\n aria-label={`Delete ${name}`}\n size=\"sm\"\n type=\"button\"\n variant=\"destructive-outline\"\n disabled={busy}\n onClick={() => {\n setRenamingId(null)\n setConfirmingId(passkey.id)\n }}\n >\n Delete\n </Button>\n </div>\n </div>\n\n <Reveal show={renamingId === passkey.id}>\n <form\n className=\"flex items-start gap-2 pt-1\"\n onSubmit={(event) => {\n event.preventDefault()\n void submitRename(passkey.id)\n }}\n >\n <Field\n className=\"min-w-0 grow\"\n invalid={Boolean(renameError)}\n >\n <FieldLabel className=\"sr-only\">\n Passkey name\n </FieldLabel>\n <Input\n aria-label=\"Passkey name\"\n aria-invalid={renameError ? true : undefined}\n autoFocus\n disabled={busy}\n maxLength={NAME_MAX + 1}\n value={renameValue}\n onChange={(event) =>\n setRenameValue(event.target.value)\n }\n />\n {renameError && (\n <FieldError match>{renameError}</FieldError>\n )}\n </Field>\n <Button size=\"sm\" type=\"submit\" loading={busy}>\n Save\n </Button>\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setRenamingId(null)}\n >\n Cancel\n </Button>\n </form>\n </Reveal>\n\n <Reveal show={confirmingId === passkey.id}>\n <div\n className=\"flex flex-col gap-2 rounded-lg bg-muted/50 p-2\"\n role=\"alertdialog\"\n aria-label={`Confirm deleting ${name}`}\n >\n <p className=\"text-sm\">\n Delete this passkey? It can no longer be used to\n sign in.\n </p>\n {lastPasskey && (\n <p className=\"text-xs text-destructive-foreground\">\n {LAST_PASSKEY_WARNING}\n </p>\n )}\n <div className=\"flex gap-2\">\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"destructive\"\n loading={busy}\n onClick={() => void confirmDelete(passkey.id)}\n >\n Delete passkey\n </Button>\n <Button\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n disabled={busy}\n onClick={() => setConfirmingId(null)}\n >\n Keep it\n </Button>\n </div>\n </div>\n </Reveal>\n </motion.li>\n )\n })}\n </AnimatePresence>\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n No passkeys registered yet. Add one to sign in without a\n password.\n </p>\n )}\n\n <Button\n className=\"w-full\"\n type=\"button\"\n variant=\"outline\"\n disabled={busy}\n loading={registering}\n onClick={() => void handleRegister()}\n >\n Add a passkey\n </Button>\n </motion.div>\n )}\n </CardPanel>\n </Card>\n </MotionConfig>\n )\n}\n","\"use client\";\n\nimport { FingerprintIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { AuthError, Reveal } from \"./auth-shell\";\n\nexport interface PasskeySignInBlockProps {\n /**\n * Whether this device can use passkeys. `false` renders nothing at all —\n * a passkey button that is guaranteed to fail is worse than no button.\n */\n available?: boolean;\n /** Button label. */\n label?: string;\n /**\n * Reject (or throw) to show the inline error. Resolving with\n * `{ cancelled: true }` returns silently to idle — a dismissed OS prompt is\n * not a failure and must not surface an error.\n */\n onSignIn?: () => Promise<{ cancelled?: boolean } | void> | void;\n /** Hint shown under an error, pointing at the remaining sign-in methods. */\n fallbackHint?: React.ReactNode;\n className?: string;\n}\n\n/**\n * Passkey sign-in entry point — a single button plus its error state, sized\n * to drop into a login card next to the password form rather than to stand on\n * its own. Renders `null` while passkeys are unavailable.\n */\nexport function PasskeySignInBlock({\n available = true,\n label = \"Sign in with a passkey\",\n onSignIn,\n fallbackHint = \"You can still sign in with your other methods below.\",\n className,\n}: PasskeySignInBlockProps) {\n const [error, setError] = React.useState<string | null>(null);\n const [loading, setLoading] = React.useState(false);\n\n if (!available) return null;\n\n async function handleClick() {\n if (loading) return;\n setError(null);\n setLoading(true);\n try {\n await onSignIn?.();\n } catch (cause) {\n setError(\n cause instanceof Error\n ? cause.message\n : \"Unable to sign in with a passkey.\",\n );\n } finally {\n setLoading(false);\n }\n }\n\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className)}>\n <Button\n variant=\"outline\"\n className=\"w-full\"\n type=\"button\"\n loading={loading}\n onClick={() => void handleClick()}\n >\n <FingerprintIcon aria-hidden=\"true\" />\n <span className=\"flex-1\">{label}</span>\n </Button>\n <AuthError message={error} />\n <Reveal show={Boolean(error) && Boolean(fallbackHint)}>\n <p className=\"text-xs text-muted-foreground\">{fallbackHint}</p>\n </Reveal>\n </div>\n );\n}\n","import { EASE_OUT } from \"@/lib/ease.ts\"\nimport type { FlatResource, SidebarResource, SidebarResourceDropPosition, SidebarResourceMove } from \"./type.ts\"\n\nexport const ROW_REVEAL = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const\n\nexport function canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\"\n}\n\nexport function flattenResources(\n items: SidebarResource[],\n expanded: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId }\n if (!item.children?.length || !expanded.has(item.id)) return [row]\n return [\n row,\n ...flattenResources(item.children, expanded, depth + 1, item.id),\n ]\n })\n}\n\nexport function findResource(\n items: SidebarResource[],\n id: string\n): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item\n const child = item.children ? findResource(item.children, id) : undefined\n if (child) return child\n }\n}\n\n\n/** Ids of every ancestor of `id` (nearest last); empty when absent. */\nexport function ancestorIdsOf(\n items: SidebarResource[],\n id: string\n): string[] {\n const walk = (nodes: SidebarResource[], trail: string[]): string[] | null => {\n for (const node of nodes) {\n if (node.id === id) return trail\n if (node.children) {\n const found = walk(node.children, [...trail, node.id])\n if (found) return found\n }\n }\n return null\n }\n return walk(items, []) ?? []\n}\n\n/** Ids of every row that can hold children and has some — the set\n * `expandAll` opens. */\nexport function expandableIdsOf(items: SidebarResource[]): string[] {\n return items.flatMap((item) =>\n item.children?.length && canContain(item)\n ? [item.id, ...expandableIdsOf(item.children)]\n : []\n )\n}\n\nexport function containsResource(item: SidebarResource, id: string): boolean {\n return (\n item.id === id ||\n item.children?.some((child) => containsResource(child, id)) === true\n );\n}\n\nexport function removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nexport function insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nexport function moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (\n move.position === \"inside\" &&\n (!target || target.disabled || !canContain(target))\n )\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(\n removed.items,\n removed.removed,\n move.targetId,\n move.position,\n );\n}\n\nexport function renameResource(\n items: SidebarResource[],\n id: string,\n label: string,\n): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children\n ? renameResource(item.children, id, label)\n : undefined,\n }));\n}\n","/**\n * Per-instance Jotai state for the AI sidebar.\n *\n * Every atom is a module-level family keyed by a sidebar id, so one\n * `ExegiaProvider` at the app root is enough: many sidebars coexist in one\n * store without a provider each, and any component can drive a sidebar by id\n * without holding its controller.\n *\n * Controlled props stay authoritative. `useAISidebar` projects them into\n * these atoms on every commit so the action atoms and remote readers work off\n * current data — a one-way projection, not a second source of truth. The\n * write gates below (`controlsItems`, `controlsActiveId`,\n * `controlsExpandedIds`) are what keep the store from overwriting a prop.\n *\n * DOM nodes are deliberately absent: the roving-focus ref map belongs to the\n * block that renders the rows, not to the store.\n */\nimport { atom } from \"jotai\";\nimport type { Atom, Getter, Setter } from \"jotai\";\n\nimport type {\n AISidebarConfig,\n AISidebarHandlers,\n AISidebarInstanceId,\n AISidebarSeed,\n AISidebarState,\n DropTarget,\n FlatResource,\n SidebarResource,\n SidebarResourceDropPosition,\n SidebarResourceMove,\n} from \"./type.ts\";\nimport {\n ancestorIdsOf,\n expandableIdsOf,\n findResource,\n flattenResources,\n moveResource,\n renameResource,\n} from \"./utils.ts\";\n\nconst NO_ITEMS: SidebarResource[] = [];\nconst NO_ROWS: FlatResource[] = [];\nconst NO_IDS: ReadonlySet<string> = new Set<string>();\nconst NO_HANDLERS: AISidebarHandlers = {};\n\n/** What a sidebar reads as before `useAISidebar` publishes its options. */\nexport const DEFAULT_AI_SIDEBAR_CONFIG: AISidebarConfig = {\n controlsItems: false,\n controlsActiveId: false,\n controlsExpandedIds: false,\n};\n\nconst DEFAULT_AI_SIDEBAR_SEED: AISidebarSeed = {\n items: NO_ITEMS,\n activeId: null,\n focusedId: null,\n expandedIds: [],\n};\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: AISidebarInstanceId) => AtomType) & {\n remove: (id: AISidebarInstanceId) => void;\n};\n\n/** Every family, so `removeAISidebarInstance` can drop an id from all. */\nconst families: { remove: (id: AISidebarInstanceId) => void }[] = [];\n\nfunction keyed<AtomType>(create: (id: AISidebarInstanceId) => AtomType) {\n const cache = new Map<AISidebarInstanceId, AtomType>();\n const family = ((id: AISidebarInstanceId) => {\n let instance = cache.get(id);\n if (instance === undefined) {\n instance = create(id);\n cache.set(id, instance);\n }\n return instance;\n }) as Family<AtomType>;\n family.remove = (id: AISidebarInstanceId) => {\n cache.delete(id);\n };\n families.push(family);\n return family;\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue);\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: AISidebarInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id));\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\nfunction actionFamily<Args extends unknown[], Result = void>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n ...args: Args\n ) => Result\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n );\n instance.debugLabel = `ai-sidebar/${id}/${name}`;\n return instance;\n });\n}\n\n/**\n * A per-row derived atom, keyed by sidebar and then row id.\n *\n * This is where Jotai earns its place: a row subscribed to\n * `aiSidebarRowExpandedAtom(sidebarId, row.item.id)` re-renders when *its*\n * branch opens and stays put when a sibling's does. Reading the whole\n * controller through props instead re-rendered every row on every hover.\n *\n * The outer family registers for cleanup, so `removeAISidebarInstance` drops\n * all of a sidebar's row atoms with it.\n */\nfunction rowFamily<Value>(\n name: string,\n read: (get: Getter, id: AISidebarInstanceId, rowId: string) => Value\n) {\n const outer = keyed((id: AISidebarInstanceId) => {\n const inner = new Map<string, Atom<Value>>();\n return (rowId: string) => {\n let instance = inner.get(rowId);\n if (instance === undefined) {\n instance = atom((get) => read(get, id, rowId));\n instance.debugLabel = `ai-sidebar/${id}/${name}/${rowId}`;\n inner.set(rowId, instance);\n }\n return instance;\n };\n });\n return (id: AISidebarInstanceId, rowId: string) => outer(id)(rowId);\n}\n\n// ── state ──────────────────────────────────────────────────────────────────\n\n/** @internal */\nexport const aiSidebarConfigAtom = stateFamily<AISidebarConfig>(\n \"config\",\n DEFAULT_AI_SIDEBAR_CONFIG\n);\n/** @internal Refreshed every commit; nothing subscribes, so it is free. */\nexport const aiSidebarHandlersAtom = stateFamily<AISidebarHandlers>(\n \"handlers\",\n NO_HANDLERS\n);\nconst aiSidebarSeedAtom = stateFamily<AISidebarSeed>(\n \"seed\",\n DEFAULT_AI_SIDEBAR_SEED\n);\nconst aiSidebarInitializedAtom = stateFamily<boolean>(\"initialized\", false);\n\n/** The sidebar's current data — hook-owned, or the projection of a\n * controlled `items` prop. */\nexport const aiSidebarItemsAtom = stateFamily<SidebarResource[]>(\n \"items\",\n NO_ITEMS\n);\n/** @internal The hook-owned selection. `select` writes it only while no\n * `activeId` prop owns the selection — read `aiSidebarActiveIdAtom` for the\n * value the sidebar actually renders. */\nexport const aiSidebarOwnActiveIdAtom = stateFamily<string | null>(\n \"ownActiveId\",\n null\n);\n/** @internal Projection of a controlled `activeId` prop; `undefined` while\n * the selection is hook-owned. */\nexport const aiSidebarControlledActiveIdAtom = stateFamily<\n string | null | undefined\n>(\"controlledActiveId\", undefined);\n/** Open rows — hook-owned, or the projection of a controlled `expandedIds`\n * prop. */\nexport const aiSidebarExpandedIdsAtom = stateFamily<ReadonlySet<string>>(\n \"expandedIds\",\n NO_IDS\n);\n/** Roving-focus target. DOM focus is moved by the block, which owns the row\n * refs; this is only which row is tabbable. */\nexport const aiSidebarFocusedIdAtom = stateFamily<string | null>(\n \"focusedId\",\n null\n);\nexport const aiSidebarDraggingIdAtom = stateFamily<string | null>(\n \"draggingId\",\n null\n);\nexport const aiSidebarDropTargetAtom = stateFamily<DropTarget | null>(\n \"dropTarget\",\n null\n);\nexport const aiSidebarMenuOpenIdAtom = stateFamily<string | null>(\n \"menuOpenId\",\n null\n);\nexport const aiSidebarRenamingIdAtom = stateFamily<string | null>(\n \"renamingId\",\n null\n);\nexport const aiSidebarHoveredIdAtom = stateFamily<string | null>(\n \"hoveredId\",\n null\n);\n/** Live-region text for the last move or rename outcome. */\nexport const aiSidebarAnnouncementAtom = stateFamily<string>(\n \"announcement\",\n \"\"\n);\n/** A move is in flight. Read synchronously by `moveAISidebarRowAtom` before\n * it starts another — the store needs no ref to see its own latest write. */\nexport const aiSidebarMovePendingAtom = stateFamily<boolean>(\n \"movePending\",\n false\n);\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** @internal The only items atom `useAISidebar` may subscribe to: empty\n * while a controlled `items` prop owns the data, so the projection write\n * never feeds back into the render that produced it. An inline `items={[…]}`\n * array is a new reference every render, and a subscribed round-trip would\n * loop. */\nexport const aiSidebarOwnedItemsAtom = readFamily(\"ownedItems\", (get, id) =>\n get(aiSidebarConfigAtom(id)).controlsItems\n ? NO_ITEMS\n : get(aiSidebarItemsAtom(id))\n);\n\n/** @internal The same guard for `expandedIds`, which is controllable here\n * and arrives as an array — just as unstable an identity as `items`. */\nexport const aiSidebarOwnedExpandedIdsAtom = readFamily(\n \"ownedExpandedIds\",\n (get, id) =>\n get(aiSidebarConfigAtom(id)).controlsExpandedIds\n ? NO_IDS\n : get(aiSidebarExpandedIdsAtom(id))\n);\n\n/** The selected row: the controlled `activeId` when there is one, the\n * hook-owned selection otherwise. Kept as two atoms because a controlled\n * `activeId` of `null` falls through to the hook-owned value — the block has\n * always read `activeId ?? internalActiveId`. */\nexport const aiSidebarActiveIdAtom = readFamily(\n \"activeId\",\n (get, id) =>\n get(aiSidebarControlledActiveIdAtom(id)) ??\n get(aiSidebarOwnActiveIdAtom(id))\n);\n\n/** Visible rows in order, each with its depth and parent id. */\nexport const aiSidebarFlatAtom = readFamily(\"flat\", (get, id) => {\n const items = get(aiSidebarItemsAtom(id));\n if (items.length === 0) return NO_ROWS;\n return flattenResources(items, get(aiSidebarExpandedIdsAtom(id)));\n});\n\n/** Some row is hovered and no drag is running — mounts the pill wrapper. */\nexport const aiSidebarHoverActiveAtom = readFamily(\n \"hoverActive\",\n (get, id) =>\n get(aiSidebarHoveredIdAtom(id)) !== null &&\n get(aiSidebarDraggingIdAtom(id)) === null\n);\n\n/** Whether this one row is the current selection. */\nexport const aiSidebarRowSelectedAtom = rowFamily(\n \"rowSelected\",\n (get, id, rowId) => get(aiSidebarActiveIdAtom(id)) === rowId\n);\n\n/** Whether this one row is open. */\nexport const aiSidebarRowExpandedAtom = rowFamily(\n \"rowExpanded\",\n (get, id, rowId) => get(aiSidebarExpandedIdsAtom(id)).has(rowId)\n);\n\n/** Whether this one row is the roving-focus target. */\nexport const aiSidebarRowFocusedAtom = rowFamily(\n \"rowFocused\",\n (get, id, rowId) => get(aiSidebarFocusedIdAtom(id)) === rowId\n);\n\n/** Whether this one row is in rename mode. */\nexport const aiSidebarRowRenamingAtom = rowFamily(\n \"rowRenaming\",\n (get, id, rowId) => get(aiSidebarRenamingIdAtom(id)) === rowId\n);\n\n/** Whether this one row's action menu is open. */\nexport const aiSidebarRowMenuOpenAtom = rowFamily(\n \"rowMenuOpen\",\n (get, id, rowId) => get(aiSidebarMenuOpenIdAtom(id)) === rowId\n);\n\n/** Whether this one row is the row in flight. */\nexport const aiSidebarRowDraggingAtom = rowFamily(\n \"rowDragging\",\n (get, id, rowId) => get(aiSidebarDraggingIdAtom(id)) === rowId\n);\n\n/** Where a drop on this one row would land, `null` when it is not hovered\n * by a drag. */\nexport const aiSidebarRowDropAtom =\n rowFamily<SidebarResourceDropPosition | null>(\"rowDrop\", (get, id, rowId) => {\n const target = get(aiSidebarDropTargetAtom(id));\n return target?.id === rowId ? target.position : null;\n });\n\n/** Whether this one row owns the sliding hover pill. */\nexport const aiSidebarRowHoveredAtom = rowFamily(\n \"rowHovered\",\n (get, id, rowId) =>\n get(aiSidebarHoveredIdAtom(id)) === rowId &&\n get(aiSidebarDraggingIdAtom(id)) === null\n);\n\n/** The whole state of one sidebar. Components reading a single field should\n * subscribe to that field's atom instead — this one changes on every edit. */\nexport const aiSidebarStateAtom = readFamily<AISidebarState>(\n \"state\",\n (get, id) => ({\n items: get(aiSidebarItemsAtom(id)),\n flat: get(aiSidebarFlatAtom(id)),\n selectedId: get(aiSidebarActiveIdAtom(id)),\n expandedIds: get(aiSidebarExpandedIdsAtom(id)),\n focusedId: get(aiSidebarFocusedIdAtom(id)),\n renamingId: get(aiSidebarRenamingIdAtom(id)),\n menuOpenId: get(aiSidebarMenuOpenIdAtom(id)),\n draggingId: get(aiSidebarDraggingIdAtom(id)),\n dropTarget: get(aiSidebarDropTargetAtom(id)),\n hoveredId: get(aiSidebarHoveredIdAtom(id)),\n movePending: get(aiSidebarMovePendingAtom(id)),\n announcement: get(aiSidebarAnnouncementAtom(id)),\n })\n);\n\n// ── shared write helpers ───────────────────────────────────────────────────\n\n/** The atom only when the hook owns the data; the callback always. */\nfunction commitItems(\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n next: SidebarResource[]\n): void {\n if (!get(aiSidebarConfigAtom(id)).controlsItems)\n set(aiSidebarItemsAtom(id), next);\n get(aiSidebarHandlersAtom(id)).onItemsChange?.(next);\n}\n\nfunction commitExpanded(\n get: Getter,\n set: Setter,\n id: AISidebarInstanceId,\n next: Set<string>\n): void {\n if (!get(aiSidebarConfigAtom(id)).controlsExpandedIds)\n set(aiSidebarExpandedIdsAtom(id), next);\n get(aiSidebarHandlersAtom(id)).onExpandedChange?.([...next]);\n}\n\nfunction seedInstance(\n set: Setter,\n id: AISidebarInstanceId,\n seed: AISidebarSeed\n): void {\n set(aiSidebarItemsAtom(id), seed.items);\n set(aiSidebarOwnActiveIdAtom(id), seed.activeId);\n set(aiSidebarFocusedIdAtom(id), seed.focusedId);\n set(aiSidebarExpandedIdsAtom(id), new Set(seed.expandedIds));\n set(aiSidebarRenamingIdAtom(id), null);\n set(aiSidebarMenuOpenIdAtom(id), null);\n set(aiSidebarDraggingIdAtom(id), null);\n set(aiSidebarDropTargetAtom(id), null);\n set(aiSidebarHoveredIdAtom(id), null);\n set(aiSidebarAnnouncementAtom(id), \"\");\n set(aiSidebarMovePendingAtom(id), false);\n}\n\n// ── expansion ──────────────────────────────────────────────────────────────\n\nexport const expandAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"expand\",\n (get, set, id, rowId) => {\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (expanded.has(rowId)) return;\n commitExpanded(get, set, id, new Set(expanded).add(rowId));\n }\n);\n\nexport const collapseAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"collapse\",\n (get, set, id, rowId) => {\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (!expanded.has(rowId)) return;\n const next = new Set(expanded);\n next.delete(rowId);\n commitExpanded(get, set, id, next);\n }\n);\n\nexport const toggleAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"toggleExpanded\",\n (get, set, id, rowId) => {\n const next = new Set(get(aiSidebarExpandedIdsAtom(id)));\n if (next.has(rowId)) next.delete(rowId);\n else next.add(rowId);\n commitExpanded(get, set, id, next);\n }\n);\n\nexport const expandAllAISidebarRowsAtom = actionFamily<[]>(\n \"expandAll\",\n (get, set, id) => {\n commitExpanded(\n get,\n set,\n id,\n new Set(expandableIdsOf(get(aiSidebarItemsAtom(id))))\n );\n }\n);\n\nexport const collapseAllAISidebarRowsAtom = actionFamily<[]>(\n \"collapseAll\",\n (get, set, id) => {\n commitExpanded(get, set, id, new Set());\n }\n);\n\n/** Open every ancestor of `rowId` without touching the rest of the tree. */\nexport const revealAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"reveal\",\n (get, set, id, rowId) => {\n const ancestors = ancestorIdsOf(get(aiSidebarItemsAtom(id)), rowId);\n const expanded = get(aiSidebarExpandedIdsAtom(id));\n if (!ancestors.some((ancestor) => !expanded.has(ancestor))) return;\n commitExpanded(get, set, id, new Set([...expanded, ...ancestors]));\n }\n);\n\n// ── selection and focus ────────────────────────────────────────────────────\n\nexport const selectAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"select\",\n (get, set, id, rowId) => {\n if (!get(aiSidebarConfigAtom(id)).controlsActiveId)\n set(aiSidebarOwnActiveIdAtom(id), rowId);\n get(aiSidebarHandlersAtom(id)).onActiveChange?.(rowId);\n }\n);\n\n/** The store half of `focus`: which row is tabbable. Moving DOM focus is the\n * block's job — it owns the row refs. */\nexport const focusAISidebarRowAtom = actionFamily<[rowId: string]>(\n \"focus\",\n (_get, set, id, rowId) => {\n set(aiSidebarFocusedIdAtom(id), rowId);\n }\n);\n\n/** @internal Keeps the roving target on a row that still renders: a focused\n * row that folds away hands focus to the first visible row instead of\n * pointing at nothing. `useAISidebar` runs it after every projection. */\nexport const normalizeAISidebarFocusAtom = actionFamily<[]>(\n \"normalizeFocus\",\n (get, set, id) => {\n const flat = get(aiSidebarFlatAtom(id));\n const focusedId = get(aiSidebarFocusedIdAtom(id));\n if (focusedId !== null && flat.some((row) => row.item.id === focusedId))\n return;\n const first = flat[0]?.item.id ?? null;\n if (focusedId !== first) set(aiSidebarFocusedIdAtom(id), first);\n }\n);\n\n// ── rename ─────────────────────────────────────────────────────────────────\n\nexport const startAISidebarRenameAtom = actionFamily<[rowId: string]>(\n \"startRename\",\n (get, set, id, rowId) => {\n // An id from elsewhere (a stale selection, another sidebar) would arm\n // rename mode against a row that never renders.\n if (!findResource(get(aiSidebarItemsAtom(id)), rowId)) return;\n set(aiSidebarRenamingIdAtom(id), rowId);\n }\n);\n\nexport const cancelAISidebarRenameAtom = actionFamily<[]>(\n \"cancelRename\",\n (_get, set, id) => {\n set(aiSidebarRenamingIdAtom(id), null);\n }\n);\n\n/** Commit a rename and leave rename mode. Applied optimistically and rolled\n * back if `onRename` rejects. Blank and unchanged labels are dropped. */\nexport const renameAISidebarRowAtom = actionFamily<\n [rowId: string, label: string]\n>(\"rename\", (get, set, id, rowId, label) => {\n const trimmed = label.trim();\n set(aiSidebarRenamingIdAtom(id), null);\n const before = get(aiSidebarItemsAtom(id));\n const item = findResource(before, rowId);\n if (!item || !trimmed || trimmed === item.label) return;\n commitItems(get, set, id, renameResource(before, rowId, trimmed));\n void Promise.resolve(\n get(aiSidebarHandlersAtom(id)).onRename?.(item, trimmed)\n ).catch(() => {\n commitItems(get, set, id, before);\n set(\n aiSidebarAnnouncementAtom(id),\n `Rename failed. ${item.label} was restored.`\n );\n });\n});\n\n// ── menu ───────────────────────────────────────────────────────────────────\n\nexport const openAISidebarMenuAtom = actionFamily<[rowId: string]>(\n \"openMenu\",\n (get, set, id, rowId) => {\n if (!findResource(get(aiSidebarItemsAtom(id)), rowId)) return;\n set(aiSidebarMenuOpenIdAtom(id), rowId);\n }\n);\n\n/** Closes the menu and hands the roving target back to the row that owned\n * it, then returns that id so the block can move DOM focus there — otherwise\n * focus falls back to the body and the keyboard user loses their place. */\nexport const closeAISidebarMenuAtom = actionFamily<[], string | null>(\n \"closeMenu\",\n (get, set, id) => {\n const current = get(aiSidebarMenuOpenIdAtom(id));\n set(aiSidebarMenuOpenIdAtom(id), null);\n if (current) set(aiSidebarFocusedIdAtom(id), current);\n return current;\n }\n);\n\n// ── data ───────────────────────────────────────────────────────────────────\n\n/**\n * Reorder, applied optimistically and rolled back if `onMove` rejects.\n *\n * The pending flag is read straight back out of the store, which is why this\n * needs no ref to guard overlapping moves the way React state did: the write\n * is visible to the next call immediately, not after a commit.\n */\nexport const moveAISidebarRowAtom = actionFamily<\n [move: SidebarResourceMove],\n Promise<void>\n>(\"move\", async (get, set, id, move) => {\n if (get(aiSidebarMovePendingAtom(id))) {\n set(aiSidebarAnnouncementAtom(id), \"Wait for the current move to finish.\");\n return;\n }\n const before = get(aiSidebarItemsAtom(id));\n const next = moveResource(before, move);\n if (!next || next === before) return;\n\n set(aiSidebarMovePendingAtom(id), true);\n commitItems(get, set, id, next);\n set(aiSidebarDropTargetAtom(id), null);\n set(aiSidebarDraggingIdAtom(id), null);\n const moved = findResource(before, move.itemId);\n const target = move.targetId ? findResource(before, move.targetId) : null;\n set(\n aiSidebarAnnouncementAtom(id),\n target\n ? `Moved ${moved?.label ?? \"item\"} ${move.position} ${target.label}.`\n : `Moved ${moved?.label ?? \"item\"} to the top level.`\n );\n\n try {\n await get(aiSidebarHandlersAtom(id)).onMove?.(move);\n } catch (error) {\n commitItems(get, set, id, before);\n set(\n aiSidebarAnnouncementAtom(id),\n `Move failed. ${moved?.label ?? \"Item\"} was restored.`\n );\n get(aiSidebarHandlersAtom(id)).onMoveError?.(error, move);\n } finally {\n set(aiSidebarMovePendingAtom(id), false);\n }\n});\n\n/** Replace the data. Reports through `onItemsChange`; writes the atom only\n * when no controlled `items` prop owns it. */\nexport const setAISidebarItemsAtom = actionFamily<[items: SidebarResource[]]>(\n \"setItems\",\n (get, set, id, items) => {\n commitItems(get, set, id, items);\n }\n);\n\n// ── hover and drag state ───────────────────────────────────────────────────\n\nexport const setAISidebarHoveredAtom = actionFamily<\n [rowId: string, hovered: boolean]\n>(\"setHovered\", (get, set, id, rowId, hovered) => {\n const current = get(aiSidebarHoveredIdAtom(id));\n const next = hovered ? rowId : current === rowId ? null : current;\n if (next !== current) set(aiSidebarHoveredIdAtom(id), next);\n});\n\nexport const clearAISidebarHoverAtom = actionFamily<[]>(\n \"clearHover\",\n (_get, set, id) => {\n set(aiSidebarHoveredIdAtom(id), null);\n }\n);\n\nexport const endAISidebarDragAtom = actionFamily<[]>(\n \"endDrag\",\n (_get, set, id) => {\n set(aiSidebarDraggingIdAtom(id), null);\n set(aiSidebarDropTargetAtom(id), null);\n }\n);\n\n// ── lifecycle ──────────────────────────────────────────────────────────────\n\n/** @internal Publish the latest options; seed the instance once. */\nexport const mountAISidebarAtom = actionFamily<\n [config: AISidebarConfig, seed: AISidebarSeed]\n>(\"mount\", (get, set, id, config, seed) => {\n set(aiSidebarConfigAtom(id), config);\n if (get(aiSidebarInitializedAtom(id))) return;\n set(aiSidebarInitializedAtom(id), true);\n set(aiSidebarSeedAtom(id), seed);\n seedInstance(set, id, seed);\n});\n\n/** @internal */\nexport const setAISidebarHandlersAtom = actionFamily<\n [handlers: AISidebarHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(aiSidebarHandlersAtom(id), handlers);\n});\n\n/** @internal One-way projections of controlled props — no callbacks fire. */\nexport const projectAISidebarItemsAtom = actionFamily<\n [items: SidebarResource[]]\n>(\"projectItems\", (_get, set, id, items) => {\n set(aiSidebarItemsAtom(id), items);\n});\n\n/** @internal */\nexport const projectAISidebarActiveIdAtom = actionFamily<\n [activeId: string | null]\n>(\"projectActiveId\", (_get, set, id, activeId) => {\n set(aiSidebarControlledActiveIdAtom(id), activeId);\n});\n\n/** @internal */\nexport const projectAISidebarExpandedIdsAtom = actionFamily<\n [expandedIds: string[]]\n>(\"projectExpandedIds\", (_get, set, id, expandedIds) => {\n set(aiSidebarExpandedIdsAtom(id), new Set(expandedIds));\n});\n\n/** Back to the values the instance mounted with. */\nexport const resetAISidebarAtom = actionFamily<[]>(\"reset\", (get, set, id) => {\n seedInstance(set, id, get(aiSidebarSeedAtom(id)));\n});\n\n/** Drop every atom for `id`. `useAISidebar` calls this on unmount for\n * sidebars it keyed itself; an explicit `sidebarId` outlives its component,\n * so an app-named sidebar keeps its open rows across a route change. */\nexport function removeAISidebarInstance(id: AISidebarInstanceId): void {\n for (const family of families) family.remove(id);\n}\n","\"use client\";\n\nimport {\n type DragEvent,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useAtomValue, useSetAtom, useStore } from \"jotai\";\n\nimport {\n aiSidebarAnnouncementAtom,\n aiSidebarDraggingIdAtom,\n aiSidebarDropTargetAtom,\n aiSidebarExpandedIdsAtom,\n aiSidebarFlatAtom,\n aiSidebarFocusedIdAtom,\n aiSidebarHoveredIdAtom,\n aiSidebarItemsAtom,\n aiSidebarMenuOpenIdAtom,\n aiSidebarMovePendingAtom,\n aiSidebarOwnActiveIdAtom,\n aiSidebarOwnedExpandedIdsAtom,\n aiSidebarOwnedItemsAtom,\n aiSidebarRenamingIdAtom,\n cancelAISidebarRenameAtom,\n clearAISidebarHoverAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n endAISidebarDragAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n mountAISidebarAtom,\n moveAISidebarRowAtom,\n normalizeAISidebarFocusAtom,\n openAISidebarMenuAtom,\n projectAISidebarActiveIdAtom,\n projectAISidebarExpandedIdsAtom,\n projectAISidebarItemsAtom,\n removeAISidebarInstance,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarHandlersAtom,\n setAISidebarHoveredAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\";\nimport type {\n AISidebarConfig,\n AISidebarController,\n AISidebarHandlers,\n AISidebarSeed,\n FlatResource,\n UseAISidebarOptions,\n} from \"./type.ts\";\nimport {\n canContain,\n containsResource,\n findResource,\n flattenResources,\n} from \"./utils.ts\";\n\nexport type { UseAISidebarOptions };\n\n/**\n * The AI sidebar's headless controller — every behaviour the block\n * performs, callable from outside it: select, expand/collapse (one row,\n * every row, or just the ancestors of one), move focus, rename, open a\n * row's action menu, reorder.\n *\n * `items`, `activeId` and `expandedIds` are each controlled when passed\n * and hook-owned via their `default*` twin otherwise. Reorder and rename\n * are applied to the data optimistically and rolled back if\n * `onMove`/`onRename` rejects, so a consumer never reduces the tree\n * itself — `moveResource` and `renameResource` are exported for the ones\n * who keep their data elsewhere.\n *\n * ```tsx\n * const sidebar = useAISidebar({ defaultItems: resources })\n * <AISidebar controller={sidebar} />\n * <Button onClick={sidebar.collapseAll}>Collapse all</Button>\n * ```\n *\n * State lives in Jotai atoms keyed by `sidebarId`, so anything under\n * `ExegiaProvider` can drive this sidebar without the controller — name it\n * and reach for `useAISidebarState(sidebarId)` /\n * `useAISidebarActions(sidebarId)` elsewhere.\n */\nexport function useAISidebar(\n options: UseAISidebarOptions\n): AISidebarController {\n const {\n items,\n defaultItems = [],\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n activeId,\n defaultActiveId = null,\n onActiveChange,\n onExpandedChange,\n } = options;\n\n // A generated key isolates unnamed sidebars from each other; an explicit\n // `sidebarId` is the app's handle on this one.\n const generatedId = useId();\n const sidebarId = options.sidebarId ?? generatedId;\n const store = useStore();\n const hoverLayoutId = useId();\n\n const controlledExpandedIds = options.expandedIds;\n const controlsItems = items !== undefined;\n const controlsActiveId = activeId !== undefined;\n const controlsExpandedIds = controlledExpandedIds !== undefined;\n\n // Primitives only, so this object is stable and the store write below runs\n // once per real change rather than once per render.\n const config = useMemo<AISidebarConfig>(\n () => ({ controlsItems, controlsActiveId, controlsExpandedIds }),\n [controlsActiveId, controlsExpandedIds, controlsItems]\n );\n\n const handlers = useMemo<AISidebarHandlers>(\n () => ({\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n onActiveChange,\n onExpandedChange,\n }),\n [\n onActiveChange,\n onExpandedChange,\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n ]\n );\n\n // Read once: the `default*` options describe the mount, not every render.\n const [seed] = useState<AISidebarSeed>(() => ({\n items: items ?? defaultItems,\n activeId: defaultActiveId,\n focusedId: activeId ?? defaultActiveId,\n expandedIds: [\n ...(controlledExpandedIds ?? options.defaultExpandedIds ?? []),\n ],\n }));\n\n const mount = useSetAtom(mountAISidebarAtom(sidebarId));\n const publishHandlers = useSetAtom(setAISidebarHandlersAtom(sidebarId));\n const projectItems = useSetAtom(projectAISidebarItemsAtom(sidebarId));\n const projectActiveId = useSetAtom(projectAISidebarActiveIdAtom(sidebarId));\n const projectExpandedIds = useSetAtom(\n projectAISidebarExpandedIdsAtom(sidebarId)\n );\n const normalizeFocus = useSetAtom(normalizeAISidebarFocusAtom(sidebarId));\n\n // Handlers first — they must be in the store before any action can fire.\n // Rewritten every commit; no read atom depends on them, so nobody\n // re-renders for it.\n useLayoutEffect(() => {\n publishHandlers(handlers);\n }, [handlers, publishHandlers]);\n\n // Before paint, so a seeded row never paints closed for a frame.\n useLayoutEffect(() => {\n mount(config, seed);\n }, [config, mount, seed]);\n\n // Controlled props stay the source of truth; the store carries a projection\n // so the action atoms and remote readers see current data.\n useLayoutEffect(() => {\n if (items !== undefined) projectItems(items);\n }, [items, projectItems]);\n\n useLayoutEffect(() => {\n if (activeId !== undefined) projectActiveId(activeId);\n }, [activeId, projectActiveId]);\n\n useLayoutEffect(() => {\n if (controlledExpandedIds !== undefined)\n projectExpandedIds(controlledExpandedIds);\n }, [controlledExpandedIds, projectExpandedIds]);\n\n // A sidebar the hook keyed is scrap once its component goes. An explicit\n // `sidebarId` is the app's key and outlives the mount.\n useEffect(() => {\n if (options.sidebarId !== undefined) return;\n return () => removeAISidebarInstance(sidebarId);\n }, [options.sidebarId, sidebarId]);\n\n // Never `aiSidebarItemsAtom` — see the note on `aiSidebarOwnedItemsAtom`.\n const ownedItems = useAtomValue(aiSidebarOwnedItemsAtom(sidebarId));\n const renderedItems = items ?? ownedItems;\n // `activeId ?? own` rather than the projected atom: a controlled `activeId`\n // of `null` has always fallen through to the hook-owned selection.\n const ownActiveId = useAtomValue(aiSidebarOwnActiveIdAtom(sidebarId));\n const selectedId = activeId ?? ownActiveId;\n const ownExpandedIds = useAtomValue(aiSidebarOwnedExpandedIdsAtom(sidebarId));\n const expandedIds = useMemo(\n () =>\n controlledExpandedIds ? new Set(controlledExpandedIds) : ownExpandedIds,\n [controlledExpandedIds, ownExpandedIds]\n );\n const focusedId = useAtomValue(aiSidebarFocusedIdAtom(sidebarId));\n const renamingId = useAtomValue(aiSidebarRenamingIdAtom(sidebarId));\n const menuOpenId = useAtomValue(aiSidebarMenuOpenIdAtom(sidebarId));\n const draggingId = useAtomValue(aiSidebarDraggingIdAtom(sidebarId));\n const dropTarget = useAtomValue(aiSidebarDropTargetAtom(sidebarId));\n const hoveredId = useAtomValue(aiSidebarHoveredIdAtom(sidebarId));\n const announcement = useAtomValue(aiSidebarAnnouncementAtom(sidebarId));\n const movePending = useAtomValue(aiSidebarMovePendingAtom(sidebarId));\n\n const flat = useMemo(\n () => flattenResources(renderedItems, expandedIds),\n [expandedIds, renderedItems]\n );\n\n // The roving target must name a row that still renders: one that folds away\n // hands focus to the first visible row instead of pointing at nothing. Last\n // of the layout effects, so it reads the projections this commit wrote.\n useLayoutEffect(() => {\n normalizeFocus();\n }, [flat, focusedId, normalizeFocus]);\n\n useEffect(() => {\n if (!menuOpenId) return;\n const frame = requestAnimationFrame(() => {\n const menus = Array.from(\n document.querySelectorAll<HTMLElement>(\"[data-sidebar-resource-menu]\")\n );\n menus\n .find((menu) => menu.dataset.sidebarResourceMenu === menuOpenId)\n ?.querySelector<HTMLElement>(\"button, a[href]\")\n ?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [menuOpenId]);\n\n const getItem = useCallback(\n (id: string) => findResource(renderedItems, id),\n [renderedItems]\n );\n\n const isExpanded = useCallback(\n (id: string) => expandedIds.has(id),\n [expandedIds]\n );\n\n // `useSetAtom` setters are already stable — no useCallback needed.\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId));\n const expand = useSetAtom(expandAISidebarRowAtom(sidebarId));\n const collapse = useSetAtom(collapseAISidebarRowAtom(sidebarId));\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId));\n const expandAll = useSetAtom(expandAllAISidebarRowsAtom(sidebarId));\n const collapseAll = useSetAtom(collapseAllAISidebarRowsAtom(sidebarId));\n const reveal = useSetAtom(revealAISidebarRowAtom(sidebarId));\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId));\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId));\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId));\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId));\n const closeMenuInStore = useSetAtom(closeAISidebarMenuAtom(sidebarId));\n const move = useSetAtom(moveAISidebarRowAtom(sidebarId));\n const reset = useSetAtom(resetAISidebarAtom(sidebarId));\n const setFocusedRow = useSetAtom(focusAISidebarRowAtom(sidebarId));\n const onRowHover = useSetAtom(setAISidebarHoveredAtom(sidebarId));\n const clearHover = useSetAtom(clearAISidebarHoverAtom(sidebarId));\n const onRowDragEnd = useSetAtom(endAISidebarDragAtom(sidebarId));\n const setDraggingId = useSetAtom(aiSidebarDraggingIdAtom(sidebarId));\n const setDropTarget = useSetAtom(aiSidebarDropTargetAtom(sidebarId));\n\n // The one piece of row state that cannot live in the store: these are DOM\n // nodes. The block owns them, and every DOM focus move goes through here.\n const rowRefs = useRef(new Map<string, HTMLDivElement>());\n\n const setRowRef = useCallback((id: string, node: HTMLDivElement | null) => {\n if (node) rowRefs.current.set(id, node);\n else rowRefs.current.delete(id);\n }, []);\n\n const focusRow = useCallback((id: string) => {\n requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const focus = useCallback(\n (id: string) => {\n setFocusedRow(id);\n focusRow(id);\n },\n [focusRow, setFocusedRow]\n );\n\n // Closing returns focus to the row that owned the menu — otherwise focus\n // falls back to the body and the keyboard user loses their place. The atom\n // hands back the id it closed so only the DOM half happens here.\n const closeMenu = useCallback(() => {\n const closed = closeMenuInStore();\n if (closed) focusRow(closed);\n }, [closeMenuInStore, focusRow]);\n\n // Roving nav reads the visible rows out of the store when a key lands\n // rather than closing over them, so one stable handler serves every row.\n const readFlat = useCallback(\n () => store.get(aiSidebarFlatAtom(sidebarId)),\n [sidebarId, store]\n );\n\n const onRowKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>, row: FlatResource) => {\n const flatRows = readFlat();\n const expanded = store.get(aiSidebarExpandedIdsAtom(sidebarId));\n const index = flatRows.findIndex(({ item }) => item.id === row.item.id);\n const previous = flatRows[index - 1];\n const next = flatRows[index + 1];\n const moveModifier = event.altKey && event.shiftKey;\n\n if (event.key === \"ArrowDown\" && !moveModifier && next) {\n event.preventDefault();\n focus(next.item.id);\n return;\n }\n if (event.key === \"ArrowUp\" && !moveModifier && previous) {\n event.preventDefault();\n focus(previous.item.id);\n return;\n }\n if (event.key === \"Home\" && flatRows[0]) {\n event.preventDefault();\n focus(flatRows[0].item.id);\n return;\n }\n if (event.key === \"End\" && flatRows.at(-1)) {\n event.preventDefault();\n focus(flatRows.at(-1)?.item.id ?? row.item.id);\n return;\n }\n\n if (row.item.disabled) {\n if (event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n focus(row.parentId);\n } else if (\n moveModifier ||\n [\"ArrowRight\", \"Enter\", \" \", \"F2\", \"ContextMenu\"].includes(\n event.key\n ) ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n }\n return;\n }\n\n if (moveModifier && event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"before\",\n });\n return;\n }\n if (moveModifier && event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: next.item.id,\n position: \"after\",\n });\n return;\n }\n if (\n moveModifier &&\n event.key === \"ArrowRight\" &&\n previous &&\n canContain(previous.item)\n ) {\n event.preventDefault();\n expand(previous.item.id);\n void move({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"inside\",\n });\n return;\n }\n if (moveModifier && event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n void move({\n itemId: row.item.id,\n targetId: row.parentId,\n position: \"after\",\n });\n return;\n }\n\n if (event.key === \"ArrowRight\" && canContain(row.item)) {\n event.preventDefault();\n if (!expanded.has(row.item.id)) expand(row.item.id);\n else if (next?.parentId === row.item.id) focus(next.item.id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (expanded.has(row.item.id)) collapse(row.item.id);\n else if (row.parentId) focus(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (canContain(row.item)) toggleExpanded(row.item.id);\n else select(row.item.id);\n } else if (event.key === \"F2\") {\n event.preventDefault();\n startRename(row.item.id);\n } else if (\n event.key === \"ContextMenu\" ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n openMenu(row.item.id);\n }\n },\n [\n collapse,\n expand,\n focus,\n move,\n openMenu,\n readFlat,\n select,\n sidebarId,\n startRename,\n store,\n toggleExpanded,\n ]\n );\n\n // The drag handlers read drag state out of the store when they run instead\n // of closing over it. That is what keeps them stable for the life of the\n // sidebar, so every row can share one set without re-rendering on a drag.\n const onRootDragOver = useCallback(\n (event: DragEvent<HTMLDivElement>) => {\n if (\n !store.get(aiSidebarDraggingIdAtom(sidebarId)) ||\n event.target !== event.currentTarget\n )\n return;\n event.preventDefault();\n setDropTarget({ id: null, position: \"after\" });\n },\n [setDropTarget, sidebarId, store]\n );\n\n const onDrop = useCallback(\n (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n const dragging = store.get(aiSidebarDraggingIdAtom(sidebarId));\n const target = store.get(aiSidebarDropTargetAtom(sidebarId));\n if (dragging && target) {\n void move({\n itemId: dragging,\n targetId: target.id,\n position: target.position,\n });\n }\n },\n [move, sidebarId, store]\n );\n\n const onRowDragStart = useCallback(\n (event: DragEvent<HTMLDivElement>, id: string) => {\n setDraggingId(id);\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/plain\", id);\n },\n [setDraggingId]\n );\n\n const onRowDragOver = useCallback(\n (event: DragEvent<HTMLDivElement>, targetRow: FlatResource) => {\n const dragging = store.get(aiSidebarDraggingIdAtom(sidebarId));\n if (!dragging || dragging === targetRow.item.id) return;\n const source = findResource(\n store.get(aiSidebarItemsAtom(sidebarId)),\n dragging\n );\n if (source && containsResource(source, targetRow.item.id)) return;\n event.preventDefault();\n event.stopPropagation();\n const rect = event.currentTarget.getBoundingClientRect();\n const ratio = (event.clientY - rect.top) / rect.height;\n const position =\n !targetRow.item.disabled &&\n canContain(targetRow.item) &&\n ratio >= 0.25 &&\n ratio <= 0.75\n ? \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\";\n setDropTarget({ id: targetRow.item.id, position });\n },\n [setDropTarget, sidebarId, store]\n );\n\n const dnd = useMemo(\n () => ({\n draggingId,\n dropTarget,\n onRootDragOver,\n onDrop,\n onRowDragStart,\n onRowDragEnd,\n onRowDragOver,\n }),\n [\n draggingId,\n dropTarget,\n onRootDragOver,\n onDrop,\n onRowDragStart,\n onRowDragEnd,\n onRowDragOver,\n ]\n );\n\n const hover = useMemo(\n () => ({\n hoveredId,\n layoutId: hoverLayoutId,\n onRowHover,\n clear: clearHover,\n }),\n [clearHover, hoverLayoutId, hoveredId, onRowHover]\n );\n\n return useMemo<AISidebarController>(\n () => ({\n sidebarId,\n items: renderedItems,\n flat,\n getItem,\n selectedId,\n select,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focusedId,\n focus,\n renamingId,\n startRename,\n cancelRename,\n rename,\n menuOpenId,\n openMenu,\n closeMenu,\n move,\n movePending,\n announcement,\n reset,\n dnd,\n hover,\n onRowKeyDown,\n setRowRef,\n }),\n [\n sidebarId,\n renderedItems,\n flat,\n getItem,\n selectedId,\n select,\n expandedIds,\n isExpanded,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focusedId,\n focus,\n renamingId,\n startRename,\n cancelRename,\n rename,\n menuOpenId,\n openMenu,\n closeMenu,\n move,\n movePending,\n announcement,\n reset,\n dnd,\n hover,\n onRowKeyDown,\n setRowRef,\n ]\n );\n}\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\nimport type { AISidebarContextValue } from \"./type.ts\";\n\nexport const AISidebarContext = createContext<AISidebarContextValue | null>(\n null\n);\n\nexport function useAISidebarContext(): AISidebarContextValue {\n const context = useContext(AISidebarContext);\n if (!context) throw new Error(\"Sidebar rows must render inside <AISidebar>.\");\n return context;\n}\n","import type { SidebarResource } from \"./type.ts\"\nimport { Bookmark, FileText, Folder, FolderOpen } from \"lucide-react\"\n\nexport function SidebarIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText\n return <Icon className=\"size-4\" />\n}\n","import { motion, useReducedMotion } from \"motion/react\"\nimport { useEffect, useRef, useState } from \"react\"\nimport { ROW_REVEAL } from \"./utils.ts\"\n\nexport function MarqueeLabel({\n active,\n children,\n}: {\n active: boolean\n children: string\n}) {\n const reduce = useReducedMotion() ?? false\n const viewportRef = useRef<HTMLSpanElement>(null)\n const labelRef = useRef<HTMLSpanElement>(null)\n const [distance, setDistance] = useState(0)\n\n useEffect(() => {\n const measure = () => {\n const viewport = viewportRef.current\n const label = labelRef.current\n if (!viewport || !label) return\n setDistance(\n label.scrollWidth > viewport.clientWidth ? label.scrollWidth + 24 : 0\n )\n }\n measure()\n const observer = new ResizeObserver(measure)\n if (viewportRef.current) observer.observe(viewportRef.current)\n if (labelRef.current) observer.observe(labelRef.current)\n return () => observer.disconnect()\n }, [])\n\n const running = active && distance > 0 && !reduce\n\n return (\n <span\n ref={viewportRef}\n className=\"relative block min-w-0 flex-1 overflow-hidden\"\n >\n <motion.span\n className=\"flex w-max items-center gap-6 whitespace-nowrap\"\n animate={{ x: running ? [0, -distance] : 0 }}\n transition={\n running\n ? {\n duration: Math.max(2.4, distance / 34),\n ease: \"linear\",\n repeat: Number.POSITIVE_INFINITY,\n repeatDelay: 2,\n }\n : ROW_REVEAL\n }\n >\n <span ref={labelRef}>{children}</span>\n {running ? <span aria-hidden=\"true\">{children}</span> : null}\n </motion.span>\n </span>\n )\n}\n","\"use client\";\n\nimport {\n type MutableRefObject,\n useCallback,\n useLayoutEffect,\n useState,\n} from \"react\";\n\nexport type PortalLayout = {\n trigger: {\n left: number;\n top: number;\n width: number;\n height: number;\n };\n content: {\n width: number;\n height: number;\n };\n};\n\nfunction sameLayout(a: PortalLayout | null, b: PortalLayout) {\n return (\n a?.trigger.left === b.trigger.left &&\n a.trigger.top === b.trigger.top &&\n a.trigger.width === b.trigger.width &&\n a.trigger.height === b.trigger.height &&\n a.content.width === b.content.width &&\n a.content.height === b.content.height\n );\n}\n\n/** Measures a trigger and portalled panel in viewport coordinates. */\nexport function usePopoverPortalPosition<\n TriggerElement extends HTMLElement,\n ContentElement extends HTMLElement,\n>(\n triggerRef: MutableRefObject<TriggerElement | null>,\n contentRef: MutableRefObject<ContentElement | null>,\n active: boolean,\n) {\n const [layout, setLayout] = useState<PortalLayout | null>(null);\n\n const update = useCallback(() => {\n const trigger = triggerRef.current;\n const content = contentRef.current;\n if (!trigger || !content) return;\n\n const rect = trigger.getBoundingClientRect();\n const next: PortalLayout = {\n trigger: {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n },\n content: {\n width: content.offsetWidth,\n height: content.offsetHeight,\n },\n };\n setLayout((current) => (sameLayout(current, next) ? current : next));\n }, [contentRef, triggerRef]);\n\n useLayoutEffect(() => {\n update();\n if (!active) return;\n\n const trigger = triggerRef.current;\n const content = contentRef.current;\n const observer = new ResizeObserver(update);\n if (trigger) observer.observe(trigger);\n if (content) observer.observe(content);\n\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n return () => {\n observer.disconnect();\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n };\n }, [active, contentRef, triggerRef, update]);\n\n return layout;\n}\n","\"use client\";\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { usePopoverPortalPosition } from \"@/components/motion/popover-position\";\nimport { EASE_OUT, SPRING_PANEL } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"end\";\n\ntype MorphContextValue = {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n triggerId: string;\n contentId: string;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n setContentRef: (node: HTMLDivElement | null) => void;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n};\n\nconst MorphContext = createContext<MorphContextValue | null>(null);\n\nfunction useMorphContext(component: string) {\n const ctx = useContext(MorphContext);\n if (!ctx) throw new Error(`${component} must be used within <MorphPopover>`);\n return ctx;\n}\n\nexport interface MorphPopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A popover whose panel morphs open from the trigger corner: it's laid out at\n * full size but clipped to the corner nearest the trigger, then unclips as one\n * piece. Closes on outside pointer / Escape. Controlled or uncontrolled.\n */\nexport function MorphPopover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n className,\n}: MorphPopoverProps) {\n const baseId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setOpen(false);\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (\n rootRef.current &&\n !rootRef.current.contains(target) &&\n !contentRef.current?.contains(target)\n )\n setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, setOpen]);\n\n const ctx = useMemo<MorphContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n triggerId: `${baseId}-trigger`,\n contentId: `${baseId}-content`,\n triggerRef,\n setContentRef: (node) => {\n contentRef.current = node;\n },\n contentRef,\n }),\n [open, setOpen, toggle, baseId],\n );\n\n return (\n <MorphContext.Provider value={ctx}>\n <div ref={rootRef} className={cn(\"relative inline-flex\", className)}>\n {children}\n </div>\n </MorphContext.Provider>\n );\n}\n\nexport interface MorphPopoverTriggerProps {\n children: ReactElement;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\n/** Wraps a single element, toggling the popover on click. */\nexport function MorphPopoverTrigger({ children }: MorphPopoverTriggerProps) {\n const ctx = useMorphContext(\"MorphPopoverTrigger\");\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child.props.onClick as\n | ((e: unknown) => void)\n | undefined;\n const childRef = (child.props as { ref?: Ref<HTMLElement> }).ref;\n\n return cloneElement(child, {\n id: ctx.triggerId,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n onClick: (e: unknown) => {\n childOnClick?.(e);\n ctx.toggle();\n },\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n });\n}\n\nconst originFor = (side: Side, align: Align) =>\n `${side === \"bottom\" ? \"top\" : \"bottom\"} ${align === \"end\" ? \"right\" : \"left\"}`;\n\n// A clip that hides everything but the corner nearest the trigger, so the\n// panel appears to grow out of it. inset(top right bottom left).\nfunction clipHidden(side: Side, align: Align, radius: number) {\n const top = side === \"bottom\" ? \"0%\" : \"92%\";\n const bottom = side === \"bottom\" ? \"92%\" : \"0%\";\n const right = align === \"end\" ? \"0%\" : \"92%\";\n const left = align === \"end\" ? \"92%\" : \"0%\";\n return `inset(${top} ${right} ${bottom} ${left} round ${radius}px)`;\n}\nconst clipShown = (radius: number) => `inset(0% 0% 0% 0% round ${radius}px)`;\n\n// Preserve the original spring character on the wrapper, but tween the complex\n// clip-path so it cannot snap when the spring resolves its final distance.\nconst MORPH_CLIP_TRANSITION = { duration: 0.32, ease: EASE_OUT } as const;\n\nexport interface MorphPopoverContentProps {\n children: ReactNode;\n side?: Side;\n align?: Align;\n /** Gap between trigger and panel, in px. Default 8. */\n sideOffset?: number;\n /** Panel corner radius, in px. Default 16. */\n radius?: number;\n className?: string;\n}\n\nexport function MorphPopoverContent({\n children,\n side = \"bottom\",\n align = \"end\",\n sideOffset = 8,\n radius = 16,\n className,\n}: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const { contentId, setContentRef, triggerId } = ctx;\n const reduce = useReducedMotion() ?? false;\n const [portalReady, setPortalReady] = useState(false);\n const layout = usePopoverPortalPosition(\n ctx.triggerRef,\n ctx.contentRef,\n portalReady && ctx.open,\n );\n\n useEffect(() => setPortalReady(true), []);\n const left = layout\n ? align === \"end\"\n ? layout.trigger.left + layout.trigger.width - layout.content.width\n : layout.trigger.left\n : 0;\n const top = layout\n ? side === \"bottom\"\n ? layout.trigger.top + layout.trigger.height + sideOffset\n : layout.trigger.top - layout.content.height - sideOffset\n : 0;\n\n // Both directions travel between the exact same hidden/show states. Exit\n // targets \"hidden\" directly instead of introducing separate choreography.\n const wrap = reduce\n ? undefined\n : {\n hidden: { opacity: 0, scale: 0.96, transition: SPRING_PANEL },\n show: { opacity: 1, scale: 1, transition: SPRING_PANEL },\n };\n const clip = reduce\n ? undefined\n : {\n hidden: {\n clipPath: clipHidden(side, align, radius),\n transition: MORPH_CLIP_TRANSITION,\n },\n show: {\n clipPath: clipShown(radius),\n transition: MORPH_CLIP_TRANSITION,\n },\n };\n\n // Keep the server and first client render identical, then mount the portal.\n if (!portalReady) return null;\n\n return createPortal(\n <AnimatePresence>\n {ctx.open ? (\n <motion.div\n data-morph-popover-portal=\"\"\n // Wrapper carries the shadow as a drop-shadow filter, which hugs the\n // clipped shape below (box-shadow would just get clipped away).\n variants={wrap}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"show\"}\n exit={reduce ? { opacity: 0 } : \"hidden\"}\n transition={reduce ? { duration: 0.12 } : undefined}\n style={{\n left,\n top,\n visibility: layout ? \"visible\" : \"hidden\",\n transformOrigin: originFor(side, align),\n }}\n className=\"fixed z-[9999] [filter:drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]\"\n >\n <motion.div\n ref={setContentRef}\n id={contentId}\n role=\"dialog\"\n aria-labelledby={triggerId}\n variants={clip}\n style={{ borderRadius: radius }}\n className={cn(\n \"overflow-hidden border border-border bg-background\",\n className,\n )}\n >\n {children}\n </motion.div>\n </motion.div>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n","\"use client\"\n\nimport {\n cloneElement,\n memo,\n useCallback,\n useEffect,\n useRef,\n useState,\n type MouseEvent,\n} from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport type { ResourceRowProps } from \"./type\"\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\"\nimport { ChevronRight, MoreHorizontal, Pencil } from \"lucide-react\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils.ts\"\nimport {\n aiSidebarHoverActiveAtom,\n aiSidebarRowDraggingAtom,\n aiSidebarRowDropAtom,\n aiSidebarRowExpandedAtom,\n aiSidebarRowFocusedAtom,\n aiSidebarRowHoveredAtom,\n aiSidebarRowMenuOpenAtom,\n aiSidebarRowRenamingAtom,\n aiSidebarRowSelectedAtom,\n cancelAISidebarRenameAtom,\n focusAISidebarRowAtom,\n openAISidebarMenuAtom,\n renameAISidebarRowAtom,\n selectAISidebarRowAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\"\nimport { useAISidebarContext } from \"./sidebar-context.ts\"\nimport { canContain } from \"./utils\"\nimport { SidebarIcon } from \"./sidebar-icon\"\nimport { MarqueeLabel } from \"./marquee-label\"\nimport {\n MorphPopover,\n MorphPopoverContent,\n MorphPopoverTrigger,\n} from \"@/components/motion/popover-morph.tsx\"\nimport { Button } from \"@/components/ui/button\"\n\n// Same choreography as SharedLayoutBg: the wrapper only fades/blurs out when\n// the pointer leaves the whole tree; a row-to-row move exits instantly so the\n// layoutId pill slides instead of crossfading.\nconst pillVariants: Variants = {\n initial: { opacity: 0, filter: \"blur(6px)\" },\n animate: { opacity: 1, filter: \"blur(0px)\" },\n exit: (hoverActive: boolean) =>\n !hoverActive ? { opacity: 0, filter: \"blur(6px)\" } : {},\n}\n\nconst reducedPillVariants: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: (hoverActive: boolean) => (!hoverActive ? { opacity: 0 } : {}),\n}\n\nfunction ResourceRowImpl({ row }: ResourceRowProps) {\n const {\n sidebarId,\n hoverLayoutId,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n setRowRef,\n onRowKeyDown,\n onRowHover,\n closeMenu,\n dnd,\n } = useAISidebarContext()\n const reduce = useReducedMotion() ?? false\n\n // One subscription per field, per row. A row re-renders when its own\n // selection, expansion, focus, rename, menu, drag or hover state changes\n // and sits still while a sibling's does — reading the controller off\n // context instead re-rendered every row on every change.\n const active = useAtomValue(aiSidebarRowSelectedAtom(sidebarId, row.item.id))\n const expanded = useAtomValue(\n aiSidebarRowExpandedAtom(sidebarId, row.item.id)\n )\n const focused = useAtomValue(aiSidebarRowFocusedAtom(sidebarId, row.item.id))\n const renaming = useAtomValue(\n aiSidebarRowRenamingAtom(sidebarId, row.item.id)\n )\n const menuOpen = useAtomValue(\n aiSidebarRowMenuOpenAtom(sidebarId, row.item.id)\n )\n const isDragging = useAtomValue(\n aiSidebarRowDraggingAtom(sidebarId, row.item.id)\n )\n const dropPosition = useAtomValue(\n aiSidebarRowDropAtom(sidebarId, row.item.id)\n )\n const hoverActive = useAtomValue(aiSidebarHoverActiveAtom(sidebarId))\n const hoverPill =\n useAtomValue(aiSidebarRowHoveredAtom(sidebarId, row.item.id)) &&\n !row.item.disabled\n\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId))\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId))\n const setFocusedRow = useSetAtom(focusAISidebarRowAtom(sidebarId))\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId))\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId))\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId))\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId))\n\n const onMenuOpenChange = useCallback(\n (open: boolean) => {\n if (open) openMenu(row.item.id)\n else closeMenu()\n },\n [closeMenu, openMenu, row.item.id]\n )\n\n const setRef = useCallback(\n (node: HTMLDivElement | null) => setRowRef(row.item.id, node),\n [row.item.id, setRowRef]\n )\n\n const [hovered, setHovered] = useState(false)\n const inputRef = useRef<HTMLInputElement>(null)\n const skipRenameBlurRef = useRef(false)\n const draggedRef = useRef(false)\n const [draft, setDraft] = useState(row.item.label)\n const acceptsChildren = canContain(row.item)\n\n useEffect(() => {\n if (!renaming) return\n skipRenameBlurRef.current = false\n // setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n inputRef.current?.select()\n })\n }, [renaming, row.item.label])\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false)\n startRename(row.item.id)\n },\n }) ?? (\n <button\n type=\"button\"\n onClick={() => {\n onMenuOpenChange(false)\n startRename(row.item.id)\n }}\n className=\"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-xs text-foreground transition-colors outline-none hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Pencil aria-hidden=\"true\" className=\"size-3.5\" />\n Rename\n </button>\n )\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={() => setFocusedRow(row.item.id)}\n onKeyDown={(event) => onRowKeyDown(event, row)}\n onClick={(event) => {\n if (\n event.defaultPrevented ||\n draggedRef.current ||\n renaming ||\n row.item.disabled\n )\n return\n if (acceptsChildren) toggleExpanded(row.item.id)\n else select(row.item.id)\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return\n event.preventDefault()\n startRename(row.item.id)\n }}\n onMouseEnter={() => {\n setHovered(true)\n onRowHover(row.item.id, true)\n }}\n onMouseLeave={() => {\n setHovered(false)\n onRowHover(row.item.id, false)\n }}\n onDragStartCapture={(event) => {\n draggedRef.current = true\n dnd.onRowDragStart(event, row.item.id)\n }}\n onDragEndCapture={() => {\n dnd.onRowDragEnd()\n requestAnimationFrame(() => {\n draggedRef.current = false\n })\n }}\n onDragOver={(event) => dnd.onRowDragOver(event, row)}\n onDrop={dnd.onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-md pr-3 text-sm outline-none\",\n \"text-muted-foreground transition-[color,background-color,scale] duration-150 ease-smooth-out hover:text-foreground motion-reduce:transition-none\",\n !row.item.disabled &&\n !renaming &&\n \"active:scale-97 motion-reduce:active:scale-100\",\n // Fallback for standalone rows that render without the shared pill.\n hoverLayoutId === undefined && \"hover:bg-muted\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45\",\n \"data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary\",\n \"data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary\",\n !acceptsChildren &&\n active &&\n \"bg-primary/10 text-primary dark:bg-primary/25 dark:text-primary-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\"\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n {hoverLayoutId ? (\n <AnimatePresence custom={hoverActive}>\n {hoverActive ? (\n <motion.span\n aria-hidden=\"true\"\n variants={reduce ? reducedPillVariants : pillVariants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n custom={hoverActive}\n className=\"pointer-events-none absolute inset-0\"\n >\n {hoverPill ? (\n <motion.span\n layoutId={hoverLayoutId}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"block h-full w-full rounded-md bg-foreground/8 dark:bg-muted/50\"\n />\n ) : null}\n </motion.span>\n ) : null}\n </AnimatePresence>\n ) : null}\n <span\n aria-hidden=\"true\"\n className=\"relative grid size-5 shrink-0 place-items-center\"\n >\n {renderIcon?.(row.item) ?? SidebarIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={`Rename ${row.item.label}`}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) rename(row.item.id, draft)\n }}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true\n rename(row.item.id, draft)\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true\n cancelRename()\n }\n }}\n className=\"relative h-7 min-w-0 flex-1 text-sm text-foreground outline-none focus-visible:ring-0 focus-visible:ring-ring\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>\n {row.item.label}\n </MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <MorphPopoverTrigger>\n {(() => {\n const custom = renderActionsTrigger?.(row.item)\n if (custom) {\n // A row click selects/toggles — the trigger must not bubble.\n const customOnClick = (\n custom.props as {\n onClick?: (event: MouseEvent<HTMLElement>) => void\n }\n ).onClick\n return cloneElement(custom, {\n draggable: false,\n onClick: (event: MouseEvent<HTMLElement>) => {\n event.stopPropagation()\n customOnClick?.(event)\n },\n } as Partial<unknown>)\n }\n return (\n <Button\n draggable={false}\n tabIndex={-1}\n variant=\"link\"\n aria-label={`Actions for ${row.item.label}`}\n onClick={(event) => event.stopPropagation()}\n className=\"relative grid size-7 shrink-0 place-items-center rounded-lg opacity-0 transition-opacity duration-150 ease-smooth-out outline-none group-hover/resource:opacity-80 group-hover/resource:delay-150 group-data-[menu-open=true]/resource:opacity-100 hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none\"\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\" />\n </Button>\n )\n })()}\n </MorphPopoverTrigger>\n <MorphPopoverContent\n side=\"bottom\"\n align=\"end\"\n sideOffset={8}\n radius={12}\n className=\"w-40 p-1.5\"\n >\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n\n {row.depth === 0 &&\n acceptsChildren &&\n (row.item.children?.length ?? 0) > 0 ? (\n <ChevronRight\n aria-hidden=\"true\"\n className={cn(\n \"relative size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ease-smooth-out motion-reduce:transition-none\",\n expanded && \"rotate-90\"\n )}\n />\n ) : null}\n </motion.div>\n )\n}\n\n/** `flat` is rebuilt whenever expansion changes, so its `FlatResource`\n * wrappers are fresh objects even for rows nothing happened to. The\n * comparator looks through the wrapper at what a row actually renders from —\n * its item (stable unless the data changed), depth and parent — so a sibling\n * opening does not walk every row. Each row's own state reaches it through\n * its atoms instead. */\nfunction sameRow(prev: ResourceRowProps, next: ResourceRowProps): boolean {\n return (\n prev.row.item === next.row.item &&\n prev.row.depth === next.row.depth &&\n prev.row.parentId === next.row.parentId\n )\n}\n\nexport const ResourceRow = memo(ResourceRowImpl, sameRow)\nResourceRow.displayName = \"ResourceRow\"\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { AnimatePresence } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport type {\n AISidebarComponentProps,\n AISidebarContextValue,\n AISidebarController,\n AISidebarProps,\n AISidebarViewProps,\n FlatResource,\n} from \"./type\"\nimport { useAISidebar } from \"./use-ai-sidebar\"\nimport { AISidebarContext } from \"./sidebar-context\"\nimport { ResourceRow } from \"./sidebar-row\"\n\n/**\n * Resource tree for the app rail: nested rows with drag-and-drop reorder,\n * inline rename, per-row action menus and full keyboard navigation.\n *\n * Two ways to drive it. Pass the data and handlers as props and the block\n * owns its state, or hold a `useAISidebar` controller and pass it as\n * `controller` — the same rendering, but select, expand, rename, reorder\n * and menu state are then callable from anywhere in your app.\n */\nexport function AISidebar(props: AISidebarComponentProps) {\n // Two components rather than one: hooks may not be called conditionally,\n // and the controller form has no options to build a fallback controller\n // from. Nobody switches a sidebar between the two forms at runtime.\n return props.controller ? (\n <AISidebarView {...viewProps(props)} controller={props.controller} />\n ) : (\n <UncontrolledAISidebar {...props} />\n )\n}\n\n/** The props form: builds its own controller and renders through it. */\nfunction UncontrolledAISidebar(props: AISidebarProps) {\n const {\n renderIcon: _icon,\n renderMenu: _menu,\n renderActionsTrigger: _trigger,\n ariaLabel: _label,\n className: _className,\n controller: _controller,\n ...options\n } = props\n const controller = useAISidebar(options)\n return <AISidebarView {...viewProps(props)} controller={controller} />\n}\n\nfunction viewProps(props: AISidebarComponentProps): AISidebarViewProps {\n return {\n renderIcon: props.renderIcon,\n renderMenu: props.renderMenu,\n renderActionsTrigger: props.renderActionsTrigger,\n ariaLabel: props.ariaLabel,\n className: props.className,\n }\n}\n\n/** Rendering only — every piece of state lives on the controller. */\nfunction AISidebarView({\n controller,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n ariaLabel = \"Resources\",\n className,\n}: AISidebarViewProps & { controller: AISidebarController }) {\n const { dnd, hover } = controller\n const { draggingId, dropTarget } = dnd\n\n // Rows take the sidebar's id and the stable handlers, never the controller\n // — so this value keeps its identity and a hover or a toggle re-renders\n // only the rows whose own atoms changed. Deps name each function because\n // `dnd` itself carries live drag state and changes identity with it.\n const context = useMemo<AISidebarContextValue>(\n () => ({\n sidebarId: controller.sidebarId,\n hoverLayoutId: hover.layoutId,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n setRowRef: controller.setRowRef,\n onRowKeyDown: controller.onRowKeyDown,\n onRowHover: hover.onRowHover,\n closeMenu: controller.closeMenu,\n dnd: {\n onDrop: dnd.onDrop,\n onRowDragStart: dnd.onRowDragStart,\n onRowDragEnd: dnd.onRowDragEnd,\n onRowDragOver: dnd.onRowDragOver,\n },\n }),\n [\n controller.sidebarId,\n controller.setRowRef,\n controller.onRowKeyDown,\n controller.closeMenu,\n hover.layoutId,\n hover.onRowHover,\n renderIcon,\n renderMenu,\n renderActionsTrigger,\n dnd.onDrop,\n dnd.onRowDragStart,\n dnd.onRowDragEnd,\n dnd.onRowDragOver,\n ]\n )\n\n return (\n <AISidebarContext.Provider value={context}>\n <div\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n onDragOver={dnd.onRootDragOver}\n onDrop={dnd.onDrop}\n onMouseLeave={hover.clear}\n className={cn(\n \"relative min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden\",\n draggingId && \"pb-9 select-none\",\n className\n )}\n >\n <AnimatePresence initial={false}>\n {controller.flat.map((row: FlatResource) => (\n <ResourceRow key={row.item.id} row={row} />\n ))}\n </AnimatePresence>\n\n {draggingId && (\n <div\n aria-hidden=\"true\"\n data-active={dropTarget?.id === null || undefined}\n className=\"absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-md border border-dashed border-border text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground\"\n >\n Move to top level\n </div>\n )}\n </div>\n <span className=\"sr-only\" aria-live=\"polite\">\n {controller.announcement}\n </span>\n </AISidebarContext.Provider>\n )\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useAtomValue, useSetAtom } from \"jotai\";\n\nimport {\n aiSidebarStateAtom,\n cancelAISidebarRenameAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n moveAISidebarRowAtom,\n openAISidebarMenuAtom,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarItemsAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\";\nimport type {\n AISidebarActions,\n AISidebarInstanceId,\n AISidebarState,\n} from \"./type.ts\";\n\n/**\n * Read the sidebar registered under `sidebarId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { selectedId, movePending } = useAISidebarState(\"app-resources\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on any\n * change. A component that reads one field should subscribe to that field's\n * atom instead: `useAtomValue(aiSidebarActiveIdAtom(\"app-resources\"))`.\n */\nexport function useAISidebarState(\n sidebarId: AISidebarInstanceId\n): AISidebarState {\n return useAtomValue(aiSidebarStateAtom(sidebarId));\n}\n\n/**\n * Drive the sidebar registered under `sidebarId` from anywhere. Writes only —\n * the caller never re-renders when the sidebar changes, so this is what a\n * command palette, a keyboard shortcut or a route guard should reach for.\n *\n * `focus` and `closeMenu` move the store's roving target; DOM focus follows\n * only for callers that hold the controller, because the row refs live in\n * the block rather than the store.\n *\n * ```tsx\n * const resources = useAISidebarActions(\"app-resources\")\n * <Button onClick={resources.collapseAll}>Collapse all</Button>\n * ```\n */\nexport function useAISidebarActions(\n sidebarId: AISidebarInstanceId\n): AISidebarActions {\n const select = useSetAtom(selectAISidebarRowAtom(sidebarId));\n const expand = useSetAtom(expandAISidebarRowAtom(sidebarId));\n const collapse = useSetAtom(collapseAISidebarRowAtom(sidebarId));\n const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId));\n const expandAll = useSetAtom(expandAllAISidebarRowsAtom(sidebarId));\n const collapseAll = useSetAtom(collapseAllAISidebarRowsAtom(sidebarId));\n const reveal = useSetAtom(revealAISidebarRowAtom(sidebarId));\n const focus = useSetAtom(focusAISidebarRowAtom(sidebarId));\n const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId));\n const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId));\n const rename = useSetAtom(renameAISidebarRowAtom(sidebarId));\n const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId));\n const closeMenuInStore = useSetAtom(closeAISidebarMenuAtom(sidebarId));\n const move = useSetAtom(moveAISidebarRowAtom(sidebarId));\n const setItems = useSetAtom(setAISidebarItemsAtom(sidebarId));\n const reset = useSetAtom(resetAISidebarAtom(sidebarId));\n\n return useMemo(\n () => ({\n select,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focus,\n startRename,\n cancelRename,\n rename,\n openMenu,\n // The atom returns the id it closed so the block can move DOM focus;\n // remote callers have no refs, so the return value is dropped here.\n closeMenu: () => void closeMenuInStore(),\n move,\n setItems,\n reset,\n }),\n [\n select,\n expand,\n collapse,\n toggleExpanded,\n expandAll,\n collapseAll,\n reveal,\n focus,\n startRename,\n cancelRename,\n rename,\n openMenu,\n closeMenuInStore,\n move,\n setItems,\n reset,\n ]\n );\n}\n","import { AISidebar } from \"./ai-sidebar\"\nimport { MarqueeLabel } from \"./marquee-label.tsx\"\nimport { ResourceRow } from \"./sidebar-row.tsx\"\nimport { SidebarIcon } from \"./sidebar-icon.tsx\"\nexport { useAISidebar, type UseAISidebarOptions } from \"./use-ai-sidebar.ts\"\nexport {\n useAISidebarActions,\n useAISidebarState,\n} from \"./use-ai-sidebar-state.ts\"\nexport type * from \"./type.ts\"\n// The public atom surface. `@internal` atoms (config, handlers, mount, the\n// projections, the owned-* loop guards) stay unexported on purpose —\n// `export *` would make every internal a breaking-change surface for\n// consumer apps.\nexport {\n aiSidebarActiveIdAtom,\n aiSidebarAnnouncementAtom,\n aiSidebarDraggingIdAtom,\n aiSidebarDropTargetAtom,\n aiSidebarExpandedIdsAtom,\n aiSidebarFlatAtom,\n aiSidebarFocusedIdAtom,\n aiSidebarHoverActiveAtom,\n aiSidebarHoveredIdAtom,\n aiSidebarItemsAtom,\n aiSidebarMenuOpenIdAtom,\n aiSidebarMovePendingAtom,\n aiSidebarRenamingIdAtom,\n aiSidebarRowDraggingAtom,\n aiSidebarRowDropAtom,\n aiSidebarRowExpandedAtom,\n aiSidebarRowFocusedAtom,\n aiSidebarRowHoveredAtom,\n aiSidebarRowMenuOpenAtom,\n aiSidebarRowRenamingAtom,\n aiSidebarRowSelectedAtom,\n aiSidebarStateAtom,\n cancelAISidebarRenameAtom,\n clearAISidebarHoverAtom,\n closeAISidebarMenuAtom,\n collapseAISidebarRowAtom,\n collapseAllAISidebarRowsAtom,\n endAISidebarDragAtom,\n expandAISidebarRowAtom,\n expandAllAISidebarRowsAtom,\n focusAISidebarRowAtom,\n moveAISidebarRowAtom,\n openAISidebarMenuAtom,\n removeAISidebarInstance,\n renameAISidebarRowAtom,\n resetAISidebarAtom,\n revealAISidebarRowAtom,\n selectAISidebarRowAtom,\n setAISidebarHoveredAtom,\n setAISidebarItemsAtom,\n startAISidebarRenameAtom,\n toggleAISidebarRowAtom,\n} from \"./ai-sidebar-atom.ts\"\n\nexport { AISidebar, MarqueeLabel, ResourceRow, SidebarIcon }\n\nexport const Sidebar = {\n Wrapper: AISidebar,\n MarqueeLabel,\n Row: ResourceRow,\n Icon: SidebarIcon,\n}\n","export const TITLE_BAR_HEIGHT = 48\n// The desktop rail settles at a hard zero-width boundary. Keep the spring\n// critically damped so it cannot overshoot, pause against that boundary, and\n// then snap back during the final frame.\nimport { EASE_OUT, EASE_DRAWER } from \"@/lib/ease.ts\"\nimport type { Variants } from \"motion/react\"\nimport { createContext, useContext, useSyncExternalStore } from \"react\"\nimport type {\n AnimatedSidebarContextValue,\n AnimatedSidebarPanelContextValue,\n} from \"./type\"\n\nexport const SIDEBAR_MORPH_TRANSITION = {\n type: \"spring\",\n stiffness: 380,\n damping: 35,\n mass: 0.75,\n} as const\n\nexport const LABEL_ENTER_TRANSITION = {\n duration: 0.2,\n delay: 0.08,\n ease: EASE_OUT,\n} as const\n\nexport const LABEL_EXIT_TRANSITION = {\n duration: 0.12,\n ease: EASE_OUT,\n} as const\n\nexport const PANEL_TRANSITION = {\n duration: 0.36,\n ease: EASE_DRAWER,\n} as const\n\nexport const REDUCED_TRANSITION = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const\n\nconst SUBMENU_TRANSITION = {\n duration: 0.18,\n ease: EASE_OUT,\n} as const\n\nexport const SUBMENU_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n clipPath: \"inset(0 0 100% 0 round 8px)\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n staggerChildren: 0.025,\n staggerDirection: -1,\n },\n },\n open: {\n opacity: 1,\n clipPath: \"inset(0 0 0% 0 round 8px)\",\n transition: {\n duration: 0.2,\n delayChildren: 0.035,\n ease: EASE_OUT,\n staggerChildren: 0.045,\n },\n },\n}\n\nexport const SUBMENU_ITEM_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n y: -6,\n filter: \"blur(3px)\",\n },\n open: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: SUBMENU_TRANSITION,\n },\n}\n\nexport const FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\nexport const MOBILE_QUERY = \"(max-width: 767px)\"\nexport const SIDEBAR_KEYBOARD_SHORTCUT = \"b\"\n\n/**\n * The shell's layout contract, in px. Every entry lands on the provider's\n * wrapper as a CSS variable, so a consumer overrides a column by restyling it\n * rather than by passing a prop:\n *\n * | variable | column |\n * | ---------------------- | ----------------------------------------- |\n * | `--sidebar-width` | left rail, expanded |\n * | `--sidebar-width-icon` | left rail, folded to icons |\n * | `--panel-width` | secondary panel: its floor AND its default |\n * | `--inset-min-width` | the body's floor |\n *\n * These are only the defaults. Every measurement resolves the live variable,\n * so an override wins over the value written here.\n */\nexport const SHELL_WIDTHS = {\n \"--sidebar-width\": \"256px\",\n \"--sidebar-width-icon\": \"56px\",\n \"--sidebar-width-mobile\": \"18rem\",\n \"--panel-width\": \"320px\",\n \"--inset-min-width\": \"360px\",\n} as const\n\n/** The expanded width of a panel docked to `side`: the secondary panel opens\n * at `--panel-width`, the primary rail at `--sidebar-width`. */\nexport function expandedWidthVar(side: \"left\" | \"right\") {\n return side === \"right\" ? \"var(--panel-width)\" : \"var(--sidebar-width)\"\n}\n\n/** Resolve a CSS length — `var()` included — to px inside `host`'s cascade.\n * Custom properties inherit, so a throwaway probe mounted in `host` reads the\n * very `--sidebar-width` the shell lays out with, including a value a\n * consumer overrode on the provider. Returns 0 when `host` has no layout\n * (server render, `display: none`), so callers must fail open on 0 rather\n * than treat it as a real measurement. */\nexport function resolveLength(host: HTMLElement, value: string) {\n const probe = document.createElement(\"div\")\n probe.style.cssText = `position:absolute;visibility:hidden;pointer-events:none;width:${value}`\n host.appendChild(probe)\n const px = probe.getBoundingClientRect().width\n probe.remove()\n return px\n}\n\nexport const AnimatedSidebarContext =\n createContext<AnimatedSidebarContextValue | null>(null)\n\nexport const AnimatedSidebarPanelContext =\n createContext<AnimatedSidebarPanelContextValue | null>(null)\n\nexport function useAnimatedSidebar() {\n const context = useContext(AnimatedSidebarContext)\n if (!context) {\n throw new Error(\n \"useAnimatedSidebar must be used inside AnimatedPanelProvider.\"\n )\n }\n return context\n}\n\nfunction subscribeToMobileQuery(callback: () => void) {\n const query = window.matchMedia(MOBILE_QUERY)\n query.addEventListener(\"change\", callback)\n return () => query.removeEventListener(\"change\", callback)\n}\n\nexport function getMobileSnapshot() {\n return window.matchMedia(MOBILE_QUERY).matches\n}\n\nexport function getServerMobileSnapshot() {\n return false\n}\n\nexport function useIsMobile() {\n return useSyncExternalStore(\n subscribeToMobileQuery,\n getMobileSnapshot,\n getServerMobileSnapshot\n )\n}\n\nexport function useAnimatedSidebarPanel() {\n const context = useContext(AnimatedSidebarPanelContext)\n if (!context) {\n throw new Error(\"Animated Sidebar parts must be used inside AnimatedPanel.\")\n }\n return context\n}\n","\"use client\"\n// beui.dev/components/motion/animated-sidebar\n\nimport { motion, type PanInfo } from \"motion/react\"\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n} from \"react\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport { cn } from \"@/lib/utils\"\nimport type { AnimatedSidebarProps } from \"./type\"\nimport {\n AnimatedSidebarPanelContext,\n expandedWidthVar,\n SIDEBAR_MORPH_TRANSITION,\n PANEL_TRANSITION,\n REDUCED_TRANSITION,\n useAnimatedSidebar,\n} from \"./utils\"\n\n/** How far one arrow key moves the panel edge (shift = coarse step). */\nconst RESIZE_STEP = 16\nconst RESIZE_STEP_COARSE = 64\n\nexport function AnimatedPanel({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"icon\",\n ariaLabel = \"Sidebar\",\n children,\n className,\n panelClassName,\n style,\n ref,\n ...props\n}: AnimatedSidebarProps) {\n const context = useAnimatedSidebar()\n const { bounds, panelWidth, resetPanelWidth, resizePanel } = context.fit\n const sideOpen = context.open[side]\n const collapsed = collapsible !== \"none\" && !sideOpen\n const offcanvas = collapsed && collapsible === \"offcanvas\"\n\n // Only the expanded secondary panel is resizable: the rail is pinned to its\n // own columns, and a collapsed panel has no edge left to grab.\n const resizable =\n side === \"right\" && collapsible === \"offcanvas\" && !collapsed\n\n const resizeStartRef = useRef(0)\n const [resizing, setResizing] = useState(false)\n\n const baseWidth = offcanvas\n ? 0\n : collapsed\n ? \"var(--sidebar-width-icon)\"\n : expandedWidthVar(side)\n // The secondary panel's width is shell state, not panel state: the shell\n // measured it, re-clamps it when the room changes, and hands back the same\n // width after a collapse. Everything else rides the CSS variables, which\n // also covers the server render, where nothing has been measured yet.\n const width = resizable && panelWidth !== null ? panelWidth : baseWidth\n\n const setPanelRef = useCallback(\n (node: HTMLElement | null) => {\n if (typeof ref === \"function\") ref(node)\n else if (ref) ref.current = node\n },\n [ref]\n )\n\n const handleResizeStart = useCallback(() => {\n resizeStartRef.current = panelWidth ?? bounds.min\n setResizing(true)\n }, [bounds.min, panelWidth])\n\n const handleResize = useCallback(\n (_event: PointerEvent, info: PanInfo) => {\n // The handle rides the panel's inner edge, so the panel grows as the\n // pointer travels left. `offset` is measured from the pointer-down\n // point, so the edge tracks it 1:1 instead of accumulating rounding.\n resizePanel(resizeStartRef.current - info.offset.x)\n },\n [resizePanel]\n )\n\n const handleResizeEnd = useCallback(() => setResizing(false), [])\n\n const handleResizeKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const direction =\n event.key === \"ArrowLeft\" ? 1 : event.key === \"ArrowRight\" ? -1 : 0\n if (!direction) return\n\n event.preventDefault()\n const step = event.shiftKey ? RESIZE_STEP_COARSE : RESIZE_STEP\n resizePanel((panelWidth ?? bounds.min) + direction * step)\n },\n [bounds.min, panelWidth, resizePanel]\n )\n\n // The pointer leaves the 2px handle the moment the drag starts, so the\n // cursor and the text selection have to be held on the document instead.\n useEffect(() => {\n if (!resizing) return\n\n const { body } = document\n const previousCursor = body.style.cursor\n const previousUserSelect = body.style.userSelect\n body.style.cursor = \"col-resize\"\n body.style.userSelect = \"none\"\n\n return () => {\n body.style.cursor = previousCursor\n body.style.userSelect = previousUserSelect\n }\n }, [resizing])\n\n // A secondary panel exists only while the viewport can carry it beside the\n // rail and the body at their own floors. Below that there is nothing to dock\n // into, so the panel stands down rather than squeezing the content column —\n // and its trigger stands down with it.\n if (side === \"right\" && !context.fit.fits) return null\n\n if (context.isMobile) return <div>TODO: Create Mobile nav experience</div>\n\n return (\n <motion.aside\n {...props}\n ref={setPanelRef}\n initial={false}\n aria-label={ariaLabel}\n data-slot=\"sidebar\"\n data-state={collapsed ? \"collapsed\" : \"expanded\"}\n data-collapsible={collapsible}\n data-variant={variant}\n data-side={side}\n data-resizing={resizing ? \"\" : undefined}\n animate={{\n width,\n // Swallow the shell's gap-x-2 column gap while off canvas so the\n // shell edge keeps a constant spacing-2 inset whether the panel is\n // open (gap + panel + margin) or collapsed (gap + this).\n ...(side === \"right\"\n ? { marginLeft: offcanvas ? \"-0.5rem\" : \"0rem\" }\n : { marginRight: offcanvas ? \"-0.5rem\" : \"0rem\" }),\n }}\n // A drag has to land on the frame it happened — the morph spring would\n // trail the pointer and keep settling after the handle is released.\n transition={\n resizing || context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION\n }\n style={style}\n className={cn(\n \"group/sidebar relative hidden h-full shrink-0 will-change-[width] md:block\",\n \"peer flex!\",\n side === \"right\" && \"order-last\",\n className\n )}\n >\n {resizable && (\n // The handle occupies the shell's gap-x-2 column gap. It must stay\n // outside the clipping mask below or the gap would never receive\n // hover — clipping cuts hit-testing, not just painting.\n <motion.div\n role=\"separator\"\n aria-label={`Resize ${ariaLabel}`}\n aria-orientation=\"vertical\"\n tabIndex={0}\n className=\"absolute inset-y-0 -left-2 z-10 w-2 cursor-col-resize touch-none\"\n initial=\"idle\"\n // Hover alone would drop the glow the instant the drag leaves the\n // handle, so the gesture pins it open for the whole drag.\n animate={resizing ? \"hover\" : \"idle\"}\n whileHover=\"hover\"\n whileFocus=\"hover\"\n onPanStart={handleResizeStart}\n onPan={handleResize}\n onPanEnd={handleResizeEnd}\n onKeyDown={handleResizeKeyDown}\n // The usual escape hatch out of a width you dragged to.\n onDoubleClick={resetPanelWidth}\n >\n <motion.div\n variants={{ idle: { scaleY: 0 }, hover: { scaleY: 1 } }}\n transition={\n context.reduce\n ? { duration: 0 }\n : { duration: 0.2, ease: EASE_OUT }\n }\n className=\"h-full w-full bg-radial/decreasing from-amber-300/70 to-amber-500/0 to-40%\"\n />\n </motion.div>\n )}\n {/* The aside's own width animation is the whole layout story: the\n inner panel just fills it and fades, so it is masked to the aside's\n box here instead of clipping the aside itself — the aside must stay\n unclipped for the gap handle above to be hoverable. */}\n <div className={\"contents\"}>\n <motion.div\n initial={false}\n animate={{ opacity: offcanvas ? 0 : 1 }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n className={cn(\n \"sticky top-0 flex w-full flex-col overflow-hidden\",\n // Pin the right panel to the aside's trailing edge so the aside's\n // width animation expands the panel out of it instead of\n // revealing a detached strip.\n side === \"right\" && \"ml-auto\",\n\n // Panels fill the shell's container, not the viewport — the shell\n // owns its own scrolling, so a bounded host (docs demo, split\n // view) must bound the panels too. Full-page apps size the shell\n // itself (e.g., h-svh). The bottom gap comes from the shell\n // container's padding, so panels only carry their top offset.\n variant === \"floating\" && \"mx-2 mt-2 h-[calc(100%-0.5rem)]\",\n variant === \"inset\" && \"mt-2 h-[calc(100%-0.5rem)]\",\n\n panelClassName\n )}\n >\n <AnimatedSidebarPanelContext.Provider\n value={{ collapsed, collapsible, side }}\n >\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </div>\n </motion.aside>\n )\n}\n","/**\n * The shell's layout arithmetic, as plain functions over px.\n *\n * Nothing here touches React or the DOM. This module IS the contract of who\n * gets which column, which keeps the rule unit-testable on its own and lets\n * the shell-fit atoms (`shellFitFitsAtom`, `shellFitPanelWidthAtom`) call it\n * without restating it: `useShellFit` only supplies the measurements.\n */\n\n/** The px the shell lays itself out with. Every field is measured from a CSS\n * variable (see `SHELL_WIDTHS`), never hard-coded, so a consumer's override\n * flows straight through the rule. */\nexport interface ShellMetrics {\n /** What the left rail occupies right now — its expanded width, its icon\n * width, or 0 when there is no rail at all (or it is off canvas). */\n rail: number\n /** The floor the body refuses to go below. */\n insetMin: number\n /** The secondary panel's floor, which is also the width it opens at. */\n panelMin: number\n /** The viewport all three columns share. */\n viewport: number\n /** px the shell's own frame eats before any column gets a share: its\n * padding, plus the gap between columns.\n *\n * Deliberately absent from `fitsPanel` — that rule is stated against the raw\n * viewport — but subtracted from the resize ceiling, where ignoring it lets\n * a full-width drag push the row past the shell by exactly this much. */\n chrome: number\n}\n\n/** px the shell needs before a secondary panel can exist: the rail as it\n * stands, plus the body and the panel at their own floors. */\nexport function requiredWidth({ rail, insetMin, panelMin }: ShellMetrics) {\n return rail + insetMin + panelMin\n}\n\n/**\n * Whether the shell can hold a secondary panel at all. Strictly `<`: a shell\n * that fits its columns exactly has no room left to give one.\n *\n * An unmeasurable shell fails open. A server render, a `display: none` host\n * or a test environment with no layout engine all report 0, and a panel must\n * never disappear over a reading the layout could not produce.\n */\nexport function fitsPanel(metrics: ShellMetrics) {\n if (metrics.viewport <= 0 || metrics.panelMin <= 0) return true\n return requiredWidth(metrics) < metrics.viewport\n}\n\n/** How wide the secondary panel may be: never under its own floor, never past\n * the slack the body holds above its floor. `max` never drops below `min`, so\n * a shell that does not fit reports a degenerate range instead of an inverted\n * one — `fitsPanel` is what hides the panel, not a negative bound. */\nexport function panelBounds(metrics: ShellMetrics) {\n const { chrome, insetMin, panelMin, rail, viewport } = metrics\n return {\n min: panelMin,\n max: Math.max(panelMin, viewport - chrome - rail - insetMin),\n }\n}\n\nexport function clampPanelWidth(width: number, metrics: ShellMetrics) {\n const { min, max } = panelBounds(metrics)\n return Math.min(Math.max(width, min), max)\n}\n\n/** Resizes fire per pointer move and per resize event, most of them landing\n * on the same numbers — comparing fields keeps those from re-rendering the\n * whole shell. */\nexport function metricsEqual(a: ShellMetrics, b: ShellMetrics) {\n return (\n a.rail === b.rail &&\n a.insetMin === b.insetMin &&\n a.panelMin === b.panelMin &&\n a.viewport === b.viewport &&\n a.chrome === b.chrome\n )\n}\n","/**\n * Per-instance Jotai state for the shell's layout fit.\n *\n * Every atom is a module-level family keyed by a shell id, so one\n * `ExegiaProvider` at the app root is enough: several shells coexist in one\n * store without a provider each, and a title bar, a command palette or a\n * layout test can drive one by id without holding its controller.\n *\n * Unlike the tree, this feature has no controlled props — the shell measures\n * itself, nobody hands it a viewport. So, like `blocks/auth`'s coordination\n * layer, there is no config atom, no projection and no owned-* loop guard.\n * `useShellFit` is the only writer of `metrics`, and that write is silent by\n * design: a resize is not an event an app subscribed to.\n *\n * The rule itself lives in `shell-metrics.ts` and is called from here, so the\n * arithmetic has one home whether it is read through a hook or a store.\n */\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport {\n clampPanelWidth,\n fitsPanel,\n metricsEqual,\n panelBounds,\n type ShellMetrics,\n} from \"./shell-metrics\"\nimport type {\n ShellFitInstanceId,\n ShellFitPanelBounds,\n ShellFitSeed,\n ShellFitState,\n} from \"./type\"\n\n/** An unmeasured shell. Zeroes read as \"no layout yet\", which the rule fails\n * open on rather than hiding a panel over a reading it never took. */\nconst NO_METRICS: ShellMetrics = {\n rail: 0,\n insetMin: 0,\n panelMin: 0,\n viewport: 0,\n chrome: 0,\n}\n\n/** A panel that mounts at `--panel-width`. */\nconst DEFAULT_SHELL_FIT_SEED: ShellFitSeed = { panelWidth: null }\n\nconst NO_BOUNDS: ShellFitPanelBounds = { min: 0, max: 0 }\n\n/**\n * A string-keyed atom family.\n *\n * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only\n * the string-keyed case with a `remove` — so this stays in-house rather than\n * adding `jotai-family` as a second Jotai package to keep version-aligned.\n * Dropping a key lets the store's WeakMap release that instance's state.\n */\ntype Family<AtomType> = ((id: ShellFitInstanceId) => AtomType) & {\n remove: (id: ShellFitInstanceId) => void\n}\n\n/** Every family, so `removeShellFitInstance` can drop an id from all of them. */\nconst families: { remove: (id: ShellFitInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ShellFitInstanceId) => AtomType) {\n const cache = new Map<ShellFitInstanceId, AtomType>()\n const family = ((id: ShellFitInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ShellFitInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ShellFitInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ShellFitInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `shell-fit/${id}/${name}`\n return instance\n })\n}\n\n/** The shell's own measurement of its columns. `useShellFit` is the only\n * writer; read `shellFitMeasuredAtom` to get it with the \"no layout yet\" case\n * already resolved. */\nexport const shellFitMetricsAtom = stateFamily<ShellMetrics>(\n \"metrics\",\n NO_METRICS\n)\n\n/** The width the user dragged to, before clamping — null while the panel sits\n * at `--panel-width`. Read `shellFitPanelWidthAtom` for the width the panel\n * actually renders at: clamping on read is what lets a narrowing viewport\n * pull the panel down without forgetting the width they asked for. */\nexport const shellFitRequestedWidthAtom = stateFamily<number | null>(\n \"requestedWidth\",\n null\n)\n\nconst shellFitSeedAtom = stateFamily<ShellFitSeed>(\n \"seed\",\n DEFAULT_SHELL_FIT_SEED\n)\nconst shellFitInitializedAtom = stateFamily<boolean>(\"initialized\", false)\n\n/** The metrics, or null when the shell has no layout to report — a server\n * render, a `display: none` host, a test with no layout engine. A zero is not\n * a width, and treating it as one would pin the panel to nothing. */\nexport const shellFitMeasuredAtom = readFamily<ShellMetrics | null>(\n \"measured\",\n (get, id) => {\n const metrics = get(shellFitMetricsAtom(id))\n return metrics.panelMin > 0 ? metrics : null\n }\n)\n\n/** Whether the shell can hold a secondary panel at all. */\nexport const shellFitFitsAtom = readFamily(\"fits\", (get, id) =>\n fitsPanel(get(shellFitMetricsAtom(id)))\n)\n\n/** The range a resize may land in. */\nexport const shellFitPanelBoundsAtom = readFamily<ShellFitPanelBounds>(\n \"panelBounds\",\n (get, id) => {\n const measured = get(shellFitMeasuredAtom(id))\n return measured ? panelBounds(measured) : NO_BOUNDS\n }\n)\n\n/** The width the secondary panel renders at, or null before the first\n * measurement, where the caller falls back to `--panel-width`. */\nexport const shellFitPanelWidthAtom = readFamily<number | null>(\n \"panelWidth\",\n (get, id) => {\n const measured = get(shellFitMeasuredAtom(id))\n if (!measured) return null\n const requested = get(shellFitRequestedWidthAtom(id))\n return clampPanelWidth(requested ?? measured.panelMin, measured)\n }\n)\n\n/** The whole fit of one shell. This changes on every measurement, so a\n * component that reads one field should subscribe to that field's atom\n * instead: `useAtomValue(shellFitFitsAtom(\"app-shell\"))`. */\nexport const shellFitStateAtom = readFamily<ShellFitState>(\n \"state\",\n (get, id) => ({\n metrics: get(shellFitMeasuredAtom(id)),\n fits: get(shellFitFitsAtom(id)),\n panelWidth: get(shellFitPanelWidthAtom(id)),\n bounds: get(shellFitPanelBoundsAtom(id)),\n })\n)\n\n/** @internal The measurement's way in. Silent, and inert when the numbers did\n * not move — a resize event that changes nothing must not re-render a shell. */\nexport const measureShellFitAtom = actionFamily<[metrics: ShellMetrics]>(\n \"measure\",\n (get, set, id, metrics) => {\n if (metricsEqual(get(shellFitMetricsAtom(id)), metrics)) return\n set(shellFitMetricsAtom(id), metrics)\n }\n)\n\n/** Resize the secondary panel. Clamped on the way in, so a drag past the\n * gutter parks at the bound instead of banking travel it has to give back —\n * and a caller with no idea how wide the shell is can still ask for 900. */\nexport const resizeShellPanelAtom = actionFamily<[width: number]>(\n \"resizePanel\",\n (get, set, id, width) => {\n const measured = get(shellFitMeasuredAtom(id))\n set(\n shellFitRequestedWidthAtom(id),\n measured ? clampPanelWidth(width, measured) : width\n )\n }\n)\n\n/** Back to the width the shell mounted with — `defaultPanelWidth`, or\n * `--panel-width` when there was none. */\nexport const resetShellPanelWidthAtom = actionFamily<[]>(\n \"resetPanelWidth\",\n (get, set, id) => {\n set(shellFitRequestedWidthAtom(id), get(shellFitSeedAtom(id)).panelWidth)\n }\n)\n\n/** @internal Seed the instance once. A seed describes the mount, not every\n * render, so a `defaultPanelWidth` that arrives later never overwrites a\n * width the user dragged to. */\nexport const mountShellFitAtom = actionFamily<[seed: ShellFitSeed]>(\n \"mount\",\n (get, set, id, seed) => {\n if (get(shellFitInitializedAtom(id))) return\n set(shellFitInitializedAtom(id), true)\n set(shellFitSeedAtom(id), seed)\n set(shellFitRequestedWidthAtom(id), seed.panelWidth)\n }\n)\n\n/** Drop every atom for `id`. `useShellFit` calls this on unmount for shells it\n * keyed itself; an explicit `shellId` is the app's key and outlives its\n * component, so a resized panel survives a route change. */\nexport function removeShellFitInstance(id: ShellFitInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport { useEffect, useId, useMemo, useRef, useState } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\nimport { useIsomorphicLayoutEffect } from \"motion/react\"\n\nimport {\n measureShellFitAtom,\n mountShellFitAtom,\n removeShellFitInstance,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitStateAtom,\n} from \"./shell-fit-atom\"\nimport { fitsPanel, type ShellMetrics } from \"./shell-metrics\"\nimport type {\n ShellFitController,\n ShellFitSeed,\n UseShellFitOptions,\n} from \"./type\"\nimport { resolveLength } from \"./utils\"\n\n/** Read the shell's columns out of the DOM. The widths come from CSS\n * variables; the rail's share comes from its own state, not its box, so a\n * fold counts the moment React commits it rather than a frame later when the\n * width animation has moved. */\nfunction readMetrics(host: HTMLElement, railOpen: boolean): ShellMetrics {\n // Whether a shell has a rail at all is the caller's composition, so it is\n // read off the DOM rather than tracked in state.\n const rail = host.querySelector<HTMLElement>(\n '[data-slot=\"sidebar\"][data-side=\"left\"]'\n )\n const collapsible = rail?.dataset.collapsible\n\n const frame = getComputedStyle(host)\n const gap = Number.parseFloat(frame.columnGap) || 0\n\n return {\n rail: !rail\n ? 0\n : railOpen || collapsible === \"none\"\n ? resolveLength(host, \"var(--sidebar-width)\")\n : collapsible === \"offcanvas\"\n ? 0\n : resolveLength(host, \"var(--sidebar-width-icon)\"),\n insetMin: resolveLength(host, \"var(--inset-min-width)\"),\n panelMin: resolveLength(host, \"var(--panel-width)\"),\n viewport: window.innerWidth,\n chrome:\n (Number.parseFloat(frame.paddingLeft) || 0) +\n (Number.parseFloat(frame.paddingRight) || 0) +\n gap * Math.max(0, host.children.length - 1),\n }\n}\n\n/**\n * Measures the shell and decides what the secondary panel may do: whether it\n * exists at all, and how wide it may be dragged.\n *\n * The three things that move the answer are all observed here — the viewport\n * (`resize`), the rail's fold (`railOpen`, a render input) and the user's own\n * drag (`resizePanel`) — so no caller has to re-derive it. The measurement is\n * the only thing this hook keeps to itself: the numbers land in the shell-fit\n * atoms keyed by `shellId`, so anything under `ExegiaProvider` can read the\n * verdict (`useShellFitState`) or move the panel (`useShellFitActions`)\n * without holding this controller.\n */\nexport function useShellFit({\n shellId: explicitId,\n hostRef,\n railOpen,\n defaultPanelWidth,\n onUnfit,\n}: UseShellFitOptions): ShellFitController {\n // A generated key isolates unnamed shells from each other; an explicit\n // `shellId` is the app's handle on this one.\n const generatedId = useId()\n const shellId = explicitId ?? generatedId\n\n // Read once: `defaultPanelWidth` describes the mount, not every render.\n const [seed] = useState<ShellFitSeed>(() => ({\n panelWidth: defaultPanelWidth ?? null,\n }))\n\n const mount = useSetAtom(mountShellFitAtom(shellId))\n const measure = useSetAtom(measureShellFitAtom(shellId))\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n const resetPanelWidth = useSetAtom(resetShellPanelWidthAtom(shellId))\n\n // Before paint, and before the first measurement below, so a seeded width\n // is in the store by the time the panel first reads its width.\n useIsomorphicLayoutEffect(() => {\n mount(seed)\n }, [mount, seed])\n\n // The listener below is bound once per fold, so the callback rides a ref\n // rather than rebinding it whenever a consumer passes a fresh arrow.\n const onUnfitRef = useRef(onUnfit)\n useIsomorphicLayoutEffect(() => {\n onUnfitRef.current = onUnfit\n })\n\n useIsomorphicLayoutEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n const takeMeasurement = () => {\n const next = readMetrics(host, railOpen)\n measure(next)\n if (!fitsPanel(next)) onUnfitRef.current?.()\n }\n\n // Measured before paint so a shell that cannot hold the panel never\n // flashes one, and re-measured on every fold because the rail's column is\n // part of the room the panel needs.\n takeMeasurement()\n window.addEventListener(\"resize\", takeMeasurement)\n return () => window.removeEventListener(\"resize\", takeMeasurement)\n }, [hostRef, railOpen, measure])\n\n // A shell the hook keyed is scrap once its component goes. An explicit\n // `shellId` is the app's key and outlives the mount — that is what lets a\n // dragged width survive a route change.\n useEffect(() => {\n if (explicitId !== undefined) return\n return () => removeShellFitInstance(shellId)\n }, [shellId, explicitId])\n\n const state = useAtomValue(shellFitStateAtom(shellId))\n\n return useMemo<ShellFitController>(\n () => ({ shellId, ...state, resizePanel, resetPanelWidth }),\n [shellId, state, resizePanel, resetPanelWidth]\n )\n}\n","import { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\"\nimport { useIsomorphicLayoutEffect, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils.ts\"\nimport type { AnimatedSidebarProviderProps, SidebarSide } from \"./type\"\nimport { useShellFit } from \"./use-shell-fit\"\nimport {\n AnimatedSidebarContext,\n SHELL_WIDTHS,\n SIDEBAR_KEYBOARD_SHORTCUT,\n useIsMobile,\n} from \"./utils\"\n\nexport function AnimatedPanelProvider({\n children,\n shellId,\n defaultPanelWidth,\n open,\n defaultOpen,\n onOpenChange,\n openMobile,\n defaultOpenMobile,\n onOpenMobileChange,\n onNarrowChange,\n // ShellLayout renders this; the bare provider only keeps it off the DOM.\n panelComponents: _panelComponents,\n className,\n style,\n ...props\n}: AnimatedSidebarProviderProps) {\n const [internalOpen, setInternalOpen] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpen?.left ?? true,\n right: defaultOpen?.right ?? false,\n }))\n const [internalOpenMobile, setInternalOpenMobile] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpenMobile?.left ?? false,\n right: defaultOpenMobile?.right ?? false,\n }))\n const isMobile = useIsMobile()\n const reduce = useReducedMotion() ?? false\n const generatedId = useId()\n const leftTriggerRef = useRef<HTMLButtonElement>(null)\n const rightTriggerRef = useRef<HTMLButtonElement>(null)\n const wrapperRef = useRef<HTMLDivElement>(null)\n // The narrow gate below is consulted by the setters, but the verdict comes\n // from `useShellFit` further down — which needs those very setters to retire\n // the panel. A ref unwinds the cycle: a setter only ever runs from an event,\n // by which time the layout effect has published the current verdict.\n const fitsRef = useRef(true)\n\n // Per-side controlled/uncontrolled merge — a side is controlled exactly\n // when its key is present on the controlled record.\n const controlledLeft = open?.left\n const controlledRight = open?.right\n const controlledMobileLeft = openMobile?.left\n const controlledMobileRight = openMobile?.right\n\n const openState = useMemo<Record<SidebarSide, boolean>>(\n () => ({\n left: controlledLeft ?? internalOpen.left,\n right: controlledRight ?? internalOpen.right,\n }),\n [controlledLeft, controlledRight, internalOpen]\n )\n const openMobileState = useMemo<Record<SidebarSide, boolean>>(\n () => ({\n left: controlledMobileLeft ?? internalOpenMobile.left,\n right: controlledMobileRight ?? internalOpenMobile.right,\n }),\n [controlledMobileLeft, controlledMobileRight, internalOpenMobile]\n )\n\n // The right panel is not on screen while the shell is too narrow to hold\n // it, so opening it would only ever surface later as a panel nobody asked\n // for. Closing always goes through — that is how state left over from a\n // wider viewport clears.\n const setOpen = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && !fitsRef.current) return\n\n const controlled = side === \"left\" ? controlledLeft : controlledRight\n if (controlled === undefined) {\n setInternalOpen((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n }\n onOpenChange?.(nextOpen, side)\n },\n [controlledLeft, controlledRight, onOpenChange]\n )\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && !fitsRef.current) return\n\n const controlled =\n side === \"left\" ? controlledMobileLeft : controlledMobileRight\n if (controlled === undefined) {\n setInternalOpenMobile((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n }\n onOpenMobileChange?.(nextOpen, side)\n },\n [controlledMobileLeft, controlledMobileRight, onOpenMobileChange]\n )\n\n const toggleSidebar = useCallback(\n (side: SidebarSide) => {\n if (isMobile) setOpenMobile(!openMobileState[side], side)\n else setOpen(!openState[side], side)\n },\n [isMobile, openMobileState, openState, setOpen, setOpenMobile]\n )\n\n const triggerRefs = useMemo(\n () => ({ left: leftTriggerRef, right: rightTriggerRef }),\n []\n )\n\n // A measurement that lands on \"no room\" retires the right panel's open\n // state instead of parking it: a panel that survived the crossing would\n // spring back the moment the viewport widened, long after the user asked\n // for it. Closing is the one write the narrow gate lets through, and the\n // guards keep a repeated verdict from re-reporting a panel already shut.\n //\n // It rides a ref so `useShellFit` can call the latest one from a listener\n // it bound once, and it is a layout effect declared FIRST so the ref is\n // filled before that listener takes its opening measurement.\n const retireRightPanelRef = useRef<() => void>(() => {})\n useIsomorphicLayoutEffect(() => {\n retireRightPanelRef.current = () => {\n if (openState.right) setOpen(false, \"right\")\n if (openMobileState.right) setOpenMobile(false, \"right\")\n }\n })\n const retireRightPanel = useCallback(() => retireRightPanelRef.current(), [])\n\n // Everything about the shell's columns — whether a secondary panel fits,\n // how wide it is, how far it may be dragged — lives in this one hook, and\n // in the shell-fit atoms it writes to under `shellId`. The rail's fold is an\n // input because its column is part of the room the panel needs.\n const fit = useShellFit({\n shellId,\n hostRef: wrapperRef,\n railOpen: openState.left,\n defaultPanelWidth,\n onUnfit: retireRightPanel,\n })\n const isNarrow = !fit.fits\n useIsomorphicLayoutEffect(() => {\n fitsRef.current = fit.fits\n })\n\n // The verdict has to travel up to whoever renders the provider —\n // useShellPanels, a title bar — since context only flows down. The\n // listener above is bound once, so the callback rides a ref rather than\n // rebinding it whenever a consumer passes a fresh arrow.\n const onNarrowChangeRef = useRef(onNarrowChange)\n useEffect(() => {\n onNarrowChangeRef.current = onNarrowChange\n })\n\n // Only real crossings are news: a resize that leaves the verdict alone is\n // silent, and so is the mount default the consumer already holds.\n const reportedNarrowRef = useRef(false)\n useEffect(() => {\n if (reportedNarrowRef.current === isNarrow) return\n reportedNarrowRef.current = isNarrow\n onNarrowChangeRef.current?.(isNarrow)\n }, [isNarrow])\n\n useEffect(() => {\n const handleShortcut = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault()\n toggleSidebar(\"left\")\n }\n }\n\n window.addEventListener(\"keydown\", handleShortcut)\n return () => window.removeEventListener(\"keydown\", handleShortcut)\n }, [toggleSidebar])\n\n return (\n <AnimatedSidebarContext.Provider\n value={{\n isMobile,\n fit,\n layoutId: `${generatedId}-active`,\n open: openState,\n openMobile: openMobileState,\n reduce,\n setOpen,\n setOpenMobile,\n toggleSidebar,\n triggerRefs,\n }}\n >\n <div\n {...props}\n ref={wrapperRef}\n data-slot=\"sidebar-wrapper\"\n data-narrow={isNarrow ? \"\" : undefined}\n data-state-left={openState.left ? \"expanded\" : \"collapsed\"}\n data-state-right={openState.right ? \"expanded\" : \"collapsed\"}\n style={{ ...SHELL_WIDTHS, ...style }}\n className={cn(\n \"group/sidebar-wrapper flex w-full min-w-0 gap-x-2\",\n className\n )}\n >\n {children}\n </div>\n </AnimatedSidebarContext.Provider>\n )\n}\n","import { forwardRef } from \"react\"\nimport { Button } from \"@/components/ui/button\"\nimport { useAnimatedSidebar } from \"./utils\"\nimport type { AnimatedSidebarTriggerProps } from \"./type\"\n\nexport const AnimatedPanelTrigger = forwardRef<\n HTMLButtonElement,\n AnimatedSidebarTriggerProps\n>(function AnimatedSidebarTrigger(\n { onClick, side = \"left\", type = \"button\", ...props },\n forwardedRef\n) {\n const context = useAnimatedSidebar()\n const expanded = context.isMobile\n ? context.openMobile[side]\n : context.open[side]\n const triggerRef = context.triggerRefs[side]\n\n // The right panel drops out of a viewport too narrow to hold it, so its\n // toggle would otherwise sit in the header driving nothing.\n if (side === \"right\" && !context.fit.fits) return null\n\n return (\n <Button\n {...props}\n ref={(node) => {\n triggerRef.current = node\n if (typeof forwardedRef === \"function\") forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }}\n type={type}\n variant=\"ghost\"\n size=\"icon-xl\"\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n aria-expanded={expanded}\n data-slot=\"sidebar-trigger\"\n data-side={side}\n data-state={expanded ? \"expanded\" : \"collapsed\"}\n onClick={(event) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n context.toggleSidebar(side)\n }}\n />\n )\n})\n","import { forwardRef } from \"react\"\nimport { motion } from \"motion/react\"\nimport { cn } from \"@/lib/utils.ts\"\nimport type { AnimatedSidebarInsetProps } from \"./type\"\n\nexport const AnimatedPanelInset = forwardRef<\n HTMLElement,\n AnimatedSidebarInsetProps\n>(function AnimatedSidebarInset({ className, ...props }, forwardedRef) {\n return (\n <motion.main\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-inset\"\n className={cn(\n // The body takes every column the panels leave (flex-1 = width 100%)\n // but never yields past its own floor: a resized panel may only take\n // the slack above --inset-min-width, and the shell drops the secondary\n // panel entirely once even that no longer fits.\n \"relative flex min-w-(--inset-min-width) flex-1 flex-col bg-neutral-50 dark:bg-neutral-900\",\n \"outline-offset-0.5 overflow-hidden border-t-3 border-white outline-neutral-100 dark:border-neutral-800 dark:inset-ring-black\",\n \"rounded-lg shadow-md shadow-neutral-200 dark:shadow-neutral-950\",\n className\n )}\n />\n )\n})\n","\"use client\"\n\nimport { MotionIcon } from \"motion-icons-react\"\nimport * as React from \"react\"\n\nimport { AnimatedPanel } from \"./animated-panel.tsx\"\nimport { cn } from \"@/lib/utils\"\nimport type { ShellLayoutProps, ShellPanelControlProps } from \"./type\"\nimport { TITLE_BAR_HEIGHT } from \"./utils\"\nimport type { ClassNameValue } from \"tailwind-merge\"\nimport { AnimatedPanelProvider } from \"./animated-panel-provider.tsx\"\nimport { AnimatedPanelTrigger } from \"./animated-panel-trigger.tsx\"\nimport { AnimatedPanelInset } from \"./animated-panel-inset.tsx\"\n\nexport function ShellLayout({\n children,\n variant = \"desktop\",\n panels,\n className,\n header,\n trailing,\n defaultOpen,\n panelComponents,\n ...panelControlProps\n}: ShellLayoutProps): React.ReactElement {\n const background: ClassNameValue = `bg-linear-to-tr/increasing from-neutral-200 via-neutral-100 to-stone-200 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950`\n\n // Content pushed through `openPanel(side, component)` wins over the static\n // `panels` entry; a side renders its panel when either supplies content.\n const leftContent = panelComponents?.left ?? panels?.left?.component\n const rightContent = panelComponents?.right ?? panels?.right?.component\n\n // Each panel seeds its own side's initial state (`defaultOpen ?? open`);\n // an explicit `defaultOpen` record — usually from useShellPanels — wins\n // per side.\n const initialOpen: ShellPanelControlProps[\"defaultOpen\"] = {\n ...(panels?.left && {\n left: panels.left.defaultOpen ?? true,\n }),\n ...(panels?.right && {\n right: panels.right.defaultOpen ?? false,\n }),\n ...defaultOpen,\n }\n\n return (\n <AnimatedPanelProvider\n {...panelControlProps}\n defaultOpen={initialOpen}\n className={cn(\n \"relative h-full min-h-0 px-2 pb-2\",\n variant === \"web\" && \"pt-2\",\n className,\n background\n )}\n style={{\n paddingTop: variant === \"desktop\" ? TITLE_BAR_HEIGHT : 0,\n }}\n >\n {leftContent && (\n <AnimatedPanel\n ariaLabel=\"Primary navigation\"\n collapsible=\"icon\"\n role=\"navigation\"\n variant=\"inset\"\n >\n {leftContent}\n </AnimatedPanel>\n )}\n\n <AnimatedPanelInset>\n <header className=\"flex h-12 flex-row! items-center justify-between gap-2 border-b px-2\">\n {leftContent && (\n <div className=\"flex min-w-0 shrink-0 items-center justify-start gap-2\">\n <AnimatedPanelTrigger side=\"left\">\n <MotionIcon name=\"PanelLeft\" size={24} animation=\"press\" />\n </AnimatedPanelTrigger>\n </div>\n )}\n {header && (\n <div className=\"flex min-w-0 flex-1 items-center\">{header}</div>\n )}\n {(trailing || rightContent) && (\n // ml-auto, not flex-fill: the cluster hugs the trailing edge even\n // when there is no header (or left trigger) to push against.\n <div className=\"ml-auto flex shrink-0 items-center justify-end gap-2\">\n {trailing}\n {rightContent && (\n <AnimatedPanelTrigger aria-label=\"Toggle panel\" side=\"right\">\n <MotionIcon\n className=\"opacity-70\"\n name=\"PanelRight\"\n size={24}\n />\n </AnimatedPanelTrigger>\n )}\n </div>\n )}\n </header>\n <div className=\"min-h-24 flex-1 overflow-auto\">{children}</div>\n </AnimatedPanelInset>\n\n {rightContent && (\n <AnimatedPanel\n ariaLabel={panels?.right?.name ?? \"Secondary panel\"}\n // Below md the panel is portal led over the page, so it carries the\n // surface itself; the desktop rail keeps it on the inner panel.\n className={cn(\n \"bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900\",\n \"outline-offset-0.5 border-t-3 border-white outline-neutral-100 dark:inset-ring-black\",\n \"rounded-lg shadow-md shadow-neutral-200 dark:shadow-neutral-950\"\n )}\n collapsible=\"offcanvas\"\n role=\"complementary\"\n side=\"right\"\n variant=\"inset\"\n >\n {rightContent}\n </AnimatedPanel>\n )}\n </AnimatedPanelProvider>\n )\n}\n","\"use client\"\n\nimport { useCallback, useEffect, useId, useMemo, useState } from \"react\"\nimport type { ReactNode } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n removeShellFitInstance,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitPanelWidthAtom,\n} from \"./shell-fit-atom\"\nimport type {\n ShellPanelControlProps,\n ShellPanelControls,\n SidebarComponentMap,\n SidebarSide,\n UseShellPanelsOptions,\n} from \"./type\"\n\n/**\n * Owns the open/close state of the shell's panels, keyed by side, and\n * reports every change through a single `onPanelChange(open, side)`\n * callback. Spread the returned `providerProps` onto ShellLayout; the\n * setters and `toggle` are for UI that lives outside the shell (title-bar\n * buttons, command palette, shortcuts).\n *\n * The way back down is the store: `providerProps` carries a `shellId`, the\n * shell files its measurement under it, and this hook reads `isNarrow` and\n * `panelWidth` straight out of those atoms — so outside UI stands down with\n * the panel instead of measuring `--sidebar-width` a second time. Name the\n * `shellId` and any component below `ExegiaProvider` can do the same with\n * `useShellFitState(shellId)`.\n *\n * Call it under the same `ExegiaProvider` as the shell it drives (or under\n * none at all, on both sides): mounted above the provider it would read\n * Jotai's default store while the shell writes to the provider's.\n */\nexport function useShellPanels({\n shellId: explicitId,\n defaultOpen,\n defaultOpenMobile,\n defaultPanelWidth,\n onPanelChange,\n}: UseShellPanelsOptions = {}): ShellPanelControls {\n // The hook, not the provider, keys the shell: it renders above the provider\n // and has to read the same atoms the provider writes. Whoever generates the\n // key drops it — the provider treats a passed-in id as the app's and leaves\n // it alone on unmount.\n const generatedId = useId()\n const shellId = explicitId ?? generatedId\n useEffect(() => {\n if (explicitId !== undefined) return\n return () => removeShellFitInstance(shellId)\n }, [shellId, explicitId])\n\n const [open, setOpenState] = useState<Record<SidebarSide, boolean>>(() => ({\n left: defaultOpen?.left ?? true,\n right: defaultOpen?.right ?? false,\n }))\n const [openMobile, setOpenMobileState] = useState<\n Record<SidebarSide, boolean>\n >(() => ({\n left: defaultOpenMobile?.left ?? false,\n right: defaultOpenMobile?.right ?? false,\n }))\n\n // Reads false until the shell has measured itself — an unmeasured shell\n // fails open, so nothing out here stands down over a reading that has not\n // happened yet.\n const fits = useAtomValue(shellFitFitsAtom(shellId))\n const isNarrow = !fits\n const panelWidth = useAtomValue(shellFitPanelWidthAtom(shellId))\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n\n // The shell drops the right panel when the viewport cannot hold it, so\n // opening it from out here would only surface later as a panel nobody\n // asked for. Closing always goes through — that is how state left over\n // from a wider viewport clears.\n const setOpen = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && isNarrow) return\n\n setOpenState((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n onPanelChange?.(nextOpen, side)\n },\n [isNarrow, onPanelChange]\n )\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean, side: SidebarSide) => {\n if (nextOpen && side === \"right\" && isNarrow) return\n\n setOpenMobileState((prev) =>\n prev[side] === nextOpen ? prev : { ...prev, [side]: nextOpen }\n )\n onPanelChange?.(nextOpen, side)\n },\n [isNarrow, onPanelChange]\n )\n\n const toggle = useCallback(\n (side: SidebarSide) => setOpen(!open[side], side),\n [open, setOpen]\n )\n\n // The content sticks even when the open is refused (too narrow): it is\n // what the panel shows whenever it next gets to open, not a one-shot.\n const [panelComponents, setPanelComponents] = useState<SidebarComponentMap>(\n {}\n )\n const openPanel = useCallback(\n (side: SidebarSide, component?: ReactNode) => {\n if (component !== undefined) {\n setPanelComponents((prev) =>\n prev[side] === component ? prev : { ...prev, [side]: component }\n )\n }\n setOpen(true, side)\n },\n [setOpen]\n )\n\n const providerProps = useMemo<ShellPanelControlProps>(\n () => ({\n shellId,\n defaultPanelWidth,\n open,\n onOpenChange: setOpen,\n openMobile,\n onOpenMobileChange: setOpenMobile,\n panelComponents,\n }),\n [\n shellId,\n defaultPanelWidth,\n open,\n openMobile,\n setOpen,\n setOpenMobile,\n panelComponents,\n ]\n )\n\n return {\n shellId,\n isNarrow,\n panelWidth,\n resizePanel,\n open,\n openMobile,\n setOpen,\n setOpenMobile,\n toggle,\n openPanel,\n providerProps,\n }\n}\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitStateAtom,\n} from \"./shell-fit-atom\"\nimport type { ShellFitActions, ShellFitInstanceId, ShellFitState } from \"./type\"\n\n/**\n * Read the fit of the shell registered under `shellId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { fits, panelWidth } = useShellFitState(\"app-shell\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on every\n * measurement. A component that reads one field should subscribe to that\n * field's atom instead: `useAtomValue(shellFitFitsAtom(\"app-shell\"))`.\n */\nexport function useShellFitState(shellId: ShellFitInstanceId): ShellFitState {\n return useAtomValue(shellFitStateAtom(shellId))\n}\n\n/**\n * Drive the secondary panel of the shell registered under `shellId` from\n * anywhere. Writes only — the caller never re-renders when the shell moves,\n * so this is what a command palette or a keyboard shortcut should reach for.\n *\n * ```tsx\n * const shell = useShellFitActions(\"app-shell\")\n * <Button onClick={() => shell.resizePanel(480)}>Wide inspector</Button>\n * ```\n */\nexport function useShellFitActions(\n shellId: ShellFitInstanceId\n): ShellFitActions {\n const resizePanel = useSetAtom(resizeShellPanelAtom(shellId))\n const resetPanelWidth = useSetAtom(resetShellPanelWidthAtom(shellId))\n\n return useMemo(\n () => ({ resizePanel, resetPanelWidth }),\n [resizePanel, resetPanelWidth]\n )\n}\n","/** Icon-rail width in px (the rail sits directly on the desktop backdrop). */\nexport const SCAFFOLD_SIDEBAR_WIDTH = 64\n\n/** Inspector drawer width in px. */\nexport const SCAFFOLD_INSPECTOR_WIDTH = 272\n\n/** Most panels the canvas holds at once — omit Actions' `onAdd` when the\n * count reaches it so the Add segment hides. */\nexport const SCAFFOLD_PANEL_CAPACITY = 3\n\n/** Narrowest a panel may render, in px. When the canvas can't grant every\n * panel this width, the scaffold hides panels until the rest fit. */\nexport const SCAFFOLD_PANEL_MIN_WIDTH = 320\n\n/** Gap in px between side-by-side panels on the canvas (`gap-2`). */\nexport const SCAFFOLD_CANVAS_GAP = 8\n\n/** Gap in px between the drawer/actions and the viewport edges. */\nexport const SCAFFOLD_EDGE_GUTTER = 10\n\n/** Vertical room in px reserved above the canvas for the actions cluster. */\nexport const SCAFFOLD_HEADER_HEIGHT = 52\n\n/** Height in px of a panel's secondary strip. */\nexport const SCAFFOLD_SECONDARY_HEIGHT = 52\n\n/** Gap in px between a panel's primary surface and its secondary strip. */\nexport const SCAFFOLD_PANEL_GAP = 10\n\n/** How long the seam menu lingers expanded after the pointer leaves it (ms)\n * before it collapses back to the compact toggle. The timer keeps counting\n * even when the pointer leaves the window entirely. */\nexport const SCAFFOLD_MENU_COLLAPSE_DELAY = 4000\n\n/** Morph duration in seconds for drawer slides and panel layout shifts. */\nexport const SCAFFOLD_MORPH_DURATION = 0.3\n\n/** `--ease-smooth-out` as a motion/react easing tuple. */\nexport const SCAFFOLD_EASE = [0.22, 1, 0.36, 1] as const\n","import type { Variants } from \"motion/react\"\nimport type { ClassNameValue } from \"tailwind-merge\"\nimport type {\n ScaffoldPanelVisibility,\n TSubPanelVariant,\n} from \"@/components/blocks/scaffold/type.ts\"\nimport { EASE_OUT } from \"@/lib/ease.ts\"\nimport {\n SCAFFOLD_CANVAS_GAP,\n SCAFFOLD_PANEL_CAPACITY,\n SCAFFOLD_PANEL_MIN_WIDTH,\n} from \"./constants\"\n\n/**\n * How many panels fit on a canvas of `width` px, granting each\n * `SCAFFOLD_PANEL_MIN_WIDTH` plus the gaps between them. Clamped to\n * [1, SCAFFOLD_PANEL_CAPACITY]; an unmeasured canvas (`null`) fits the cap.\n */\nexport function getPanelCapacity(width: number | null): number {\n if (width === null) return SCAFFOLD_PANEL_CAPACITY\n const fits = Math.floor(\n (width + SCAFFOLD_CANVAS_GAP) /\n (SCAFFOLD_PANEL_MIN_WIDTH + SCAFFOLD_CANVAS_GAP)\n )\n return Math.max(1, Math.min(SCAFFOLD_PANEL_CAPACITY, fits))\n}\n\n/** @internal An untracked scaffold: nothing registered, nothing hidden. */\nexport const EMPTY_SCAFFOLD_VISIBILITY: ScaffoldPanelVisibility = {\n visibleOrder: [],\n autoHidden: [],\n userHidden: [],\n}\n\n/**\n * @internal Fold the registered ids and current capacity into a settled\n * visibility: prune departed panels, admit new ones, evict the\n * least-recently-activated visible panels past capacity, and restore\n * auto-hidden ones when room returns. Returns `prev` untouched when nothing\n * changes, so callers can compare identities instead of contents.\n */\nexport function reconcileVisibility(\n prev: ScaffoldPanelVisibility,\n ids: readonly string[],\n capacity: number\n): ScaffoldPanelVisibility {\n const known = new Set(ids)\n const visibleOrder = prev.visibleOrder.filter((id) => known.has(id))\n const autoHidden = prev.autoHidden.filter((id) => known.has(id))\n const userHidden = prev.userHidden.filter((id) => known.has(id))\n\n const tracked = new Set([...visibleOrder, ...autoHidden, ...userHidden])\n for (const id of ids) if (!tracked.has(id)) visibleOrder.push(id)\n\n while (visibleOrder.length > capacity && visibleOrder.length > 1) {\n autoHidden.push(visibleOrder.shift() as string)\n }\n while (visibleOrder.length < capacity && autoHidden.length > 0) {\n visibleOrder.push(autoHidden.pop() as string)\n }\n\n const unchanged =\n visibleOrder.join(\" \") === prev.visibleOrder.join(\" \") &&\n autoHidden.join(\" \") === prev.autoHidden.join(\" \") &&\n userHidden.join(\" \") === prev.userHidden.join(\" \")\n return unchanged ? prev : { visibleOrder, autoHidden, userHidden }\n}\n\n/** Desktop backdrop the whole scaffold sits on — a soft warm-gray wash. */\nexport const scaffoldBackgroundClass: ClassNameValue =\n \"bg-linear-to-tr/increasing from-neutral-400 via-stone-200 to-neutral-300 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950\"\n\n/** Card surface shared by a panel's primary area and secondary strip. */\nexport const panelSurfaceClass: ClassNameValue =\n \"rounded-2xl bg-slate-100 inset-ring-1 inset-ring-white/60 dark:bg-neutral-900 dark:inset-ring-white/5\"\n\n/** Floating icon button hovering over a panel (close, swap). */\nexport const floatingButtonClass: ClassNameValue =\n \"transition-[opacity,scale,box-shadow] duration-200 ease-smooth-out hover:text-neutral-900 hover:shadow-md active:scale-97 dark:bg-neutral-800/95 dark:text-neutral-300 dark:inset-ring-white/10 dark:hover:text-white motion-reduce:transition-none motion-reduce:active:scale-100 z-20\"\n\n/** Hidden until the pointer rests on the panel (always shown for touch and\n * while focused) — the affordances stay quiet until the panel is engaged. */\nexport const revealOnPanelHoverClass: ClassNameValue =\n \"opacity-0 scale-95 group-hover/panel:opacity-100 group-hover/panel:scale-100 focus-visible:opacity-100 focus-visible:scale-100 pointer-coarse:opacity-100 pointer-coarse:scale-100\"\n\n/** Pill segment inside the actions cluster (Add, browse). */\nexport const actionSegmentClass: ClassNameValue =\n \"flex h-[30px] items-center rounded-full text-neutral-700 transition-[background-color,color,scale,box-shadow] duration-150 ease-smooth-out hover:bg-white hover:text-neutral-900 hover:shadow-xs active:scale-97 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:hover:text-white motion-reduce:transition-none motion-reduce:active:scale-100\"\n\n/** Pill segments (seam-menu actions, tabs, Add) blur/fade in place while\n * the track morphs around them. The exit is a fast tween, not the layout\n * spring — the track stays overflow-visible, so popped-out segments must be\n * gone before the shrinking pill leaves them behind as a ghost. */\nexport const segmentVariants: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: {\n opacity: 0,\n filter: \"blur(4px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n}\n\n/** Map of sub-panel variants to their corresponding side. */\nexport const subPanelVariant: Record<TSubPanelVariant, ClassNameValue> = {\n card: \"bg-neutral-50 dark:bg-neutral-900 rounded-md border-t border-b border-t-white dark:border-t-neutral-700/50 border-b-neutral-900/10 dark:border-b-black/70 shadow-sm shadow-neutral-900/10 dark:shadow-black/50 inset-shadow-sm inset-shadow-white dark:inset-shadow-neutral-800\",\n subtle: \"bg-neutral-100 dark:bg-neutral-800\",\n inset: \"bg-neutral-200 dark:bg-neutral-700\",\n} as const\n","\"use client\"\n\nimport { RiCloseLine } from \"@remixicon/react\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { PanelFloatingButtonProps } from \"./type\"\nimport { floatingButtonClass, revealOnPanelHoverClass } from \"./utils\"\n\n/** Floating close affordance in a panel's top-right corner. */\nexport function PanelCloseButton({\n onClick,\n label,\n sound = true,\n className,\n}: PanelFloatingButtonProps): React.ReactElement {\n return (\n <button\n id=\"scaffold-panel-close-button\"\n aria-label={label}\n className={cn(\n floatingButtonClass,\n revealOnPanelHoverClass,\n \"absolute top-4 right-3.5 z-10\",\n className\n )}\n data-cuelume-press={sound ? \"\" : undefined}\n data-cuelume-release={sound ? \"\" : undefined}\n data-slot=\"scaffold-panel-close\"\n onClick={onClick}\n type=\"button\"\n >\n <RiCloseLine aria-hidden className=\"size-4\" />\n </button>\n )\n}\n","import { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { motion, type HTMLMotionProps } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Separator } from \"@/components/ui/separator\"\n\nconst buttonGroupVariants = cva(\n \"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0\",\n vertical:\n \"flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: HTMLMotionProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <motion.div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\">) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"button-group-text\",\n },\n })\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n","\"use client\"\n\nimport {\n type FrostGlassVariantProp,\n glassVariantStyles,\n} from \"@/lib/glass-variants\"\nimport { cn } from \"@/lib/utils\"\n\nimport { ButtonGroup } from \"../button-group\"\nimport { LiquidGlass } from \"./liquid-glass\"\n\ntype GlassButtonGroupProps = React.ComponentProps<typeof ButtonGroup> &\n FrostGlassVariantProp\n\nfunction GlassButtonGroup({\n className,\n glassVariant = \"liquid-refract\",\n children,\n ...props\n}: GlassButtonGroupProps) {\n if (glassVariant === \"liquid-refract\") {\n return (\n <LiquidGlass className={cn(\"\", className)}>\n <ButtonGroup\n data-slot=\"glass-button-group\"\n data-glass-variant={glassVariant}\n className={cn(\"bg-transparent\", className)}\n {...props}\n >\n {children}\n </ButtonGroup>\n </LiquidGlass>\n )\n }\n\n return (\n <ButtonGroup\n data-slot=\"glass-button-group\"\n data-glass-variant={glassVariant}\n className={cn(\"rounded-lg\", glassVariantStyles[glassVariant], className)}\n {...props}\n >\n {children}\n </ButtonGroup>\n )\n}\n\nexport { GlassButtonGroup }\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Returns true only on devices that have a true hover (mouse / trackpad).\n * Touch devices fire phantom `:hover` on tap that sticks until tap-elsewhere\n * — gate hover-only effects (scale lifts, magnetic pulls) behind this.\n */\nexport function useHoverCapable() {\n const [canHover, setCanHover] = useState(false);\n\n useEffect(() => {\n if (typeof window === \"undefined\" || !window.matchMedia) return;\n const mq = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n const update = () => setCanHover(mq.matches);\n update();\n mq.addEventListener?.(\"change\", update);\n return () => mq.removeEventListener?.(\"change\", update);\n }, []);\n\n return canHover;\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { More } from \"iconsax-reactjs\"\nimport { LucideArrowUpDown, LucideChevronDown, LucideX } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { PanelMenuButtonProps } from \"./type\"\nimport { floatingButtonClass, revealOnPanelHoverClass } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { GlassButtonGroup } from \"@/components/ui/glasscn/glass-button-group.tsx\"\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\"\nimport { SCAFFOLD_MENU_COLLAPSE_DELAY } from \"./constants\"\n\n/** One side of the seam menu. Both sides stay mounted; the pill morphs by\n * collapsing one side's grid column to 0fr while the other grows — pure\n * CSS, driven by `data-expanded` on the group. The hidden side is inert\n * and aria-hidden so it can't be clicked, focused or found by queries. */\nconst menuCellClass =\n \"grid transition-[grid-template-columns,opacity] duration-300 ease-smooth-out motion-reduce:transition-none\"\n\n/**\n * Floating menu affordance centered on the seam between a panel's primary\n * surface and its secondary strip: a compact ⋯ toggle that morphs into the\n * Expand | Swap (| Close) actions.\n */\nexport function PanelMenuButton({\n onClick,\n onExpand,\n onCloseSecondary,\n secondaryExpanded = false,\n swapped = false,\n label,\n sound = true,\n className,\n}: PanelMenuButtonProps): React.ReactElement {\n const canHover = useHoverCapable()\n const actionsId = React.useId()\n const groupRef = React.useRef<HTMLDivElement>(null)\n const actionsRef = React.useRef<HTMLDivElement>(null)\n const [expanded, setExpanded] = React.useState(false);\n\n const collapseTimerRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)\n const suppressHoverOpenUntilRef = React.useRef(0)\n const focusActionsOnOpenRef = React.useRef(false)\n\n React.useEffect(() => () => clearTimeout(collapseTimerRef.current), [])\n\n const cancelCollapse = React.useCallback(() => {\n clearTimeout(collapseTimerRef.current)\n }, [])\n\n // Arms when the pointer stops hovering the group: the menu lingers for the\n // grace period, then collapses — unless the pointer (or focus) came back.\n const armCollapse = React.useCallback(() => {\n if (!canHover) return\n clearTimeout(collapseTimerRef.current)\n collapseTimerRef.current = setTimeout(() => {\n // Focus keeps the menu open — don't collapse under the keyboard.\n if (groupRef.current?.contains(document.activeElement)) return\n setExpanded(false)\n }, SCAFFOLD_MENU_COLLAPSE_DELAY)\n }, [canHover])\n\n // The grace period must keep counting when the pointer leaves the whole\n // app — leaving the window can skip the group's own pointerleave, so arm\n // on viewport exit and window blur as well.\n React.useEffect(() => {\n if (!expanded || !canHover) return\n const root = document.documentElement\n root.addEventListener(\"pointerleave\", armCollapse)\n window.addEventListener(\"blur\", armCollapse)\n return () => {\n root.removeEventListener(\"pointerleave\", armCollapse)\n window.removeEventListener(\"blur\", armCollapse)\n }\n }, [expanded, canHover, armCollapse])\n\n // Click-opens replace the toggle with the actions — hand focus over so\n // keyboard users aren't dropped onto an inert control.\n React.useEffect(() => {\n if (!expanded || !focusActionsOnOpenRef.current) return\n focusActionsOnOpenRef.current = false\n actionsRef.current?.querySelector<HTMLButtonElement>(\"button\")?.focus()\n }, [expanded])\n\n const collapse = () => {\n // The shrinking toggle can glide under a resting cursor and hover-reopen\n // the menu it just closed — ignore hover-opens until it has settled.\n suppressHoverOpenUntilRef.current = Date.now() + 600\n setExpanded(false)\n }\n\n // Acting collapses the menu — the pill returns to the compact toggle.\n const handleAction = (action?: () => void) => {\n action?.()\n collapse()\n }\n\n // Click open — the touch and keyboard path.\n const handleOnExpand = () => {\n if (groupRef.current?.contains(document.activeElement)) {\n focusActionsOnOpenRef.current = true\n }\n setExpanded(true)\n }\n\n // Hover on the toggle opens the menu (hover-capable devices only — touch\n // and keyboard go through the click toggle).\n const handleToggleHover = () => {\n if (!canHover || Date.now() < suppressHoverOpenUntilRef.current) return\n cancelCollapse()\n setExpanded(true)\n }\n\n return (\n <GlassButtonGroup\n ref={groupRef}\n onPointerEnter={cancelCollapse}\n onPointerLeave={armCollapse}\n glassVariant=\"subtle\"\n data-expanded={expanded ? \"\" : undefined}\n className={cn(\n floatingButtonClass,\n revealOnPanelHoverClass,\n \"group/menu absolute top-1/2 z-10 -translate-y-1/2\",\n className\n )}\n >\n <div\n aria-hidden={expanded || undefined}\n inert={expanded || undefined}\n className={cn(\n menuCellClass,\n \"grid-cols-[1fr] opacity-100 group-data-expanded/menu:grid-cols-[0fr] group-data-expanded/menu:opacity-0\"\n )}\n >\n <div className=\"flex min-w-0 overflow-hidden\">\n <Button\n id=\"scaffold-panel-menu-toggle-button\"\n aria-label={label}\n aria-expanded={expanded}\n aria-controls={actionsId}\n size=\"icon-sm\"\n variant=\"ghost\"\n sound={sound}\n // The hidden Expand|Swap|Close side stretches the pill to the sm\n // button height — match it so the collapsed toggle stays square.\n className=\"size-8 sm:size-7\"\n data-slot=\"scaffold-panel-menu-toggle\"\n onClick={handleOnExpand}\n onPointerEnter={handleToggleHover}\n >\n <More size={16} />\n </Button>\n </div>\n </div>\n <div\n id={actionsId}\n ref={actionsRef}\n aria-hidden={!expanded || undefined}\n inert={!expanded || undefined}\n className={cn(\n menuCellClass,\n \"grid-cols-[0fr] opacity-0 group-data-expanded/menu:grid-cols-[1fr] group-data-expanded/menu:opacity-100\"\n )}\n >\n <div className=\"flex min-w-0 overflow-hidden\">\n <Button\n id=\"scaffold-panel-menu-expand\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-expand\"\n className=\"rounded-r-none\"\n onClick={() => handleAction(onExpand)}\n >\n {/* Points at the sub-panel that grows next, in VISUAL space —\n a swapped panel is column-reverse, so the direction mirrors.\n Button's [&_svg]:transition-transform eases the flip. */}\n <LucideChevronDown\n size={16}\n className={cn(secondaryExpanded !== swapped && \"rotate-180\")}\n />\n Expand\n </Button>\n <Button\n id=\"scaffold-panel-menu-swap\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-swap\"\n className={cn(\n \"border-l-0\",\n onCloseSecondary ? \"rounded-none\" : \"rounded-l-none\"\n )}\n onClick={() => handleAction(onClick)}\n >\n <LucideArrowUpDown size={16} />\n Swap\n </Button>\n {onCloseSecondary && (\n <Button\n id=\"scaffold-panel-menu-close\"\n size=\"sm\"\n variant=\"ghost\"\n sound={sound}\n data-slot=\"scaffold-panel-menu-close\"\n className=\"rounded-l-none border-l-0\"\n onClick={() => handleAction(onCloseSecondary)}\n >\n <LucideX size={16} />\n Close\n </Button>\n )}\n </div>\n </div>\n </GlassButtonGroup>\n )\n}\n","/**\n * Scaffold state — Jotai atom families keyed by a scaffold id.\n *\n * Same layout as the tree (`components/composed/tree/tree-atom.ts`), the\n * shell (`blocks/shell/shell-fit-atom.ts`) and the profile card: in-house\n * `keyed()` families per field, write-only action atoms, a composed\n * read-only state atom, and `removeScaffoldInstance` to drop an id from\n * every family.\n *\n * The visibility bookkeeping (`visibleOrder` / `autoHidden` / `userHidden`)\n * stays one atom on purpose — `reconcileVisibility` always settles the three\n * lists together, so splitting them would only invite half-written states.\n * The reconcile rule itself lives in `utils.ts`, and every action that moves\n * an input (ids, capacity, a toggle) settles the visibility before it\n * returns, so readers never see an interim state — the render-time settling\n * the old `usePanelVisibility` hook needed has no equivalent here.\n */\n\nimport { atom } from \"jotai\"\nimport type { Atom, Getter, Setter } from \"jotai\"\n\nimport { SCAFFOLD_PANEL_CAPACITY } from \"./constants\"\nimport type {\n ScaffoldConfig,\n ScaffoldHandlers,\n ScaffoldInstanceId,\n ScaffoldPanelVisibility,\n ScaffoldState,\n} from \"./type\"\nimport {\n EMPTY_SCAFFOLD_VISIBILITY,\n getPanelCapacity,\n reconcileVisibility,\n} from \"./utils\"\n\nconst DEFAULT_CONFIG: ScaffoldConfig = { controlsInspector: false }\nconst NO_HANDLERS: ScaffoldHandlers = {}\nconst NO_PANEL_IDS: readonly string[] = []\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: ScaffoldInstanceId) => AtomType) & {\n remove: (id: ScaffoldInstanceId) => void\n}\n\nconst families: { remove: (id: ScaffoldInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ScaffoldInstanceId) => AtomType) {\n const cache = new Map<ScaffoldInstanceId, AtomType>()\n const family = ((id: ScaffoldInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ScaffoldInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ScaffoldInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ScaffoldInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `scaffold/${id}/${name}`\n return instance\n })\n}\n\n/** A family keyed by scaffold AND panel, so a tab or a panel subscribes to\n * its own boolean and sits still when a sibling's changes — the per-node\n * rule from the tree, at panel scale. Removal drops a whole scaffold. */\nfunction panelFamily<Value>(\n name: string,\n read: (get: Getter, id: ScaffoldInstanceId, panelId: string) => Value\n) {\n const cache = new Map<ScaffoldInstanceId, Map<string, Atom<Value>>>()\n const family = (id: ScaffoldInstanceId, panelId: string): Atom<Value> => {\n let panels = cache.get(id)\n if (panels === undefined) {\n panels = new Map()\n cache.set(id, panels)\n }\n let instance = panels.get(panelId)\n if (instance === undefined) {\n const created = atom((get) => read(get, id, panelId))\n created.debugLabel = `scaffold/${id}/${panelId}/${name}`\n panels.set(panelId, created)\n instance = created\n }\n return instance\n }\n families.push({\n remove: (id: ScaffoldInstanceId) => {\n cache.delete(id)\n },\n })\n return family\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\nexport const scaffoldInspectorOpenAtom = stateFamily<boolean>(\n \"inspectorOpen\",\n false\n)\n\n/** @internal The canvas's ordered panel ids, as registered each render. */\nexport const scaffoldPanelIdsAtom = stateFamily<readonly string[]>(\n \"panelIds\",\n NO_PANEL_IDS\n)\n\n/** @internal The capacity derived from the canvas's measured width — the\n * derived number is stored, not the raw width, so resize storms only touch\n * the store when a panel actually gains or loses room. */\nexport const scaffoldMeasuredCapacityAtom = stateFamily<number | null>(\n \"measuredCapacity\",\n null\n)\n\n/** @internal The three visibility lists, settled as one value. */\nexport const scaffoldVisibilityAtom = stateFamily<ScaffoldPanelVisibility>(\n \"visibility\",\n EMPTY_SCAFFOLD_VISIBILITY\n)\n\nexport const scaffoldHoveredPanelIdAtom = stateFamily<string | null>(\n \"hoveredPanelId\",\n null\n)\n\n/** @internal */\nexport const scaffoldConfigAtom = stateFamily<ScaffoldConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n/** @internal */\nexport const scaffoldHandlersAtom = stateFamily<ScaffoldHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\n/** How many panels fit side by side; the cap while the canvas is unmeasured. */\nexport const scaffoldPanelCapacityAtom = readFamily(\n \"panelCapacity\",\n (get, id) =>\n get(scaffoldMeasuredCapacityAtom(id)) ?? SCAFFOLD_PANEL_CAPACITY\n)\n\n/** Ids of panels currently hidden (auto + user), for tabs to reflect. */\nexport const scaffoldHiddenPanelIdsAtom = readFamily<readonly string[]>(\n \"hiddenPanelIds\",\n (get, id) => {\n const visibility = get(scaffoldVisibilityAtom(id))\n return [...visibility.autoHidden, ...visibility.userHidden]\n }\n)\n\n/** Whether one panel is hidden. A tab subscribes here and sits still while\n * its siblings toggle. Empty `panelId` (a tab without one) reads false. */\nexport const scaffoldPanelHiddenAtom = panelFamily(\n \"hidden\",\n (get, id, panelId) => {\n if (panelId === \"\") return false\n const visibility = get(scaffoldVisibilityAtom(id))\n return (\n visibility.autoHidden.includes(panelId) ||\n visibility.userHidden.includes(panelId)\n )\n }\n)\n\n/** Whether one panel fades back while another panel's tab holds the\n * spotlight. Moving the hover between two tabs re-renders those panels\n * only — everyone else's boolean holds. */\nexport const scaffoldPanelDimmedAtom = panelFamily(\n \"dimmed\",\n (get, id, panelId) => {\n if (panelId === \"\") return false\n const hovered = get(scaffoldHoveredPanelIdAtom(id))\n return hovered !== null && hovered !== panelId\n }\n)\n\n/** The whole state of one scaffold. This changes on every hover move, so a\n * component that reads one field should subscribe to that field's atom\n * instead: `useAtomValue(scaffoldInspectorOpenAtom(\"workspace\"))`. */\nexport const scaffoldStateAtom = readFamily<ScaffoldState>(\n \"state\",\n (get, id) => ({\n inspectorOpen: get(scaffoldInspectorOpenAtom(id)),\n panelCapacity: get(scaffoldPanelCapacityAtom(id)),\n hiddenPanelIds: get(scaffoldHiddenPanelIdsAtom(id)),\n hoveredPanelId: get(scaffoldHoveredPanelIdAtom(id)),\n })\n)\n\n// ── visibility settling ────────────────────────────────────────────────────\n\n/** Re-settle the lists after any input moved. Inert when nothing changes —\n * `reconcileVisibility` returns `prev` untouched then. */\nfunction settleVisibility(get: Getter, set: Setter, id: ScaffoldInstanceId) {\n const prev = get(scaffoldVisibilityAtom(id))\n const settled = reconcileVisibility(\n prev,\n get(scaffoldPanelIdsAtom(id)),\n get(scaffoldPanelCapacityAtom(id))\n )\n if (settled !== prev) set(scaffoldVisibilityAtom(id), settled)\n}\n\n// ── actions: inspector ─────────────────────────────────────────────────────\n\n/** Reports through `onInspectorOpenChange` always; writes the store only\n * when no `inspectorOpen` prop controls the root — the prop is truth then. */\nexport const setScaffoldInspectorOpenAtom = actionFamily<[open: boolean]>(\n \"setInspectorOpen\",\n (get, set, id, open) => {\n if (get(scaffoldInspectorOpenAtom(id)) === open) return\n if (!get(scaffoldConfigAtom(id)).controlsInspector)\n set(scaffoldInspectorOpenAtom(id), open)\n get(scaffoldHandlersAtom(id)).onInspectorOpenChange?.(open)\n }\n)\n\nexport const toggleScaffoldInspectorAtom = actionFamily<[]>(\n \"toggleInspector\",\n (get, set, id) => {\n set(setScaffoldInspectorOpenAtom(id), !get(scaffoldInspectorOpenAtom(id)))\n }\n)\n\n// ── actions: panels ────────────────────────────────────────────────────────\n\n/** Show/hide an id'd panel. Showing past capacity auto-hides the\n * least-recently-activated visible panel; the last visible one never hides. */\nexport const toggleScaffoldPanelAtom = actionFamily<[panelId: string]>(\n \"togglePanel\",\n (get, set, id, panelId) => {\n const ids = get(scaffoldPanelIdsAtom(id))\n if (!ids.includes(panelId)) return\n const prev = get(scaffoldVisibilityAtom(id))\n const hidden =\n prev.autoHidden.includes(panelId) || prev.userHidden.includes(panelId)\n if (!hidden && prev.visibleOrder.length <= 1) return\n\n const next: ScaffoldPanelVisibility = hidden\n ? {\n // Showing: newest activation — reconcile evicts the oldest\n // visible panel if the canvas can't fit one more.\n visibleOrder: [...prev.visibleOrder, panelId],\n autoHidden: prev.autoHidden.filter((other) => other !== panelId),\n userHidden: prev.userHidden.filter((other) => other !== panelId),\n }\n : {\n visibleOrder: prev.visibleOrder.filter((other) => other !== panelId),\n autoHidden: prev.autoHidden,\n userHidden: [...prev.userHidden, panelId],\n }\n set(\n scaffoldVisibilityAtom(id),\n reconcileVisibility(next, ids, get(scaffoldPanelCapacityAtom(id)))\n )\n }\n)\n\n/** @internal Tabs report pointer enter/leave on their label. Leaving clears\n * only its own id — a tab that unmounts mid-hover must not wipe out a hover\n * the pointer has already moved on to. */\nexport const setScaffoldPanelHoveredAtom = actionFamily<\n [panelId: string, hovered: boolean]\n>(\"setPanelHovered\", (get, set, id, panelId, hovered) => {\n const prev = get(scaffoldHoveredPanelIdAtom(id))\n if (hovered) {\n if (prev !== panelId) set(scaffoldHoveredPanelIdAtom(id), panelId)\n return\n }\n if (prev === panelId) set(scaffoldHoveredPanelIdAtom(id), null)\n})\n\n/** @internal Canvas reports its ordered panel ids each render. Inert when\n * the ids did not move; otherwise the visibility settles in the same write. */\nexport const registerScaffoldPanelIdsAtom = actionFamily<\n [ids: readonly string[]]\n>(\"registerPanelIds\", (get, set, id, ids) => {\n const prev = get(scaffoldPanelIdsAtom(id))\n if (prev.length === ids.length && prev.every((v, i) => v === ids[i])) return\n set(scaffoldPanelIdsAtom(id), [...ids])\n settleVisibility(get, set, id)\n})\n\n/** @internal Canvas reports its measured width. Only the derived capacity is\n * stored, so resize storms settle to at most one visibility change. */\nexport const measureScaffoldCanvasAtom = actionFamily<[width: number]>(\n \"measureCanvas\",\n (get, set, id, width) => {\n const capacity = getPanelCapacity(width)\n if (get(scaffoldMeasuredCapacityAtom(id)) === capacity) return\n set(scaffoldMeasuredCapacityAtom(id), capacity)\n settleVisibility(get, set, id)\n }\n)\n\n// ── internal projections ───────────────────────────────────────────────────\n\n/** @internal Projection of the mounted root's controlled props. */\nexport const projectScaffoldPropsAtom = actionFamily<\n [config: ScaffoldConfig, inspectorOpen: boolean | undefined]\n>(\"projectProps\", (_get, set, id, config, inspectorOpen) => {\n set(scaffoldConfigAtom(id), config)\n if (config.controlsInspector && inspectorOpen !== undefined)\n set(scaffoldInspectorOpenAtom(id), inspectorOpen)\n})\n\n/** @internal */\nexport const setScaffoldHandlersAtom = actionFamily<\n [handlers: ScaffoldHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(scaffoldHandlersAtom(id), handlers)\n})\n\n/** @internal Seed the uncontrolled inspector on mount without firing\n * `onInspectorOpenChange`. */\nexport const seedScaffoldInspectorAtom = actionFamily<[open: boolean]>(\n \"seedInspector\",\n (_get, set, id, open) => {\n set(scaffoldInspectorOpenAtom(id), open)\n }\n)\n\n// ── reset ──────────────────────────────────────────────────────────────────\n\nexport const resetScaffoldAtom = actionFamily<[]>(\"reset\", (_get, set, id) => {\n set(scaffoldInspectorOpenAtom(id), false)\n set(scaffoldPanelIdsAtom(id), NO_PANEL_IDS)\n set(scaffoldMeasuredCapacityAtom(id), null)\n set(scaffoldVisibilityAtom(id), EMPTY_SCAFFOLD_VISIBILITY)\n set(scaffoldHoveredPanelIdAtom(id), null)\n set(scaffoldConfigAtom(id), DEFAULT_CONFIG)\n set(scaffoldHandlersAtom(id), NO_HANDLERS)\n})\n\n/** Forget a scaffold entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeScaffoldInstance(id: ScaffoldInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport type { ScaffoldContextValue } from \"./type\"\n\nexport const ScaffoldContext = React.createContext<ScaffoldContextValue | null>(\n null\n)\n\n/** Read the scaffold's identity (`scaffoldId`, `inspectorWidth`); must run\n * under `Scaffold.Root`. State itself lives in the store — subscribe to the\n * atoms, or reach them by id through `useScaffoldState` / `useScaffoldActions`. */\nexport function useScaffoldContext(): ScaffoldContextValue {\n const context = React.useContext(ScaffoldContext)\n if (!context) {\n throw new Error(\"useScaffoldContext must be used within <Scaffold.Root>\")\n }\n return context\n}\n","\"use client\"\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { useAtomValue } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_EASE, SCAFFOLD_EDGE_GUTTER, SCAFFOLD_MORPH_DURATION } from \"./constants\"\nimport { scaffoldInspectorOpenAtom } from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldActionsProps } from \"./type\"\nimport { segmentVariants } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport { LucidePlus } from \"lucide-react\"\n\n/**\n * The floating pill cluster in the main region's top-right corner — the\n * design's \"Panel Context Menu\": one tab per open panel (`Scaffold.Tab`\n * children) plus an Add segment. Add renders only while `onAdd` is\n * present — omit it once the canvas holds `SCAFFOLD_PANEL_CAPACITY`\n * panels. Slides left in step with the inspector opening.\n */\nexport function ScaffoldActions({\n onAdd,\n addLabel = \"Panel\",\n addIcon,\n sound = true,\n className,\n children,\n ...rest\n}: ScaffoldActionsProps): React.ReactElement {\n const { scaffoldId, inspectorWidth } = useScaffoldContext()\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const reducedMotion = useReducedMotion()\n const transition = reducedMotion ? { duration: 0 } : SPRING_LAYOUT\n\n return (\n <motion.div\n id=\"scaffold-actions\"\n animate={{\n x: inspectorOpen ? -(inspectorWidth + SCAFFOLD_EDGE_GUTTER) : 0,\n }}\n className={cn(\n \"sticky inline-flex h-12 items-center gap-0.5\",\n \"justify-end\",\n className\n )}\n data-slot=\"scaffold-actions\"\n initial={false}\n transition={{\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }}\n {...rest}\n >\n <motion.div\n layout\n transition={transition}\n className=\"flex items-center gap-1.5\"\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {onAdd && (\n <motion.div\n key=\"scaffold-add\"\n layout\n animate={reducedMotion ? { opacity: 1 } : \"visible\"}\n className=\"flex shrink-0\"\n exit={reducedMotion ? { opacity: 0 } : \"exit\"}\n initial={reducedMotion ? { opacity: 0 } : \"hidden\"}\n transition={transition}\n variants={segmentVariants}\n >\n <Button\n onClick={onAdd}\n size=\"sm\"\n sound={sound}\n variant=\"ghost\"\n className=\"h-full gap-2 rounded-sm py-1.5 pr-3 pl-2\"\n >\n {addIcon ?? <LucidePlus className=\"stroke-2\" />}\n {addLabel}\n </Button>\n </motion.div>\n )}\n {children}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n )\n}\n","\"use client\"\n\nimport { AnimatePresence } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n measureScaffoldCanvasAtom,\n registerScaffoldPanelIdsAtom,\n scaffoldHiddenPanelIdsAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldCanvasProps, ScaffoldPanelProps } from \"./type\"\n\n/** A canvas child's panel id when it opted into responsive hiding. */\nfunction panelIdOf(child: React.ReactNode): string | undefined {\n if (!React.isValidElement<Pick<ScaffoldPanelProps, \"id\">>(child))\n return undefined\n const id = child.props.id\n return typeof id === \"string\" ? id : undefined\n}\n\n/**\n * The panel row below the action cluster: 8px gutters, 8px gaps, panels\n * side by side. Key each `Scaffold.Panel` child so closes animate out.\n * Measures its own width and hides id'd panels (oldest activation first)\n * whenever it can't grant each one `SCAFFOLD_PANEL_MIN_WIDTH`.\n */\nexport function ScaffoldCanvas({\n className,\n children,\n ...rest\n}: ScaffoldCanvasProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n const hiddenPanelIds = useAtomValue(scaffoldHiddenPanelIdsAtom(scaffoldId))\n const registerPanelIds = useSetAtom(registerScaffoldPanelIdsAtom(scaffoldId))\n const measureCanvas = useSetAtom(measureScaffoldCanvasAtom(scaffoldId))\n const ref = React.useRef<HTMLDivElement>(null)\n\n React.useLayoutEffect(() => {\n const element = ref.current\n if (!element || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(([entry]) =>\n measureCanvas(entry.contentRect.width)\n )\n observer.observe(element)\n return () => observer.disconnect()\n }, [measureCanvas])\n\n const childArray = React.Children.toArray(children)\n const panelIds = childArray\n .map(panelIdOf)\n .filter((id): id is string => id !== undefined)\n const idsKey = panelIds.join(\" \")\n\n React.useLayoutEffect(() => {\n registerPanelIds(panelIds)\n // panelIds is rebuilt each render; idsKey carries its identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [idsKey, registerPanelIds])\n\n const visibleChildren = childArray.filter((child) => {\n const id = panelIdOf(child)\n return id === undefined || !hiddenPanelIds.includes(id)\n })\n\n return (\n <div\n className={cn(\"relative flex min-h-0 w-full flex-1 gap-2\", className)}\n data-slot=\"scaffold-canvas\"\n ref={ref}\n {...rest}\n >\n {/* Sync mode (no `mode=\"wait\"`): an exiting panel shrinks in place\n while its siblings grow into the freed room in the same beat. */}\n <AnimatePresence initial={false}>{visibleChildren}</AnimatePresence>\n </div>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n type FrostGlassVariant,\n type FrostGlassVariantProp,\n glassVariantStyles,\n} from \"@/lib/glass-variants\"\nimport { cn } from \"@/lib/utils\"\nimport { LiquidGlass } from \"./liquid-glass\"\n\nconst glassSidebarVariableStyles: Record<FrostGlassVariant, string> = {\n clear: [\n \"[--sidebar:rgba(255,255,255,0.18)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.48)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.34)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.38)]\",\n \"dark:[--sidebar:rgba(0,0,0,0.28)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.1)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.16)]\",\n ].join(\" \"),\n frosted: [\n \"[--sidebar:rgba(255,255,255,0.4)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.62)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.3)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.32)]\",\n \"dark:[--sidebar:rgba(0,0,0,0.38)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.14)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.1)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.14)]\",\n ].join(\" \"),\n subtle: [\n \"[--sidebar:rgba(255,255,255,0.14)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.28)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(0,0,0,0.05)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.28)]\",\n \"dark:[--sidebar:rgba(255,255,255,0.05)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.08)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.08)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.12)]\",\n ].join(\" \"),\n liquid: [\n \"[--sidebar:rgba(255,255,255,0.22)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.55)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.42)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.45)]\",\n \"dark:[--sidebar:rgba(255,255,255,0.06)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.16)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.20)]\",\n ].join(\" \"),\n \"liquid-refract\": [\n \"[--sidebar:rgba(255,255,255,0.18)]\",\n \"[--sidebar-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-accent:rgba(255,255,255,0.48)]\",\n \"[--sidebar-accent-foreground:oklch(0.145_0_0)]\",\n \"[--sidebar-border:rgba(255,255,255,0.34)]\",\n \"[--sidebar-ring:rgba(255,255,255,0.38)]\",\n \"dark:[--sidebar-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-accent:rgba(255,255,255,0.12)]\",\n \"dark:[--sidebar-accent-foreground:oklch(0.985_0_0)]\",\n \"dark:[--sidebar-border:rgba(255,255,255,0.15)]\",\n \"dark:[--sidebar-ring:rgba(255,255,255,0.18)]\",\n ].join(\" \"),\n}\n\ntype GlassSidebarProps = React.HTMLAttributes<HTMLDivElement> &\n FrostGlassVariantProp\n\nfunction getGlassSidebarStandaloneClasses(glassVariant: FrostGlassVariant) {\n return cn(\n glassVariantStyles[glassVariant],\n glassSidebarVariableStyles[glassVariant],\n \"overflow-hidden\",\n \"shadow-[0_24px_80px_rgba(15,23,42,0.08)] dark:shadow-[0_24px_80px_rgba(0,0,0,0.28)]\"\n )\n}\n\nfunction GlassContainer({\n glassVariant = \"liquid-refract\",\n className,\n children,\n ...props\n}: GlassSidebarProps) {\n return (\n <LiquidGlass\n className={cn(\"rounded-[1.75rem]\", className)}\n blur={5}\n refraction={50}\n >\n <div\n className={cn(\n getGlassSidebarStandaloneClasses(glassVariant),\n glassVariant === \"liquid-refract\" &&\n \"border-0 bg-transparent shadow-none\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n </LiquidGlass>\n )\n}\n\nexport { GlassContainer, glassSidebarVariableStyles }\nexport type { FrostGlassVariant } from \"@/lib/glass-variants\"\n","\"use client\"\n\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_EASE, SCAFFOLD_EDGE_GUTTER, SCAFFOLD_MORPH_DURATION } from \"./constants\"\nimport {\n scaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldInspectorProps } from \"./type\"\nimport { GlassContainer } from \"@/components/ui/glasscn/glass-container.tsx\"\nimport { Button } from \"@/components/ui/button\"\nimport { LucideX } from \"lucide-react\"\n\n/**\n * The right-hand drawer: a brighter card that slides in over the canvas,\n * inset from the viewport edges. Open state lives on `Scaffold.Root` (or\n * `useScaffold().providerProps`); the drawer stays mounted so it can slide\n * back out.\n */\nexport function ScaffoldInspector({\n children,\n name = \"Inspector\",\n className,\n ...rest\n}: ScaffoldInspectorProps): React.ReactElement {\n const { scaffoldId, inspectorWidth } = useScaffoldContext()\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n const reducedMotion = useReducedMotion()\n\n // Slide fully past the edge gutter and the drop shadow's blur radius.\n const offcanvasX = inspectorWidth + SCAFFOLD_EDGE_GUTTER + 12\n\n return (\n <motion.aside\n id=\"scaffold-inspector\"\n animate={{ x: inspectorOpen ? 0 : offcanvasX }}\n aria-hidden={inspectorOpen ? undefined : true}\n aria-label={name}\n className={cn(\n \"absolute right-0 z-20 my-2 flex h-full max-h-[calc(100%-0.5rem)] w-96 flex-col\",\n !inspectorOpen && \"pointer-events-none\",\n className\n )}\n data-slot=\"scaffold-inspector\"\n inert={inspectorOpen ? undefined : true}\n initial={false}\n role=\"complementary\"\n style={{ width: inspectorWidth }}\n transition={{\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }}\n {...rest}\n >\n <GlassContainer\n className=\"flex flex-1 flex-col rounded-md border-t border-white bg-neutral-50/20 shadow-inner shadow-lg dark:border-neutral-800 dark:bg-black/5\"\n glassVariant=\"subtle\"\n >\n <div\n id=\"scaffold-inspector-header\"\n className=\"flex h-12 items-center justify-between gap-2 border-b pr-3 pl-4\"\n >\n <span className=\"text-base font-normal text-card-foreground/70\">\n {name}\n </span>\n <Button\n size=\"icon-xs\"\n variant=\"glass\"\n glassVariant=\"subtle\"\n className=\"scale-85\"\n aria-label=\"Close inspector\"\n onClick={toggleInspector}\n >\n <LucideX className=\"stroke-3\" />\n </Button>\n </div>\n {children}\n </GlassContainer>\n </motion.aside>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldMainProps } from \"./type\"\n\n/**\n * The region right of the rail. Hosts `Scaffold.Actions` (top-right),\n * `Scaffold.Canvas` and the `Scaffold.Inspector` overlay — all positioned\n * against this box.\n */\nexport function ScaffoldMain({\n className,\n children,\n ...rest\n}: ScaffoldMainProps): React.ReactElement {\n return (\n <div\n id=\"scaffold-main\"\n className={cn(\"relative flex min-w-0 flex-1 flex-col\", className)}\n data-slot=\"scaffold-main\"\n {...rest}\n >\n {children}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldSubPanelProps } from \"./type\"\nimport { subPanelVariant } from \"@/components/blocks/scaffold/utils.ts\"\nimport { SCAFFOLD_EASE, SCAFFOLD_MORPH_DURATION } from \"./constants\"\n\nexport function ScaffoldSubPanel({\n className,\n children,\n variant = \"card\",\n primary = false,\n expanded,\n ...rest\n}: ScaffoldSubPanelProps): React.ReactElement {\n const reduce = useReducedMotion()\n // The primary card holds the flexible slot unless the panel says otherwise.\n const isExpanded = expanded ?? primary\n\n return (\n <motion.div\n // Full `layout` (position + size), not `layout=\"size\"`: a swap flips\n // the panel's flex direction in a single commit, and only a position\n // FLIP makes the two cards glide past each other instead of teleport.\n layout\n id={`scaffold-sub-panel-${variant}`}\n // Grow is animated as a style, not a class flip — a class flip rides the\n // layout FLIP, which scales both cards into a swap-like morph. Animating\n // flex-grow slides only the shared boundary: the collapsed card grows up\n // (or down) while the other is squeezed and cropped in place.\n initial={false}\n animate={{ flexGrow: isExpanded ? 1 : 0 }}\n transition={\n reduce\n ? { duration: 0 }\n : { duration: SCAFFOLD_MORPH_DURATION, ease: SCAFFOLD_EASE }\n }\n className={cn(\n \"flex w-full flex-col\",\n subPanelVariant[variant],\n // basis-14 + clip let the primary squeeze down to the strip height;\n // the strip keeps its natural (basis-auto) height when collapsed.\n primary ? \"min-h-14 basis-14 overflow-clip\" : \"min-h-14 basis-auto\",\n className\n )}\n data-slot={`scaffold-sub-panel-${variant}`}\n data-expanded={isExpanded ? \"\" : undefined}\n {...rest}\n >\n {children}\n </motion.div>\n )\n}\n","\"use client\"\n\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useState } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n SCAFFOLD_EASE,\n SCAFFOLD_MORPH_DURATION,\n SCAFFOLD_PANEL_MIN_WIDTH,\n} from \"./constants\"\nimport { useAtomValue } from \"jotai\"\n\nimport { PanelMenuButton } from \"./panel-menu-button.tsx\"\nimport { scaffoldPanelDimmedAtom } from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldPanelProps, TSubPanelPosition } from \"./type\"\nimport { ScaffoldSubPanel } from \"@/components/blocks/scaffold/scaffold-sub-panel.tsx\"\n\n/**\n * A canvas panel: a primary card plus an optional secondary strip below it,\n * separated by a slice of the desktop backdrop. Floating close and swap\n * buttons reveal on hover when their callbacks are provided. Swapping trades\n * the two cards with a layout morph — the strip glides up and grows into the\n * primary slot while the primary card shrinks down into the strip.\n */\nexport function ScaffoldPanel({\n id,\n children,\n SecondaryPanel,\n onSwap,\n onCloseSecondary,\n name,\n swapLabel = \"Swap panel content\",\n sound = true,\n className,\n}: ScaffoldPanelProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n const reducedMotion = useReducedMotion()\n\n // A hovered tab spotlights its own panel — every other id'd panel fades\n // back so the pairing reads at a glance. The per-panel atom keeps a hover\n // moving between two tabs from re-rendering the panels that stay dimmed;\n // the empty-key sentinel reads false for a panel without an `id`.\n const dimmed = useAtomValue(scaffoldPanelDimmedAtom(scaffoldId, id ?? \"\"))\n\n const transition = {\n duration: reducedMotion ? 0 : SCAFFOLD_MORPH_DURATION,\n ease: SCAFFOLD_EASE,\n }\n\n const [subPanelPosition, setSubPanelPosition] =\n useState<TSubPanelPosition>(\"top\")\n const [isSwapped, setIsSwapped] = useState<boolean>(false)\n const handleSwap = () => {\n setIsSwapped((prev) => !prev)\n onSwap?.()\n }\n\n // Trades which sub-panel holds the flexible slot — the collapsed card grows\n // into `flex-1` while the expanded one shrinks to the `min-h-14` strip.\n const handleExpand = () => {\n setSubPanelPosition((prev) => (prev === \"top\" ? \"bottom\" : \"top\"))\n }\n\n // Enter/exit grow and shrink the panel's slot in the flex row: flexGrow\n // carries the width (the panel is basis-0, so `width` itself is inert on\n // the main axis) and minWidth releases the 320px floor so the slot can\n // reach zero. scaleX pins the visual anchor to the panel's center —\n // flexbox collapses a slot toward whichever edge its neighbors grow\n // from, so without it the panel would wipe from one side.\n const hidden = { flexGrow: 0, minWidth: 0, scaleX: 0, opacity: 0 }\n\n return (\n <motion.section\n id={id ?? \"scaffold-panel\"}\n animate={{\n flexGrow: 1,\n // id panels opt into responsive hiding, so each visible one can\n // hold the 320px floor — the canvas hides siblings before this\n // floor would overflow it.\n minWidth: id !== undefined ? SCAFFOLD_PANEL_MIN_WIDTH : 0,\n scaleX: 1,\n // The hovered tab's panel keeps full opacity; the rest fade back\n // so the tab↔panel pairing reads at a glance. Inline (not a\n // class) because motion owns this element's opacity.\n opacity: dimmed ? 0.35 : 1,\n }}\n initial={hidden}\n exit={hidden}\n style={{ originX: 0.5 }}\n aria-label={name}\n className={cn(\n \"group/panel relative flex w-full min-w-0 flex-1\",\n // Swap flips the direction as a class, NOT an animate target:\n // flex-direction is discrete, so motion would apply it instantly —\n // the flip lands in one commit and the children's `layout` FLIP is\n // what glides the cards past each other.\n isSwapped ? \"flex-col-reverse\" : \"flex-col\",\n className\n )}\n layout\n data-slot=\"scaffold-panel\"\n data-dimmed={dimmed ? \"\" : undefined}\n data-swapped={isSwapped ? \"\" : undefined}\n transition={transition}\n >\n <ScaffoldSubPanel id=\"top\" expanded={subPanelPosition === \"top\"} primary>\n {children}\n </ScaffoldSubPanel>\n {(onSwap || onCloseSecondary) && SecondaryPanel && (\n // `layout` keeps the seam glued to the moving boundary while the\n // cards trade places around it.\n <motion.div\n layout\n transition={transition}\n className=\"relative flex h-2 items-center justify-center\"\n >\n <PanelMenuButton\n label={swapLabel}\n onClick={handleSwap}\n onExpand={handleExpand}\n onCloseSecondary={onCloseSecondary}\n secondaryExpanded={subPanelPosition === \"bottom\"}\n swapped={isSwapped}\n sound={sound}\n />\n </motion.div>\n )}\n {SecondaryPanel && (\n <ScaffoldSubPanel id=\"bottom\" expanded={subPanelPosition === \"bottom\"}>\n {SecondaryPanel}\n </ScaffoldSubPanel>\n )}\n </motion.section>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SCAFFOLD_INSPECTOR_WIDTH } from \"./constants\"\nimport {\n projectScaffoldPropsAtom,\n removeScaffoldInstance,\n seedScaffoldInspectorAtom,\n setScaffoldHandlersAtom,\n} from \"./scaffold-atom\"\nimport { ScaffoldContext } from \"./scaffold-context\"\nimport type {\n ScaffoldConfig,\n ScaffoldContextValue,\n ScaffoldHandlers,\n ScaffoldRootProps,\n} from \"./type\"\nimport type { ClassNameValue } from \"tailwind-merge\"\n\n/**\n * The scaffold's viewport: desktop backdrop + horizontal row of rail and\n * main region, and the binding between this instance's props and its slice\n * of the store. Fills its container — size it from the outside (e.g.\n * `h-svh` for a full page).\n *\n * State lives in the store under `scaffoldId`; the context carries only the\n * id and the drawer width, so its value never changes while the scaffold is\n * mounted and parts subscribe to exactly the atoms they render from. A\n * controlled `inspectorOpen` stays the source of truth: it is projected\n * one-way into the store (so remote readers see current data), and the\n * inspector actions report through `onInspectorOpenChange` instead of\n * writing.\n */\nexport function ScaffoldRoot({\n scaffoldId: scaffoldIdProp,\n inspectorOpen: inspectorOpenProp,\n defaultInspectorOpen,\n onInspectorOpenChange,\n inspectorWidth = SCAFFOLD_INSPECTOR_WIDTH,\n className,\n children,\n ...rest\n}: ScaffoldRootProps): React.ReactElement {\n const generatedId = React.useId()\n const scaffoldId = scaffoldIdProp ?? generatedId\n const background: ClassNameValue = `bg-linear-to-tr/increasing from-neutral-200 via-neutral-100 to-stone-200 dark:from-neutral-900 dark:via-neutral-950 dark:to-stone-950`\n\n const controlsInspector = inspectorOpenProp !== undefined\n const config = React.useMemo<ScaffoldConfig>(\n () => ({ controlsInspector }),\n [controlsInspector]\n )\n const handlers = React.useMemo<ScaffoldHandlers>(\n () => ({ onInspectorOpenChange }),\n [onInspectorOpenChange]\n )\n\n const project = useSetAtom(projectScaffoldPropsAtom(scaffoldId))\n const publishHandlers = useSetAtom(setScaffoldHandlersAtom(scaffoldId))\n const seedInspector = useSetAtom(seedScaffoldInspectorAtom(scaffoldId))\n\n // Seed the uncontrolled inspector once per mount, before the projection —\n // `defaultInspectorOpen` describes the mount, not every render. Layout\n // effects so children read settled values in the same commit; primitive\n // deps, so no loop guard is needed.\n const [seed] = React.useState(\n () => inspectorOpenProp ?? defaultInspectorOpen ?? false\n )\n React.useLayoutEffect(() => {\n if (!controlsInspector) seedInspector(seed)\n // Mount-time seed only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n // Handlers before the projection — they must be in the store before any\n // action can fire.\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n React.useLayoutEffect(() => {\n project(config, inspectorOpenProp)\n }, [project, config, inspectorOpenProp])\n\n React.useEffect(() => {\n if (scaffoldIdProp !== undefined) return\n return () => removeScaffoldInstance(scaffoldId)\n }, [scaffoldIdProp, scaffoldId])\n\n const value = React.useMemo<ScaffoldContextValue>(\n () => ({ scaffoldId, inspectorWidth }),\n [scaffoldId, inspectorWidth]\n )\n\n return (\n <ScaffoldContext.Provider value={value}>\n <div\n id={\"scaffold-root\"}\n className={cn(\n // `clip`, not `hidden`: the off canvas inspector extends the\n // scrollable overflow, and focus/scrollIntoView would scroll a\n // hidden-overflow root sideways to reveal it.\n \"relative isolate flex size-full flex-1 overflow-clip pr-2 pb-2\",\n background,\n className\n )}\n data-slot=\"scaffold\"\n {...rest}\n >\n {children}\n </div>\n </ScaffoldContext.Provider>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport type { ScaffoldSidebarProps } from \"./type\"\n\n/**\n * The 64px icon rail on the left edge. Transparent — it sits directly on\n * the desktop backdrop; fill it with icon buttons.\n */\nexport function ScaffoldSidebar({\n className,\n children,\n ...rest\n}: ScaffoldSidebarProps): React.ReactElement {\n return (\n <nav\n id=\"scaffold-sidebar\"\n aria-label=\"Primary\"\n className={cn(\n \"flex h-full min-w-12 shrink-0 flex-col items-center gap-1 overflow-y-auto pt-10 pb-2\",\n className\n )}\n data-slot=\"scaffold-sidebar\"\n {...rest}\n >\n {children}\n </nav>\n )\n}\n","\"use client\"\n\nimport { useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport { cn } from \"@/lib/utils\"\nimport { SPRING_LAYOUT } from \"@/lib/ease.ts\"\nimport {\n scaffoldPanelHiddenAtom,\n setScaffoldPanelHoveredAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nimport { useScaffoldContext } from \"./scaffold-context\"\nimport type { ScaffoldTabProps } from \"./type\"\nimport { segmentVariants } from \"./utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { LucideAppWindow, LucideEyeOff, LucideX } from \"lucide-react\"\nimport { GlassButtonGroup } from \"@/components/ui/glasscn/glass-button-group.tsx\"\n\n/**\n * A panel's tab inside the action cluster: its label plus a close\n * affordance. Render one per open panel as Actions children, keyed —\n * closes animate out of the pill. Omit `onClose` on the last remaining\n * panel's tab; the canvas keeps at least one panel open.\n *\n * With `panelId` (matching a `Scaffold.Panel`'s `id`), the tab also fronts\n * that panel's visibility: a hidden panel dims its tab behind an eye-off\n * icon, and pressing the label toggles the panel — showing one past\n * capacity hides the least-recently-activated panel in its place.\n */\nexport function ScaffoldTab({\n children,\n panelId,\n onClose,\n closeLabel = \"Close panel\",\n sound = true,\n className,\n ...rest\n}: ScaffoldTabProps): React.ReactElement {\n const { scaffoldId } = useScaffoldContext()\n // The per-panel atom keeps this tab still while its siblings toggle; the\n // empty-key sentinel reads false for a tab without a `panelId`.\n const hidden = useAtomValue(scaffoldPanelHiddenAtom(scaffoldId, panelId ?? \"\"))\n const togglePanel = useSetAtom(toggleScaffoldPanelAtom(scaffoldId))\n const setPanelHovered = useSetAtom(setScaffoldPanelHoveredAtom(scaffoldId))\n const reduce = useReducedMotion()\n const transition = reduce ? { duration: 0 } : SPRING_LAYOUT\n\n // A tab closed mid-hover never fires pointer-leave — release the\n // spotlight it holds so the canvas doesn't stay dimmed.\n React.useEffect(() => {\n if (panelId === undefined) return\n return () => setPanelHovered(panelId, false)\n }, [panelId, setPanelHovered])\n\n return (\n <GlassButtonGroup\n layout\n animate={reduce ? { opacity: 1, width: \"auto\" } : \"visible\"}\n data-slot=\"scaffold-tab\"\n data-panel-hidden={hidden ? \"\" : undefined}\n onPointerEnter={\n panelId !== undefined ? () => setPanelHovered(panelId, true) : undefined\n }\n onPointerLeave={\n panelId !== undefined\n ? () => setPanelHovered(panelId, false)\n : undefined\n }\n exit={reduce ? { opacity: 0, width: 0 } : \"exit\"}\n initial={reduce ? { opacity: 0, width: 0 } : \"hidden\"}\n transition={transition}\n variants={segmentVariants}\n glassVariant=\"subtle\"\n className={cn(\"h-full rounded-sm\", className)}\n {...rest}\n >\n <Button\n aria-pressed={panelId !== undefined ? !hidden : undefined}\n onClick={panelId !== undefined ? () => togglePanel(panelId) : undefined}\n size=\"sm\"\n sound={sound}\n variant=\"ghost\"\n className={cn(\n \"gap-2.5 rounded-sm pl-2\",\n onClose && \"pr-2\",\n hidden && \"text-muted-foreground/70\"\n )}\n >\n {hidden ? <LucideEyeOff size={16} /> : <LucideAppWindow size={16} />}\n {children}\n </Button>\n {onClose && (\n <Button\n aria-label={closeLabel}\n onClick={onClose}\n size=\"icon-sm\"\n sound={sound}\n variant=\"ghost\"\n className=\"self-center rounded-none!\"\n >\n <LucideX size={16} />\n </Button>\n )}\n </GlassButtonGroup>\n )\n}\n","\"use client\"\n\nimport { useEffect, useId, useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n removeScaffoldInstance,\n scaffoldInspectorOpenAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n} from \"./scaffold-atom\"\nimport type { ScaffoldControls, UseScaffoldOptions } from \"./type\"\n\n/**\n * Owns the scaffold's inspector state for UI living outside the scaffold\n * (title-bar buttons, command palette, shortcuts). Spread the returned\n * `providerProps` onto `Scaffold.Root`; without this hook the root manages\n * the same state internally via `defaultInspectorOpen`.\n *\n * The hook and the root meet in the store: `providerProps` carries a\n * `scaffoldId`, both sides read and write that instance's atoms, and\n * `useScaffoldState` / `useScaffoldActions` reach the same slice from\n * anywhere else by id. Unnamed scaffolds key off `useId` and are dropped on\n * unmount; an explicit `scaffoldId` outlives its component.\n */\nexport function useScaffold({\n scaffoldId: scaffoldIdProp,\n defaultInspectorOpen,\n onInspectorChange,\n}: UseScaffoldOptions = {}): ScaffoldControls {\n const generatedId = useId()\n const scaffoldId = scaffoldIdProp ?? generatedId\n\n const inspectorOpen = useAtomValue(scaffoldInspectorOpenAtom(scaffoldId))\n const setInspectorOpen = useSetAtom(setScaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n\n useEffect(() => {\n if (scaffoldIdProp !== undefined) return\n return () => removeScaffoldInstance(scaffoldId)\n }, [scaffoldIdProp, scaffoldId])\n\n const providerProps = useMemo<ScaffoldControls[\"providerProps\"]>(\n () => ({\n scaffoldId,\n defaultInspectorOpen,\n onInspectorOpenChange: onInspectorChange,\n }),\n [scaffoldId, defaultInspectorOpen, onInspectorChange]\n )\n\n return {\n scaffoldId,\n inspectorOpen,\n setInspectorOpen,\n toggleInspector,\n providerProps,\n }\n}\n","\"use client\"\n\nimport { useMemo } from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n resetScaffoldAtom,\n scaffoldStateAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nimport type {\n ScaffoldInstanceId,\n ScaffoldState,\n ScaffoldStateActions,\n} from \"./type\"\n\n/**\n * Read the scaffold registered under `scaffoldId` from anywhere below\n * `ExegiaProvider` — no controller, no props, no provider of its own.\n *\n * ```tsx\n * const { inspectorOpen, hiddenPanelIds } = useScaffoldState(\"workspace\")\n * ```\n *\n * This returns the whole state object, so the caller re-renders on every\n * change, hovers included. A component that reads one field should subscribe\n * to that field's atom instead:\n * `useAtomValue(scaffoldInspectorOpenAtom(\"workspace\"))`.\n */\nexport function useScaffoldState(scaffoldId: ScaffoldInstanceId): ScaffoldState {\n return useAtomValue(scaffoldStateAtom(scaffoldId))\n}\n\n/**\n * Drive the scaffold registered under `scaffoldId` from anywhere. Writes\n * only — the caller never re-renders when the scaffold changes, so this is\n * what a command palette or a keyboard shortcut should reach for.\n *\n * ```tsx\n * const scaffold = useScaffoldActions(\"workspace\")\n * <Button onClick={scaffold.toggleInspector}>Inspect</Button>\n * ```\n */\nexport function useScaffoldActions(\n scaffoldId: ScaffoldInstanceId\n): ScaffoldStateActions {\n const setInspectorOpen = useSetAtom(setScaffoldInspectorOpenAtom(scaffoldId))\n const toggleInspector = useSetAtom(toggleScaffoldInspectorAtom(scaffoldId))\n const togglePanel = useSetAtom(toggleScaffoldPanelAtom(scaffoldId))\n const reset = useSetAtom(resetScaffoldAtom(scaffoldId))\n\n return useMemo(\n () => ({ setInspectorOpen, toggleInspector, togglePanel, reset }),\n [setInspectorOpen, toggleInspector, togglePanel, reset]\n )\n}\n","import { PanelCloseButton } from \"./panel-close-button\"\nimport { PanelMenuButton } from \"./panel-menu-button.tsx\"\nimport { ScaffoldActions } from \"./scaffold-actions\"\nimport { ScaffoldCanvas } from \"./scaffold-canvas\"\nimport { ScaffoldInspector } from \"./scaffold-inspector\"\nimport { ScaffoldMain } from \"./scaffold-main\"\nimport { ScaffoldPanel } from \"./scaffold-panel\"\nimport { ScaffoldRoot } from \"./scaffold-root\"\nimport { ScaffoldSidebar } from \"./scaffold-sidebar\"\nimport { ScaffoldTab } from \"./scaffold-tab\"\nimport { ScaffoldSubPanel } from \"@/components/blocks/scaffold/scaffold-sub-panel.tsx\"\n\nexport { useScaffoldContext } from \"./scaffold-context\"\nexport { useScaffold } from \"./use-scaffold\"\nexport { useScaffoldActions, useScaffoldState } from \"./use-scaffold-state\"\nexport {\n removeScaffoldInstance,\n resetScaffoldAtom,\n scaffoldHiddenPanelIdsAtom,\n scaffoldHoveredPanelIdAtom,\n scaffoldInspectorOpenAtom,\n scaffoldPanelCapacityAtom,\n scaffoldPanelDimmedAtom,\n scaffoldPanelHiddenAtom,\n scaffoldStateAtom,\n setScaffoldInspectorOpenAtom,\n toggleScaffoldInspectorAtom,\n toggleScaffoldPanelAtom,\n} from \"./scaffold-atom\"\nexport type * from \"./type\"\nexport * from \"./constants\"\n\nexport {\n PanelCloseButton,\n PanelMenuButton,\n ScaffoldActions,\n ScaffoldCanvas,\n ScaffoldInspector,\n ScaffoldMain,\n ScaffoldPanel,\n ScaffoldRoot,\n ScaffoldSidebar,\n ScaffoldTab,\n}\n\nexport const Scaffold = {\n Root: ScaffoldRoot,\n Sidebar: ScaffoldSidebar,\n Main: ScaffoldMain,\n Actions: ScaffoldActions,\n Canvas: ScaffoldCanvas,\n Panel: ScaffoldPanel,\n Tab: ScaffoldTab,\n Inspector: ScaffoldInspector,\n SubPanel: ScaffoldSubPanel,\n}\n","import ShellLayout, {\n AnimatedPanel,\n AnimatedPanelTrigger,\n useShellPanels,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitMeasuredAtom,\n shellFitMetricsAtom,\n shellFitPanelBoundsAtom,\n shellFitPanelWidthAtom,\n shellFitRequestedWidthAtom,\n shellFitStateAtom,\n} from \"@/components/blocks/shell\"\n\nconst Layout = {\n Main: ShellLayout,\n Panel: AnimatedPanel,\n Trigger: AnimatedPanelTrigger,\n}\n\nexport {\n useShellPanels,\n resetShellPanelWidthAtom,\n resizeShellPanelAtom,\n shellFitFitsAtom,\n shellFitMeasuredAtom,\n shellFitMetricsAtom,\n shellFitPanelBoundsAtom,\n shellFitPanelWidthAtom,\n shellFitRequestedWidthAtom,\n shellFitStateAtom,\n}\n\nexport default Layout\n","/**\n * Profile card state — Jotai atom families keyed by a card id.\n *\n * Same layout as the tree (`components/composed/tree/tree-atom.ts`) and the\n * avatar (`components/user-avatar/user-avatar-atom.ts`): in-house `keyed()`\n * families per field, write-only action atoms, a composed read-only state\n * atom, and `removeProfileCardInstance` to drop an id from every family.\n */\n\nimport { atom } from \"jotai\"\nimport type { Getter, Setter } from \"jotai\"\n\nimport type {\n ProfileCardAction,\n ProfileCardConfig,\n ProfileCardHandlers,\n ProfileCardInstanceId,\n ProfileCardState,\n ProfileCardVariant,\n} from \"./type\"\n\nconst DEFAULT_CONFIG: ProfileCardConfig = {\n controlsVariant: false,\n controlsMenuOpen: false,\n}\nconst NO_HANDLERS: ProfileCardHandlers = {}\n\n// ── families ───────────────────────────────────────────────────────────────\n\ntype Family<AtomType> = ((id: ProfileCardInstanceId) => AtomType) & {\n remove: (id: ProfileCardInstanceId) => void\n}\n\nconst families: { remove: (id: ProfileCardInstanceId) => void }[] = []\n\nfunction keyed<AtomType>(create: (id: ProfileCardInstanceId) => AtomType) {\n const cache = new Map<ProfileCardInstanceId, AtomType>()\n const family = ((id: ProfileCardInstanceId) => {\n let instance = cache.get(id)\n if (instance === undefined) {\n instance = create(id)\n cache.set(id, instance)\n }\n return instance\n }) as Family<AtomType>\n family.remove = (id: ProfileCardInstanceId) => {\n cache.delete(id)\n }\n families.push(family)\n return family\n}\n\nfunction stateFamily<Value>(name: string, initialValue: Value) {\n return keyed((id) => {\n const instance = atom(initialValue)\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\nfunction readFamily<Value>(\n name: string,\n read: (get: Getter, id: ProfileCardInstanceId) => Value\n) {\n return keyed((id) => {\n const instance = atom((get) => read(get, id))\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\nfunction actionFamily<Args extends unknown[]>(\n name: string,\n write: (\n get: Getter,\n set: Setter,\n id: ProfileCardInstanceId,\n ...args: Args\n ) => void\n) {\n return keyed((id) => {\n const instance = atom(null, (get, set, ...args: Args) =>\n write(get, set, id, ...args)\n )\n instance.debugLabel = `profileCard/${id}/${name}`\n return instance\n })\n}\n\n// ── primitives ─────────────────────────────────────────────────────────────\n\nexport const profileCardVariantAtom = stateFamily<ProfileCardVariant>(\n \"variant\",\n \"expanded\"\n)\n\nexport const profileCardMenuOpenAtom = stateFamily<boolean>(\"menuOpen\", false)\n\nexport const profileCardPendingActionIdAtom = stateFamily<string | null>(\n \"pendingActionId\",\n null\n)\n\n/** @internal */\nexport const profileCardConfigAtom = stateFamily<ProfileCardConfig>(\n \"config\",\n DEFAULT_CONFIG\n)\n\n/** @internal */\nexport const profileCardHandlersAtom = stateFamily<ProfileCardHandlers>(\n \"handlers\",\n NO_HANDLERS\n)\n\n// ── derived ────────────────────────────────────────────────────────────────\n\nexport const profileCardCollapsedAtom = readFamily(\n \"collapsed\",\n (get, id) => get(profileCardVariantAtom(id)) === \"collapsed\"\n)\n\nexport const profileCardBusyAtom = readFamily(\n \"busy\",\n (get, id) => get(profileCardPendingActionIdAtom(id)) !== null\n)\n\n/** Whole-state read for callers that want the object; the field atoms are\n * cheaper for components that watch one thing. */\nexport const profileCardStateAtom = readFamily<ProfileCardState>(\n \"state\",\n (get, id) => ({\n variant: get(profileCardVariantAtom(id)),\n menuOpen: get(profileCardMenuOpenAtom(id)),\n pendingActionId: get(profileCardPendingActionIdAtom(id)),\n busy: get(profileCardBusyAtom(id)),\n })\n)\n\n// ── actions: variant ───────────────────────────────────────────────────────\n\n/** Reports through `onVariantChange` always; writes the store only when no\n * `variant` prop controls the card — the prop is truth then. */\nexport const setProfileCardVariantAtom = actionFamily<\n [variant: ProfileCardVariant]\n>(\"setVariant\", (get, set, id, variant) => {\n if (get(profileCardVariantAtom(id)) === variant) return\n if (!get(profileCardConfigAtom(id)).controlsVariant)\n set(profileCardVariantAtom(id), variant)\n get(profileCardHandlersAtom(id)).onVariantChange?.(variant)\n})\n\nexport const toggleProfileCardVariantAtom = actionFamily<[]>(\n \"toggleVariant\",\n (get, set, id) => {\n set(\n setProfileCardVariantAtom(id),\n get(profileCardVariantAtom(id)) === \"collapsed\" ? \"expanded\" : \"collapsed\"\n )\n }\n)\n\n// ── actions: menu ──────────────────────────────────────────────────────────\n\n/** Inert while an `open` prop controls the menu. */\nexport const setProfileCardMenuOpenAtom = actionFamily<[open: boolean]>(\n \"setMenuOpen\",\n (get, set, id, open) => {\n if (get(profileCardConfigAtom(id)).controlsMenuOpen) return\n set(profileCardMenuOpenAtom(id), open)\n }\n)\n\n// ── actions: selection ─────────────────────────────────────────────────────\n\n/**\n * Run an action's `onSelect`. A returned promise marks the card busy until it\n * settles; a rejection goes to `onError` and the card leaves its busy state\n * either way. Because the pending id is a store value, it survives the card\n * unmounting mid-flight (sign-out typically unmounts it) — the settle just\n * writes to an instance nobody renders any more.\n */\nexport const selectProfileCardActionAtom = actionFamily<\n [action: ProfileCardAction]\n>(\"selectAction\", (get, set, id, action) => {\n const result = action.onSelect?.()\n if (!(result instanceof Promise)) return\n set(profileCardPendingActionIdAtom(id), action.id)\n result\n .catch((cause: unknown) => get(profileCardHandlersAtom(id)).onError?.(cause))\n .finally(() => {\n // Only clear our own flight — a later action may have taken over.\n if (get(profileCardPendingActionIdAtom(id)) === action.id)\n set(profileCardPendingActionIdAtom(id), null)\n })\n})\n\n// ── internal projections ───────────────────────────────────────────────────\n\n/** @internal Projection of the mounted component's controlled props. */\nexport const projectProfileCardPropsAtom = actionFamily<\n [\n config: ProfileCardConfig,\n variant: ProfileCardVariant | undefined,\n menuOpen: boolean | undefined,\n ]\n>(\"projectProps\", (_get, set, id, config, variant, menuOpen) => {\n set(profileCardConfigAtom(id), config)\n if (config.controlsVariant && variant !== undefined)\n set(profileCardVariantAtom(id), variant)\n if (config.controlsMenuOpen && menuOpen !== undefined)\n set(profileCardMenuOpenAtom(id), menuOpen)\n})\n\n/** @internal */\nexport const setProfileCardHandlersAtom = actionFamily<\n [handlers: ProfileCardHandlers]\n>(\"setHandlers\", (_get, set, id, handlers) => {\n set(profileCardHandlersAtom(id), handlers)\n})\n\n/** @internal Seed the uncontrolled variant on mount without firing\n * `onVariantChange`. */\nexport const seedProfileCardVariantAtom = actionFamily<\n [variant: ProfileCardVariant]\n>(\"seedVariant\", (_get, set, id, variant) => {\n set(profileCardVariantAtom(id), variant)\n})\n\n// ── reset ──────────────────────────────────────────────────────────────────\n\nexport const resetProfileCardAtom = actionFamily<[]>(\n \"reset\",\n (_get, set, id) => {\n set(profileCardVariantAtom(id), \"expanded\")\n set(profileCardMenuOpenAtom(id), false)\n set(profileCardPendingActionIdAtom(id), null)\n set(profileCardConfigAtom(id), DEFAULT_CONFIG)\n set(profileCardHandlersAtom(id), NO_HANDLERS)\n }\n)\n\n/** Forget a card entirely — every family drops the key so the store can\n * release its state. Call on teardown of a named instance. */\nexport function removeProfileCardInstance(id: ProfileCardInstanceId): void {\n for (const family of families) family.remove(id)\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n profileCardBusyAtom,\n profileCardMenuOpenAtom,\n profileCardVariantAtom,\n projectProfileCardPropsAtom,\n removeProfileCardInstance,\n seedProfileCardVariantAtom,\n selectProfileCardActionAtom,\n setProfileCardHandlersAtom,\n setProfileCardMenuOpenAtom,\n} from \"./profile-card-atom\"\nimport type {\n ProfileCardAction,\n ProfileCardConfig,\n ProfileCardHandlers,\n ProfileCardInstanceId,\n ProfileCardVariant,\n} from \"./type\"\n\nexport interface UseProfileCardOptions {\n profileCardId?: ProfileCardInstanceId\n /** Controlled fold. `undefined` leaves the store (and `defaultVariant`) in charge. */\n variant?: ProfileCardVariant\n defaultVariant?: ProfileCardVariant\n onVariantChange?: (variant: ProfileCardVariant) => void\n /** Controlled menu. */\n open?: boolean\n defaultOpen?: boolean\n onError?: (error: unknown) => void\n}\n\nexport interface ProfileCardBinding {\n profileCardId: ProfileCardInstanceId\n variant: ProfileCardVariant\n collapsed: boolean\n menuOpen: boolean\n busy: boolean\n /** Hand to the menu's `onOpenChange` (first argument). Stable. */\n setMenuOpen: (open: boolean) => void\n /** Run an action: `onSelect`, promise → busy, rejection → `onError`. Stable. */\n select: (action: ProfileCardAction) => void\n}\n\n/**\n * Binds one profile card to its slice of the store: projects the controlled\n * `variant` / `open` props (one-way, with write gates so the store never\n * overwrites a prop), publishes the latest handlers, and returns the values\n * the component renders from.\n *\n * Unnamed cards key off `useId` and are dropped on unmount; a named\n * `profileCardId` outlives its component, so a fold set from elsewhere\n * (`useProfileCardActions(id).collapse()`) survives a route change.\n */\nexport function useProfileCard(options: UseProfileCardOptions): ProfileCardBinding {\n const {\n variant: variantProp,\n defaultVariant = \"expanded\",\n onVariantChange,\n open: openProp,\n onError,\n } = options\n const generatedId = React.useId()\n const profileCardId = options.profileCardId ?? generatedId\n\n const controlsVariant = variantProp !== undefined\n const controlsMenuOpen = openProp !== undefined\n const config = React.useMemo<ProfileCardConfig>(\n () => ({ controlsVariant, controlsMenuOpen }),\n [controlsVariant, controlsMenuOpen]\n )\n const handlers = React.useMemo<ProfileCardHandlers>(\n () => ({ onVariantChange, onError }),\n [onVariantChange, onError]\n )\n\n const project = useSetAtom(projectProfileCardPropsAtom(profileCardId))\n const publishHandlers = useSetAtom(setProfileCardHandlersAtom(profileCardId))\n const seedVariant = useSetAtom(seedProfileCardVariantAtom(profileCardId))\n const setMenuOpen = useSetAtom(setProfileCardMenuOpenAtom(profileCardId))\n const select = useSetAtom(selectProfileCardActionAtom(profileCardId))\n\n // Seed the uncontrolled fold once per mount, before the projection — the\n // `default*` options describe the mount, not every render. Layout effects\n // so children read settled values in the same commit; primitive deps, so\n // no loop guard is needed.\n const [seed] = React.useState(() => ({\n variant: variantProp ?? defaultVariant,\n open: openProp ?? options.defaultOpen ?? false,\n }))\n React.useLayoutEffect(() => {\n if (!controlsVariant) seedVariant(seed.variant)\n if (!controlsMenuOpen) setMenuOpen(seed.open)\n // Mount-time seed only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n React.useLayoutEffect(() => {\n project(config, variantProp, openProp)\n }, [project, config, variantProp, openProp])\n React.useLayoutEffect(() => {\n publishHandlers(handlers)\n }, [publishHandlers, handlers])\n\n React.useEffect(() => {\n if (options.profileCardId !== undefined) return\n return () => removeProfileCardInstance(profileCardId)\n }, [options.profileCardId, profileCardId])\n\n const variant = useAtomValue(profileCardVariantAtom(profileCardId))\n const menuOpen = useAtomValue(profileCardMenuOpenAtom(profileCardId))\n const busy = useAtomValue(profileCardBusyAtom(profileCardId))\n\n return {\n profileCardId,\n variant,\n collapsed: variant === \"collapsed\",\n menuOpen,\n busy,\n setMenuOpen,\n select,\n }\n}\n","\"use client\"\n\nimport {\n ChevronsUpDownIcon,\n LogOutIcon,\n SettingsIcon,\n UserIcon,\n UserPlusIcon,\n UsersIcon,\n} from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport * as React from \"react\"\n\nimport {\n AnimatedSidebarPanelContext,\n LABEL_ENTER_TRANSITION,\n LABEL_EXIT_TRANSITION,\n REDUCED_TRANSITION,\n} from \"@/components/blocks/shell/utils\"\nimport { UserAvatar } from \"@/components/user-avatar\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n type MenuPrimitive,\n} from \"@/components/ui/menu\"\nimport { playCue } from \"@/lib/sound\"\nimport { cn } from \"@/lib/utils\"\n\nimport { useProfileCard } from \"./use-profile-card\"\nimport type {\n ProfileCardAction,\n ProfileCardItem,\n ProfileCardUser,\n ProfileCardVariant,\n} from \"./type\"\n\nexport type {\n ProfileCardAction,\n ProfileCardActions,\n ProfileCardInstanceId,\n ProfileCardItem,\n ProfileCardLabel,\n ProfileCardSeparator,\n ProfileCardState,\n ProfileCardUser,\n ProfileCardVariant,\n} from \"./type\"\n\n/**\n * The menu the card ships with. Spread it to keep the shape and attach your\n * own handlers, or ignore it and pass `items` of your own.\n */\nexport const defaultProfileCardItems: ProfileCardItem[] = [\n { type: \"label\", label: \"Management\" },\n { id: \"profile\", label: \"Profile\", icon: <UserIcon aria-hidden=\"true\" /> },\n {\n id: \"settings\",\n label: \"Settings\",\n icon: <SettingsIcon aria-hidden=\"true\" />,\n },\n { type: \"separator\" },\n { id: \"teams\", label: \"Teams\", icon: <UsersIcon aria-hidden=\"true\" /> },\n { id: \"invite\", label: \"Invite\", icon: <UserPlusIcon aria-hidden=\"true\" /> },\n { type: \"separator\" },\n {\n id: \"sign-out\",\n label: \"Log out\",\n icon: <LogOutIcon aria-hidden=\"true\" />,\n variant: \"destructive\",\n },\n]\n\ntype PopupProps = React.ComponentProps<typeof DropdownMenuContent>\n\nexport interface ProfileCardBlockProps {\n user: ProfileCardUser\n /**\n * The menu, flat: actions plus `{ type: \"separator\" }` / `{ type: \"label\" }`\n * entries. Defaults to `defaultProfileCardItems` (no handlers attached).\n */\n items?: ProfileCardItem[]\n /** Menu placement relative to the card. */\n align?: PopupProps[\"align\"]\n side?: PopupProps[\"side\"]\n sideOffset?: PopupProps[\"sideOffset\"]\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: MenuPrimitive.Root.Props[\"onOpenChange\"]\n /**\n * \"content\" sizes the menu to its items; \"card\" locks it to the trigger's\n * width, so `align` stops mattering horizontally.\n */\n menuWidth?: \"content\" | \"card\"\n /**\n * `expanded` shows avatar, name and handle; `collapsed` folds the card to\n * its avatar — for an icon-collapsed sidebar rail. The fold animates: the\n * identity lines and chevron slide to zero width, the avatar stays put.\n * Controlled when passed. Left unset, the card follows the `AnimatedPanel`\n * it sits in (a panel footer folds with the rail on its own), and\n * outside a panel starts from `defaultVariant`.\n */\n variant?: ProfileCardVariant\n defaultVariant?: ProfileCardVariant\n onVariantChange?: (variant: ProfileCardVariant) => void\n /**\n * Name this card's slice of the store so `useProfileCardState(id)` /\n * `useProfileCardActions(id)` can read or drive it (fold it, open its\n * menu) from anywhere under `ExegiaProvider`. Unnamed cards key off\n * `useId` and are dropped on unmount.\n */\n profileCardId?: string\n /**\n * Presence badge on the avatar — overrides `user.presence`. Name the avatar\n * with `avatarId` and `useUserAvatarActions(id).setPresence()` can flip it\n * from a socket handler instead.\n */\n presence?: ProfileCardUser[\"presence\"]\n avatarId?: string\n /**\n * Emit cuelume press/release on the card and play the open/close cues.\n * Inert unless the app opts into interaction sound via `bindSounds()`.\n */\n sound?: boolean\n /** Called when an action's promise rejects — the card leaves its loading state either way. */\n onError?: (error: unknown) => void\n className?: string\n}\n\n/** Split a flat item list into the groups the menu renders. */\nfunction toGroups(\n items: ProfileCardItem[]\n): { label?: string; actions: ProfileCardAction[] }[] {\n const groups: { label?: string; actions: ProfileCardAction[] }[] = []\n let current: { label?: string; actions: ProfileCardAction[] } = {\n actions: [],\n }\n\n for (const item of items) {\n if (item.type === \"separator\") {\n groups.push(current)\n current = { actions: [] }\n } else if (item.type === \"label\") {\n current.label = item.label\n } else {\n current.actions.push(item)\n }\n }\n groups.push(current)\n\n return groups.filter(\n (group) => group.actions.length > 0 || group.label !== undefined\n )\n}\n\n/**\n * Avatar card that opens an account menu.\n *\n * The trigger is the rich identity chip (avatar + name over handle) and the\n * popup is a plain action menu. `items` is the whole menu — a flat list of\n * actions, separators and labels — defaulting to `defaultProfileCardItems`.\n */\nexport function ProfileCardBlock({\n user,\n items = defaultProfileCardItems,\n align = \"center\",\n side = \"bottom\",\n sideOffset = 8,\n menuWidth = \"content\",\n variant: variantProp,\n defaultVariant,\n onVariantChange,\n profileCardId,\n presence,\n avatarId,\n open,\n defaultOpen,\n onOpenChange,\n sound = true,\n onError,\n className,\n}: ProfileCardBlockProps): React.ReactElement {\n const groups = React.useMemo(() => toGroups(items), [items])\n\n // Optional, not required: the card is a standalone block that also lands\n // in sidebar footers, so it reads the panel context when there is one and\n // does not throw when there is not. Inside a panel the rail is the truth\n // for the fold, so it is projected as a controlled variant.\n const panel = React.useContext(AnimatedSidebarPanelContext)\n const card = useProfileCard({\n profileCardId,\n variant:\n variantProp ??\n (panel ? (panel.collapsed ? \"collapsed\" : \"expanded\") : undefined),\n defaultVariant,\n onVariantChange,\n open,\n defaultOpen,\n onError,\n })\n const { collapsed, busy, menuOpen, setMenuOpen, select } = card\n const reduce = useReducedMotion()\n const identity = `${user.name}${user.username ? ` ${user.username}` : \"\"}`\n\n const handleOpenChange: MenuPrimitive.Root.Props[\"onOpenChange\"] = (\n nextOpen,\n details\n ) => {\n if (sound) playCue(nextOpen ? \"bloom\" : \"droplet\")\n setMenuOpen(nextOpen)\n onOpenChange?.(nextOpen, details)\n }\n\n return (\n // The store mirrors the menu: `open` (when passed) is projected into it,\n // and this always renders from it, so `useProfileCardActions(id).openMenu()`\n // works the same whether or not the consumer controls the prop.\n <DropdownMenu onOpenChange={handleOpenChange} open={menuOpen}>\n <DropdownMenuTrigger\n disabled={busy}\n render={\n <Button\n // Spelled out rather than left to the name-from-contents rule: the\n // avatar sits inside the button and the handle is a second line.\n aria-label={`${identity}, account menu`}\n className={cn(\n // Quiet at rest — the background only surfaces on hover or\n // while the menu is open.\n \"h-auto w-full justify-between py-1.5 pl-1.5 data-popup-open:bg-accent sm:h-auto\",\n // Folded: a 40px avatar tile, the size the tree rail uses. It\n // is 8px wider than a footer's 32px inner box on purpose — the\n // -mx-1 lets it borrow the footer padding so the 32px avatar\n // clears the 1px border and sits dead centre. The label spans\n // below fold to zero width rather than unmounting so the change\n // animates. Button's own gap-2 stays: its always-mounted loading\n // slot carries a -ms-2 that cancels it, so zeroing the gap would\n // pull the avatar 8px left; the folded chevron cancels its own\n // gap instead (see below). `sm:size-10` because the base carries\n // an `sm:h-auto` that an unprefixed size would not beat.\n collapsed &&\n \"-mx-1 size-10 shrink-0 justify-center rounded-xl p-0 sm:size-10\",\n className\n )}\n data-collapsed={collapsed ? \"\" : undefined}\n data-slot=\"profile-card\"\n data-variant={collapsed ? \"collapsed\" : \"expanded\"}\n loading={busy}\n sound={sound}\n // The visible name is gone while folded — name the tile on hover\n // the way the rail's menu buttons do.\n title={collapsed ? identity : undefined}\n variant=\"ghost\"\n >\n <span\n className={cn(\n \"flex min-w-0 items-center justify-start\",\n collapsed ? \"w-auto gap-0\" : \"w-full gap-2\"\n )}\n >\n <UserAvatar\n // Decorative: the name beside it already labels the card.\n alt=\"\"\n avatarId={avatarId}\n initials={user.initials}\n name={user.name}\n presence={presence ?? user.presence}\n src={user.avatar}\n />\n <motion.span\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? -4 : 0,\n }}\n aria-hidden={collapsed || undefined}\n className={cn(\n \"flex min-w-0 flex-col overflow-hidden text-left whitespace-nowrap\",\n collapsed && \"pointer-events-none\"\n )}\n data-slot=\"profile-card-identity\"\n initial={false}\n transition={\n reduce\n ? REDUCED_TRANSITION\n : collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n >\n <span className=\"truncate font-medium\">{user.name}</span>\n {user.username ? (\n <span className=\"truncate text-xs font-normal text-muted-foreground\">\n {user.username}\n </span>\n ) : null}\n </motion.span>\n </span>\n <motion.span\n animate={{\n width: collapsed ? 0 : \"auto\",\n opacity: collapsed ? 0 : 1,\n x: collapsed ? 4 : 0,\n }}\n aria-hidden=\"true\"\n className={cn(\n \"flex shrink-0 items-center overflow-hidden\",\n // 0px wide while folded, but the flex gap before it would\n // still offset the avatar — pull it back by that gap.\n collapsed && \"-ml-2\"\n )}\n initial={false}\n transition={\n reduce\n ? REDUCED_TRANSITION\n : collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n >\n <ChevronsUpDownIcon aria-hidden=\"true\" className=\"size-3.5\" />\n </motion.span>\n </Button>\n }\n />\n <DropdownMenuContent\n align={align}\n // Content-width by default so `align` reads: a popup locked to\n // `--anchor-width` lands in the same place for every value. `!`\n // because the popup's own `not-[class*='w-']:min-w-32` compiles to\n // a higher-specificity `:not(:is())` that would otherwise win.\n className={cn(\n menuWidth === \"card\" ? \"w-(--anchor-width)\" : \"min-w-44!\",\n \"origin-(--transform-origin) transition-[opacity,scale,translate] duration-150 ease-smooth-out data-ending-style:scale-98 data-ending-style:opacity-0 data-ending-style:duration-100 data-starting-style:scale-98 data-starting-style:opacity-0 data-[side=bottom]:data-ending-style:-translate-y-1 data-[side=bottom]:data-starting-style:-translate-y-1 data-[side=top]:data-ending-style:translate-y-1 data-[side=top]:data-starting-style:translate-y-1 motion-reduce:transition-none\"\n )}\n side={side}\n sideOffset={sideOffset}\n >\n {groups.map((group, index) => (\n <React.Fragment key={group.label ?? `group-${group.actions[0]?.id}`}>\n {index > 0 ? <DropdownMenuSeparator /> : null}\n <DropdownMenuGroup>\n {group.label ? (\n <DropdownMenuLabel>{group.label}</DropdownMenuLabel>\n ) : null}\n {group.actions.map((item) => (\n <DropdownMenuItem\n disabled={item.disabled}\n key={item.id}\n onClick={() => select(item)}\n variant={item.variant}\n >\n {item.icon}\n <span>{item.label}</span>\n {item.shortcut ? (\n <DropdownMenuShortcut>{item.shortcut}</DropdownMenuShortcut>\n ) : null}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </React.Fragment>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { useAtomValue, useSetAtom } from \"jotai\"\n\nimport {\n profileCardStateAtom,\n resetProfileCardAtom,\n setProfileCardMenuOpenAtom,\n setProfileCardVariantAtom,\n toggleProfileCardVariantAtom,\n} from \"./profile-card-atom\"\nimport type {\n ProfileCardActions,\n ProfileCardInstanceId,\n ProfileCardState,\n} from \"./type\"\n\n/**\n * Read the card registered under `profileCardId` from anywhere below\n * `ExegiaProvider` — no props, no ref, no provider of its own.\n *\n * ```tsx\n * const { variant, busy } = useProfileCardState(\"account\")\n * ```\n *\n * Returns the whole state object, so the caller re-renders on any change. A\n * component that watches one field should subscribe to that atom instead:\n * `useAtomValue(profileCardVariantAtom(\"account\"))`.\n */\nexport function useProfileCardState(\n profileCardId: ProfileCardInstanceId\n): ProfileCardState {\n return useAtomValue(profileCardStateAtom(profileCardId))\n}\n\n/**\n * Write-only handles onto the card registered under `profileCardId`. Nothing\n * here subscribes, so a rail toggle can fold the card without re-rendering\n * when the card changes.\n *\n * ```tsx\n * const { collapse, expand } = useProfileCardActions(\"account\")\n * ```\n */\nexport function useProfileCardActions(\n profileCardId: ProfileCardInstanceId\n): ProfileCardActions {\n const setVariant = useSetAtom(setProfileCardVariantAtom(profileCardId))\n const toggleVariant = useSetAtom(toggleProfileCardVariantAtom(profileCardId))\n const setMenuOpen = useSetAtom(setProfileCardMenuOpenAtom(profileCardId))\n const reset = useSetAtom(resetProfileCardAtom(profileCardId))\n\n return React.useMemo(\n () => ({\n setVariant,\n toggleVariant,\n collapse: () => setVariant(\"collapsed\"),\n expand: () => setVariant(\"expanded\"),\n setMenuOpen,\n openMenu: () => setMenuOpen(true),\n closeMenu: () => setMenuOpen(false),\n reset,\n }),\n [setVariant, toggleVariant, setMenuOpen, reset]\n )\n}\n","\"use client\";\n\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\nimport {\n Children,\n cloneElement,\n forwardRef,\n type HTMLAttributes,\n isValidElement,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useId,\n useState,\n} from \"react\";\nimport { SPRING_LAYOUT } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface SharedLayoutBgProps\n extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n children: ReactNode;\n /** Semantic container used for the children. */\n as?: \"div\" | \"ul\";\n /** Tailwind class applied to the moving pill. Defaults to a subtle foreground tint. */\n pillClassName?: string;\n /** Horizontal inset of the pill relative to each row (px). Default 20. */\n inset?: number;\n /** Optional positioning override for the pill wrapper inside each item. */\n pillContainerClassName?: string;\n}\n\nconst variants: Variants = {\n initial: { opacity: 0, filter: \"blur(6px)\" },\n animate: { opacity: 1, filter: \"blur(0px)\" },\n exit: (isActive: boolean) =>\n !isActive ? { opacity: 0, filter: \"blur(6px)\" } : {},\n};\n\nconst reducedVariants: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: (isActive: boolean) => (!isActive ? { opacity: 0 } : {}),\n};\n\nexport const SharedLayoutBg = forwardRef<HTMLElement, SharedLayoutBgProps>(\n function SharedLayoutBg(\n {\n children,\n as = \"div\",\n className,\n onMouseLeave,\n pillClassName,\n pillContainerClassName,\n inset = 20,\n ...props\n },\n forwardedRef,\n ) {\n const [activeId, setActiveId] = useState<string | null>(null);\n const uid = useId();\n const reduce = useReducedMotion();\n\n const renderedChildren = Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const el = child as ReactElement<{\n className?: string;\n onMouseEnter?: () => void;\n children?: ReactNode;\n }>;\n const childKey = el.key ? String(el.key) : `item-${index}`;\n return cloneElement(\n el,\n {\n key: childKey,\n className: cn(\"relative\", el.props.className),\n onMouseEnter: () => {\n el.props.onMouseEnter?.();\n setActiveId(childKey);\n },\n },\n <>\n <AnimatePresence custom={activeId !== null}>\n {activeId !== null ? (\n <motion.div\n variants={reduce ? reducedVariants : variants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n custom={activeId !== null}\n className={cn(\n \"pointer-events-none absolute inset-y-0\",\n pillContainerClassName,\n )}\n style={{ left: -inset, right: -inset }}\n >\n {activeId === childKey ? (\n <motion.div\n layoutId={`shared-bg-${uid}`}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n className={cn(\n \"pointer-events-none h-full w-full rounded-2xl bg-primary/[0.06]\",\n pillClassName,\n )}\n />\n ) : null}\n </motion.div>\n ) : null}\n </AnimatePresence>\n <div className=\"relative z-10\">{el.props.children}</div>\n </>,\n );\n });\n\n const handleMouseLeave = (event: MouseEvent<HTMLElement>) => {\n setActiveId(null);\n onMouseLeave?.(event);\n };\n\n // layoutRoot scopes the pill's layout projection to this list, so fixed or\n // scrolled ancestors can't smear scroll offsets into its movement.\n return as === \"ul\" ? (\n <motion.ul\n {...(props as HTMLMotionProps<\"ul\">)}\n ref={forwardedRef as Ref<HTMLUListElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.ul>\n ) : (\n <motion.div\n {...(props as HTMLMotionProps<\"div\">)}\n ref={forwardedRef as Ref<HTMLDivElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.div>\n );\n },\n);\n","/* eslint-disable react-refresh/only-export-components */\nimport * as React from \"react\"\n\ntype Theme = \"dark\" | \"light\" | \"system\"\ntype ResolvedTheme = \"dark\" | \"light\"\n\ntype ThemeProviderProps = {\n children: React.ReactNode\n defaultTheme?: Theme\n storageKey?: string\n disableTransitionOnChange?: boolean\n}\n\ntype ThemeProviderState = {\n theme: Theme\n setTheme: (theme: Theme) => void\n}\n\nconst COLOR_SCHEME_QUERY = \"(prefers-color-scheme: dark)\"\nconst THEME_VALUES: Theme[] = [\"dark\", \"light\", \"system\"]\n\nconst ThemeProviderContext = React.createContext<\n ThemeProviderState | undefined\n>(undefined)\n\nfunction isTheme(value: string | null): value is Theme {\n if (value === null) {\n return false\n }\n\n return THEME_VALUES.includes(value as Theme)\n}\n\nfunction getSystemTheme(): ResolvedTheme {\n if (window.matchMedia(COLOR_SCHEME_QUERY).matches) {\n return \"dark\"\n }\n\n return \"light\"\n}\n\nfunction disableTransitionsTemporarily() {\n const style = document.createElement(\"style\")\n style.appendChild(\n document.createTextNode(\n \"*,*::before,*::after{-webkit-transition:none!important;transition:none!important}\"\n )\n )\n document.head.appendChild(style)\n\n return () => {\n window.getComputedStyle(document.body)\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n style.remove()\n })\n })\n }\n}\n\nfunction isEditableTarget(target: EventTarget | null) {\n if (!(target instanceof HTMLElement)) {\n return false\n }\n\n if (target.isContentEditable) {\n return true\n }\n\n const editableParent = target.closest(\n \"input, textarea, select, [contenteditable='true']\"\n )\n if (editableParent) {\n return true\n }\n\n return false\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme = \"system\",\n storageKey = \"theme\",\n disableTransitionOnChange = true,\n ...props\n}: ThemeProviderProps) {\n const [theme, setThemeState] = React.useState<Theme>(() => {\n const storedTheme = localStorage.getItem(storageKey)\n if (isTheme(storedTheme)) {\n return storedTheme\n }\n\n return defaultTheme\n })\n\n const setTheme = React.useCallback(\n (nextTheme: Theme) => {\n localStorage.setItem(storageKey, nextTheme)\n setThemeState(nextTheme)\n },\n [storageKey]\n )\n\n const applyTheme = React.useCallback(\n (nextTheme: Theme) => {\n const root = document.documentElement\n const resolvedTheme =\n nextTheme === \"system\" ? getSystemTheme() : nextTheme\n const restoreTransitions = disableTransitionOnChange\n ? disableTransitionsTemporarily()\n : null\n\n root.classList.remove(\"light\", \"dark\")\n root.classList.add(resolvedTheme)\n\n if (restoreTransitions) {\n restoreTransitions()\n }\n },\n [disableTransitionOnChange]\n )\n\n React.useEffect(() => {\n applyTheme(theme)\n\n if (theme !== \"system\") {\n return undefined\n }\n\n const mediaQuery = window.matchMedia(COLOR_SCHEME_QUERY)\n const handleChange = () => {\n applyTheme(\"system\")\n }\n\n mediaQuery.addEventListener(\"change\", handleChange)\n\n return () => {\n mediaQuery.removeEventListener(\"change\", handleChange)\n }\n }, [theme, applyTheme])\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.repeat) {\n return\n }\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n if (isEditableTarget(event.target)) {\n return\n }\n\n if (event.key.toLowerCase() !== \"d\") {\n return\n }\n\n setThemeState((currentTheme) => {\n const nextTheme =\n currentTheme === \"dark\"\n ? \"light\"\n : currentTheme === \"light\"\n ? \"dark\"\n : getSystemTheme() === \"dark\"\n ? \"light\"\n : \"dark\"\n\n localStorage.setItem(storageKey, nextTheme)\n return nextTheme\n })\n }\n\n window.addEventListener(\"keydown\", handleKeyDown)\n\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown)\n }\n }, [storageKey])\n\n React.useEffect(() => {\n const handleStorageChange = (event: StorageEvent) => {\n if (event.storageArea !== localStorage) {\n return\n }\n\n if (event.key !== storageKey) {\n return\n }\n\n if (isTheme(event.newValue)) {\n setThemeState(event.newValue)\n return\n }\n\n setThemeState(defaultTheme)\n }\n\n window.addEventListener(\"storage\", handleStorageChange)\n\n return () => {\n window.removeEventListener(\"storage\", handleStorageChange)\n }\n }, [defaultTheme, storageKey])\n\n const value = React.useMemo(\n () => ({\n theme,\n setTheme,\n }),\n [theme, setTheme]\n )\n\n return (\n <ThemeProviderContext.Provider {...props} value={value}>\n {children}\n </ThemeProviderContext.Provider>\n )\n}\n\nexport const useTheme = () => {\n const context = React.useContext(ThemeProviderContext)\n\n if (context === undefined) {\n throw new Error(\"useTheme must be used within a ThemeProvider\")\n }\n\n return context\n}\n","import { createStore } from \"jotai\"\n\n/** A Jotai store as created by `createStore()`. */\nexport type ExegiaStore = ReturnType<typeof createStore>\n\n/**\n * The library's default store — the one `ExegiaProvider` mounts unless it is\n * handed another. Exported so non-React code (a router guard, a command\n * palette, a test) can read and write library state imperatively:\n *\n * ```ts\n * exegiaStore.get(treeExpandedIdsAtom(\"app-nav\"))\n * ```\n *\n * A single module-level store is wrong for SSR — state would leak between\n * requests — so render-per-request apps pass a fresh `createStore()` to\n * `ExegiaProvider` instead.\n */\nexport const exegiaStore: ExegiaStore = createStore()\n","\"use client\"\n\n/* eslint-disable react-refresh/only-export-components */\n/**\n * The library's one and only state provider.\n *\n * Mount it once at the app root. Every library state hook then works\n * anywhere below it — there are no per-component providers to nest.\n *\n * One provider suffices because library state lives in module-level Jotai\n * atom families keyed by an instance id, not in a context created per\n * component. A new stateful component adds atoms to that module scope; it\n * never adds a provider. Consumer code therefore stays exactly as it is as\n * the library grows.\n *\n * Without this provider the hooks still run, which is the trap: Jotai falls\n * back to its implicit default store, and that store is NOT `exegiaStore`,\n * so imperative access would read a different store than the one the\n * components render from. Mount the provider.\n *\n * ```tsx\n * export function App() {\n * return (\n * <ExegiaProvider sound>\n * <Routes />\n * </ExegiaProvider>\n * )\n * }\n * ```\n */\nimport * as React from \"react\"\nimport { Provider, useStore } from \"jotai\"\n\nimport { ThemeProvider } from \"@/components/theme-provider\"\nimport { bindSounds } from \"@/lib/sound\"\nimport { exegiaStore } from \"./store\"\nimport type { ExegiaStore } from \"./store\"\n\n/** Options forwarded to the library's `ThemeProvider`. */\nexport interface ExegiaThemeOptions {\n defaultTheme?: \"dark\" | \"light\" | \"system\"\n storageKey?: string\n disableTransitionOnChange?: boolean\n}\n\nexport interface ExegiaProviderProps {\n children: React.ReactNode\n /** Store to mount. Defaults to the library's `exegiaStore`. */\n store?: ExegiaStore\n /** Opt into interaction sound. Off unless the app asks for it. */\n sound?: boolean\n /** Mount `ThemeProvider` with these options. Omit it and none is mounted —\n * it reads `localStorage` in its state initializer, so an unconditional\n * mount would break SSR consumers, and `useTheme` already throws without\n * one. */\n theme?: ExegiaThemeOptions\n}\n\nexport function ExegiaProvider({\n children,\n store,\n sound = false,\n theme,\n}: ExegiaProviderProps): React.ReactElement {\n React.useEffect(() => {\n // Idempotent, and deliberately not at module scope: opting into sound is\n // the consuming app's decision, not an import side effect.\n if (sound) bindSounds()\n }, [sound])\n\n return (\n <Provider store={store ?? exegiaStore}>\n {theme ? <ThemeProvider {...theme}>{children}</ThemeProvider> : children}\n </Provider>\n )\n}\n\n/** The store mounted by the nearest `ExegiaProvider` above the caller. */\nexport const useExegiaStore = useStore\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,CAAM,CAAC;AAC7B;;;ACCA,SAAgB,GAAO,EACrB,cACA,GAAG,KAC8C;CACjD,OACE,kBAAC,EAAgB,MAAjB;EACE,WAAW,EACT,mJACA,CACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,GAAY,EAC1B,cACA,GAAG,KAC+C;CAClD,OACE,kBAAC,EAAgB,OAAjB;EACE,WAAW,EAAG,0BAA0B,CAAS;EACjD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,GAAe,EAC7B,cACA,GAAG,KACkD;CACrD,OACE,kBAAC,EAAgB,UAAjB;EACE,WAAW,EACT,oEACA,CACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;;;AC7CA,SAAgB,GAAQ,EACtB,cACA,GAAG,KAC4D;CAC/D,OACE,kBAAC,GAAD;EACE,cAAW;EACX,WAAW,EAAG,gBAAgB,CAAS;EACvC,MAAK;EACL,GAAI;CACL,CAAA;AAEL;;;ACOA,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CAAC;EAC7D,IAAI,CAAC,KAAY,MAAa,EAAU,KAAK,IAAI;EACjD,IAAM,IAAS,GACb,EAAM,IAAI,GAAmB,CAAS,CAAC,GACvC,CACF;EACA,IAAI,KAAU,GAAiB,GAAQ,EAAU,KAAK,EAAE,GAAG;EAE3D,AADA,EAAM,eAAe,GACrB,EAAM,gBAAgB;EACtB,IAAM,IAAO,EAAM,cAAc,sBAAsB,GACjD,KAAS,EAAM,UAAU,EAAK,OAAO,EAAK,QAC1C,IACJ,CAAC,EAAU,KAAK,YAChB,GAAW,EAAU,IAAI,KACzB,KAAS,OACT,KAAS,MACL,WACA,IAAQ,KACN,WACA;EACR,GAAc;GAAE,IAAI,EAAU,KAAK;GAAI;EAAS,CAAC;CACnD,GACA;EAAC;EAAe;EAAW;CAAK,CAClC,GAEM,KAAM,SACH;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF,GAEM,KAAQ,SACL;EACL;EACA,UAAU;EACV;EACA,OAAO;CACT,IACA;EAAC;EAAY;EAAe;EAAW;CAAU,CACnD;CAEA,OAAO,SACE;EACL;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF;;;ACjmBA,IAAa,KAAmB,GAC9B,IACF;AAEA,SAAgB,KAA6C;CAC3D,IAAM,IAAU,GAAW,EAAgB;CAC3C,IAAI,CAAC,GAAS,MAAU,MAAM,8CAA8C;CAC5E,OAAO;AACT;;;ACXA,SAAgB,GAAY,GAAuB,GAAmB;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