{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-carousel",
  "title": "Hero Carousel",
  "author": "AlgorizeTech",
  "description": "Ask the user to pick one of 16 hero variants: https://avaraui.com/view/hero. This is the Hero carousel. Skip the question if the user already named one. A full-bleed photo hero with a queue of cards: the front card is the slide on screen, the ones behind it are what comes next. Every five seconds or on a click the queue slides forward, the photograph behind crossfades and the headline and caption follow. A glass panel carries the faces of past guests, an intro and the call to action.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/animated-typography.json",
    "https://avaraui.com/r/avatar-stack.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/HeroCarouselBlock.tsx",
      "content": "\"use client\";\n\nimport React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { ArrowUpRight } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport { AnimatedTypographyBlock } from \"./AnimatedTypographyBlock\";\nimport { AvatarStack, type StackAvatar } from \"./AvatarStackBlock\";\nimport { accentTokens } from \"@/lib/accent\";\n\n// ==========================================\n// HERO CAROUSEL\n// A full-bleed photo hero for a place worth travelling to: an eyebrow pill, a\n// large light headline, a glass panel with the people who came before you and\n// a call to action, and — the thing that moves — a queue of cards. The front\n// card is the slide on screen; the ones behind it are what comes next. Every\n// five seconds, or on a click, the queue slides forward, the photograph behind\n// everything crossfades and the caption follows.\n// ==========================================\n\nexport interface HeroSlide {\n  /** The photograph: shown full-bleed behind the section and inside its card. */\n  image: string;\n  alt: string;\n  /** Short name of the experience, under the front card. */\n  title: string;\n  /** One or two lines under the title. */\n  description?: string;\n  /** Replaces the section `heading` while this slide is in front. */\n  heading?: React.ReactNode;\n  /** CSS object-position for the crop. */\n  position?: string;\n}\n\nexport interface HeroCarouselProps extends Omit<React.HTMLAttributes<HTMLElement>, \"onChange\"> {\n  slides: HeroSlide[];\n  /** The small pill above the headline. */\n  eyebrow?: string;\n  /** The headline, used whenever the front slide has none of its own. */\n  heading?: React.ReactNode;\n  /** The paragraph in the glass panel. */\n  intro?: string;\n  avatars?: StackAvatar[];\n  /** Beside the faces, e.g. \"50+ travellers this season\". */\n  avatarsLabel?: string;\n  cta?: { label: string; href: string };\n  /** Milliseconds between slides. `0` turns autoplay off. */\n  interval?: number;\n  defaultIndex?: number;\n  onChange?: (index: number) => void;\n  /** Sets `--primary` for the section: the eyebrow pip, the arrow on the call to action, the progress line, the focus rings and a tint in the ground. */\n  accent?: string;\n  color?: string;\n  reveal?: \"in-view\" | \"immediate\";\n  /** Pass `next/link` to keep client-side navigation on the CTA. */\n  linkComponent?: React.ElementType;\n}\n\n// ------------------------------------------\n// Rail geometry: the queue is laid out by hand so the cards can tween between\n// positions. Sizes come from the rail's measured width, not the viewport, so\n// the same numbers work whether the rail shares its row with the panel or not.\n// ------------------------------------------\ninterface RailMetrics {\n  bigW: number;\n  bigH: number;\n  smallW: number;\n  smallH: number;\n  gap: number;\n  /** Height of the whole rail: the front card plus its caption. */\n  railH: number;\n}\n\n/** Room under the front card for its title and two lines. */\nconst CAPTION_SPACE = 92;\n\nfunction railMetrics(width: number): RailMetrics {\n  if (width < 520) {\n    // Phones: the queued cards match the front card's height, so they stay\n    // portrait rather than becoming slivers; the caption has the row to itself.\n    const bigW = Math.round(width * 0.6);\n    const bigH = Math.round(bigW * 0.8);\n    return { bigW, bigH, smallW: Math.round(width * 0.3), smallH: bigH, gap: 10, railH: bigH + CAPTION_SPACE - 14 };\n  }\n  if (width < 780) {\n    return { bigW: 240, bigH: 188, smallW: 130, smallH: 188 + CAPTION_SPACE, gap: 12, railH: 188 + CAPTION_SPACE };\n  }\n  return { bigW: 288, bigH: 224, smallW: 158, smallH: 224 + CAPTION_SPACE, gap: 14, railH: 224 + CAPTION_SPACE };\n}\n\nconst prefersReducedMotion = () =>\n  typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n\n// ------------------------------------------\n// Motion, with no library: GSAP's power3.out, power3.inOut and power2.out as\n// CSS easings, run through the Web Animations API so a move can be dropped\n// where it stands and the next one start from there.\n// ------------------------------------------\nconst EASE_OUT =\n  \"linear(0, .1945, .3591, .4971, .6115, .7052, .7808, .8409, .8877, .9233, .9497, .9686, .9816, .9901, .9952, .998, .9994, .9999, 1, 1)\";\nconst EASE_TRAVEL =\n  \"linear(0, 0, .0002, .0012, .0039, .0094, .0195, .0361, .0617, .0988, .1505, .2204, .3121, .4299, .5701, .6879, .7796, .8495, .9012, .9383, .9639, .9805, .9906, .9961, .9988, .9998, 1, 1)\";\nconst EASE_SETTLE = \"cubic-bezier(0.3333, 1, 0.6667, 1)\";\n\n/** `el.animate`, or nothing where the engine cannot run these easings. */\nfunction play(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions) {\n  if (typeof el.animate !== \"function\") return null;\n  try {\n    return el.animate(keyframes, options);\n  } catch {\n    return null;\n  }\n}\n\n// The progress line fills once per slide; its end moves the queue.\nconst PROGRESS_CSS = \"@keyframes hc-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }\";\n\nexport const DEFAULT_CAROUSEL_AVATARS: StackAvatar[] = [\n  {\n    src: \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_120,h_120,c_fill/v1790145139/pexels-photo-1036623-1790145143487.jpg\",\n    alt: \"Elena Vance\",\n    name: \"Elena Vance\",\n    role: \"Alpine Trekker\",\n    designation: \"Alpine Trekker\",\n  },\n  {\n    src: \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_120,h_120,c_fill/v1790145142/pexels-photo-2043590-1790145143488.jpg\",\n    alt: \"Tom Hardy\",\n    name: \"Tom Hardy\",\n    role: \"Summit Guide\",\n    designation: \"Summit Guide\",\n  },\n  {\n    src: \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_120,h_120,c_fill/v1790145139/pexels-photo-1587009-1790145143488.jpg\",\n    alt: \"Mara Jade\",\n    name: \"Mara Jade\",\n    role: \"Trail Explorer\",\n    designation: \"Trail Explorer\",\n  },\n  {\n    src: \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_120,h_120,c_fill/v1790145139/pexels-photo-3775534-1790145143488.jpg\",\n    alt: \"Leo Silva\",\n    name: \"Leo Silva\",\n    role: \"Photographer\",\n    designation: \"Photographer\",\n  },\n  {\n    src: \"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_120,h_120,c_fill/v1790082180/pexels-photo-1520760-1790082180553.jpg\",\n    alt: \"June Carter\",\n    name: \"June Carter\",\n    role: \"Mountain Guide\",\n    designation: \"Mountain Guide\",\n  },\n];\n\n// ------------------------------------------\n// Root\n// ------------------------------------------\nexport function HeroCarousel({\n  slides,\n  eyebrow,\n  heading,\n  intro,\n  avatars = DEFAULT_CAROUSEL_AVATARS,\n  avatarsLabel,\n  cta,\n  interval = 5000,\n  defaultIndex = 0,\n  onChange,\n  accent,\n  color,\n  reveal = \"in-view\",\n  linkComponent: Link = \"a\",\n  className,\n  style,\n  ...props\n}: HeroCarouselProps) {\n  const n = slides.length;\n  const rootRef = useRef<HTMLElement>(null);\n  const railRef = useRef<HTMLDivElement>(null);\n  const cardRefs = useRef<(HTMLButtonElement | null)[]>([]);\n  const bgRefs = useRef<(HTMLDivElement | null)[]>([]);\n  const movesRef = useRef(new WeakMap<Element, Animation>());\n  const fadesRef = useRef(new WeakMap<Element, Animation>());\n  const driftsRef = useRef(new WeakMap<Element, Animation>());\n  const driftRef = useRef<Animation | null>(null);\n  const queueRef = useRef<number[]>([]);\n  const swipe = useRef<{ x: number; moved: boolean } | null>(null);\n\n  const [active, setActive] = useState(() => Math.min(Math.max(defaultIndex, 0), Math.max(n - 1, 0)));\n  const [leaving, setLeaving] = useState<number | null>(null);\n  const [railWidth, setRailWidth] = useState(0);\n  const [inView, setInView] = useState(reveal === \"immediate\");\n  const [hover, setHover] = useState(false);\n  const [hidden, setHidden] = useState(false);\n  const [onScreen, setOnScreen] = useState(true);\n\n  const resolvedAvatars: StackAvatar[] = (avatars && avatars.length > 0 ? avatars : DEFAULT_CAROUSEL_AVATARS).map((a, i) => {\n    const fallback = DEFAULT_CAROUSEL_AVATARS[i % DEFAULT_CAROUSEL_AVATARS.length];\n    return {\n      ...a,\n      name: a.name ?? (a.alt && a.alt !== \"Traveller\" ? a.alt : fallback.name),\n      alt: a.alt ?? a.name ?? fallback.alt,\n      role: a.role ?? a.designation ?? fallback.designation ?? fallback.role,\n      designation: a.designation ?? a.role ?? fallback.designation ?? fallback.role,\n    };\n  });\n\n  const metrics = railWidth > 0 ? railMetrics(railWidth) : null;\n\n  // The committed index, for `go` — kept current as soon as each change lands.\n  const activeRef = useRef(active);\n  useLayoutEffect(() => {\n    activeRef.current = active;\n  }, [active]);\n  const go = useCallback(\n    (index: number) => {\n      if (n === 0) return;\n      const next = ((index % n) + n) % n;\n      const current = activeRef.current;\n      if (current === next) return;\n      setLeaving(current);\n      setActive(next);\n    },\n    [n],\n  );\n\n  useEffect(() => {\n    onChange?.(active);\n  }, [active, onChange]);\n\n  // ---- Measure the rail. Cards are positioned from these numbers.\n  useLayoutEffect(() => {\n    const rail = railRef.current;\n    if (!rail) return;\n    const measure = () => setRailWidth(rail.clientWidth);\n    measure();\n    if (typeof ResizeObserver === \"undefined\") return;\n    const ro = new ResizeObserver(measure);\n    ro.observe(rail);\n    return () => ro.disconnect();\n  }, []);\n\n  // ---- Lay the queue out. The front card is `active`; the rest follow in order.\n  // A card that moves backwards in the queue slides there; one sent to the back\n  // appears at its new place instead of flying across the others. The queue\n  // position is the card's `translate`, so it never meets the reveal's\n  // `transform`.\n  useLayoutEffect(() => {\n    if (!metrics) return;\n    const reduced = prefersReducedMotion();\n    const first = queueRef.current.length !== n;\n    slides.forEach((_, i) => {\n      const el = cardRefs.current[i];\n      if (!el) return;\n      const k = (i - active + n) % n;\n      const x = k === 0 ? 0 : metrics.bigW + metrics.gap + (k - 1) * (metrics.smallW + metrics.gap);\n      const target = {\n        translate: `${x}px 0px`,\n        width: `${k === 0 ? metrics.bigW : metrics.smallW}px`,\n        height: `${k === 0 ? metrics.bigH : metrics.smallH}px`,\n      };\n      el.style.zIndex = String(n - k);\n      const prevK = queueRef.current[i];\n      // Placing a card always drops a slide still running on it; left to run,\n      // the old slide would carry the card back to where it was heading (a\n      // card could stay stuck at the front after quick clicks).\n      const running = movesRef.current.get(el);\n      movesRef.current.delete(el);\n      if (first || reduced || prevK === k) {\n        running?.cancel();\n        Object.assign(el.style, target);\n      } else if (k > prevK) {\n        running?.cancel();\n        Object.assign(el.style, target);\n        fadesRef.current.get(el)?.cancel();\n        const fade = play(el, [{ opacity: 0 }, { opacity: 1 }], { duration: 600, delay: 350, easing: EASE_SETTLE, fill: \"backwards\" });\n        if (fade) fadesRef.current.set(el, fade);\n      } else {\n        // From wherever the card is on screen, the full length again.\n        const cs = getComputedStyle(el);\n        const from = { translate: cs.translate, width: cs.width, height: cs.height };\n        running?.cancel();\n        Object.assign(el.style, target);\n        const move = play(el, [from, target], { duration: 950, easing: EASE_TRAVEL });\n        if (move) movesRef.current.set(el, move);\n      }\n      queueRef.current[i] = k;\n    });\n    // The metrics object is derived from railWidth; that is the real dependency.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [active, railWidth, n]);\n\n  // ---- The photograph behind everything: swap, settle, then drift. The\n  // layers' opacity comes straight from render, so the swap is a cut.\n  useEffect(() => {\n    const incoming = bgRefs.current[active];\n    if (!incoming) return;\n    const img = incoming.querySelector(\"img\");\n    const reduced = prefersReducedMotion();\n    // The drift that was running stops where it is: its photograph keeps\n    // that scale.\n    const previous = driftRef.current;\n    driftRef.current = null;\n    if (previous) {\n      try {\n        previous.commitStyles();\n        previous.cancel();\n      } catch {\n        previous.pause();\n      }\n    }\n    if (!img) return;\n    driftsRef.current.get(img)?.cancel();\n    driftsRef.current.delete(img);\n    if (reduced) {\n      img.style.transform = \"scale(1)\";\n      return;\n    }\n    // Settle from 1.08 to 1 over 1.6s, then creep to 1.05 until well past the next slide.\n    const drift = Math.max(interval / 1000, 4) + 3;\n    const total = 1.6 + drift;\n    const anim = play(\n      img,\n      [\n        { transform: \"scale(1.08)\", easing: EASE_SETTLE },\n        { transform: \"scale(1)\", offset: 1.6 / total, easing: \"linear\" },\n        { transform: \"scale(1.05)\" },\n      ],\n      { duration: total * 1000, fill: \"forwards\" },\n    );\n    if (anim) {\n      driftRef.current = anim;\n      driftsRef.current.set(img, anim);\n    }\n  }, [active, interval]);\n\n  // ---- The slide that just left keeps its \"leaving\" state until its\n  // transition has run, then goes back to idle.\n  useEffect(() => {\n    if (leaving === null) return;\n    const t = window.setTimeout(() => setLeaving(null), 700);\n    return () => window.clearTimeout(t);\n  }, [leaving, active]);\n\n  // ---- Autoplay is the progress line: when it fills, the queue moves. Pausing\n  // the line pauses the clock, so a hover never loses the time already spent.\n  // (The line is a CSS animation on the front card; see `onProgressEnd`.)\n  const paused = hover || hidden || !onScreen || !inView;\n  const onProgressEnd = (e: React.AnimationEvent<HTMLSpanElement>) => {\n    if (e.target === e.currentTarget && e.animationName === \"hc-progress\") go(active + 1);\n  };\n\n  useEffect(() => {\n    const onVisibility = () => setHidden(document.hidden);\n    document.addEventListener(\"visibilitychange\", onVisibility);\n    return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n  }, []);\n\n  useEffect(() => {\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(\n      (entries) => {\n        const hit = entries.some((e) => e.isIntersecting);\n        setOnScreen(hit);\n        if (hit) setInView(true);\n      },\n      { threshold: 0.2 },\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  // ---- The reveal: eyebrow and headline out of a blur, the panel up, the\n  // cards one after another. Plays once, the first time the section is seen.\n  // Keyed on booleans, not on `metrics` (a fresh object every render): any\n  // re-render — a resize, a hover, props arriving — would otherwise run the\n  // cleanup and kill the timeline mid-play, leaving everything blurred out.\n  const measured = metrics !== null;\n  const revealed = useRef(false);\n  const revealAnims = useRef<Animation[]>([]);\n  useEffect(() => {\n    if (!inView || !measured || revealed.current) return;\n    revealed.current = true;\n    const root = rootRef.current;\n    if (!root || prefersReducedMotion()) return;\n    // A reveal cut short earlier is still frozen where it stopped.\n    revealAnims.current.forEach((a) => a.cancel());\n    const anims: Animation[] = [];\n    // Each element starts `start + i * each` seconds in, held at its start pose until then.\n    const rise = (selector: string, from: Keyframe, to: Keyframe, duration: number, start: number, each = 0) =>\n      root.querySelectorAll(selector).forEach((el, i) => {\n        const a = play(el, [from, to], {\n          duration: duration * 1000,\n          delay: (start + i * each) * 1000,\n          easing: EASE_OUT,\n          fill: \"backwards\",\n        });\n        if (a) anims.push(a);\n      });\n    const shown = { opacity: 1, transform: \"translateY(0px)\" };\n    rise(\"[data-hc-lead]\", { opacity: 0, transform: \"translateY(22px)\", filter: \"blur(10px)\" }, { ...shown, filter: \"blur(0px)\" }, 0.9, 0, 0.12);\n    rise(\"[data-hc-card]\", { opacity: 0, transform: \"translateY(28px)\" }, shown, 0.9, 0.35, 0.08);\n    rise(\"[data-hc-captions]\", { opacity: 0, transform: \"translateY(10px)\" }, shown, 0.6, 0.8);\n    rise(\"[data-hc-panel]\", { opacity: 0, transform: \"translateY(18px)\" }, shown, 0.8, 0.55);\n    revealAnims.current = anims;\n    return () => {\n      // Reached on unmount, a StrictMode remount, or the rail measuring 0 while\n      // hidden. An entrance cut short replays next time rather than staying frozen.\n      if (anims.some((a) => a.playState !== \"finished\")) {\n        revealed.current = false;\n        anims.forEach((a) => a.pause());\n      }\n    };\n  }, [inView, measured]);\n\n  // ---- Keyboard and touch: arrows walk the queue, a swipe on the rail too.\n  const onKeyDown = (e: React.KeyboardEvent) => {\n    if (e.key === \"ArrowRight\") {\n      e.preventDefault();\n      go(active + 1);\n    } else if (e.key === \"ArrowLeft\") {\n      e.preventDefault();\n      go(active - 1);\n    }\n  };\n  const onPointerDown = (e: React.PointerEvent) => {\n    if (e.pointerType === \"mouse\") return;\n    swipe.current = { x: e.clientX, moved: false };\n  };\n  const onPointerMove = (e: React.PointerEvent) => {\n    if (!swipe.current) return;\n    if (Math.abs(e.clientX - swipe.current.x) > 12) swipe.current.moved = true;\n  };\n  const onPointerUp = (e: React.PointerEvent) => {\n    const s = swipe.current;\n    swipe.current = null;\n    if (!s) return;\n    const dx = e.clientX - s.x;\n    if (Math.abs(dx) > 40) go(dx < 0 ? active + 1 : active - 1);\n  };\n\n  const vars = accentTokens(accent || color);\n  const front = slides[active];\n  const railHeight = metrics ? metrics.railH : 320;\n\n  return (\n    <section\n      ref={rootRef}\n      className={cn(\"relative isolate w-full overflow-hidden bg-[color-mix(in_oklab,var(--primary)_12%,#0b0c0f)] text-white\", className)}\n      style={{ ...vars, ...style }}\n      {...props}\n    >\n      <style>{PROGRESS_CSS}</style>\n      {/* ---- The photographs, one on top of the other; the front slide's is opaque. */}\n      <div className=\"absolute inset-0\" aria-hidden>\n        {slides.map((s, i) => (\n          <div\n            key={s.image + i}\n            ref={(el) => {\n              bgRefs.current[i] = el;\n            }}\n            className=\"absolute inset-0 will-change-[opacity]\"\n            style={{ opacity: i === active ? 1 : 0 }}\n          >\n            <img\n              src={s.image}\n              alt=\"\"\n              draggable={false}\n              style={s.position ? { objectPosition: s.position } : undefined}\n              className=\"absolute inset-0 h-full w-full object-cover will-change-transform\"\n            />\n          </div>\n        ))}\n        {/* The scrim: dark along the top for the headline, darker along the foot for the panel and the rail. */}\n        <div className=\"absolute inset-0 bg-[linear-gradient(to_bottom,rgba(0,0,0,0.42)_0%,rgba(0,0,0,0.06)_38%,rgba(0,0,0,0.14)_62%,rgba(0,0,0,0.6)_100%)]\" />\n      </div>\n\n      {/* No viewport units here: the section takes the height it needs and a\n          consumer who wants it screen-tall passes `className=\"lg:h-svh\"`. */}\n      <div className=\"relative mx-auto flex h-full min-h-[38rem] max-w-7xl flex-col px-5 pb-6 pt-12 sm:px-8 sm:pb-8 sm:pt-16 lg:min-h-[44rem] lg:pt-20\">\n        {/* ---- Eyebrow and headline ---- */}\n        <div className=\"text-center\">\n          {eyebrow && (\n            <span\n              data-hc-lead=\"\"\n              className=\"inline-flex items-center gap-2 rounded-full border border-white/20 bg-white/10 px-4 py-1.5 text-[13px] font-medium text-white/90 shadow-[0_8px_30px_-12px_rgba(0,0,0,0.5)] backdrop-blur-md\"\n            >\n              <span className=\"size-1.5 rounded-full bg-primary\" aria-hidden />\n              {eyebrow}\n            </span>\n          )}\n          <div data-hc-lead=\"\" className=\"mx-auto mt-5 grid max-w-[46rem] sm:mt-6\">\n            {/* The headline follows the front slide, blurring across. */}\n            <AnimatedTypographyBlock\n              as=\"h1\"\n              bare\n              variant=\"blur-swap\"\n              index={active}\n              words={slides.map((s) => s.heading ?? heading)}\n              className=\"text-balance font-sans text-[2.35rem] font-light leading-[1.04] tracking-[-0.025em] [text-shadow:0_2px_24px_rgba(0,0,0,0.35)] sm:text-[3.3rem] lg:text-[4.2rem] xl:text-[4.6rem]\"\n            />\n          </div>\n        </div>\n\n        {/* ---- Panel and rail ---- */}\n        <div className=\"mt-10 grid items-end gap-6 sm:mt-12 lg:mt-auto lg:grid-cols-[minmax(19rem,23rem)_minmax(0,1fr)] lg:gap-10\">\n          <div\n            data-hc-panel=\"\"\n            className=\"order-2 w-full max-w-[28rem] rounded-[26px] border border-white/15 bg-white/10 p-5 shadow-[0_30px_60px_-30px_rgba(0,0,0,0.6)] backdrop-blur-xl sm:p-6 lg:order-1 lg:max-w-none\"\n          >\n            {(resolvedAvatars.length > 0 || avatarsLabel) && (\n              <div className=\"flex items-center gap-3\">\n                {resolvedAvatars.length > 0 && (\n                  <AvatarStack\n                    avatars={resolvedAvatars}\n                    variant=\"shift\"\n                    showTooltip={true}\n                    size=\"md\"\n                    max={4}\n                    ringClassName=\"border-white/30 ring-0\"\n                    className=\"m-0 p-0 py-0 px-0 h-auto\"\n                  />\n                )}\n                {avatarsLabel && (\n                  <span className=\"shrink-0 text-[13px] font-medium leading-snug text-white/90 transition-all duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]\">\n                    {avatarsLabel}\n                  </span>\n                )}\n              </div>\n            )}\n            {intro && <p className=\"mt-4 max-w-[34ch] text-[14px] leading-[1.6] text-white/80\">{intro}</p>}\n            {cta && (\n              <Link\n                href={cta.href}\n                className=\"group/cta mt-5 inline-flex h-11 items-center gap-3 rounded-full border border-white/25 bg-white/10 py-1 pl-5 pr-1.5 text-[14px] font-semibold text-white outline-none backdrop-blur-md transition-[background-color,transform] duration-300 hover:bg-white/20 focus-visible:ring-2 focus-visible:ring-primary/70 active:scale-[0.98]\"\n              >\n                {cta.label}\n                <span className=\"grid size-8 place-items-center rounded-full bg-primary text-primary-foreground transition-transform duration-300 group-hover/cta:rotate-45\">\n                  <ArrowUpRight size={15} />\n                </span>\n              </Link>\n            )}\n          </div>\n\n          <div\n            ref={railRef}\n            role=\"group\"\n            aria-roledescription=\"carousel\"\n            aria-label=\"Experiences\"\n            tabIndex={-1}\n            onKeyDown={onKeyDown}\n            onMouseEnter={() => setHover(true)}\n            onMouseLeave={() => setHover(false)}\n            onFocus={(e) => {\n              // Only a keyboard focus holds the clock; a mouse click focuses too but the pointer is already pausing it.\n              if ((e.target as HTMLElement).matches?.(\":focus-visible\")) setHover(true);\n            }}\n            onBlur={(e) => {\n              if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setHover(false);\n            }}\n            onPointerDown={onPointerDown}\n            onPointerMove={onPointerMove}\n            onPointerUp={onPointerUp}\n            onPointerCancel={() => {\n              swipe.current = null;\n            }}\n            className=\"relative order-1 w-full touch-pan-y select-none outline-none [mask-image:linear-gradient(to_right,black_82%,transparent)] lg:order-2\"\n            style={{ height: railHeight, visibility: metrics ? \"visible\" : \"hidden\" }}\n          >\n            {slides.map((s, i) => {\n              const isFront = i === active;\n              return (\n                <button\n                  key={s.image + i}\n                  type=\"button\"\n                  ref={(el) => {\n                    cardRefs.current[i] = el;\n                  }}\n                  data-hc-card=\"\"\n                  aria-label={isFront ? `${s.title} (showing)` : `Show ${s.title}`}\n                  aria-current={isFront ? \"true\" : undefined}\n                  onClick={(e) => {\n                    if (swipe.current?.moved) {\n                      e.preventDefault();\n                      return;\n                    }\n                    go(isFront ? active + 1 : i);\n                  }}\n                  className={cn(\n                    \"group absolute left-0 top-0 overflow-hidden rounded-[18px] outline-none ring-white/80 ring-offset-2 ring-offset-transparent will-change-[transform,width,height] focus-visible:ring-2 sm:rounded-[22px]\",\n                    !isFront && \"cursor-pointer\",\n                  )}\n                >\n                  <img\n                    src={s.image}\n                    alt={s.alt}\n                    draggable={false}\n                    style={s.position ? { objectPosition: s.position } : undefined}\n                    className={cn(\n                      \"absolute inset-0 h-full w-full object-cover transition-transform duration-700 ease-out\",\n                      !isFront && \"group-hover:scale-[1.06]\",\n                    )}\n                  />\n                  <span\n                    aria-hidden\n                    className={cn(\n                      \"absolute inset-0 bg-gradient-to-t from-black/40 via-black/0 to-black/0 transition-opacity duration-500\",\n                      isFront ? \"opacity-60\" : \"opacity-100 group-hover:opacity-70\",\n                    )}\n                  />\n                  <span aria-hidden className=\"absolute inset-0 rounded-[inherit] ring-1 ring-inset ring-white/20\" />\n                  {isFront && interval > 0 && n > 1 && (\n                    <span aria-hidden className=\"absolute inset-x-4 bottom-3 h-[3px] overflow-hidden rounded-full bg-white/30\">\n                      <span\n                        // A new interval or queue length starts the line again.\n                        key={`${interval}:${n}`}\n                        onAnimationEnd={onProgressEnd}\n                        className=\"block h-full w-full origin-left rounded-full bg-primary\"\n                        // Held until the rail is measured, which only happens once the page is live.\n                        style={{\n                          transform: \"scaleX(0)\",\n                          animationName: \"hc-progress\",\n                          animationDuration: `${interval}ms`,\n                          animationTimingFunction: \"linear\",\n                          animationFillMode: \"forwards\",\n                          animationPlayState: paused || !metrics ? \"paused\" : \"running\",\n                        }}\n                      />\n                    </span>\n                  )}\n                </button>\n              );\n            })}\n\n            {/* The caption sits under the front card and swaps with it. */}\n            {metrics && (\n              <div\n                data-hc-captions=\"\"\n                className=\"absolute left-0 grid\"\n                style={{ top: metrics.bigH + 14, width: metrics.bigW }}\n              >\n                {slides.map((s, i) => {\n                  const state = i === active ? \"active\" : i === leaving ? \"leaving\" : \"idle\";\n                  return (\n                    <div\n                      key={s.image + i}\n                      aria-hidden={i !== active}\n                      className={cn(\n                        \"col-start-1 row-start-1 transition-[opacity,transform,filter] duration-600 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none\",\n                        state === \"active\" && \"opacity-100 delay-200\",\n                        state === \"leaving\" && \"-translate-y-2 opacity-0 blur-[4px]\",\n                        state === \"idle\" && \"translate-y-3 opacity-0 blur-[4px] transition-none\",\n                      )}\n                    >\n                      <p className=\"text-[15px] font-semibold leading-tight text-white [text-shadow:0_1px_12px_rgba(0,0,0,0.4)]\">{s.title}</p>\n                      {s.description && (\n                        <p className=\"mt-1.5 line-clamp-2 text-[12.5px] leading-snug text-white/75 [text-shadow:0_1px_12px_rgba(0,0,0,0.4)]\">{s.description}</p>\n                      )}\n                    </div>\n                  );\n                })}\n              </div>\n            )}\n            <span className=\"sr-only\" aria-live=\"polite\">\n              {front ? `Slide ${active + 1} of ${n}: ${front.title}` : \"\"}\n            </span>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nHeroCarousel.metrics = railMetrics;\n\nexport default HeroCarousel;\n",
      "type": "registry:component",
      "target": "components/custom/blocks/HeroCarouselBlock.tsx"
    },
    {
      "path": "src/lib/accent.ts",
      "content": "import type { CSSProperties } from \"react\";\n\n/**\n * Bridging the docs colour picker into a preview.\n *\n * Most blocks are already written against the `--primary` token (`bg-primary`,\n * `ring-primary/30`, `text-primary-foreground`…). Rather than teaching each one a\n * bespoke `color` prop, a demo can repoint that token for its own subtree and\n * every one of those classes follows along.\n */\n\n/** The swatches the picker offers, as concrete CSS colours. */\nconst PRESET_HEX: Record<string, string> = {\n  lavender: \"#9b8afb\",\n  indigo: \"#6366f1\",\n  rose: \"#f43f5e\",\n  emerald: \"#10b981\",\n  zinc: \"#18181b\",\n};\n\n/** True when the picker sits on \"Default\" — the page theme should win. */\nexport function isDefaultAccent(color?: string): boolean {\n  return !color || color === \"primary\" || color === \"default\";\n}\n\n/**\n * Turns a picker value into a CSS colour, or null for \"Default\" — meaning\n * nothing should be overridden, so the theme (and the sidebar customizer)\n * keeps control.\n */\nexport function resolveAccent(color?: string): string | null {\n  if (isDefaultAccent(color)) return null;\n  return PRESET_HEX[color as string] ?? (color as string);\n}\n\n/**\n * The picker value in a form every block accepts. Blocks know the older swatch\n * names but not \"lavender\" — and since that is also a CSS named colour\n * (#e6e6fa), a block that passes unknown names straight through would paint\n * the wrong shade, while others fall back to a different palette. Demos that\n * hand the picker value to such a block run it through this first. Every\n * other value is returned untouched.\n */\nexport function toBlockColor(color: string): string;\nexport function toBlockColor(color: string | undefined): string | undefined;\nexport function toBlockColor(color?: string): string | undefined {\n  return color === \"lavender\" ? PRESET_HEX.lavender : color;\n}\n\nfunction parseHex(input: string): [number, number, number] | null {\n  const hex = input.trim().replace(/^#/, \"\");\n  if (/^[a-f\\d]{3}$/i.test(hex)) {\n    const [r, g, b] = hex.split(\"\");\n    return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16)];\n  }\n  if (/^[a-f\\d]{6}$/i.test(hex)) {\n    return [\n      parseInt(hex.slice(0, 2), 16),\n      parseInt(hex.slice(2, 4), 16),\n      parseInt(hex.slice(4, 6), 16),\n    ];\n  }\n  return null;\n}\n\n/** Legible foreground for content sitting on a filled `color` swatch. */\nexport function accentForeground(color: string): string {\n  const rgb = parseHex(color);\n  if (!rgb) return \"#ffffff\";\n  const channel = (v: number) => {\n    const c = v / 255;\n    return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n  };\n  const luminance =\n    0.2126 * channel(rgb[0]) +\n    0.7152 * channel(rgb[1]) +\n    0.0722 * channel(rgb[2]);\n  return luminance > 0.45 ? \"#09090b\" : \"#ffffff\";\n}\n\n/** The theme tokens a picked accent repoints, as `--name` → value. */\nexport function accentTokens(color?: string): Record<string, string> {\n  const resolved = resolveAccent(color);\n  if (!resolved) return {};\n  return {\n    \"--primary\": resolved,\n    \"--primary-foreground\": accentForeground(resolved),\n    \"--ring\": resolved,\n  };\n}\n\n/**\n * Inline style repointing `--primary` at the picked accent for one subtree.\n * `--primary-foreground` is derived alongside it, otherwise a light pick leaves\n * `text-primary-foreground` content unreadable on its own fill. Returns `{}` on\n * \"Default\" so the page theme still wins.\n */\nexport function accentStyle(color?: string): CSSProperties {\n  return accentTokens(color) as CSSProperties;\n}\n",
      "type": "registry:component",
      "target": "lib/accent.ts"
    }
  ],
  "docs": "Named export: HeroCarousel. Composed from the avatar-stack item, which installs alongside it. Pass `slides` ({ image, alt, title, description?, heading?, position? }), `eyebrow`, `heading`, `intro`, `avatars` + `avatarsLabel`, `cta` ({ label, href }) and `linkComponent`. `interval` is the autoplay gap in ms (0 turns it off), `accent` sets --primary, `reveal` is in-view or immediate, `onChange` reports the front slide.",
  "categories": [
    "marketing",
    "layout"
  ],
  "type": "registry:component"
}
