{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "copy-01",
  "title": "copy-01",
  "description": "Animated copy icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/copy-01.tsx",
      "content": "'use client';\n\nimport type { Easing, Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\nimport type { HTMLAttributes } from 'react';\nimport { forwardRef, useId } from 'react';\nimport { useIconAnimation } from '@/lib/use-icon-animation';\nimport { cn } from '@/lib/utils';\n\n/** Imperative controls for the Copy icon animation. */\nexport interface Copy01IconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface Copy01IconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst FRONT_PATH =\n  'M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z';\n\nconst COPY_DURATION = 0.86;\nconst COPY_TIMES = [0, 0.1, 0.34, 0.46, 0.56, 0.76, 0.88, 1];\nconst COPY_EASING: Easing[] = [\n  [0.23, 1, 0.32, 1],\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  'linear',\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  [0.23, 1, 0.32, 1],\n];\n\n// The front sheet grows to cover the rear panel, pauses, then returns.\nconst frontVariants: Variants = {\n  normal: {\n    transform: 'translate(0px, 0px) scale(1)',\n    strokeWidth: 1.5,\n    visibility: 'visible',\n  },\n  animate: {\n    transform: [\n      'translate(0px, 0px) scale(1)',\n      'translate(0.45px, 0.45px) scale(0.97)',\n      'translate(-6.2px, -6.2px) scale(1.2)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(0.65px, 0.65px) scale(0.96)',\n      'translate(-0.25px, -0.25px) scale(1.03)',\n      'translate(0px, 0px) scale(1)',\n    ],\n    strokeWidth: [\n      1.5,\n      1.5 / 0.97,\n      1.5 / 1.2,\n      1.5 / 1.14,\n      1.5 / 1.14,\n      1.5 / 0.96,\n      1.5 / 1.03,\n      1.5,\n    ],\n    visibility: 'visible',\n    transition: {\n      duration: COPY_DURATION,\n      ease: COPY_EASING,\n      times: COPY_TIMES,\n    },\n  },\n};\n\n// The invisible mask grows during the overlap so the rear panel is fully hidden.\nconst occlusionVariants: Variants = {\n  normal: { transform: 'translate(0px, 0px) scale(1)' },\n  animate: {\n    transform: [\n      'translate(0px, 0px) scale(1)',\n      'translate(0.45px, 0.45px) scale(0.97)',\n      'translate(-6.2px, -6.2px) scale(1.24)',\n      'translate(-6px, -6px) scale(1.18)',\n      'translate(-6px, -6px) scale(1.18)',\n      'translate(0.65px, 0.65px) scale(1.06)',\n      'translate(-0.25px, -0.25px) scale(1.03)',\n      'translate(0px, 0px) scale(1)',\n    ],\n    transition: {\n      duration: COPY_DURATION,\n      ease: COPY_EASING,\n      times: COPY_TIMES,\n    },\n  },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0.08 } },\n  animate: { visibility: 'visible', transition: { duration: 0 } },\n};\n\n/** Animated Copy icon with imperative hover controls. */\nconst Copy01Icon = forwardRef<Copy01IconHandle, Copy01IconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const occlusionMaskId = useId();\n    const controls = useAnimation();\n    const { handleMouseEnter, handleMouseLeave } = useIconAnimation({\n      controls,\n      loops: false,\n      onMouseEnter,\n      onMouseLeave,\n      ref,\n    });\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          xmlns=\"http://www.w3.org/2000/svg\"\n          width={size}\n          height={size}\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          overflow=\"visible\"\n        >\n          <defs>\n            <mask\n              id={occlusionMaskId}\n              maskUnits=\"userSpaceOnUse\"\n              x=\"-4\"\n              y=\"-4\"\n              width=\"32\"\n              height=\"32\"\n            >\n              <rect x=\"-4\" y=\"-4\" width=\"32\" height=\"32\" fill=\"white\" />\n              <motion.g\n                variants={generatedGeometryVariants}\n                animate={controls}\n                initial=\"normal\"\n              >\n                <motion.path\n                  d={FRONT_PATH}\n                  fill=\"black\"\n                  stroke=\"black\"\n                  strokeLinejoin=\"round\"\n                  strokeWidth=\"2.5\"\n                  variants={occlusionVariants}\n                  animate={controls}\n                  initial=\"normal\"\n                  style={{ transformOrigin: '15.5px 15.5px' }}\n                />\n              </motion.g>\n            </mask>\n          </defs>\n          <motion.path\n            d={FRONT_PATH}\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            variants={frontVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '15.5px 15.5px' }}\n          />\n          <motion.path\n            d=\"M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            mask={`url(#${occlusionMaskId})`}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nCopy01Icon.displayName = 'Copy01Icon';\n\nexport { Copy01Icon };\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/use-icon-animation.ts",
      "content": "'use client';\n\nimport type { LegacyAnimationControls } from 'motion/react';\nimport { useReducedMotion } from 'motion/react';\nimport type {\n  ForwardedRef,\n  MouseEventHandler,\n} from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nexport interface AnimatedIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface UseIconAnimationOptions {\n  controls: LegacyAnimationControls;\n  loops?: boolean;\n  onMouseEnter?: MouseEventHandler<HTMLDivElement>;\n  onMouseLeave?: MouseEventHandler<HTMLDivElement>;\n  ref: ForwardedRef<AnimatedIconHandle>;\n}\n\nexport function useIconAnimation({\n  controls,\n  loops = false,\n  onMouseEnter,\n  onMouseLeave,\n  ref,\n}: UseIconAnimationOptions) {\n  const shouldReduceMotion = useReducedMotion();\n  const isControlledRef = useRef(false);\n  const isPlayingRef = useRef(false);\n  const runRef = useRef(0);\n\n  const startAnimation = useCallback(() => {\n    if (shouldReduceMotion || isPlayingRef.current) return;\n\n    isPlayingRef.current = true;\n    const run = ++runRef.current;\n    controls.set('normal');\n    void controls.start('animate').then(() => {\n      if (runRef.current === run) isPlayingRef.current = false;\n    });\n  }, [controls, shouldReduceMotion]);\n\n  const stopAnimation = useCallback(() => {\n    if (!loops) return;\n\n    runRef.current++;\n    isPlayingRef.current = false;\n    void controls.start('normal');\n  }, [controls, loops]);\n\n  useImperativeHandle(\n    ref,\n    () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    },\n    [startAnimation, stopAnimation]\n  );\n\n  const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseEnter?.(event);\n      if (!isControlledRef.current) startAnimation();\n    },\n    [onMouseEnter, startAnimation]\n  );\n\n  const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseLeave?.(event);\n      if (!isControlledRef.current) stopAnimation();\n    },\n    [onMouseLeave, stopAnimation]\n  );\n\n  return { handleMouseEnter, handleMouseLeave };\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:ui"
}