{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "fallow",
  "type": "registry:block",
  "title": "Fallow",
  "description": "Empty-state block with five presets (no results, first run, error, offline, inbox zero) and a custom mode. Each preset has an original 1.5px line illustration with one accent detail and a three-cycle idle loop, plus title, description, primary action, secondary link, suggestion chips and an async retry button that runs pending to success.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/app/fallow/fallow.tsx",
      "type": "registry:block",
      "target": "components/crucible/fallow.tsx",
      "content": "\"use client\";\n\nimport { AnimatePresence, motion, type Transition } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\n\n/** Built-in empty-state presets, plus `\"custom\"` (bring your own illustration + copy). */\nexport type FallowKind = \"no-results\" | \"first-run\" | \"error\" | \"offline\" | \"inbox-zero\" | \"custom\";\n\n/** Overall scale of the block. */\nexport type FallowSize = \"sm\" | \"md\" | \"lg\";\n\n/** A primary or secondary call to action. */\nexport interface FallowAction {\n  /** Visible label. */\n  label: React.ReactNode;\n  /** Click handler (rendered as a `<button>`). */\n  onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n  /** Render as a link (`<a href>`) instead of a button. */\n  href?: string;\n}\n\n/** Imperative verbs exposed through the `ref` prop. */\nexport interface FallowHandle {\n  /** Replay the intro and the illustration's idle loop, and clear any retry state. */\n  replay: () => void;\n}\n\nexport interface FallowProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"title\" | \"children\"> {\n  /**\n   * Which preset to render. Each preset brings its own line illustration and\n   * default copy/actions; `\"custom\"` renders only what you pass.\n   * @default \"no-results\"\n   */\n  kind?: FallowKind;\n  /** Headline. Defaults to the preset's copy. */\n  title?: React.ReactNode;\n  /** Supporting sentence under the headline. Defaults to the preset's copy. */\n  description?: React.ReactNode;\n  /**\n   * Primary action (accent-filled button). Defaults to the preset's action;\n   * pass `null` to hide it. In retry mode (`onRetry` set) its label becomes the\n   * retry button's idle label.\n   */\n  action?: FallowAction | null;\n  /** Secondary text link. Defaults to the preset's link; pass `null` to hide it. */\n  secondaryAction?: FallowAction | null;\n  /**\n   * Suggestion chips shown under the copy (\"Try 'deploy'\"). Defaults to three\n   * sample queries for `no-results`, none otherwise; pass `[]` to hide.\n   */\n  suggestions?: string[];\n  /** Fires with the chip's text when a suggestion is chosen. */\n  onSuggestion?: (suggestion: string) => void;\n  /**\n   * Retry mode (meant for `error` / `offline`). When set, the primary button\n   * calls this; return a Promise to show a pending spinner, then a success\n   * check on resolve, or an inline \"still failing\" note on reject.\n   */\n  onRetry?: () => void | Promise<unknown>;\n  /** Overall scale: illustration size, type ramp and button height. @default \"md\" */\n  size?: FallowSize;\n  /** Wrap the block in a dashed-border panel instead of rendering bare. @default false */\n  framed?: boolean;\n  /** Replace the preset illustration (decorative; rendered `aria-hidden`). */\n  illustration?: React.ReactNode;\n  /** Heading element for the title. @default \"h3\" */\n  titleAs?: \"h2\" | \"h3\" | \"h4\" | \"p\";\n  /** Stop the illustration's idle loop (it already stops by itself after 3 cycles). @default false */\n  paused?: boolean;\n  /** The single accent: illustration detail, primary fill, focus rings. @default \"#a3c9a8\" (sage) */\n  accentColor?: string;\n  /** Imperative handle (`replay()`). React 19 ref-as-prop. */\n  ref?: React.Ref<FallowHandle>;\n  /** Extra classes for the root. */\n  className?: string;\n}\n\nconst DEFAULT_ACCENT = \"#a3c9a8\";\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\nconst INSTANT: Transition = { duration: 0 };\nconst CYCLES = 3;\n\ninterface PresetCopy {\n  title: string;\n  description: string;\n  action?: string;\n  secondary?: string;\n  suggestions?: string[];\n  pending: string;\n  success: string;\n  failure: string;\n}\n\nconst PRESETS: Record<FallowKind, PresetCopy> = {\n  \"no-results\": {\n    title: \"No matches found\",\n    description: \"Nothing matches your search. Check the spelling or try a broader term.\",\n    action: \"Clear search\",\n    secondary: \"Browse all\",\n    suggestions: [\"deploy\", \"billing\", \"api keys\"],\n    pending: \"Searching\",\n    success: \"Updated\",\n    failure: \"Still nothing. Try another term.\",\n  },\n  \"first-run\": {\n    title: \"Plant your first project\",\n    description: \"Projects keep environments, deploys and teammates in one place. Setup takes about a minute.\",\n    action: \"Create project\",\n    secondary: \"Import from file\",\n    pending: \"Working\",\n    success: \"Done\",\n    failure: \"That didn't work. Try again.\",\n  },\n  error: {\n    title: \"Something came unplugged\",\n    description: \"We couldn't load this view. Your data is safe; the problem is on our side.\",\n    action: \"Try again\",\n    secondary: \"View status\",\n    pending: \"Retrying\",\n    success: \"Reconnected\",\n    failure: \"Still failing. Give it a moment and try again.\",\n  },\n  offline: {\n    title: \"You're offline\",\n    description: \"Changes are kept on this device and sync automatically when you reconnect.\",\n    action: \"Reconnect\",\n    secondary: \"Work offline\",\n    pending: \"Reconnecting\",\n    success: \"Back online\",\n    failure: \"No connection yet. Check your network and try again.\",\n  },\n  \"inbox-zero\": {\n    title: \"You're all caught up\",\n    description: \"No new notifications. We'll let you know the moment something needs you.\",\n    action: \"View archive\",\n    secondary: \"Notification settings\",\n    pending: \"Working\",\n    success: \"Done\",\n    failure: \"That didn't work. Try again.\",\n  },\n  custom: {\n    title: \"Nothing here yet\",\n    description: \"\",\n    pending: \"Working\",\n    success: \"Done\",\n    failure: \"That didn't work. Try again.\",\n  },\n};\n\nconst SIZES = {\n  sm: {\n    pad: \"px-5 py-6\",\n    art: 76,\n    gapArt: \"mb-3\",\n    title: \"text-sm font-semibold\",\n    desc: \"mt-1 max-w-[30ch] text-xs leading-relaxed\",\n    chips: \"mt-3\",\n    actions: \"mt-4\",\n    btn: \"h-8 px-3.5 text-xs\",\n    link: \"text-xs\",\n    chip: \"h-6 px-2 text-[11px]\",\n  },\n  md: {\n    pad: \"px-6 py-9\",\n    art: 112,\n    gapArt: \"mb-5\",\n    title: \"text-base font-semibold\",\n    desc: \"mt-1.5 max-w-sm text-sm leading-relaxed\",\n    chips: \"mt-4\",\n    actions: \"mt-6\",\n    btn: \"h-9 px-4 text-sm\",\n    link: \"text-sm\",\n    chip: \"h-7 px-2.5 text-xs\",\n  },\n  lg: {\n    pad: \"px-8 py-12\",\n    art: 136,\n    gapArt: \"mb-6\",\n    title: \"text-xl font-semibold tracking-tight\",\n    desc: \"mt-2 max-w-md text-[15px] leading-relaxed\",\n    chips: \"mt-5\",\n    actions: \"mt-7\",\n    btn: \"h-10 px-5 text-sm\",\n    link: \"text-sm\",\n    chip: \"h-7 px-3 text-xs\",\n  },\n} as const;\n\n/* ---------------------------------------------------------------- helpers */\n\n/** Black or white text, whichever reads against the accent fill. */\nfunction readableOn(hex: string): string {\n  const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());\n  if (!m) return \"#0a0a0a\";\n  let s = m[1];\n  if (s.length === 3) s = s.replace(/./g, (c) => c + c);\n  const n = parseInt(s, 16);\n  const lum = 0.2126 * ((n >> 16) & 255) + 0.7152 * ((n >> 8) & 255) + 0.0722 * (n & 255);\n  return lum > 140 ? \"#0a0a0a\" : \"#ffffff\";\n}\n\nfunction Spinner() {\n  return (\n    <svg aria-hidden viewBox=\"0 0 24 24\" className=\"size-3.5 motion-safe:animate-spin\" fill=\"none\">\n      <circle cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" strokeOpacity=\"0.25\" strokeWidth=\"3\" />\n      <path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction CheckGlyph() {\n  return (\n    <svg aria-hidden viewBox=\"0 0 24 24\" className=\"size-3.5\" fill=\"none\">\n      <path d=\"M5 12.5l4.5 4.5L19 7.5\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction ArrowGlyph() {\n  return (\n    <svg aria-hidden viewBox=\"0 0 16 16\" className=\"size-3.5 transition-transform group-hover:translate-x-0.5\" fill=\"none\">\n      <path d=\"M3.5 8h8.5M8.5 4.5 12 8l-3.5 3.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\n/* ---------------------------------------------------------------- illustrations */\n\ninterface ArtProps {\n  accent: string;\n  /** Run the idle loop (in view, not paused, motion allowed). */\n  play: boolean;\n  /** Draw-on intro allowed (false under reduced motion). */\n  animateIn: boolean;\n  /** The block has entered the viewport (intro may start). */\n  entered: boolean;\n}\n\n/** Neutral line ink shared by every illustration. */\nconst INK = \"rgba(255,255,255,0.46)\";\nconst INK_SOFT = \"rgba(255,255,255,0.2)\";\nconst SW = 1.5;\n\n/** Idle loop: CYCLES repeats, each cycle starting and ending at the rest pose. */\nconst loop = (play: boolean, duration: number, extra?: Partial<Transition>): Transition =>\n  play\n    ? { duration, ease: \"easeInOut\", repeat: CYCLES - 1, delay: 0.75, ...extra }\n    : INSTANT;\n\n/** Magnifier sweeping across empty result rows. */\nfunction NoResultsArt({ accent, play }: ArtProps) {\n  return (\n    <>\n      <rect x=\"22\" y=\"28\" width=\"76\" height=\"64\" rx=\"9\" stroke={INK_SOFT} strokeWidth={SW} />\n      {[44, 60, 76].map((y, i) => (\n        <g key={y}>\n          <circle cx=\"33\" cy={y} r=\"3.5\" stroke={INK} strokeWidth={SW} />\n          <path d={`M42 ${y}H${i === 1 ? 74 : 86}`} stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" strokeDasharray=\"3 4\" />\n        </g>\n      ))}\n      <motion.g\n        initial={false}\n        animate={play ? { x: [0, -13, 15, 0], y: [0, 2, -2, 0] } : { x: 0, y: 0 }}\n        transition={loop(play, 3.2)}\n      >\n        <circle cx=\"62\" cy=\"58\" r=\"14\" fill=\"rgba(10,10,10,0.72)\" stroke={accent} strokeWidth={SW} />\n        <path d=\"M54 52.5a9 9 0 0 1 6-3.6\" stroke={accent} strokeOpacity=\"0.55\" strokeWidth={SW} strokeLinecap=\"round\" />\n        <rect x=\"-2.5\" y=\"0\" width=\"5\" height=\"14\" rx=\"2.5\" transform=\"translate(72 68) rotate(-45)\" stroke={INK} strokeWidth={SW} />\n      </motion.g>\n    </>\n  );\n}\n\n/** Seedling growing out of a dashed planter. */\nfunction FirstRunArt({ accent, play, animateIn, entered }: ArtProps) {\n  const grown = !animateIn || entered;\n  return (\n    <>\n      <path d=\"M34 78H86\" stroke={INK} strokeWidth={SW} strokeLinecap=\"round\" />\n      <path d=\"M38 78L43.5 98H76.5L82 78\" stroke={INK} strokeWidth={SW} strokeLinejoin=\"round\" strokeDasharray=\"3.5 3.5\" />\n      <path d=\"M50 88H70\" stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" strokeDasharray=\"2 4\" />\n      <motion.g\n        initial={false}\n        animate={play ? { rotate: [0, -5, 4, 0] } : { rotate: 0 }}\n        transition={loop(play, 3.4)}\n        style={{ transformBox: \"view-box\", transformOrigin: \"60px 78px\" }}\n      >\n        <motion.path\n          d=\"M60 78C60 70 59 62 60.5 52\"\n          stroke={INK}\n          strokeWidth={SW}\n          strokeLinecap=\"round\"\n          initial={animateIn ? { pathLength: 0 } : false}\n          animate={{ pathLength: grown ? 1 : 0 }}\n          transition={animateIn ? { duration: 0.55, ease: EASE, delay: 0.15 } : INSTANT}\n        />\n        <motion.g\n          initial={animateIn ? { scale: 0, opacity: 0 } : false}\n          animate={grown ? { scale: 1, opacity: 1 } : { scale: 0, opacity: 0 }}\n          transition={animateIn ? { type: \"spring\", stiffness: 260, damping: 22, delay: 0.5 } : INSTANT}\n          style={{ transformBox: \"view-box\", transformOrigin: \"60px 60px\" }}\n        >\n          <path d=\"M60 62C53 62 46.5 58 45 50.5C52.5 50 58.5 54.5 60 62Z\" fill={accent} fillOpacity=\"0.14\" stroke={accent} strokeWidth={SW} strokeLinejoin=\"round\" />\n          <path d=\"M60.5 56C63 50 69.5 45.5 77 46C75.5 53.5 68 57.5 60.5 56Z\" fill={accent} fillOpacity=\"0.14\" stroke={accent} strokeWidth={SW} strokeLinejoin=\"round\" />\n        </motion.g>\n      </motion.g>\n    </>\n  );\n}\n\n/** Plug pulled out of its socket, twitching toward it. */\nfunction ErrorArt({ accent, play }: ArtProps) {\n  const t = { duration: 2.6, times: [0, 0.06, 0.11, 0.17, 0.26, 1] };\n  return (\n    <>\n      {/* Socket + its cable */}\n      <rect x=\"72\" y=\"44\" width=\"26\" height=\"32\" rx=\"7\" stroke={INK} strokeWidth={SW} />\n      <path d=\"M81 54v8M89 54v8\" stroke={INK} strokeWidth={SW} strokeLinecap=\"round\" />\n      <path d=\"M98 60h6c4 0 6 3 6 7v24\" stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" />\n      {/* Plug + cable */}\n      <motion.g\n        initial={false}\n        animate={play ? { x: [0, 4.5, 0.5, 3, 0, 0], rotate: [0, -2, 1, -1, 0, 0] } : { x: 0, rotate: 0 }}\n        transition={play ? { ...t, ease: \"easeOut\", repeat: CYCLES - 1, delay: 0.75 } : INSTANT}\n        style={{ transformBox: \"view-box\", transformOrigin: \"30px 60px\" }}\n      >\n        <rect x=\"30\" y=\"48\" width=\"20\" height=\"24\" rx=\"5\" stroke={INK} strokeWidth={SW} />\n        <path d=\"M50 55h7M50 65h7\" stroke={INK} strokeWidth={SW} strokeLinecap=\"round\" />\n        <path d=\"M35 56v8\" stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" />\n        <path d=\"M30 60c-8 0-11 4-12 10s-3 12-10 14\" stroke={INK} strokeWidth={SW} strokeLinecap=\"round\" />\n      </motion.g>\n      {/* Spark — the accent detail */}\n      <motion.g\n        initial={false}\n        animate={play ? { opacity: [0.85, 0.25, 1, 0.3, 0.85, 0.85] } : { opacity: 0.85 }}\n        transition={play ? { ...t, ease: \"linear\", repeat: CYCLES - 1, delay: 0.75 } : INSTANT}\n        stroke={accent}\n        strokeWidth={SW}\n        strokeLinecap=\"round\"\n      >\n        <path d=\"M64.5 47.5v4\" />\n        <path d=\"M58.5 49.5l2 3\" />\n        <path d=\"M70.5 49.5l-2 3\" />\n        <path d=\"M64.5 72.5v-4\" />\n      </motion.g>\n    </>\n  );\n}\n\n/** Wi-fi arcs fading bar by bar, outermost first. */\nfunction OfflineArt({ accent, play }: ArtProps) {\n  const cx = 60;\n  const cy = 84;\n  const arc = (r: number) => {\n    const d = r * Math.SQRT1_2;\n    return `M${cx - d} ${cy - d}A${r} ${r} 0 0 1 ${cx + d} ${cy - d}`;\n  };\n  // Rest opacities read as \"weak signal\"; index 0 = innermost.\n  const rest = [0.7, 0.3, 0.14];\n  return (\n    <>\n      <path d=\"M30 98H90\" stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" strokeDasharray=\"2 5\" />\n      {[13, 26, 39].map((r, i) => {\n        // Outer arcs fade first, inner last.\n        const order = 2 - i;\n        const start = 0.18 + order * 0.16;\n        return (\n          <motion.path\n            key={r}\n            d={arc(r)}\n            stroke={INK}\n            strokeWidth={SW}\n            strokeLinecap=\"round\"\n            initial={false}\n            animate={play ? { opacity: [rest[i], 1, 1, rest[i], rest[i]] } : { opacity: rest[i] }}\n            transition={\n              play\n                ? {\n                    duration: 3,\n                    times: [0, 0.12, start, start + 0.16, 1],\n                    ease: \"easeInOut\",\n                    repeat: CYCLES - 1,\n                    delay: 0.75,\n                  }\n                : INSTANT\n            }\n          />\n        );\n      })}\n      <circle cx={cx} cy={cy} r=\"3.5\" fill={accent} />\n      <circle cx={cx} cy={cy} r=\"7.5\" stroke={accent} strokeOpacity=\"0.35\" strokeWidth={SW} />\n    </>\n  );\n}\n\n/** A tray with a single paper plane gliding off. */\nfunction InboxZeroArt({ accent, play }: ArtProps) {\n  return (\n    <>\n      <path\n        d=\"M26 72L35 54H85L94 72V90a5 5 0 0 1-5 5H31a5 5 0 0 1-5-5Z\"\n        stroke={INK}\n        strokeWidth={SW}\n        strokeLinejoin=\"round\"\n      />\n      <path d=\"M26 72H46l4 7h20l4-7H94\" stroke={INK} strokeWidth={SW} strokeLinejoin=\"round\" strokeLinecap=\"round\" />\n      <path d=\"M38 40c6-8 14-11 22-9\" stroke={INK_SOFT} strokeWidth={SW} strokeLinecap=\"round\" strokeDasharray=\"2 4\" />\n      <motion.g\n        initial={false}\n        animate={\n          play\n            ? { x: [0, 30, -14, -14, 0], y: [0, -20, 18, 18, 0], opacity: [1, 0, 0, 0, 1] }\n            : { x: 0, y: 0, opacity: 1 }\n        }\n        transition={\n          play\n            ? { duration: 3.4, times: [0, 0.42, 0.5, 0.6, 1], ease: \"easeInOut\", repeat: CYCLES - 1, delay: 0.75 }\n            : INSTANT\n        }\n      >\n        <path d=\"M62 36L86 26L79 46L73 39Z\" fill={accent} fillOpacity=\"0.14\" stroke={accent} strokeWidth={SW} strokeLinejoin=\"round\" />\n        <path d=\"M73 39L86 26\" stroke={accent} strokeWidth={SW} strokeLinecap=\"round\" />\n        <path d=\"M73 39L72 45L76 42\" stroke={accent} strokeWidth={SW} strokeLinejoin=\"round\" strokeLinecap=\"round\" />\n      </motion.g>\n    </>\n  );\n}\n\nconst ART: Partial<Record<FallowKind, React.ComponentType<ArtProps>>> = {\n  \"no-results\": NoResultsArt,\n  \"first-run\": FirstRunArt,\n  error: ErrorArt,\n  offline: OfflineArt,\n  \"inbox-zero\": InboxZeroArt,\n};\n\n/* ---------------------------------------------------------------- main */\n\ntype RetryPhase = \"idle\" | \"pending\" | \"success\" | \"failed\";\n\n/**\n * Fallow — an empty-state block with five presets (`no-results`, `first-run`,\n * `error`, `offline`, `inbox-zero`) and a custom mode. Each preset carries an\n * original 1.5px line illustration with a single accent detail and a gentle\n * idle loop that plays three cycles once in view, then rests: a magnifier\n * sweeping empty rows, a seedling in a dashed planter, a twitching unplugged\n * cable, Wi-fi arcs fading bar by bar, a paper plane gliding off a tray.\n * Headline, description, an accent primary action and a secondary link, an\n * optional suggestion-chip row, and a retry mode whose button runs an async\n * `onRetry` through pending → success (or an inline \"still failing\" note).\n * The copy sits in a `role=\"status\"` region so swaps and retry results are\n * announced. Reduced motion renders the rest pose with crossfades only.\n */\nexport function Fallow({\n  kind = \"no-results\",\n  title,\n  description,\n  action,\n  secondaryAction,\n  suggestions,\n  onSuggestion,\n  onRetry,\n  size = \"md\",\n  framed = false,\n  illustration,\n  titleAs = \"h3\",\n  paused = false,\n  accentColor = DEFAULT_ACCENT,\n  ref,\n  className,\n  style,\n  ...props\n}: FallowProps) {\n  const reducedMotion = useReducedMotion();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const [seen, setSeen] = React.useState(false);\n  const [run, setRun] = React.useState(0);\n  // Retry state is tagged with the preset it belongs to, so switching `kind`\n  // starts with a clean button (and late results from the old preset are ignored).\n  const [retryState, setRetryState] = React.useState<{ kind: FallowKind; phase: RetryPhase }>({\n    kind,\n    phase: \"idle\",\n  });\n  const retry: RetryPhase = retryState.kind === kind ? retryState.phase : \"idle\";\n  const setRetry = React.useCallback((phase: RetryPhase, forKind: FallowKind) => setRetryState({ kind: forKind, phase }), []);\n  const retryToken = React.useRef(0);\n\n  const preset = PRESETS[kind];\n  const sz = SIZES[size];\n  const ink = readableOn(accentColor);\n  const Title = titleAs;\n\n  // Designed intro: plays the first time the block scrolls into view.\n  React.useEffect(() => {\n    const el = rootRef.current;\n    if (!el) return;\n    const observer = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          setSeen(true);\n          observer.disconnect();\n        }\n      },\n      { threshold: 0.2 }\n    );\n    observer.observe(el);\n    // Belt and braces: if already on screen at mount, don't wait on the observer.\n    const raf = window.requestAnimationFrame(() => {\n      const r = el.getBoundingClientRect();\n      if (r.width > 0 && r.bottom > 0 && r.top < window.innerHeight) {\n        setSeen(true);\n        observer.disconnect();\n      }\n    });\n    return () => {\n      window.cancelAnimationFrame(raf);\n      observer.disconnect();\n    };\n  }, []);\n\n  const replay = React.useCallback(() => {\n    retryToken.current++;\n    setRetry(\"idle\", kind);\n    setRun((r) => r + 1);\n  }, [kind, setRetry]);\n  React.useImperativeHandle(ref, () => ({ replay }), [replay]);\n\n  const shown = reducedMotion || seen;\n  // On replay() the subtree remounts (key={run}) and starts from the hidden pose.\n  const replaying = run > 0 && !reducedMotion;\n  const reveal = (delay: number) => ({\n    initial: replaying ? { opacity: 0, y: 10 } : (false as const),\n    animate: { opacity: shown ? 1 : 0, y: shown ? 0 : 10 },\n    transition: reducedMotion ? INSTANT : { duration: 0.5, ease: EASE, delay },\n  });\n\n  const primary: FallowAction | null =\n    action === null ? null : action ?? (preset.action ? { label: preset.action } : null);\n  const secondary: FallowAction | null =\n    secondaryAction === null ? null : secondaryAction ?? (preset.secondary ? { label: preset.secondary } : null);\n  const chips = suggestions ?? preset.suggestions ?? [];\n  const retryMode = Boolean(onRetry);\n  const showPrimary = retryMode || primary !== null;\n  const titleText = title ?? preset.title;\n  const descText = description ?? preset.description;\n\n  const handleRetry = async () => {\n    if (!onRetry || retry === \"pending\" || retry === \"success\") return;\n    const token = ++retryToken.current;\n    const forKind = kind;\n    setRetry(\"pending\", forKind);\n    try {\n      await onRetry();\n      if (token === retryToken.current) setRetry(\"success\", forKind);\n    } catch {\n      if (token === retryToken.current) setRetry(\"failed\", forKind);\n    }\n  };\n\n  const Art = ART[kind];\n  const art = illustration ?? (Art ? (\n    <svg viewBox=\"0 0 120 120\" fill=\"none\" className=\"size-full overflow-visible\">\n      <circle cx=\"60\" cy=\"62\" r=\"54\" fill=\"rgba(255,255,255,0.018)\" />\n      <circle cx=\"60\" cy=\"62\" r=\"54\" stroke=\"rgba(255,255,255,0.06)\" strokeWidth=\"1\" strokeDasharray=\"1.5 5\" />\n      <Art accent={accentColor} play={shown && !reducedMotion && !paused} animateIn={!reducedMotion} entered={shown} />\n    </svg>\n  ) : null);\n\n  const focusRing =\n    \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--fallow-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-neutral-950\";\n\n  const primaryLabel: React.ReactNode =\n    retry === \"pending\" ? preset.pending : retry === \"success\" ? preset.success : primary?.label ?? preset.action ?? \"Try again\";\n\n  const primaryClass = cn(\n    \"inline-flex shrink-0 items-center justify-center gap-1.5 rounded-lg font-medium whitespace-nowrap\",\n    \"shadow-[inset_0_1px_0_rgba(255,255,255,0.25),0_1px_2px_rgba(0,0,0,0.4)] transition-[filter,transform] hover:brightness-110 active:scale-[0.98]\",\n    sz.btn,\n    focusRing\n  );\n\n  const announce =\n    retry === \"pending\"\n      ? `${preset.pending}…`\n      : retry === \"success\"\n        ? `${preset.success}.`\n        : retry === \"failed\"\n          ? preset.failure\n          : \"\";\n\n  return (\n    <div\n      ref={rootRef}\n      data-crucible=\"fallow\"\n      className={cn(\"@container relative w-full text-white\", className)}\n      style={{ [\"--fallow-accent\" as string]: accentColor, ...style }}\n      {...props}\n    >\n      <div\n        key={run}\n        className={cn(\n          \"flex flex-col items-center text-center\",\n          sz.pad,\n          framed && \"rounded-2xl border border-dashed border-white/[0.12] bg-white/[0.015]\"\n        )}\n      >\n        {art ? (\n          <motion.div\n            aria-hidden\n            className={cn(\"relative isolate shrink-0\", sz.gapArt)}\n            style={{ width: sz.art, height: sz.art }}\n            initial={replaying ? { opacity: 0, scale: 0.94 } : false}\n            animate={{ opacity: shown ? 1 : 0, scale: shown ? 1 : 0.94 }}\n            transition={reducedMotion ? INSTANT : { duration: 0.55, ease: EASE }}\n          >\n            <div\n              className=\"pointer-events-none absolute inset-[-20%] -z-10 rounded-full opacity-60 blur-2xl\"\n              style={{ background: `radial-gradient(closest-side, color-mix(in srgb, ${accentColor} 14%, transparent), transparent)` }}\n            />\n            {art}\n          </motion.div>\n        ) : null}\n\n        <div role=\"status\" aria-live=\"polite\" className=\"flex flex-col items-center\">\n          <motion.div {...reveal(0.08)}>\n            <Title className={cn(\"text-balance text-white\", sz.title)}>{titleText}</Title>\n          </motion.div>\n          {descText ? (\n            <motion.p className={cn(\"text-pretty text-white/55\", sz.desc)} {...reveal(0.14)}>\n              {descText}\n            </motion.p>\n          ) : null}\n          <span className=\"sr-only\">{announce}</span>\n        </div>\n\n        {chips.length > 0 ? (\n          <motion.div className={cn(\"flex flex-wrap items-center justify-center gap-1.5\", sz.chips)} {...reveal(0.2)}>\n            <span className={cn(\"mr-0.5 text-white/40\", size === \"sm\" ? \"text-[11px]\" : \"text-xs\")}>Try</span>\n            {chips.map((chip) => (\n              <button\n                key={chip}\n                type=\"button\"\n                onClick={() => onSuggestion?.(chip)}\n                className={cn(\n                  \"inline-flex items-center rounded-full border border-white/[0.09] bg-white/[0.03] font-medium text-white/70 transition-colors\",\n                  \"hover:border-[color:var(--fallow-accent)]/50 hover:bg-white/[0.06] hover:text-white\",\n                  sz.chip,\n                  focusRing\n                )}\n              >\n                <span className=\"text-white/35\">&lsquo;</span>\n                {chip}\n                <span className=\"text-white/35\">&rsquo;</span>\n              </button>\n            ))}\n          </motion.div>\n        ) : null}\n\n        {showPrimary || secondary ? (\n          <motion.div\n            className={cn(\"flex w-full flex-col items-center justify-center gap-2.5 @xs:w-auto @xs:flex-row @xs:gap-4\", sz.actions)}\n            {...reveal(0.26)}\n          >\n            {showPrimary ? (\n              retryMode ? (\n                <motion.button\n                  type=\"button\"\n                  layout={!reducedMotion}\n                  transition={{ layout: reducedMotion ? INSTANT : { type: \"spring\", stiffness: 420, damping: 34 } }}\n                  onClick={handleRetry}\n                  aria-busy={retry === \"pending\" || undefined}\n                  aria-disabled={retry === \"pending\" || retry === \"success\" || undefined}\n                  className={cn(primaryClass, \"w-full @xs:w-auto\", retry === \"success\" && \"cursor-default hover:brightness-100 active:scale-100\")}\n                  style={{ backgroundColor: accentColor, color: ink }}\n                >\n                  <AnimatePresence mode=\"popLayout\" initial={false}>\n                    <motion.span\n                      key={retry === \"failed\" ? \"idle\" : retry}\n                      className=\"inline-flex items-center gap-1.5\"\n                      initial={{ opacity: 0, y: reducedMotion ? 0 : 6 }}\n                      animate={{ opacity: 1, y: 0 }}\n                      exit={{ opacity: 0, y: reducedMotion ? 0 : -6 }}\n                      transition={reducedMotion ? { duration: 0.12 } : { duration: 0.2, ease: \"easeOut\" }}\n                    >\n                      {retry === \"pending\" ? <Spinner /> : retry === \"success\" ? <CheckGlyph /> : null}\n                      {primaryLabel}\n                    </motion.span>\n                  </AnimatePresence>\n                </motion.button>\n              ) : primary?.href ? (\n                <a\n                  href={primary.href}\n                  onClick={primary.onClick}\n                  className={cn(primaryClass, \"w-full @xs:w-auto\")}\n                  style={{ backgroundColor: accentColor, color: ink }}\n                >\n                  {primary.label}\n                </a>\n              ) : (\n                <button\n                  type=\"button\"\n                  onClick={primary?.onClick}\n                  className={cn(primaryClass, \"w-full @xs:w-auto\")}\n                  style={{ backgroundColor: accentColor, color: ink }}\n                >\n                  {primary?.label}\n                </button>\n              )\n            ) : null}\n            {secondary ? (\n              secondary.href ? (\n                <a\n                  href={secondary.href}\n                  onClick={secondary.onClick}\n                  className={cn(\"group inline-flex items-center gap-1 whitespace-nowrap rounded font-medium text-white/60 transition-colors hover:text-white\", sz.link, focusRing)}\n                >\n                  {secondary.label}\n                  <ArrowGlyph />\n                </a>\n              ) : (\n                <button\n                  type=\"button\"\n                  onClick={secondary.onClick}\n                  className={cn(\"group inline-flex items-center gap-1 whitespace-nowrap rounded font-medium text-white/60 transition-colors hover:text-white\", sz.link, focusRing)}\n                >\n                  {secondary.label}\n                  <ArrowGlyph />\n                </button>\n              )\n            ) : null}\n          </motion.div>\n        ) : null}\n\n        <AnimatePresence initial={false}>\n          {retry === \"failed\" ? (\n            <motion.p\n              key=\"failed\"\n              className={cn(\"mt-3 text-white/50\", size === \"sm\" ? \"text-[11px]\" : \"text-xs\")}\n              initial={{ opacity: 0, height: 0 }}\n              animate={{ opacity: 1, height: \"auto\" }}\n              exit={{ opacity: 0, height: 0 }}\n              transition={reducedMotion ? { duration: 0.12 } : { duration: 0.25, ease: EASE }}\n              aria-hidden\n            >\n              <span className=\"mr-1.5 inline-block size-1.5 -translate-y-px rounded-full bg-amber-300/80 align-middle\" />\n              {preset.failure}\n            </motion.p>\n          ) : null}\n        </AnimatePresence>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}