{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "infinite-marquee",
  "title": "Infinite Marquee",
  "description": "A seamless scrolling text marquee with solid/gradient/outline text styles, a separator, double-row mode, edge fade, and pause-on-hover.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/infinite-marquee/infinite-marquee.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type InfiniteMarqueeDirection = \"left\" | \"right\";\nexport type InfiniteMarqueeTextStyle = \"solid\" | \"gradient\" | \"outline\";\n\nexport interface InfiniteMarqueeProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  text: string;\n  separator?: string;\n  speed?: number;\n  direction?: InfiniteMarqueeDirection;\n  pauseOnHover?: boolean;\n  repeatCount?: number;\n  fontSize?: number;\n  fontWeight?: number | string;\n  fontFamily?: string;\n  letterSpacing?: number;\n  uppercase?: boolean;\n  gap?: number;\n  separatorGap?: number;\n  textStyle?: InfiniteMarqueeTextStyle;\n  textColor?: string;\n  gradientFrom?: string;\n  gradientTo?: string;\n  gradientAngle?: number;\n  strokeColor?: string;\n  strokeWidth?: number;\n  separatorColor?: string;\n  doubleRow?: boolean;\n  rowGap?: number;\n  fadeEdges?: boolean;\n  fadeWidth?: number;\n  backgroundColor?: string;\n  paddingTop?: number;\n  paddingBottom?: number;\n  borderRadius?: number;\n}\n\nfunction MarqueeRow({\n  displayText,\n  separator,\n  items,\n  isReverse,\n  speed,\n  isPaused,\n  computedTextStyle,\n  sepStyle,\n  itemGap,\n  separatorGap,\n}: {\n  displayText: string;\n  separator?: string;\n  items: number[];\n  isReverse: boolean;\n  speed: number;\n  isPaused: boolean;\n  computedTextStyle: React.CSSProperties;\n  sepStyle: React.CSSProperties;\n  itemGap: number;\n  separatorGap: number;\n}) {\n  const innerRef = React.useRef<HTMLDivElement>(null);\n  const [duration, setDuration] = React.useState(10);\n\n  React.useLayoutEffect(() => {\n    if (!innerRef.current) return;\n    const halfWidth = innerRef.current.scrollWidth / 2;\n    if (halfWidth > 0) setDuration(halfWidth / speed);\n  }, [displayText, separator, itemGap, items.length, speed]);\n\n  return (\n    <div className=\"w-full overflow-hidden\">\n      <div\n        ref={innerRef}\n        aria-hidden\n        className=\"im-track inline-flex items-center will-change-transform\"\n        style={{\n          animationName: isReverse ? \"im-marquee-rtl\" : \"im-marquee-ltr\",\n          animationDuration: `${duration}s`,\n          animationTimingFunction: \"linear\",\n          animationIterationCount: \"infinite\",\n          animationPlayState: isPaused ? \"paused\" : \"running\",\n        }}\n      >\n        {[...items, ...items].map((_, idx) => (\n          <span key={idx} className=\"inline-flex items-center whitespace-nowrap\" style={{ gap: itemGap }}>\n            <span style={computedTextStyle}>{displayText}</span>\n            {separator && (\n              <span style={{ ...sepStyle, marginRight: separatorGap }}>{separator}</span>\n            )}\n          </span>\n        ))}\n      </div>\n    </div>\n  );\n}\n\nexport function InfiniteMarquee({\n  text,\n  separator = \"✦\",\n  speed = 80,\n  direction = \"left\",\n  pauseOnHover = false,\n  repeatCount = 6,\n  fontSize = 48,\n  fontWeight = 700,\n  fontFamily = \"Inter, sans-serif\",\n  letterSpacing = -1,\n  uppercase = true,\n  gap = 32,\n  separatorGap = 32,\n  textStyle = \"solid\",\n  textColor = \"#FFFFFF\",\n  gradientFrom = \"#FF6B6B\",\n  gradientTo = \"#4ECDC4\",\n  gradientAngle = 90,\n  strokeColor = \"#FFFFFF\",\n  strokeWidth = 1.5,\n  separatorColor = \"#FFFFFF\",\n  doubleRow = false,\n  rowGap = 0,\n  fadeEdges = false,\n  fadeWidth = 100,\n  backgroundColor = \"#000000\",\n  paddingTop = 20,\n  paddingBottom = 20,\n  borderRadius = 0,\n  className,\n  ...props\n}: InfiniteMarqueeProps) {\n  const [isPaused, setIsPaused] = React.useState(false);\n  const [isInView, setIsInView] = React.useState(true);\n  const containerRef = React.useRef<HTMLDivElement>(null);\n\n  React.useEffect(() => {\n    if (!containerRef.current) return;\n    const observer = new IntersectionObserver(([entry]) => setIsInView(entry.isIntersecting), { threshold: 0 });\n    observer.observe(containerRef.current);\n    return () => observer.disconnect();\n  }, []);\n\n  const isReverse = direction === \"right\";\n  const displayText = uppercase ? text.toUpperCase() : text;\n  const items = React.useMemo(() => Array.from({ length: Math.max(repeatCount, 2) }, (_, i) => i), [repeatCount]);\n\n  const computedTextStyle: React.CSSProperties = React.useMemo(() => {\n    const base: React.CSSProperties = { fontSize, fontWeight, fontFamily, letterSpacing, lineHeight: 1 };\n    if (textStyle === \"gradient\") {\n      return {\n        ...base,\n        background: `linear-gradient(${gradientAngle}deg, ${gradientFrom}, ${gradientTo})`,\n        WebkitBackgroundClip: \"text\",\n        backgroundClip: \"text\",\n        WebkitTextFillColor: \"transparent\",\n        color: \"transparent\",\n      };\n    }\n    if (textStyle === \"outline\") {\n      return { ...base, WebkitTextStroke: `${strokeWidth}px ${strokeColor}`, WebkitTextFillColor: \"transparent\", color: \"transparent\" };\n    }\n    return { ...base, color: textColor };\n  }, [fontSize, fontWeight, fontFamily, letterSpacing, textColor, textStyle, strokeColor, gradientFrom, gradientTo, gradientAngle, strokeWidth]);\n\n  const sepStyle: React.CSSProperties = React.useMemo(\n    () => ({ color: separatorColor, fontSize: fontSize * 0.7, lineHeight: 1, flexShrink: 0, fontFamily }),\n    [separatorColor, fontSize, fontFamily],\n  );\n\n  const maskImage = fadeEdges\n    ? `linear-gradient(to right, transparent 0%, black ${fadeWidth}px, black calc(100% - ${fadeWidth}px), transparent 100%)`\n    : undefined;\n\n  const rowProps = { displayText, separator, items, speed, isPaused: isPaused || !isInView, computedTextStyle, sepStyle, itemGap: gap, separatorGap };\n  const srLabel = `${displayText}${separator ? \" \" + separator : \"\"}`;\n\n  return (\n    <div ref={containerRef} className={cn(\"flex w-full flex-col items-center\", className)} {...props}>\n      <style>{`\n        @keyframes im-marquee-ltr { from { transform: translateX(0); } to { transform: translateX(-50%); } }\n        @keyframes im-marquee-rtl { from { transform: translateX(-50%); } to { transform: translateX(0); } }\n        @media (prefers-reduced-motion: reduce) {\n          .im-track { animation: none !important; }\n        }\n      `}</style>\n      <div\n        role=\"marquee\"\n        aria-label={srLabel}\n        className=\"box-border flex w-full flex-col overflow-hidden\"\n        style={{\n          backgroundColor: backgroundColor,\n          paddingTop,\n          paddingBottom,\n          borderRadius,\n          gap: doubleRow ? rowGap : 0,\n          cursor: pauseOnHover ? \"pointer\" : \"default\",\n          WebkitMaskImage: maskImage,\n          maskImage,\n        }}\n        onMouseEnter={() => pauseOnHover && setIsPaused(true)}\n        onMouseLeave={() => pauseOnHover && setIsPaused(false)}\n      >\n        <span className=\"sr-only\">{srLabel}</span>\n        <MarqueeRow {...rowProps} isReverse={isReverse} />\n        {doubleRow && <MarqueeRow {...rowProps} isReverse={!isReverse} />}\n      </div>\n\n          </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}