{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sent",
  "title": "sent",
  "description": "Animated sent icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/sent.tsx",
      "content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\nimport type { HTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\nimport { useIconAnimation } from '@/lib/use-icon-animation';\nimport { cn } from '@/lib/utils';\n\nexport interface SentIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface SentIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst SENT_PLANE =\n  'M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z';\n\nconst SENT_DURATION = 0.92;\nconst SENT_TIMES = [\n  0, 0.07, 0.14, 0.22, 0.32, 0.43, 0.5, 0.54, 0.62, 0.71, 0.8, 0.88,\n  0.95, 1,\n];\n\n// The first plane pulls back, banks, and accelerates beyond the top-right\n// edge. A second full plane follows the same route from the bottom left.\nconst departingPlaneVariants: Variants = {\n  normal: {\n    transform: 'translate(0%, 0%) rotate(0deg)',\n    transition: { duration: 0.16, ease: [0.23, 1, 0.32, 1] },\n  },\n  animate: {\n    transform: [\n      'translate(0%, 0%) rotate(0deg)',\n      'translate(-3%, 3%) rotate(2.2deg)',\n      'translate(-1%, 1.5%) rotate(1.2deg)',\n      'translate(7%, -5%) rotate(-1deg)',\n      'translate(22%, -16%) rotate(-3.2deg)',\n      'translate(48%, -38%) rotate(-5.5deg)',\n      'translate(82%, -68%) rotate(-5deg)',\n      'translate(118%, -100%) rotate(-3.5deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n      'translate(145%, -125%) rotate(-2deg)',\n    ],\n    transition: {\n      duration: SENT_DURATION,\n      ease: 'linear',\n      times: SENT_TIMES,\n    },\n  },\n};\n\nconst arrivingPlaneVariants: Variants = {\n  normal: {\n    transform: 'translate(-145%, 125%) rotate(-6deg)',\n    transition: { duration: 0.16, ease: [0.23, 1, 0.32, 1] },\n  },\n  animate: {\n    transform: [\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-145%, 125%) rotate(-6deg)',\n      'translate(-118%, 102%) rotate(-6deg)',\n      'translate(-82%, 70%) rotate(-5deg)',\n      'translate(-50%, 41%) rotate(-4deg)',\n      'translate(-24%, 19%) rotate(-2.5deg)',\n      'translate(-7%, 4%) rotate(-0.8deg)',\n      'translate(-1%, 1%) rotate(0.8deg)',\n      'translate(0%, 0%) rotate(0deg)',\n    ],\n    transition: {\n      duration: SENT_DURATION,\n      ease: 'linear',\n      times: SENT_TIMES,\n    },\n  },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0 } },\n  animate: { visibility: 'visible', transition: { duration: 0 } },\n};\n\n// Temporary launch trails grow behind the plane, move back toward the bottom\n// left, and clear before the replacement arrives.\nconst trailVariants: Variants = {\n  normal: { pathLength: 0, pathOffset: 0, visibility: 'hidden' },\n  animate: (i: number) => ({\n    pathLength: [0, 0.25, 1, 0.34, 0, 0],\n    pathOffset: [0, 0, 0, 0.66, 1, 1],\n    visibility: ['hidden', 'visible', 'visible', 'visible', 'hidden', 'hidden'],\n    transition: {\n      duration: 0.38,\n      delay: 0.06 + i * 0.028,\n      ease: 'linear',\n      times: [0, 0.14, 0.34, 0.58, 0.8, 1],\n    },\n  }),\n};\n\nfunction PlaneGeometry() {\n  return (\n    <>\n      <path d={SENT_PLANE} stroke=\"currentColor\" strokeWidth=\"1.5\" />\n      <path\n        d=\"M11.4999 12.5L14.9999 9\"\n        stroke=\"currentColor\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n        strokeWidth=\"1.5\"\n      />\n    </>\n  );\n}\n\nconst SentIcon = forwardRef<SentIconHandle, SentIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\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=\"hidden\"\n        >\n          <motion.g\n            variants={generatedGeometryVariants}\n            animate={controls}\n            initial=\"normal\"\n          >\n            <motion.path\n              d=\"M7.2 14.8L2.2 19.8\"\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeWidth=\"1.5\"\n              variants={trailVariants}\n              custom={0}\n              animate={controls}\n              initial=\"normal\"\n            />\n            <motion.path\n              d=\"M10.2 17.6L6.6 21.2\"\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeWidth=\"1.5\"\n              variants={trailVariants}\n              custom={1}\n              animate={controls}\n              initial=\"normal\"\n            />\n            <motion.path\n              d=\"M5.2 12.6L2 15.8\"\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeWidth=\"1.5\"\n              variants={trailVariants}\n              custom={2}\n              animate={controls}\n              initial=\"normal\"\n            />\n          </motion.g>\n          <motion.g\n            variants={departingPlaneVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '12px 12px' }}\n          >\n            <PlaneGeometry />\n          </motion.g>\n          <motion.g\n            variants={generatedGeometryVariants}\n            animate={controls}\n            initial=\"normal\"\n          >\n            <motion.g\n              variants={arrivingPlaneVariants}\n              animate={controls}\n              initial=\"normal\"\n              style={{ transformOrigin: '12px 12px' }}\n            >\n              <PlaneGeometry />\n            </motion.g>\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nSentIcon.displayName = 'SentIcon';\n\nexport { SentIcon };\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"
}