{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "parallax-carousel",
  "title": "Parallax Carousel",
  "description": "A strip of image planes you drag, scroll or step through with the arrow keys, each picture sliding inside its frame as it moves away from the centre, with an optional autoplay drift. No dependencies.",
  "files": [
    {
      "path": "registry/mewo/ui/parallax-carousel.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface ParallaxCarouselControls {\n  /** Glide until image `index` is centred, or as near as the scroll range allows without loop. */\n  scrollToIndex: (index: number) => void\n  /** Glide back to the start. */\n  reset: () => void\n}\n\nexport interface ParallaxCarouselProps extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n  /** Image URLs, in order. Landscape images give the parallax room to slide inside the portrait planes. */\n  images?: string[]\n  /** Plane width in pixels. */\n  imageWidth?: number\n  /** Plane height in pixels. */\n  imageHeight?: number\n  /** Gap between planes in pixels. */\n  gap?: number\n  /** How far each image slides inside its plane as the plane moves away from the centre, 0 to 1. */\n  parallaxIntensity?: number\n  /** The image is zoomed by 1 / uvScale inside its plane, for more parallax room. 0.6 to 1. */\n  uvScale?: number\n  /** Share of the remaining distance the strip covers per 60 fps frame, 0 to 1, at any frame rate. Lower glides longer. */\n  lerp?: number\n  /** Multiplier on wheel movement. Either wheel axis moves the strip sideways. */\n  wheelSensitivity?: number\n  /** Multiplier on drag movement. The strip glides to a stop on release, without a fling. */\n  dragSensitivity?: number\n  /**\n   * Loop endlessly; the planes wrap around. Without it the scroll runs from the first image centred to content\n   * width minus view width, so the last images stop short of the centre.\n   */\n  loop?: boolean\n  /** Corner radius of the planes, in pixels. */\n  borderRadius?: number\n  /** Idle drift in pixels per second; 0 turns it off. It holds while dragging, off screen and with reduced motion. */\n  autoplaySpeed?: number\n  /** Hold the drift while a mouse is over the carousel. */\n  pauseOnHover?: boolean\n  /** Show a progress line at the bottom. It is hidden in loop mode and when there is nothing to scroll. */\n  showProgress?: boolean\n  /**\n   * Tone curve applied to the images: each channel becomes (v / 255) ^ toneGamma. 2.2 gives a deep, saturated\n   * look; 1 keeps the true colours. Needs readable pixels (same-origin, data: or CORS-enabled images); other\n   * images show as they are.\n   */\n  toneGamma?: number\n  /** Receives `{ scrollToIndex, reset }`. The root's own ref stays free for the consumer. */\n  controlsRef?: React.Ref<ParallaxCarouselControls>\n}\n\ninterface Texture {\n  /** Which preparation this is: tone gamma and source. */\n  key: string\n  url: string\n  /** Size of the image before padding, in source pixels. */\n  w: number\n  h: number\n  /** Padding on each side, in source pixels. */\n  pad: number\n  /** The url is a blob made here, revoked when the last carousel showing it lets go. */\n  blob: boolean\n}\n\ninterface TextureEntry {\n  /** Settles on the prepared image, or on null when it does not load at all. */\n  ready: Promise<Texture | null>\n  texture: Texture | null\n  users: number\n  released: boolean\n}\n\n// placeholder cats, each a fixed one from cataas.com (served with CORS), so the strip shows the same pictures every time\nexport const DEFAULT_IMAGES = [\"7aqq2nCe7IiZEKjJ\", \"7U01QMCY91SvOpyk\", \"5n4MTAC6ld0bVeCe\", \"Tp3xHAlsE30nHEsC\", \"2R4fwl2tPwmSwvp1\", \"BbXEl9TskqkOjzyr\", \"tFhSg8kwne156Mj9\", \"pSvsRuMYzn3AoBGx\"].map((id) => `https://cataas.com/cat/${id}`)\n\n// An image slides by this share of its drawn width, times the intensity, when its plane is half a view from the centre.\nconst PARALLAX_SCALE = 0.5\n// A press has to travel this many pixels before it counts as a drag.\nconst DRAG_THRESHOLD = 3\n// Images are downscaled to this width before they are prepared.\nconst TEXTURE_MAX_WIDTH = 1600\n// A prepared image carries this share of its width again on either side, filled with its stretched edge columns,\n// so a shift past the edge smears the edge pixels (like a clamped texture) instead of opening a gap.\nconst EDGE_PAD = 0.5\n// A wheel reporting in lines (deltaMode 1) moves this many pixels per line.\nconst WHEEL_LINE = 40\n// uvScale is held at or above this, so the zoom stays within reason.\nconst MIN_UV_SCALE = 0.3\n// Below this many pixels from its target the strip has arrived.\nconst SETTLE_DISTANCE = 0.01\n\nconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value))\nconst modulo = (value: number, count: number) => ((value % count) + count) % count\n\n/** How far the strip scrolls without loop: content width minus view width. 0 has the first image centred. */\nexport function scrollRange(count: number, imageWidth: number, gap: number, viewWidth: number) {\n  const content = count * imageWidth + Math.max(0, count - 1) * gap\n  return Math.max(0, content - viewWidth)\n}\n\n/** How far an image slides inside its plane when the plane is `offset` pixels from the view's centre. It slides the same way as the plane. */\nexport function parallaxShift(offset: number, viewWidth: number, intensity: number, drawnWidth: number) {\n  return PARALLAX_SCALE * intensity * (offset / (viewWidth / 2)) * drawnWidth\n}\n\n/** Share of the remaining distance covered in `dt` seconds: `lerp` per 60 fps frame, whatever the frame rate. */\nexport function easeFactor(lerp: number, dt: number) {\n  return 1 - Math.pow(1 - clamp(lerp, 0.001, 1), dt * 60)\n}\n\n/** Lookup table for the tone curve: a channel value v becomes 255 × (v / 255) ^ gamma. */\nexport function toneCurve(gamma: number) {\n  const lut = new Uint8ClampedArray(256)\n  for (let v = 0; v < 256; v++) lut[v] = 255 * Math.pow(v / 255, gamma)\n  return lut\n}\n\n/** Scale that makes a prepared image cover a plane, zoomed by 1 / uvScale. */\nconst coverScale = (texture: Texture, width: number, height: number, uvScale: number) =>\n  Math.max(width / texture.w, height / texture.h) / clamp(uvScale, MIN_UV_SCALE, 1)\n\n// Prepared images, shared by every carousel that shows them and freed when the last one lets go.\nconst textureCache = new Map<string, TextureEntry>()\nconst textureKey = (src: string, gamma: number) => `${gamma}|${src}`\n\n/**\n * Prepares an image once in a hidden 2D canvas: the tone curve, and padding left and right filled with the\n * stretched edge columns. Without readable pixels it settles on the plain image, so the image still shows.\n */\nfunction prepareTexture(src: string, gamma: number, key: string): TextureEntry {\n  const entry: TextureEntry = { ready: Promise.resolve(null), texture: null, users: 0, released: false }\n  entry.ready = new Promise((resolve) => {\n    const finish = (texture: Texture | null) => {\n      if (entry.released) {\n        if (texture?.blob) URL.revokeObjectURL(texture.url)\n        resolve(null)\n        return\n      }\n      entry.texture = texture\n      resolve(texture)\n    }\n\n    const load = (cors: boolean) => {\n      const image = new Image()\n      if (cors) image.crossOrigin = \"anonymous\"\n      image.decoding = \"async\"\n      // An image served without CORS headers fails to load for reading; it loads again plainly, to show as it is.\n      image.onerror = () => (cors ? load(false) : finish(null))\n      image.onload = () => {\n        if (entry.released) return finish(null)\n        const scale = Math.min(1, TEXTURE_MAX_WIDTH / image.naturalWidth)\n        const w = Math.max(1, Math.round(image.naturalWidth * scale))\n        const h = Math.max(1, Math.round(image.naturalHeight * scale))\n        const plain: Texture = { key, url: src, w, h, pad: 0, blob: false }\n        if (!cors) return finish(plain)\n        try {\n          const pad = Math.round(w * EDGE_PAD)\n          const canvas = document.createElement(\"canvas\")\n          canvas.width = w + pad * 2\n          canvas.height = h\n          const context = canvas.getContext(\"2d\", { willReadFrequently: true })\n          if (!context) return finish(plain)\n          context.drawImage(image, pad, 0, w, h)\n          // The first and last columns, stretched outwards.\n          context.drawImage(canvas, pad, 0, 1, h, 0, 0, pad, h)\n          context.drawImage(canvas, pad + w - 1, 0, 1, h, pad + w, 0, pad, h)\n          if (gamma !== 1) {\n            // Throws when the pixels turn out not to be readable.\n            const data = context.getImageData(0, 0, canvas.width, h)\n            const lut = toneCurve(gamma)\n            const px = data.data\n            for (let i = 0; i < px.length; i += 4) {\n              px[i] = lut[px[i]]\n              px[i + 1] = lut[px[i + 1]]\n              px[i + 2] = lut[px[i + 2]]\n            }\n            context.putImageData(data, 0, 0)\n          }\n          canvas.toBlob((blob) => finish(blob ? { key, url: URL.createObjectURL(blob), w, h, pad, blob: true } : plain), \"image/webp\", 0.92)\n        } catch {\n          finish(plain)\n        }\n      }\n      image.src = src\n    }\n\n    load(true)\n  })\n  return entry\n}\n\nfunction holdTexture(src: string, gamma: number) {\n  const key = textureKey(src, gamma)\n  let entry = textureCache.get(key)\n  if (!entry) {\n    entry = prepareTexture(src, gamma, key)\n    textureCache.set(key, entry)\n  }\n  entry.users += 1\n  return entry\n}\n\nfunction dropTexture(key: string) {\n  const entry = textureCache.get(key)\n  if (!entry) return\n  entry.users -= 1\n  if (entry.users > 0) return\n  textureCache.delete(key)\n  entry.released = true\n  if (entry.texture?.blob) URL.revokeObjectURL(entry.texture.url)\n  entry.texture = null\n}\n\nexport function ParallaxCarousel({\n  images = DEFAULT_IMAGES,\n  imageWidth = 420,\n  imageHeight = 560,\n  gap = 32,\n  parallaxIntensity = 0.4,\n  uvScale = 1,\n  lerp = 0.08,\n  wheelSensitivity = 1,\n  dragSensitivity = 1.4,\n  loop = false,\n  borderRadius = 16,\n  autoplaySpeed = 0,\n  pauseOnHover = true,\n  showProgress = true,\n  toneGamma = 2.2,\n  controlsRef,\n  className,\n  ...props\n}: ParallaxCarouselProps) {\n  const trackRef = React.useRef<HTMLDivElement>(null)\n  const planeRefs = React.useRef<(HTMLDivElement | null)[]>([])\n  const imageRefs = React.useRef<(HTMLDivElement | null)[]>([])\n  const fillRef = React.useRef<HTMLDivElement>(null)\n  const syncRef = React.useRef<(() => void) | null>(null)\n  const controlsImplRef = React.useRef<ParallaxCarouselControls | null>(null)\n  // The preparations this carousel holds: the ones it wants and the ones it shows.\n  const heldRef = React.useRef(new Set<string>())\n\n  // The view's width is reported by a ResizeObserver; the frame loop keeps its own copy and never waits for it.\n  const [viewWidth, setViewWidth] = React.useState(0)\n  const [textures, setTextures] = React.useState<Record<string, Texture>>({})\n  const [dragging, setDragging] = React.useState(false)\n\n  const count = images.length\n  const pitch = imageWidth + gap\n  // Enough repeated slots that a wrapped strip always fills the view.\n  const slots = loop && count ? count * Math.max(1, Math.ceil((viewWidth + pitch * 2) / (count * pitch))) : count\n  const range = viewWidth > 0 ? scrollRange(count, imageWidth, gap, viewWidth) : 0\n\n  const settings = {\n    images,\n    count,\n    pitch,\n    slots,\n    imageWidth,\n    imageHeight,\n    gap,\n    parallaxIntensity,\n    uvScale,\n    lerp,\n    wheelSensitivity,\n    dragSensitivity,\n    loop,\n    autoplaySpeed,\n    pauseOnHover,\n    textures,\n  }\n  const settingsRef = React.useRef(settings)\n\n  // The frame loop and every listener are set up once. A prop change only reaches them through settingsRef.\n  React.useLayoutEffect(() => {\n    const track = trackRef.current\n    // The root's ref stays the consumer's, so the root is reached through the track.\n    const root = track?.parentElement\n    if (!track || !root) return\n\n    const motionQuery = window.matchMedia?.(\"(prefers-reduced-motion: reduce)\")\n    let reduced = motionQuery?.matches ?? false\n    const view = { w: root.clientWidth, h: root.clientHeight }\n    // Scroll position in pixels, 0 with the first image centred. `current` eases toward `target`.\n    let current = 0\n    let target = 0\n    let hovered = false\n    let held = false\n    let visible = true\n    let raf = 0\n    let last = 0\n    const drag = { id: -1, x: 0, from: 0, moved: false }\n\n    const clampScroll = (value: number) => {\n      const s = settingsRef.current\n      return s.loop ? value : clamp(value, 0, scrollRange(s.count, s.imageWidth, s.gap, view.w))\n    }\n\n    const layout = () => {\n      const s = settingsRef.current\n      if (!view.w || !s.count) return\n      const top = (view.h - s.imageHeight) / 2\n      const total = s.slots * s.pitch\n\n      for (let i = 0; i < s.slots; i++) {\n        const plane = planeRefs.current[i]\n        if (!plane) continue\n        // Plane centre relative to the view's centre; slot 0 sits in the centre at scroll 0.\n        let offset = i * s.pitch - current\n        if (s.loop) offset = modulo(offset + total / 2, total) - total / 2\n        const shown = Math.abs(offset) < view.w / 2 + s.imageWidth\n        // Planes past the edges are culled. The flag is written only when it flips, so a frame writes transforms alone.\n        const visibility = shown ? \"\" : \"hidden\"\n        if (plane.style.visibility !== visibility) plane.style.visibility = visibility\n        if (!shown) continue\n        plane.style.transform = `translate3d(${(view.w / 2 + offset - s.imageWidth / 2).toFixed(2)}px,${top.toFixed(2)}px,0)`\n\n        // Parallax: the image layer slides the same way as its plane, further the further the plane is from the centre.\n        const image = imageRefs.current[i]\n        const texture = s.textures[s.images[i % s.count]]\n        if (image && texture) {\n          const drawn = texture.w * coverScale(texture, s.imageWidth, s.imageHeight, s.uvScale)\n          image.style.transform = `translate3d(${parallaxShift(offset, view.w, s.parallaxIntensity, drawn).toFixed(2)}px,0,0)`\n        }\n      }\n\n      const max = scrollRange(s.count, s.imageWidth, s.gap, view.w)\n      if (fillRef.current) fillRef.current.style.transform = `scaleX(${max ? clamp(current / max, 0, 1) : 0})`\n    }\n\n    const frame = (now: number) => {\n      raf = 0\n      if (!visible || document.hidden) return\n      const s = settingsRef.current\n      // dt is clamped so a hitch or a tab switch does not jump the glide or the drift.\n      const dt = clamp((now - last) / 1000, 1 / 240, 0.05)\n      last = now\n      let drifting = false\n      if (s.autoplaySpeed !== 0 && !reduced && !held && !(s.pauseOnHover && hovered)) {\n        const next = clampScroll(target + s.autoplaySpeed * dt)\n        // A drift held at the end of the range is not movement.\n        drifting = next !== target\n        target = next\n      }\n      current += (target - current) * (reduced ? 1 : easeFactor(s.lerp, dt))\n      if (Math.abs(target - current) < SETTLE_DISTANCE) current = target\n      layout()\n      // The loop ends once the strip has arrived and nothing drifts; a carousel at rest costs nothing.\n      if (drifting || current !== target) raf = requestAnimationFrame(frame)\n    }\n\n    const wake = () => {\n      // Never schedules off screen or in a hidden tab.\n      if (raf || !visible || document.hidden) return\n      last = performance.now()\n      raf = requestAnimationFrame(frame)\n    }\n\n    // After a render (a prop, the view's size, a texture or the drag state changed): clamp, lay out before paint, wake.\n    const sync = () => {\n      target = clampScroll(target)\n      current = clampScroll(current)\n      layout()\n      wake()\n    }\n\n    const moveTo = (value: number) => {\n      target = clampScroll(value)\n      wake()\n    }\n\n    const scrollToIndex = (index: number) => {\n      const s = settingsRef.current\n      if (!s.count) return\n      if (!s.loop) {\n        moveTo(clamp(Math.round(index), 0, s.count - 1) * s.pitch)\n        return\n      }\n      // In loop mode the strip takes the short way round.\n      const total = s.count * s.pitch\n      let delta = modulo(Math.round(index) * s.pitch - target, total)\n      if (delta > total / 2) delta -= total\n      moveTo(target + delta)\n    }\n\n    const reset = () => moveTo(0)\n\n    // Either wheel axis scrolls; a vertical wheel moves the strip sideways.\n    const onWheel = (event: WheelEvent) => {\n      const raw = Math.abs(event.deltaX) > Math.abs(event.deltaY) ? event.deltaX : event.deltaY\n      if (!raw) return\n      event.preventDefault()\n      const unit = event.deltaMode === 1 ? WHEEL_LINE : event.deltaMode === 2 ? view.w : 1\n      moveTo(target + raw * unit * settingsRef.current.wheelSensitivity)\n    }\n\n    // Drag: the target follows the pointer and the ease provides the glide. There is no fling.\n    const onPointerDown = (event: PointerEvent) => {\n      if (event.button !== 0) return\n      Object.assign(drag, { id: event.pointerId, x: event.clientX, from: target, moved: false })\n      root.setPointerCapture?.(event.pointerId)\n    }\n\n    const onPointerMove = (event: PointerEvent) => {\n      if (drag.id !== event.pointerId) return\n      const dx = event.clientX - drag.x\n      if (!drag.moved) {\n        if (Math.abs(dx) < DRAG_THRESHOLD) return\n        drag.moved = true\n        held = true\n        setDragging(true)\n      }\n      moveTo(drag.from - dx * settingsRef.current.dragSensitivity)\n    }\n\n    const onPointerUp = (event: PointerEvent) => {\n      if (drag.id !== event.pointerId) return\n      drag.id = -1\n      if (!drag.moved) return\n      held = false\n      setDragging(false)\n      wake()\n    }\n\n    const onPointerEnter = (event: PointerEvent) => {\n      if (event.pointerType === \"mouse\") hovered = true\n    }\n\n    const onPointerLeave = () => {\n      hovered = false\n      wake()\n    }\n\n    const onKeyDown = (event: KeyboardEvent) => {\n      const s = settingsRef.current\n      const index = Math.round(target / s.pitch)\n      if (event.key === \"ArrowRight\") scrollToIndex(index + 1)\n      else if (event.key === \"ArrowLeft\") scrollToIndex(index - 1)\n      else if (event.key === \"Home\") reset()\n      else if (event.key === \"End\" && !s.loop) scrollToIndex(s.count - 1)\n      else return\n      event.preventDefault()\n    }\n\n    const onVisibility = () => wake()\n\n    const onMotionChange = () => {\n      reduced = motionQuery?.matches ?? false\n      wake()\n    }\n\n    // An observer reports the root's size once on observing, then on every change.\n    const resizeObserver = new ResizeObserver(() => {\n      view.w = root.clientWidth\n      view.h = root.clientHeight\n      setViewWidth(view.w)\n      sync()\n    })\n    // Off screen the loop stops where it is, autoplay included, and carries on when the carousel is back.\n    const intersectionObserver = new IntersectionObserver((entries) => {\n      for (const entry of entries) visible = entry.isIntersecting\n      wake()\n    })\n\n    root.addEventListener(\"wheel\", onWheel, { passive: false })\n    root.addEventListener(\"pointerdown\", onPointerDown, { passive: true })\n    root.addEventListener(\"pointermove\", onPointerMove, { passive: true })\n    root.addEventListener(\"pointerup\", onPointerUp, { passive: true })\n    root.addEventListener(\"pointercancel\", onPointerUp, { passive: true })\n    root.addEventListener(\"pointerenter\", onPointerEnter, { passive: true })\n    root.addEventListener(\"pointerleave\", onPointerLeave, { passive: true })\n    root.addEventListener(\"keydown\", onKeyDown)\n    document.addEventListener(\"visibilitychange\", onVisibility)\n    motionQuery?.addEventListener?.(\"change\", onMotionChange)\n    resizeObserver.observe(root)\n    intersectionObserver.observe(root)\n    syncRef.current = sync\n    controlsImplRef.current = { scrollToIndex, reset }\n\n    return () => {\n      cancelAnimationFrame(raf)\n      syncRef.current = null\n      controlsImplRef.current = null\n      resizeObserver.disconnect()\n      intersectionObserver.disconnect()\n      root.removeEventListener(\"wheel\", onWheel)\n      root.removeEventListener(\"pointerdown\", onPointerDown)\n      root.removeEventListener(\"pointermove\", onPointerMove)\n      root.removeEventListener(\"pointerup\", onPointerUp)\n      root.removeEventListener(\"pointercancel\", onPointerUp)\n      root.removeEventListener(\"pointerenter\", onPointerEnter)\n      root.removeEventListener(\"pointerleave\", onPointerLeave)\n      root.removeEventListener(\"keydown\", onKeyDown)\n      document.removeEventListener(\"visibilitychange\", onVisibility)\n      motionQuery?.removeEventListener?.(\"change\", onMotionChange)\n    }\n  }, [])\n\n  // Props reach the loop through this ref, written after every render and never during one. The loop then lays\n  // the planes out before paint and runs for as long as something moves.\n  React.useLayoutEffect(() => {\n    settingsRef.current = settings\n    syncRef.current?.()\n  })\n\n  React.useImperativeHandle(\n    controlsRef,\n    () => ({\n      scrollToIndex: (index: number) => controlsImplRef.current?.scrollToIndex(index),\n      reset: () => controlsImplRef.current?.reset(),\n    }),\n    []\n  )\n\n  // Each image is prepared once per tone gamma and shared with any other carousel showing it.\n  React.useEffect(() => {\n    const held = heldRef.current\n    let alive = true\n    for (const src of new Set(images)) {\n      const key = textureKey(src, toneGamma)\n      const entry = held.has(key) ? textureCache.get(key) : holdTexture(src, toneGamma)\n      held.add(key)\n      entry?.ready.then((texture) => {\n        if (alive && texture) setTextures((t) => (t[src] === texture ? t : { ...t, [src]: texture }))\n      })\n    }\n    return () => {\n      alive = false\n    }\n  }, [images, toneGamma])\n\n  // A preparation this carousel neither wants nor shows any more is let go, so a replaced tone gamma frees its blobs.\n  React.useEffect(() => {\n    const held = heldRef.current\n    const keep = new Set(images.map((src) => textureKey(src, toneGamma)))\n    for (const texture of Object.values(textures)) keep.add(texture.key)\n    for (const key of held) {\n      if (keep.has(key)) continue\n      held.delete(key)\n      dropTexture(key)\n    }\n  }, [images, toneGamma, textures])\n\n  // On unmount every preparation is let go; the last carousel to let go of one revokes its blob URL.\n  React.useEffect(() => {\n    const held = heldRef.current\n    return () => {\n      for (const key of held) dropTexture(key)\n      held.clear()\n    }\n  }, [])\n\n  return (\n    <div\n      data-slot=\"parallax-carousel\"\n      role=\"region\"\n      aria-roledescription=\"carousel\"\n      aria-label=\"Image carousel. Drag, scroll or use the arrow keys to move through the images.\"\n      tabIndex={0}\n      className={cn(\n        \"relative h-full min-h-80 w-full cursor-grab touch-pan-y overflow-hidden text-foreground select-none [-webkit-tap-highlight-color:transparent] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\",\n        dragging && \"cursor-grabbing\",\n        className\n      )}\n      {...props}\n    >\n      <div ref={trackRef} className=\"absolute inset-0\">\n        {Array.from({ length: slots }, (_, i) => {\n          const src = images[i % count]\n          const texture = textures[src]\n          let style: React.CSSProperties = { backgroundImage: `url(${JSON.stringify(src)})` }\n          if (texture) {\n            // Cover-fit the image; the padded texture reaches past both sides for the parallax.\n            const cover = coverScale(texture, imageWidth, imageHeight, uvScale)\n            const width = texture.w * cover\n            const height = texture.h * cover\n            const pad = texture.pad * cover\n            style = {\n              left: (imageWidth - width) / 2 - pad,\n              top: (imageHeight - height) / 2,\n              width: width + pad * 2,\n              height,\n              backgroundImage: `url(${JSON.stringify(texture.url)})`,\n            }\n          }\n          return (\n            <div\n              key={i}\n              ref={(el) => {\n                planeRefs.current[i] = el\n              }}\n              data-slot=\"parallax-carousel-plane\"\n              role=\"img\"\n              aria-label={`Image ${(i % count) + 1} of ${count}`}\n              aria-hidden={i >= count ? true : undefined}\n              // The image moves inside the plane; isolation keeps the rounded clip cheap while it does.\n              className=\"absolute top-0 left-0 isolate overflow-hidden bg-muted will-change-transform\"\n              style={{ width: imageWidth, height: imageHeight, borderRadius }}\n            >\n              <div\n                ref={(el) => {\n                  imageRefs.current[i] = el\n                }}\n                className={cn(\n                  \"pointer-events-none absolute bg-no-repeat will-change-transform\",\n                  texture ? \"bg-size-[100%_100%]\" : \"inset-0 bg-cover bg-center\"\n                )}\n                style={style}\n              />\n            </div>\n          )\n        })}\n      </div>\n\n      {showProgress && !loop && range > 0 && (\n        <div\n          data-slot=\"parallax-carousel-progress\"\n          aria-hidden\n          className=\"pointer-events-none absolute bottom-4 left-1/2 -ml-16 h-0.5 w-32 overflow-hidden rounded-full bg-current/15\"\n        >\n          <div ref={fillRef} className=\"size-full origin-left bg-current/80 will-change-transform [transform:scaleX(0)]\" />\n        </div>\n      )}\n    </div>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "added": "2026-10-28"
  },
  "categories": [
    "card"
  ],
  "type": "registry:ui"
}